{{::dialog.mdTextContent}}
', + 'diff --git a/README.md b/README.md index 82c555a..08f1828 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,4 @@ If you desire to require minified AngularMaterial files, add the following: ## Versioning -Current version of AngularMaterial - 1.1.0-rc1 +Current version of AngularMaterial - 1.1.3 diff --git a/lib/rails-angular-material/version.rb b/lib/rails-angular-material/version.rb index ca92d30..aff895f 100644 --- a/lib/rails-angular-material/version.rb +++ b/lib/rails-angular-material/version.rb @@ -1,3 +1,3 @@ module AngularMaterialRails - VERSION = "1.1.0-rc1" + VERSION = "1.1.3" end diff --git a/vendor/assets/javascripts/angular-material.js b/vendor/assets/javascripts/angular-material.js index 641025a..5936252 100644 --- a/vendor/assets/javascripts/angular-material.js +++ b/vendor/assets/javascripts/angular-material.js @@ -2,7 +2,7 @@ * Angular Material Design * https://github.com/angular/material * @license MIT - * v1.1.0-rc1 + * v1.1.3 */ (function( window, angular, undefined ){ "use strict"; @@ -10,7 +10,7 @@ (function(){ "use strict"; -angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","material.core.gestures","material.core.layout","material.core.theming.palette","material.core.theming","material.core.animate","material.components.autocomplete","material.components.backdrop","material.components.bottomSheet","material.components.button","material.components.card","material.components.checkbox","material.components.chips","material.components.content","material.components.datepicker","material.components.dialog","material.components.divider","material.components.fabActions","material.components.fabShared","material.components.fabSpeedDial","material.components.fabToolbar","material.components.fabTrigger","material.components.gridList","material.components.icon","material.components.input","material.components.list","material.components.menu","material.components.menuBar","material.components.progressCircular","material.components.progressLinear","material.components.radioButton","material.components.select","material.components.showHide","material.components.sidenav","material.components.slider","material.components.sticky","material.components.subheader","material.components.swipe","material.components.switch","material.components.tabs","material.components.toast","material.components.toolbar","material.components.tooltip","material.components.virtualRepeat","material.components.whiteframe"]); +angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","material.core.gestures","material.core.interaction","material.core.layout","material.core.meta","material.core.theming.palette","material.core.theming","material.core.animate","material.components.autocomplete","material.components.backdrop","material.components.bottomSheet","material.components.button","material.components.card","material.components.checkbox","material.components.chips","material.components.colors","material.components.content","material.components.datepicker","material.components.dialog","material.components.divider","material.components.fabActions","material.components.fabShared","material.components.fabSpeedDial","material.components.fabToolbar","material.components.gridList","material.components.icon","material.components.input","material.components.list","material.components.menu","material.components.menuBar","material.components.panel","material.components.navBar","material.components.progressCircular","material.components.progressLinear","material.components.radioButton","material.components.select","material.components.showHide","material.components.sidenav","material.components.slider","material.components.sticky","material.components.subheader","material.components.swipe","material.components.switch","material.components.toast","material.components.tabs","material.components.toolbar","material.components.tooltip","material.components.truncate","material.components.virtualRepeat","material.components.whiteframe"]); })(); (function(){ "use strict"; @@ -19,11 +19,16 @@ angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","materia * Initialization function that validates environment * requirements. */ +DetectNgTouch.$inject = ["$log", "$injector"]; +MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"]; +rAFDecorator.$inject = ["$delegate"]; +qDecorator.$inject = ["$delegate"]; angular .module('material.core', [ 'ngAnimate', 'material.core.animate', 'material.core.layout', + 'material.core.interaction', 'material.core.gestures', 'material.core.theming' ]) @@ -34,6 +39,7 @@ angular /** * Detect if the ng-Touch module is also being used. * Warn if detected. + * @ngInject */ function DetectNgTouch($log, $injector) { if ( $injector.has('$swipe') ) { @@ -44,12 +50,14 @@ function DetectNgTouch($log, $injector) { $log.warn(msg); } } -DetectNgTouch.$inject = ["$log", "$injector"]; - +/** + * @ngInject + */ function MdCoreConfigure($provide, $mdThemingProvider) { - $provide.decorator('$$rAF', ["$delegate", rAFDecorator]); + $provide.decorator('$$rAF', ['$delegate', rAFDecorator]); + $provide.decorator('$q', ['$delegate', qDecorator]); $mdThemingProvider.theme('default') .primaryPalette('indigo') @@ -57,8 +65,10 @@ function MdCoreConfigure($provide, $mdThemingProvider) { .warnPalette('deep-orange') .backgroundPalette('grey'); } -MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"]; +/** + * @ngInject + */ function rAFDecorator($delegate) { /** * Use this to throttle events that come in often. @@ -90,11 +100,30 @@ function rAFDecorator($delegate) { return $delegate; } +/** + * @ngInject + */ +function qDecorator($delegate) { + /** + * Adds a shim for $q.resolve for Angular version that don't have it, + * so we don't have to think about it. + * + * via https://github.com/angular/angular.js/pull/11987 + */ + + // TODO(crisbeto): this won't be necessary once we drop Angular 1.3 + if (!$delegate.resolve) { + $delegate.resolve = $delegate.when; + } + return $delegate; +} + })(); (function(){ "use strict"; -angular.module('material.core') + +MdAutofocusDirective.$inject = ["$parse"];angular.module('material.core') .directive('mdAutofocus', MdAutofocusDirective) // Support the deprecated md-auto-focus and md-sidenav-focus as well @@ -109,7 +138,7 @@ angular.module('material.core') * @description * * `[md-autofocus]` provides an optional way to identify the focused element when a `$mdDialog`, - * `$mdBottomSheet`, or `$mdSidenav` opens or upon page load for input-like elements. + * `$mdBottomSheet`, `$mdMenu` or `$mdSidenav` opens or upon page load for input-like elements. * * When one of these opens, it will find the first nested element with the `[md-autofocus]` * attribute directive and optional expression. An expression may be specified as the directive @@ -186,21 +215,120 @@ angular.module('material.core') * * **/ -function MdAutofocusDirective() { +function MdAutofocusDirective($parse) { return { restrict: 'A', + link: { + pre: preLink + } + }; - link: postLink + function preLink(scope, element, attr) { + var attrExp = attr.mdAutoFocus || attr.mdAutofocus || attr.mdSidenavFocus; + + // Initially update the expression by manually parsing the expression as per $watch source. + updateExpression($parse(attrExp)(scope)); + + // Only watch the expression if it is not empty. + if (attrExp) { + scope.$watch(attrExp, updateExpression); + } + + /** + * Updates the autofocus class which is used to determine whether the attribute + * expression evaluates to true or false. + * @param {string|boolean} value Attribute Value + */ + function updateExpression(value) { + + // Rather than passing undefined to the jqLite toggle class function we explicitly set the + // value to true. Otherwise the class will be just toggled instead of being forced. + if (angular.isUndefined(value)) { + value = true; + } + + element.toggleClass('md-autofocus', !!value); + } } + } -function postLink(scope, element, attrs) { - var attr = attrs.mdAutoFocus || attrs.mdAutofocus || attrs.mdSidenavFocus; +})(); +(function(){ +"use strict"; - // Setup a watcher on the proper attribute to update a class we can check for in $mdUtil - scope.$watch(attr, function(canAutofocus) { - element.toggleClass('_md-autofocus', canAutofocus); - }); +/** + * @ngdoc module + * @name material.core.colorUtil + * @description + * Color Util + */ +angular + .module('material.core') + .factory('$mdColorUtil', ColorUtilFactory); + +function ColorUtilFactory() { + /** + * Converts hex value to RGBA string + * @param color {string} + * @returns {string} + */ + function hexToRgba (color) { + var hex = color[ 0 ] === '#' ? color.substr(1) : color, + dig = hex.length / 3, + red = hex.substr(0, dig), + green = hex.substr(dig, dig), + blue = hex.substr(dig * 2); + if (dig === 1) { + red += red; + green += green; + blue += blue; + } + return 'rgba(' + parseInt(red, 16) + ',' + parseInt(green, 16) + ',' + parseInt(blue, 16) + ',0.1)'; + } + + /** + * Converts rgba value to hex string + * @param color {string} + * @returns {string} + */ + function rgbaToHex(color) { + color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); + + var hex = (color && color.length === 4) ? "#" + + ("0" + parseInt(color[1],10).toString(16)).slice(-2) + + ("0" + parseInt(color[2],10).toString(16)).slice(-2) + + ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; + + return hex.toUpperCase(); + } + + /** + * Converts an RGB color to RGBA + * @param color {string} + * @returns {string} + */ + function rgbToRgba (color) { + return color.replace(')', ', 0.1)').replace('(', 'a('); + } + + /** + * Converts an RGBA color to RGB + * @param color {string} + * @returns {string} + */ + function rgbaToRgb (color) { + return color + ? color.replace('rgba', 'rgb').replace(/,[^\),]+\)/, ')') + : 'rgb(0,0,0)'; + } + + return { + rgbaToHex: rgbaToHex, + hexToRgba: hexToRgba, + rgbToRgba: rgbToRgba, + rgbaToRgb: rgbaToRgb + }; } })(); @@ -214,14 +342,69 @@ angular.module('material.core') * Factory function that creates the grab-bag $mdConstant service. * @ngInject */ -function MdConstantFactory($sniffer) { +function MdConstantFactory() { + + var prefixTestEl = document.createElement('div'); + var vendorPrefix = getVendorPrefix(prefixTestEl); + var isWebkit = /webkit/i.test(vendorPrefix); + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; - var webkit = /webkit/i.test($sniffer.vendorPrefix); function vendorProperty(name) { - return webkit ? ('webkit' + name.charAt(0).toUpperCase() + name.substring(1)) : name; + // Add a dash between the prefix and name, to be able to transform the string into camelcase. + var prefixedName = vendorPrefix + '-' + name; + var ucPrefix = camelCase(prefixedName); + var lcPrefix = ucPrefix.charAt(0).toLowerCase() + ucPrefix.substring(1); + + return hasStyleProperty(prefixTestEl, name) ? name : // The current browser supports the un-prefixed property + hasStyleProperty(prefixTestEl, ucPrefix) ? ucPrefix : // The current browser only supports the prefixed property. + hasStyleProperty(prefixTestEl, lcPrefix) ? lcPrefix : name; // Some browsers are only supporting the prefix in lowercase. } - return { + function hasStyleProperty(testElement, property) { + return angular.isDefined(testElement.style[property]); + } + + function camelCase(input) { + return input.replace(SPECIAL_CHARS_REGEXP, function(matches, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + + function getVendorPrefix(testElement) { + var prop, match; + var vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/; + + for (prop in testElement.style) { + if (match = vendorRegex.exec(prop)) { + return match[0]; + } + } + } + + var self = { + isInputKey : function(e) { return (e.keyCode >= 31 && e.keyCode <= 90); }, + isNumPadKey : function (e){ return (3 === e.location && e.keyCode >= 97 && e.keyCode <= 105); }, + isNavigationKey : function(e) { + var kc = self.KEY_CODE, NAVIGATION_KEYS = [kc.SPACE, kc.ENTER, kc.UP_ARROW, kc.DOWN_ARROW]; + return (NAVIGATION_KEYS.indexOf(e.keyCode) != -1); + }, + + /** + * Maximum size, in pixels, that can be explicitly set to an element. The actual value varies + * between browsers, but IE11 has the very lowest size at a mere 1,533,917px. Ideally we could + * compute this value, but Firefox always reports an element to have a size of zero if it + * goes over the max, meaning that we'd have to binary search for the value. + */ + ELEMENT_MAX_PIXELS: 1533917, + + /** + * Priority for a directive that should run before the directives from ngAria. + */ + BEFORE_NG_ARIA: 210, + + /** + * Common Keyboard actions and their associated keycode. + */ KEY_CODE: { COMMA: 188, SEMICOLON : 186, @@ -240,10 +423,15 @@ function MdConstantFactory($sniffer) { BACKSPACE: 8, DELETE: 46 }, + + /** + * Vendor prefixed CSS properties to be used to support the given functionality in older browsers + * as well. + */ CSS: { /* Constants */ - TRANSITIONEND: 'transitionend' + (webkit ? ' webkitTransitionEnd' : ''), - ANIMATIONEND: 'animationend' + (webkit ? ' webkitAnimationEnd' : ''), + TRANSITIONEND: 'transitionend' + (isWebkit ? ' webkitTransitionEnd' : ''), + ANIMATIONEND: 'animationend' + (isWebkit ? ' webkitAnimationEnd' : ''), TRANSFORM: vendorProperty('transform'), TRANSFORM_ORIGIN: vendorProperty('transformOrigin'), @@ -255,6 +443,7 @@ function MdConstantFactory($sniffer) { ANIMATION_TIMING: vendorProperty('animationTimingFunction'), ANIMATION_DIRECTION: vendorProperty('animationDirection') }, + /** * As defined in core/style/variables.scss * @@ -265,17 +454,20 @@ function MdConstantFactory($sniffer) { * */ MEDIA: { - 'xs' : '(max-width: 599px)' , - 'gt-xs' : '(min-width: 600px)' , - 'sm' : '(min-width: 600px) and (max-width: 959px)' , - 'gt-sm' : '(min-width: 960px)' , - 'md' : '(min-width: 960px) and (max-width: 1279px)' , - 'gt-md' : '(min-width: 1280px)' , - 'lg' : '(min-width: 1280px) and (max-width: 1919px)', - 'gt-lg' : '(min-width: 1920px)' , - 'xl' : '(min-width: 1920px)' , + 'xs' : '(max-width: 599px)' , + 'gt-xs' : '(min-width: 600px)' , + 'sm' : '(min-width: 600px) and (max-width: 959px)' , + 'gt-sm' : '(min-width: 960px)' , + 'md' : '(min-width: 960px) and (max-width: 1279px)' , + 'gt-md' : '(min-width: 1280px)' , + 'lg' : '(min-width: 1280px) and (max-width: 1919px)', + 'gt-lg' : '(min-width: 1920px)' , + 'xl' : '(min-width: 1920px)' , + 'landscape' : '(orientation: landscape)' , + 'portrait' : '(orientation: portrait)' , 'print' : 'print' }, + MEDIA_PRIORITY: [ 'xl', 'gt-lg', @@ -286,11 +478,14 @@ function MdConstantFactory($sniffer) { 'sm', 'gt-xs', 'xs', + 'landscape', + 'portrait', 'print' ] }; + + return self; } -MdConstantFactory.$inject = ["$sniffer"]; })(); (function(){ @@ -528,7 +723,8 @@ MdConstantFactory.$inject = ["$sniffer"]; (function(){ "use strict"; -angular.module('material.core') + +mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];angular.module('material.core') .factory('$mdMedia', mdMediaFactory); /** @@ -588,13 +784,21 @@ angular.module('material.core') *
@@ -616,6 +820,7 @@ angular.module('material.core')
*
*/
+/* @ngInject */
function mdMediaFactory($mdConstant, $rootScope, $window) {
var queries = {};
var mqls = {};
@@ -703,7 +908,7 @@ function mdMediaFactory($mdConstant, $rootScope, $window) {
});
return function unwatch() {
- unwatchFns.forEach(function(fn) { fn(); })
+ unwatchFns.forEach(function(fn) { fn(); });
};
}
@@ -713,7 +918,107 @@ function mdMediaFactory($mdConstant, $rootScope, $window) {
(normalizeCache[attrName] = attrs.$normalize(attrName));
}
}
-mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];
+
+})();
+(function(){
+"use strict";
+
+angular
+ .module('material.core')
+ .config( ["$provide", function($provide) {
+ $provide.decorator('$mdUtil', ['$delegate', function ($delegate) {
+
+ // Inject the prefixer into our original $mdUtil service.
+ $delegate.prefixer = MdPrefixer;
+
+ return $delegate;
+ }]);
+ }]);
+
+function MdPrefixer(initialAttributes, buildSelector) {
+ var PREFIXES = ['data', 'x'];
+
+ if (initialAttributes) {
+ // The prefixer also accepts attributes as a parameter, and immediately builds a list or selector for
+ // the specified attributes.
+ return buildSelector ? _buildSelector(initialAttributes) : _buildList(initialAttributes);
+ }
+
+ return {
+ buildList: _buildList,
+ buildSelector: _buildSelector,
+ hasAttribute: _hasAttribute,
+ removeAttribute: _removeAttribute
+ };
+
+ function _buildList(attributes) {
+ attributes = angular.isArray(attributes) ? attributes : [attributes];
+
+ attributes.forEach(function(item) {
+ PREFIXES.forEach(function(prefix) {
+ attributes.push(prefix + '-' + item);
+ });
+ });
+
+ return attributes;
+ }
+
+ function _buildSelector(attributes) {
+ attributes = angular.isArray(attributes) ? attributes : [attributes];
+
+ return _buildList(attributes)
+ .map(function(item) {
+ return '[' + item + ']';
+ })
+ .join(',');
+ }
+
+ function _hasAttribute(element, attribute) {
+ element = _getNativeElement(element);
+
+ if (!element) {
+ return false;
+ }
+
+ var prefixedAttrs = _buildList(attribute);
+
+ for (var i = 0; i < prefixedAttrs.length; i++) {
+ if (element.hasAttribute(prefixedAttrs[i])) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function _removeAttribute(element, attribute) {
+ element = _getNativeElement(element);
+
+ if (!element) {
+ return;
+ }
+
+ _buildList(attribute).forEach(function(prefixedAttribute) {
+ element.removeAttribute(prefixedAttribute);
+ });
+ }
+
+ /**
+ * Transforms a jqLite or DOM element into a HTML element.
+ * This is useful when supporting jqLite elements and DOM elements at
+ * same time.
+ * @param element {JQLite|Element} Element to be parsed
+ * @returns {HTMLElement} Parsed HTMLElement
+ */
+ function _getNativeElement(element) {
+ element = element[0] || element;
+
+ if (element.nodeType) {
+ return element;
+ }
+ }
+
+}
})();
(function(){
@@ -725,6 +1030,7 @@ mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];
* will create its own instance of this array and the app's IDs
* will not be unique.
*/
+UtilFactory.$inject = ["$document", "$timeout", "$compile", "$rootScope", "$$mdAnimate", "$interpolate", "$log", "$rootElement", "$window", "$$rAF"];
var nextUniqueId = 0;
/**
@@ -737,7 +1043,10 @@ angular
.module('material.core')
.factory('$mdUtil', UtilFactory);
-function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, $rootElement, $window) {
+/**
+ * @ngInject
+ */
+function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, $rootElement, $window, $$rAF) {
// Setup some core variables for the processTemplate method
var startSymbol = $interpolate.startSymbol(),
endSymbol = $interpolate.endSymbol(),
@@ -761,13 +1070,46 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
return hasValue;
};
+ function validateCssValue(value) {
+ return !value ? '0' :
+ hasPx(value) || hasPercent(value) ? value : value + 'px';
+ }
+
+ function hasPx(value) {
+ return String(value).indexOf('px') > -1;
+ }
+
+ function hasPercent(value) {
+ return String(value).indexOf('%') > -1;
+
+ }
+
var $mdUtil = {
dom: {},
- now: window.performance ?
+ now: window.performance && window.performance.now ?
angular.bind(window.performance, window.performance.now) : Date.now || function() {
return new Date().getTime();
},
+ /**
+ * Cross-version compatibility method to retrieve an option of a ngModel controller,
+ * which supports the breaking changes in the AngularJS snapshot (SHA 87a2ff76af5d0a9268d8eb84db5755077d27c84c).
+ * @param {!angular.ngModelCtrl} ngModelCtrl
+ * @param {!string} optionName
+ * @returns {Object|undefined}
+ */
+ getModelOption: function (ngModelCtrl, optionName) {
+ if (!ngModelCtrl.$options) {
+ return;
+ }
+
+ var $options = ngModelCtrl.$options;
+
+ // The newer versions of Angular introduced a `getOption function and made the option values no longer
+ // visible on the $options object.
+ return $options.getOption ? $options.getOption(optionName) : $options[optionName]
+ },
+
/**
* Bi-directional accessor/mutator used to easily update an element's
* property based on the current 'dir'ectional value.
@@ -779,22 +1121,29 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
if ( arguments.length == 0 ) return ltr ? 'ltr' : 'rtl';
// If mutator
+ var elem = angular.element(element);
+
if ( ltr && angular.isDefined(lValue)) {
- angular.element(element).css(property, validate(lValue));
+ elem.css(property, validateCssValue(lValue));
}
else if ( !ltr && angular.isDefined(rValue)) {
- angular.element(element).css(property, validate(rValue) );
+ elem.css(property, validateCssValue(rValue) );
}
+ },
- // Internal utils
+ bidiProperty: function (element, lProperty, rProperty, value) {
+ var ltr = !($document[0].dir == 'rtl' || $document[0].body.dir == 'rtl');
- function validate(value) {
- return !value ? '0' :
- hasPx(value) ? value : value + 'px';
- }
- function hasPx(value) {
- return String(value).indexOf('px') > -1;
- }
+ var elem = angular.element(element);
+
+ if ( ltr && angular.isDefined(lProperty)) {
+ elem.css(lProperty, validateCssValue(value));
+ elem.css(rProperty, '');
+ }
+ else if ( !ltr && angular.isDefined(rProperty)) {
+ elem.css(rProperty, validateCssValue(value) );
+ elem.css(lProperty, '');
+ }
},
clientRect: function(element, offsetParent, isOffsetRect) {
@@ -830,18 +1179,12 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
},
/**
- * Calculate the positive scroll offset
- * TODO: Check with pinch-zoom in IE/Chrome;
- * https://code.google.com/p/chromium/issues/detail?id=496285
+ * Determines the absolute position of the viewport.
+ * Useful when making client rectangles absolute.
+ * @returns {number}
*/
- scrollTop: function(element) {
- element = angular.element(element || $document[0].body);
-
- var body = (element[0] == $document[0].body) ? $document[0].body : undefined;
- var scrollTop = body ? body.scrollTop + body.parentElement.scrollTop : 0;
-
- // Calculate the positive scroll offset
- return scrollTop || Math.abs(element[0].getBoundingClientRect().top);
+ getViewportTop: function() {
+ return window.scrollY || window.pageYOffset || 0;
},
/**
@@ -852,14 +1195,14 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
* @returns {*}
*/
findFocusTarget: function(containerEl, attributeVal) {
- var AUTO_FOCUS = '[md-autofocus]';
+ var AUTO_FOCUS = this.prefixer('md-autofocus', true);
var elToFocus;
elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS);
if ( !elToFocus && attributeVal != AUTO_FOCUS) {
// Scan for deprecated attribute
- elToFocus = scanForFocusable(containerEl, '[md-auto-focus]');
+ elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true));
if ( !elToFocus ) {
// Scan for fallback to 'universal' API
@@ -881,9 +1224,9 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
items.length && angular.forEach(items, function(it) {
it = angular.element(it);
- // Check the element for the _md-autofocus class to ensure any associated expression
+ // Check the element for the md-autofocus class to ensure any associated expression
// evaluated to true.
- var isFocusable = it.hasClass('_md-autofocus');
+ var isFocusable = it.hasClass('md-autofocus');
if (isFocusable) elFound = it;
});
}
@@ -891,103 +1234,120 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
}
},
- // Disables scroll around the passed element.
- disableScrollAround: function(element, parent) {
- $mdUtil.disableScrollAround._count = $mdUtil.disableScrollAround._count || 0;
- ++$mdUtil.disableScrollAround._count;
- if ($mdUtil.disableScrollAround._enableScrolling) return $mdUtil.disableScrollAround._enableScrolling;
- element = angular.element(element);
- var body = $document[0].body,
- restoreBody = disableBodyScroll(),
- restoreElement = disableElementScroll(parent);
-
- return $mdUtil.disableScrollAround._enableScrolling = function() {
- if (!--$mdUtil.disableScrollAround._count) {
+ /**
+ * Disables scroll around the passed parent element.
+ * @param element Unused
+ * @param {!Element|!angular.JQLite} parent Element to disable scrolling within.
+ * Defaults to body if none supplied.
+ * @param options Object of options to modify functionality
+ * - disableScrollMask Boolean of whether or not to create a scroll mask element or
+ * use the passed parent element.
+ */
+ disableScrollAround: function(element, parent, options) {
+ options = options || {};
+
+ $mdUtil.disableScrollAround._count = Math.max(0, $mdUtil.disableScrollAround._count || 0);
+ $mdUtil.disableScrollAround._count++;
+
+ if ($mdUtil.disableScrollAround._restoreScroll) {
+ return $mdUtil.disableScrollAround._restoreScroll;
+ }
+
+ var body = $document[0].body;
+ var restoreBody = disableBodyScroll();
+ var restoreElement = disableElementScroll(parent);
+
+ return $mdUtil.disableScrollAround._restoreScroll = function() {
+ if (--$mdUtil.disableScrollAround._count <= 0) {
restoreBody();
restoreElement();
- delete $mdUtil.disableScrollAround._enableScrolling;
+ delete $mdUtil.disableScrollAround._restoreScroll;
}
};
- // Creates a virtual scrolling mask to absorb touchmove, keyboard, scrollbar clicking, and wheel events
+ /**
+ * Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking,
+ * and wheel events
+ */
function disableElementScroll(element) {
- element = angular.element(element || body)[0];
- var zIndex = 50;
- var scrollMask = angular.element(
- 'Number {{item}}
+ *Number {{item}}
' + + * ' '+ + * 'locals options...
+ * $scope.employee = employee;
+ *
+ * $scope.closeDialog = function() {
+ * // Easily hides most recent dialog shown...
+ * // no specific instance reference is needed.
+ * $mdDialog.hide();
+ * };
+ * }
+ *
+ * })(angular);
+ * {{::dialog.mdTextContent}}
', + '
+ *
+ *
+ * Cells are arrayed vertically and horizontally within the grid.
+ *
+ * Tiles hold content and can span one or more cells vertically or horizontally.
+ *
+ * ### Responsive Attributes
+ *
+ * The `md-grid-list` directive supports "responsive" attributes, which allow
+ * different `md-cols`, `md-gutter` and `md-row-height` values depending on the
+ * currently matching media query.
+ *
+ * In order to set a responsive attribute, first define the fallback value with
+ * the standard attribute name, then add additional attributes with the
+ * following convention: `{base-attribute-name}-{media-query-name}="{value}"`
+ * (ie. `md-cols-lg="8"`)
+ *
+ * @param {number} md-cols Number of columns in the grid.
+ * @param {string} md-row-height One of
+ *