Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit c13feb7

Browse files
committed
fix(panel): css and docs fixes
- Remove will-change css property. - Verify positionConfig exists before setting position. - Update docs for destroy. - Destorys -> destroys - Remove overflow: auto from panel. - Fix type annotations. - Update origin docs.
1 parent 9d9eeb9 commit c13feb7

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

src/components/panel/panel.js

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ angular
9696
* controller.
9797
* - `controllerAs` - `{string=}`: An alias to assign the controller to on
9898
* the scope.
99+
* - `bindToController` - `{boolean=}`: Binds locals to the controller
100+
* instead of passing them in. Defaults to true, as this is a best
101+
* practice.
99102
* - `locals` - `{Object=}`: An object containing key/value pairs. The keys
100103
* will be used as names of values to inject into the controller. For
101104
* example, `locals: {three: 3}` would inject `three` into the controller,
@@ -107,6 +110,8 @@ angular
107110
* application.
108111
* - `panelClass` - `{string=}`: A css class to apply to the panel element.
109112
* This class should define any borders, box-shadow, etc. for the panel.
113+
* - `zIndex` - `{number=}`: The z-index to place the panel at.
114+
* Defaults to 80.
110115
* - `position` - `{MdPanelPosition=}`: An MdPanelPosition object that
111116
* specifies the alignment of the panel. For more information, see
112117
* `MdPanelPosition`.
@@ -141,7 +146,8 @@ angular
141146
* panel is removed from the DOM.
142147
* - `origin` - `{(string|!angular.JQLite|!Element)=}`: The element to
143148
* focus on when the panel closes. This is commonly the element which triggered
144-
* the opening of the panel.
149+
* the opening of the panel. If you do not use `origin`, you need to control
150+
* the focus manually.
145151
*
146152
* TODO(ErinCoughlan): Add the following config options.
147153
* - `groupName` - `{string=}`: Name of panel groups. This group name is
@@ -286,6 +292,13 @@ angular
286292
* hidden and animations are completed.
287293
*/
288294

295+
/**
296+
* @ngdoc method
297+
* @name MdPanelRef#destroy
298+
* @description
299+
* Destroys the panel. The panel cannot be opened again after this is called.
300+
*/
301+
289302
/**
290303
* @ngdoc method
291304
* @name MdPanelRef#addClass
@@ -622,16 +635,16 @@ function MdPanelService($rootElement, $rootScope, $injector, $window) {
622635
this._config = {};
623636

624637
/** @private @const */
625-
this._$rootScope = $rootScope;
638+
this._$rootElement = $rootElement;
626639

627640
/** @private @const */
628-
this._$rootElement = $rootElement;
641+
this._$rootScope = $rootScope;
629642

630643
/** @private @const */
631644
this._$injector = $injector;
632645

633-
/** @private @const {!angular.$window} */
634-
this._$window = $injector.get('$window');
646+
/** @private @const */
647+
this._$window = $window;
635648

636649

637650
/**
@@ -1173,15 +1186,17 @@ MdPanelRef.prototype._addStyles = function() {
11731186
MdPanelRef.prototype._updatePosition = function() {
11741187
var positionConfig = this._config['position'];
11751188

1176-
positionConfig._setPanelPosition(this._panelEl);
1177-
this._panelEl.css('top', positionConfig.getTop());
1178-
this._panelEl.css('bottom', positionConfig.getBottom());
1179-
this._panelEl.css('left', positionConfig.getLeft());
1180-
this._panelEl.css('right', positionConfig.getRight());
1189+
if (positionConfig) {
1190+
positionConfig._setPanelPosition(this._panelEl);
1191+
this._panelEl.css('top', positionConfig.getTop());
1192+
this._panelEl.css('bottom', positionConfig.getBottom());
1193+
this._panelEl.css('left', positionConfig.getLeft());
1194+
this._panelEl.css('right', positionConfig.getRight());
11811195

1182-
// Use the vendor prefixed version of transform.
1183-
var prefixedTransform = this._$mdConstant.CSS.TRANSFORM;
1184-
this._panelEl.css(prefixedTransform, positionConfig.getTransform());
1196+
// Use the vendor prefixed version of transform.
1197+
var prefixedTransform = this._$mdConstant.CSS.TRANSFORM;
1198+
this._panelEl.css(prefixedTransform, positionConfig.getTransform());
1199+
}
11851200
};
11861201

11871202

@@ -1500,10 +1515,13 @@ MdPanelRef.prototype._done = function(callback, self) {
15001515
* position: panelPosition
15011516
* });
15021517
*
1503-
* @param @const {!angular.$window}
1518+
* @param {!angular.$window} $window
15041519
* @final @constructor
15051520
*/
15061521
function MdPanelPosition($window) {
1522+
/** @private @const */
1523+
this._$window = $window;
1524+
15071525
/** @private {boolean} */
15081526
this._absolute = false;
15091527

@@ -1531,8 +1549,6 @@ function MdPanelPosition($window) {
15311549
/** @private {!Array<{x:string, y:string}>} */
15321550
this._positions = [];
15331551

1534-
this._$window = $window;
1535-
15361552
/** @private {?{x:string, y:string}} */
15371553
this._actualPosition;
15381554
}

src/components/panel/panel.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
.md-panel {
2929
opacity: 0;
30-
overflow: auto;
3130
position: fixed;
3231

3332
&._md-panel-shown {

src/components/tooltip/tooltip.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,5 @@ md-tooltip {
6767
&._md-show {
6868
transition: $swift-ease-out;
6969
pointer-events: auto;
70-
will-change: opacity, height, width;
7170
}
7271
}

0 commit comments

Comments
 (0)