Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9b2eaa7

Browse files
ThomasBurlesonmatsko
authored andcommittedAug 4, 2015
fix(dialog, menu, select, interimElement): use $animateCss
replace programmatic use of element.css for style changes and use of transitionEnd event listeners with use of ngAnimate's $animateCss; use polyfill for Angular <1.4. $mdUtil.dom.animator.translate3d() uses $animateCss() instead of waitTransitionEnd() use animateCss.js polyfill for 'material.animate' module - add mock `createMockStyleSheet` for animateCss tests refactors to menu-interim-element.js and select.js - refactor logic and patterns used - use $animateCss in place of waitTransitionEnd() debounce Select and Menu window resize handlers Dialog uses same showBackdrop/hideBackdrop pattern as Menu and Select select async demo no longer clears users list when reloading select demos use `md-input-container { margin-right: 10px;}` hide Select Backdrop with zero duration enable full click detection in select-value area by using background color (with zero alpa). BREAKING-CHANGES: select and backdrop styles added * select list text is not selectable, * select backdrop hide duration is 0ms * select text value background has zero alpha ```scss .md-text { @include not-selectable(); } .md-select-value { background-color: rgba(0,0,0,0); } md-backdrop { &.md-select-backdrop { transition-duration: 0ms; } } ``` Fixes #3919. Fixes #3837. Fixes #3773, Fixes #3640. Fixes #3527. Fixes #3653.
1 parent 765b000 commit 9b2eaa7

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed
 

‎config/build.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var fs = require('fs');
33
var versionFile = __dirname + '/../dist/commit';
44

55
module.exports = {
6-
ngVersion: '1.4.3',
6+
ngVersion: '1.3.15',
77
version: pkg.version,
88
repository: pkg.repository.url
99
.replace(/^git/,'https')

‎package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"url": "git://github.com/angular/material.git"
66
},
77
"devDependencies": {
8-
"angular": "^1.4.0",
9-
"angular-animate": "^1.4.0",
10-
"angular-aria": "^1.4.0",
11-
"angular-messages": "^1.4.0",
12-
"angular-mocks": "^1.4.0",
13-
"angular-route": "^1.4.0",
8+
"angular": "^1.3.15",
9+
"angular-animate": "^1.3.15",
10+
"angular-aria": "^1.3.15",
11+
"angular-messages": "^1.3.15",
12+
"angular-mocks": "^1.3.15",
13+
"angular-route": "^1.3.15",
1414
"angularytics": "^0.3.0",
1515
"canonical-path": "0.0.2",
1616
"cli-color": "^1.0.0",
@@ -64,4 +64,4 @@
6464
"merge-base": "git merge-base $(npm run -s current-branch) origin/master",
6565
"squash": "git rebase -i $(npm run -s merge-base)"
6666
}
67-
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
angular.module('selectDemoOptionsAsync', ['ngMaterial'])
22
.controller('SelectAsyncController', function($timeout, $scope) {
3-
$scope.user = "";
4-
$scope.users = [];
3+
$scope.user = null;
4+
$scope.users = null;
55

66
$scope.loadUsers = function() {
7+
78
// Use timeout to simulate a 650ms request.
89
return $timeout(function() {
9-
$scope.users = [
10+
11+
$scope.users = $scope.users || [
1012
{ id: 1, name: 'Scooby Doo' },
1113
{ id: 2, name: 'Shaggy Rodgers' },
1214
{ id: 3, name: 'Fred Jones' },
1315
{ id: 4, name: 'Daphne Blake' },
14-
{ id: 5, name: 'Velma Dinkley' },
16+
{ id: 5, name: 'Velma Dinkley' }
1517
];
18+
1619
}, 650);
1720
};
1821
});

‎src/components/select/select.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,9 @@ function SelectProvider($$interimElementProvider) {
980980
.then(function () {
981981
scope.$$loadingAsyncDone = true;
982982
delete opts.loadingAsync;
983-
});
983+
}).then(function(){
984+
$$rAF( positionAndFocusMenu );
985+
})
984986
}
985987
}
986988

@@ -1042,9 +1044,8 @@ function SelectProvider($$interimElementProvider) {
10421044
target: option
10431045
});
10441046
ev.preventDefault();
1045-
} else {
1046-
checkCloseMenu();
10471047
}
1048+
checkCloseMenu();
10481049
break;
10491050
case $mdConstant.KEY_CODE.TAB:
10501051
case $mdConstant.KEY_CODE.ESCAPE:
@@ -1092,7 +1093,7 @@ function SelectProvider($$interimElementProvider) {
10921093
}
10931094

10941095
function checkCloseMenu(ev) {
1095-
if (( ev.type == 'mouseup') && (ev.currentTarget != dropDown[0])) return;
1096+
if (ev && ( ev.type == 'mouseup') && (ev.currentTarget != dropDown[0])) return;
10961097

10971098
if (!selectCtrl.isMultiple) {
10981099
opts.restoreFocus = true;
@@ -1167,7 +1168,7 @@ function SelectProvider($$interimElementProvider) {
11671168
optionNodes = selectNode.getElementsByTagName('md-option'),
11681169
optgroupNodes = selectNode.getElementsByTagName('md-optgroup');
11691170

1170-
var loading = angular.isDefined(opts.loadingAsync);
1171+
var loading = isPromiseLike(opts.loadingAsync);
11711172
var centeredNode;
11721173
if ( !loading ) {
11731174
// If a selected node, center around that
@@ -1277,10 +1278,17 @@ function SelectProvider($$interimElementProvider) {
12771278
}
12781279
}
12791280
};
1281+
1282+
1283+
12801284
}
12811285

12821286
}
12831287

1288+
function isPromiseLike(obj) {
1289+
return obj && angular.isFunction(obj.then);
1290+
}
1291+
12841292
function clamp(min, n, max) {
12851293
return Math.max(min, Math.min(n, max));
12861294
}

‎src/core/util/animation/animateCss.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ describe('$animateCss', function() {
33
var jqLite = angular.element;
44
var forEach = angular.forEach;
55

6-
beforeEach(module('material.animate','ngAnimate'));
6+
beforeEach(module('ngAnimateMock','material.animate'));
77

88
function assertHasClass(element, className, not) {
99
expect(element.hasClass(className)).toBe(!not);

0 commit comments

Comments
 (0)