@@ -14,6 +14,7 @@ angular
14
14
* PUBLIC DOCUMENTATION *
15
15
*****************************************************************************/
16
16
17
+
17
18
/**
18
19
* @ngdoc service
19
20
* @name $mdPanel
@@ -155,10 +156,11 @@ angular
155
156
* on when the panel closes. This is commonly the element which triggered
156
157
* the opening of the panel. If you do not use `origin`, you need to control
157
158
* the focus manually.
158
- * - `groupName` - `{string=}`: Name of a panel group. This group name is used
159
- * for configuring the number of open panels and identifying specific
160
- * behaviors for groups. For instance, all tooltips could be identified
161
- * using the same groupName.
159
+ * - `groupName` - `{(string|!Array<string>)=}`: A group name or an array of
160
+ * group names. The group name is used for creating a group of panels. The
161
+ * group is used for configuring the number of open panels and identifying
162
+ * specific behaviors for groups. For instance, all tooltips could be
163
+ * identified using the same groupName.
162
164
*
163
165
* @returns {!MdPanelRef } panelRef
164
166
*/
@@ -685,6 +687,7 @@ angular
685
687
* MdPanelAnimation *
686
688
*****************************************************************************/
687
689
690
+
688
691
/**
689
692
* @ngdoc type
690
693
* @name MdPanelAnimation
@@ -895,7 +898,12 @@ MdPanelService.prototype.create = function(config) {
895
898
this . _config . scope . $on ( '$destroy' , angular . bind ( panelRef , panelRef . detach ) ) ;
896
899
897
900
if ( this . _config . groupName ) {
898
- panelRef . addToGroup ( this . _config . groupName ) ;
901
+ if ( angular . isString ( this . _config . groupName ) ) {
902
+ this . _config . groupName = [ this . _config . groupName ] ;
903
+ }
904
+ angular . forEach ( this . _config . groupName , function ( group ) {
905
+ panelRef . addToGroup ( group ) ;
906
+ } ) ;
899
907
}
900
908
901
909
return panelRef ;
@@ -987,7 +995,7 @@ MdPanelService.prototype.setGroupMaxOpen = function(groupName, maxOpen) {
987
995
* @private
988
996
*/
989
997
MdPanelService . prototype . _openCountExceedsMaxOpen = function ( groupName ) {
990
- if ( groupName && this . _groups [ groupName ] ) {
998
+ if ( this . _groups [ groupName ] ) {
991
999
var group = this . _groups [ groupName ] ;
992
1000
return group . maxOpen > 0 && group . openPanels . length > group . maxOpen ;
993
1001
}
@@ -1001,9 +1009,7 @@ MdPanelService.prototype._openCountExceedsMaxOpen = function(groupName) {
1001
1009
* @private
1002
1010
*/
1003
1011
MdPanelService . prototype . _closeFirstOpenedPanel = function ( groupName ) {
1004
- if ( groupName ) {
1005
- this . _groups [ groupName ] . openPanels [ 0 ] . close ( ) ;
1006
- }
1012
+ this . _groups [ groupName ] . openPanels [ 0 ] . close ( ) ;
1007
1013
} ;
1008
1014
1009
1015
@@ -1137,8 +1143,12 @@ MdPanelRef.prototype.open = function() {
1137
1143
var done = self . _done ( resolve , self ) ;
1138
1144
var show = self . _simpleBind ( self . show , self ) ;
1139
1145
var checkGroupMaxOpen = function ( ) {
1140
- if ( self . _$mdPanel . _openCountExceedsMaxOpen ( self . config . groupName ) ) {
1141
- self . _$mdPanel . _closeFirstOpenedPanel ( self . config . groupName ) ;
1146
+ if ( self . config . groupName ) {
1147
+ angular . forEach ( self . config . groupName , function ( group ) {
1148
+ if ( self . _$mdPanel . _openCountExceedsMaxOpen ( group ) ) {
1149
+ self . _$mdPanel . _closeFirstOpenedPanel ( group ) ;
1150
+ }
1151
+ } ) ;
1142
1152
}
1143
1153
} ;
1144
1154
@@ -1258,8 +1268,11 @@ MdPanelRef.prototype.detach = function() {
1258
1268
* Destroys the panel. The Panel cannot be opened again after this.
1259
1269
*/
1260
1270
MdPanelRef . prototype . destroy = function ( ) {
1271
+ var self = this ;
1261
1272
if ( this . config . groupName ) {
1262
- this . removeFromGroup ( this . config . groupName ) ;
1273
+ angular . forEach ( this . config . groupName , function ( group ) {
1274
+ self . removeFromGroup ( group ) ;
1275
+ } ) ;
1263
1276
}
1264
1277
this . config . scope . $destroy ( ) ;
1265
1278
this . config . locals = null ;
@@ -1294,8 +1307,9 @@ MdPanelRef.prototype.show = function() {
1294
1307
var onOpenComplete = self . config [ 'onOpenComplete' ] || angular . noop ;
1295
1308
var addToGroupOpen = function ( ) {
1296
1309
if ( self . config . groupName ) {
1297
- var group = self . _$mdPanel . _groups [ self . config . groupName ] ;
1298
- group . openPanels . push ( self ) ;
1310
+ angular . forEach ( self . config . groupName , function ( group ) {
1311
+ self . _$mdPanel . _groups [ group ] . openPanels . push ( self ) ;
1312
+ } ) ;
1299
1313
}
1300
1314
} ;
1301
1315
@@ -1336,11 +1350,14 @@ MdPanelRef.prototype.hide = function() {
1336
1350
} ;
1337
1351
var removeFromGroupOpen = function ( ) {
1338
1352
if ( self . config . groupName ) {
1339
- var group = self . _$mdPanel . _groups [ self . config . groupName ] ;
1340
- var index = group . openPanels . indexOf ( self ) ;
1341
- if ( index > - 1 ) {
1342
- group . openPanels . splice ( index , 1 ) ;
1343
- }
1353
+ var group , index ;
1354
+ angular . forEach ( self . config . groupName , function ( group ) {
1355
+ group = self . _$mdPanel . _groups [ group ] ;
1356
+ index = group . openPanels . indexOf ( self ) ;
1357
+ if ( index > - 1 ) {
1358
+ group . openPanels . splice ( index , 1 ) ;
1359
+ }
1360
+ } ) ;
1344
1361
}
1345
1362
} ;
1346
1363
var focusOnOrigin = function ( ) {
@@ -1884,6 +1901,7 @@ MdPanelRef.prototype._animateClose = function() {
1884
1901
} ) ;
1885
1902
} ;
1886
1903
1904
+
1887
1905
/**
1888
1906
* Registers a interceptor with the panel. The callback should return a promise,
1889
1907
* which will allow the action to continue when it gets resolved, or will
@@ -1914,6 +1932,7 @@ MdPanelRef.prototype.registerInterceptor = function(type, callback) {
1914
1932
return this ;
1915
1933
} ;
1916
1934
1935
+
1917
1936
/**
1918
1937
* Removes a registered interceptor.
1919
1938
* @param {string } type Type of interceptor to be removed.
@@ -2169,6 +2188,7 @@ MdPanelPosition.prototype.absolute = function() {
2169
2188
return this ;
2170
2189
} ;
2171
2190
2191
+
2172
2192
/**
2173
2193
* Sets the value of a position for the panel. Clears any previously set
2174
2194
* position.
@@ -3037,6 +3057,7 @@ MdPanelAnimation.prototype._getBoundingClientRect = function(element) {
3037
3057
* Util Methods *
3038
3058
*****************************************************************************/
3039
3059
3060
+
3040
3061
/**
3041
3062
* Returns the angular element associated with a css selector or element.
3042
3063
* @param el {string|!angular.JQLite|!Element}
@@ -3048,6 +3069,7 @@ function getElement(el) {
3048
3069
return angular . element ( queryResult ) ;
3049
3070
}
3050
3071
3072
+
3051
3073
/**
3052
3074
* Gets the computed values for an element's translateX and translateY in px.
3053
3075
* @param {!angular.JQLite|!Element } el
0 commit comments