diff --git a/package-lock.json b/package-lock.json index 32c634d381f..3de1baac556 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "angular-material-source", - "version": "1.1.22", + "version": "1.1.23", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/components/panel/panel.js b/src/components/panel/panel.js index aeb44e667d5..ff06c325698 100644 --- a/src/components/panel/panel.js +++ b/src/components/panel/panel.js @@ -1631,7 +1631,7 @@ MdPanelRef.prototype.destroy = function() { this.config.onDomRemoved = null; this.config.onRemoving = null; this.config.onOpenComplete = null; - this._interceptors = null; + this._interceptors = undefined; }; @@ -1705,7 +1705,7 @@ MdPanelRef.prototype.hide = function() { }; var removeFromGroupOpen = function() { if (self.config.groupName) { - var group, index; + var index; angular.forEach(self.config.groupName, function(group) { group = self._$mdPanel._groups[group]; index = group.openPanels.indexOf(self); @@ -2023,6 +2023,7 @@ MdPanelRef.prototype._updatePosition = function(init) { // Hide the panel now that position is known. if (init) { this.panelEl.removeClass('_md-panel-offscreen'); + this.innerWrapper.removeClass('_md-panel-offscreen'); this.panelContainer.addClass(MD_PANEL_HIDDEN); } @@ -2319,34 +2320,34 @@ MdPanelRef.prototype._animateOpen = function() { /** * Animate the panel closing. - * @returns {!Q.IPromise} A promise that is resolved when the panel has - * animated closed. + * @returns {!Q.IPromise} A promise that is resolved when the panel has animated closed. * @private */ MdPanelRef.prototype._animateClose = function() { + var self = this; var animationConfig = this.config['animation']; + if (!animationConfig) { this.panelContainer.removeClass('md-panel-is-showing'); this.panelContainer.removeClass('_md-panel-shown'); return this._$q.when(this); - } - - var self = this; - return this._$q(function(resolve) { - var done = function() { - self.panelContainer.removeClass('md-panel-is-showing'); - resolve(self); - }; - var warnAndClose = function() { - self._$log.warn( - 'mdPanel: MdPanel Animations failed. ' + - 'Hiding panel without animating.'); - done(); - }; + } else { + return this._$q(function (resolve) { + var done = function () { + self.panelContainer.removeClass('md-panel-is-showing'); + // Remove the transform so that re-used panels don't accumulate transforms. + self.panelEl.css('transform', ''); + resolve(self); + }; + var warnAndClose = function () { + self._$log.warn( + 'mdPanel: MdPanel Animations failed. Hiding panel without animating.'); + done(); + }; - animationConfig.animateClose(self.panelEl) - .then(done, warnAndClose); - }); + animationConfig.animateClose(self.panelEl).then(done, warnAndClose); + }); + } }; @@ -2467,7 +2468,7 @@ MdPanelRef.prototype._simpleBind = function(callback, self) { /** - * @param {function} callback + * @param {function|IQResolveReject} callback * @param {!Object} self * @return {function} Callback function with a self param. */ @@ -2882,7 +2883,7 @@ MdPanelPosition.prototype.getRight = function() { /** * Gets the value of `transform` for the panel. - * @returns {string} + * @returns {string} representation of the translateX and translateY rules and values */ MdPanelPosition.prototype.getTransform = function() { var translateX = this._reduceTranslateValues('translateX', this._translateX); @@ -3369,8 +3370,7 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl) { /** * Animate the panel close. * @param {!JQLite} panelEl - * @returns {!Q.IPromise} A promise that resolves when the close - * animation is complete. + * @returns {!Q.IPromise} A promise that resolves when the close animation is complete. */ MdPanelAnimation.prototype.animateClose = function(panelEl) { var animator = this._$mdUtil.dom.animator; @@ -3391,8 +3391,7 @@ MdPanelAnimation.prototype.animateClose = function(panelEl) { transitionOutClass: '_md-panel-animate-enter _md-panel-animate-leave' }; - var closeSlide = animator.calculateSlideToOrigin( - panelEl, this._closeTo) || ''; + var closeSlide = animator.calculateSlideToOrigin(panelEl, this._closeTo) || ''; closeTo = animator.toTransformCss(closeSlide + ' ' + panelTransform); break; @@ -3402,8 +3401,7 @@ MdPanelAnimation.prototype.animateClose = function(panelEl) { transitionOutClass: '_md-panel-animate-scale-out _md-panel-animate-enter _md-panel-animate-leave' }; - var closeScale = animator.calculateZoomToOrigin( - panelEl, this._closeTo) || ''; + var closeScale = animator.calculateZoomToOrigin(panelEl, this._closeTo) || ''; closeTo = animator.toTransformCss(panelTransform + ' ' + closeScale); break; @@ -3492,9 +3490,9 @@ function getElement(el) { /** * Gets the computed values for an element's translateX and translateY in px. - * @param {!JQLite|!Element} el + * @param {!JQLite|!Element} el the element to evaluate * @param {string} property - * @return {{x: number, y: number}} + * @return {{x: number, y: number}} an element's translateX and translateY in px */ function getComputedTranslations(el, property) { // The transform being returned by `getComputedStyle` is in the format: diff --git a/src/core/util/animation/animate.js b/src/core/util/animation/animate.js index 4dc68353fcf..d1c4985000c 100644 --- a/src/core/util/animation/animate.js +++ b/src/core/util/animation/animate.js @@ -29,7 +29,7 @@ function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss) { duration: options.duration }) .start() - .then(function(){ + .then(function() { // Resolve with reverser function... return reverseTranslate; }); @@ -199,6 +199,10 @@ function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss) { /** * Convert the translate CSS value to key/value pair(s). + * @param {string} transform + * @param {boolean=} addTransition + * @param {string=} transition + * @return {Object} object containing CSS translate key/value pair(s) */ toTransformCss: function (transform, addTransition, transition) { var css = {}; diff --git a/src/core/util/constant.js b/src/core/util/constant.js index 533620653a6..91cba218284 100755 --- a/src/core/util/constant.js +++ b/src/core/util/constant.js @@ -12,6 +12,10 @@ function MdConstantFactory() { var isWebkit = /webkit/i.test(vendorPrefix); var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + /** + * @param {string} name CSS property name + * @return {string} the property name supported by the browser + */ function vendorProperty(name) { // Add a dash between the prefix and name, to be able to transform the string into camelcase. var prefixedName = vendorPrefix + '-' + name; @@ -27,6 +31,10 @@ function MdConstantFactory() { return angular.isDefined(testElement.style[property]); } + /** + * @param {!string} input value to convert to camelCase + * @return {string} camelCased version of the input string + */ function camelCase(input) { return input.replace(SPECIAL_CHARS_REGEXP, function(matches, separator, letter, offset) { return offset ? letter.toUpperCase() : letter;