@refinitiv-ui/efx-grid 6.0.122 → 6.0.124

Sign up to get free protection for your applications and to get access to all the features.
@@ -2708,21 +2708,31 @@ Grid.prototype._removeRow = function(rowDef) {
2708
2708
  }
2709
2709
  this._dispatch("beforeRowRemoved", {});
2710
2710
 
2711
- let connector = this._connector;
2712
- let dt = this._dt;
2713
2711
  let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
2714
- if(childRowDefs) { // Remove all children first
2715
- for(let i = 0; i < childRowDefs.length; i++) {
2716
- connector.removeRic(childRowDefs[i]);
2717
- }
2718
- let rowIds = childRowDefs.map(RowDefinition.toRowId);
2719
- dt.removeRows(rowIds);
2712
+ if(childRowDefs) {
2713
+ this._removeConstituentRows(childRowDefs);
2720
2714
  }
2721
- connector.removeRic(rowDef);
2722
- dt.removeRow(rowDef.getRowId()); // TODO: Merge this with the above removeRows() method
2715
+ this._connector.removeRic(rowDef);
2716
+ this._dt.removeRow(rowDef.getRowId()); // TODO: Merge this with the above removeRows() method
2723
2717
  rowDef.dispose(); // WARNING: This does not remove child reference from its parent
2724
2718
  };
2725
2719
 
2720
+ /** @private
2721
+ * @param {Array.<RowDefinition>} rowDefs
2722
+ */
2723
+ Grid.prototype._removeConstituentRows = function(rowDefs) {
2724
+ let connector = this._connector;
2725
+ let rowIds = [];
2726
+ for(let i = 0; i < rowDefs.length; i++) {
2727
+ let childRowDef = rowDefs[i];
2728
+ rowIds.push(childRowDef.getRowId());
2729
+ connector.removeRic(childRowDef);
2730
+ childRowDef.dispose();
2731
+ }
2732
+
2733
+ this._dt.removeRows(rowIds);
2734
+ };
2735
+
2726
2736
  /** @public
2727
2737
  * @param {Grid~RowReference} rowRef
2728
2738
  * @param {boolean=} hidden if false, show instead of hide
@@ -2827,7 +2837,20 @@ Grid.prototype.unlinkChain = function(rowRef) {
2827
2837
  }
2828
2838
 
2829
2839
  this._unlinking = true;
2840
+
2841
+ let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
2842
+ if(childRowDefs) {
2843
+ if(rowDef.isChainExpanded()) {
2844
+ for(let i = 0; i < childRowDefs.length; i++) {
2845
+ childRowDefs[i].toRealTimeRow();
2846
+ }
2847
+ } else {
2848
+ this._removeConstituentRows(childRowDefs);
2849
+ }
2850
+ }
2851
+
2830
2852
  rowDef.unlinkChain();
2853
+
2831
2854
  this._unlinking = false;
2832
2855
  };
2833
2856
 
@@ -3596,7 +3619,7 @@ Grid.prototype._onDataChanged = function(e) {
3596
3619
  let subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
3597
3620
  if(subId) {
3598
3621
  let parentDef = this._getRowDefinitionById(subId);
3599
- if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
3622
+ if(parentDef && parentDef.isChain() && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
3600
3623
  if(!this._chainMembers) {
3601
3624
  this._chainMembers = {};
3602
3625
  }
@@ -1158,9 +1158,10 @@ RowDefinition.prototype.addConstituent = function(ric) {
1158
1158
  };
1159
1159
 
1160
1160
  /** Used to convert autogenerated row to regular real-time row
1161
- * @private
1161
+ * @public
1162
+ * @ignore
1162
1163
  */
1163
- RowDefinition.prototype._toRealTimeRow = function() {
1164
+ RowDefinition.prototype.toRealTimeRow = function() {
1164
1165
  if(!this._ric) { // Empty row
1165
1166
  return;
1166
1167
  }
@@ -1189,14 +1190,6 @@ RowDefinition.prototype.unlinkChain = function() {
1189
1190
  return;
1190
1191
  }
1191
1192
 
1192
- if(this.isChainExpanded()) {
1193
- let rowDefs = this.getDescendants();
1194
- let len = rowDefs.length;
1195
- for(let i = 0; i < len; i++) {
1196
- rowDefs[i]._toRealTimeRow();
1197
- }
1198
- }
1199
-
1200
1193
  let staticData = this._cloneStaticRowData();
1201
1194
  this.unsubscribeForUpdates();
1202
1195
 
@@ -537,6 +537,7 @@ CheckboxPlugin.prototype._genCheckboxColumn = function (userObj) {
537
537
  let defaultObj = {
538
538
  width: this._width,
539
539
  sortable: false,
540
+ focusable: true,
540
541
  className: "tr-checkbox-column", // For rt-grid
541
542
  classes: { "tr-checkbox-column": 1 }, // For composite grid
542
543
  noResizing: true, // ColumnResizing Extension
@@ -625,7 +626,8 @@ CheckboxPlugin.prototype._findCheckboxColumnIndexFromConfig = function (columns)
625
626
  if(Array.isArray(columns)) {
626
627
  let colCount = columns.length;
627
628
  for(let i = 0; i < colCount; i++) {
628
- if(columns[i].checkboxColumn) {
629
+ let col = columns[i];
630
+ if(col && col.checkboxColumn) {
629
631
  return i;
630
632
  }
631
633
  }
@@ -1,6 +1,6 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
3
+ import {extendObject, injectCss, prettifyCss, isEmptyObject} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
@@ -1,6 +1,6 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
3
+ import {extendObject, injectCss, prettifyCss, isEmptyObject} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
@@ -762,7 +762,7 @@ ConditionalColoringPlugin.prototype.setColumnBlinking = function (colIndex, blin
762
762
  }
763
763
  let blinkDuration = bOptions.duration || this._blinkingDuration;
764
764
  painter.setBlinkingDuration(blinkDuration);
765
- painter.disableLevelColor(bOptions.level === false);
765
+ colData.levelBlinkingDisabled = bOptions.level === false; // Used in _onSectionBinding
766
766
  if (bOptions.customColor) {
767
767
  painter.addBlink(newBlinkingField, bOptions.up, bOptions.down, bOptions.level, bOptions.border);
768
768
  } else {
@@ -1198,8 +1198,7 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1198
1198
  }
1199
1199
 
1200
1200
  let prevDataRow, prevDataRows = host._prevDataRows;
1201
- let prevIds = Object.keys(prevDataRows);
1202
- let prevRowCount = prevIds.length;
1201
+ let isPrevRowExisted = !isEmptyObject(prevDataRows);
1203
1202
  for (r = fromR; r < toR; ++r) {
1204
1203
  dataRow = this._rowGetter(dataRows[r]);
1205
1204
  if (!dataRow) continue; // prevent from null value access when using with RowGroupingExtension
@@ -1259,14 +1258,17 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1259
1258
  let prevValue = prevDataRow[field];
1260
1259
  if (prevValue != null) {
1261
1260
  if (changedCols && changedCols[field]) {
1262
- blinking = true;
1263
- bgBlinking = painter.blinkCell(cell, newValue, prevValue, dataRow, dataRow);
1261
+ let blinkSignal = painter.calcBlinkSignal(newValue, prevValue);
1262
+ if(blinkSignal !== 0 || (blinkSignal === 0 && !colData.levelBlinkingDisabled)) {
1263
+ blinking = true;
1264
+ bgBlinking = painter.blink(cell, blinkSignal, dataRow);
1265
+ }
1264
1266
  }
1265
1267
  }
1266
1268
  } else {
1267
- if(prevRowCount && insertedRow){
1269
+ if(isPrevRowExisted && insertedRow){
1268
1270
  blinking = true;
1269
- bgBlinking = painter.blinkCell(cell, newValue, newValue, dataRow, dataRow);
1271
+ bgBlinking = painter.blink(cell, 0, dataRow);
1270
1272
  }
1271
1273
  }
1272
1274
  }
@@ -1607,6 +1607,7 @@ RowFilteringPlugin.prototype._getUniqueValues = function(field, dialogConfig, fo
1607
1607
  let uniqueValues = {};
1608
1608
  let formattedVal = null;
1609
1609
  let rawVal = null;
1610
+ let blankAtLeastOne = false;
1610
1611
  if(!Array.isArray(userItemList)) {
1611
1612
  userItemList = null;
1612
1613
  let dvs = this._getAvailableDataViews();
@@ -1631,6 +1632,10 @@ RowFilteringPlugin.prototype._getUniqueValues = function(field, dialogConfig, fo
1631
1632
 
1632
1633
  if(!rawVal) { // Only valid values are accepted
1633
1634
  if(rawVal !== 0 && rawVal !== false) {
1635
+ if(!blankAtLeastOne && BlankValues[rawVal]) {
1636
+ blankAtLeastOne = true;
1637
+ _collectUniqueValue(uniqueValues, BLANKS, rawVal);
1638
+ }
1634
1639
  continue;
1635
1640
  }
1636
1641
  }
@@ -1755,6 +1760,8 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1755
1760
  this._filterDialog.addEventListener("sortChanged", this._onDialogSortChanged.bind(this));
1756
1761
  }
1757
1762
  this._filterDialog.addEventListener("filterChanged", this._onDialogFilterChanged.bind(this));
1763
+ this._filterDialog.addEventListener("confirm", this._onDialogClosed.bind(this));
1764
+ this._filterDialog.addEventListener("cancel", this._onDialogClosed.bind(this));
1758
1765
  }
1759
1766
  }
1760
1767
 
@@ -1914,7 +1921,6 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1914
1921
  );
1915
1922
 
1916
1923
  if(dialogConfig.blankValues) {
1917
- delete uniqueValues[BLANKS];
1918
1924
  let dunmmySelectItem = {};
1919
1925
  let blkVals = ["", null, undefined, NaN]; // eslint-disable-line
1920
1926
  let dummyRow = {};
@@ -1927,7 +1933,11 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1927
1933
  break;
1928
1934
  }
1929
1935
  }
1936
+ if(!dialogConfig.blankValuesChecked && !uniqueValues[BLANKS]) {
1937
+ dialogConfig.blankValues = false; // doesn't display a blank item when the checkbox for it is unchecked and there's no blank value at least one item.
1938
+ }
1930
1939
  }
1940
+ delete uniqueValues[BLANKS];
1931
1941
 
1932
1942
  let keys = Object.keys(uniqueValues);
1933
1943
  if(sortLogic) {
@@ -2145,7 +2155,14 @@ RowFilteringPlugin._getFilterBuilder = function() {
2145
2155
  }
2146
2156
  return RowFilteringPlugin._filterBuilder;
2147
2157
  };
2148
-
2158
+ /** @private
2159
+ * @param {Object} e
2160
+ */
2161
+ RowFilteringPlugin.prototype._onDialogClosed = function(e) {
2162
+ if(this._hosts.length) {
2163
+ this._hosts[0].focus();
2164
+ }
2165
+ };
2149
2166
  /** @public
2150
2167
  * @ignore
2151
2168
  * @param {*} val
@@ -128,7 +128,7 @@ declare class CellPainter {
128
128
 
129
129
  public renderColoring(cell: any, rowData: any): void;
130
130
 
131
- public blink(cell: any, blinkSignal: number, rowData: any): void;
131
+ public blink(cell: any, blinkSignal: number, rowData: any): boolean;
132
132
 
133
133
  public blinkCell(cell: any, newValue: number, oldValue: number, rowData: any): boolean;
134
134
 
@@ -77,10 +77,6 @@ CellPainter.prototype._scopes;
77
77
  * @private
78
78
  */
79
79
  CellPainter.prototype._columnStats = null;
80
- /** @type {boolean}
81
- * @private
82
- */
83
- CellPainter.prototype._levelColorDisabled = false;
84
80
  /** @type {number}
85
81
  * @private
86
82
  */
@@ -729,7 +725,7 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
729
725
  } else if(ret < 0) {
730
726
  curCond["cssClass"] = curCond["downClass"];
731
727
  } else {
732
- curCond["cssClass"] = this._levelColorDisabled ? "" : curCond["levelClass"];
728
+ curCond["cssClass"] = curCond["levelClass"];
733
729
  }
734
730
  curCond["cssClass"] = curCond["cssClass"] || "";
735
731
  return curCond;
@@ -1029,42 +1025,11 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
1029
1025
  * @param {tr.grid.Cell} cell
1030
1026
  * @param {number} blinkSignal
1031
1027
  * @param {Object} rowData to calculate original style e.g. { PCTCHNG: 0.53, CF_NETCHNG: 0.75 }
1032
- */
1033
- CellPainter.prototype.blink = function (cell, blinkSignal, rowData) {
1034
- this._blinkCell(cell, rowData, blinkSignal);
1035
- };
1036
-
1037
- /**
1038
- * @public
1039
- * @param {tr.grid.Cell} cell
1040
- * @param {number} newValue
1041
- * @param {number} oldValue
1042
- * @param {Object} rowData e.g. { PCTCHNG: 0.53, CF_NETCHNG: 0.75 }
1043
- * @return {boolean}
1044
- */
1045
- CellPainter.prototype.blinkCell = function(cell, newValue, oldValue, rowData) {
1046
- let bc = this._blinkCondition;
1047
- if (!bc) return false;
1048
-
1049
- let blinkSignal = this._blinkCondition._fn(newValue, oldValue);
1050
- return this._blinkCell(cell, rowData, blinkSignal);
1051
- };
1052
-
1053
- /** @private
1054
- * @param {tr.grid.Cell} cell
1055
- * @param {Object} rowData e.g. { PCTCHNG: 0.53, CF_NETCHNG: 0.75 }
1056
- * @param {number} blinkSignal
1057
1028
  * @return {boolean}
1058
1029
  */
1059
- CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
1030
+ CellPainter.prototype.blink = function (cell, blinkSignal, rowData) {
1060
1031
  if (!cell) return false;
1061
1032
 
1062
- if (this._levelColorDisabled) {
1063
- if(!blinkSignal) { // Disabled level color equivalent to no blinking for blink signal 0
1064
- return false;
1065
- }
1066
- }
1067
-
1068
1033
  let elem = cell.getElement();
1069
1034
  if (!elem) return false; // Cell has been disposed
1070
1035
 
@@ -1117,6 +1082,36 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
1117
1082
  return bgBlinking;
1118
1083
  };
1119
1084
 
1085
+ /**
1086
+ * @public
1087
+ * @param {tr.grid.Cell} cell
1088
+ * @param {number} newValue
1089
+ * @param {number} oldValue
1090
+ * @param {Object} rowData e.g. { PCTCHNG: 0.53, CF_NETCHNG: 0.75 }
1091
+ * @return {boolean}
1092
+ */
1093
+ CellPainter.prototype.blinkCell = function(cell, newValue, oldValue, rowData) {
1094
+ let bc = this._blinkCondition;
1095
+ if (!bc) return false;
1096
+
1097
+ let blinkSignal = this._blinkCondition._fn(newValue, oldValue);
1098
+ return this.blink(cell, blinkSignal, rowData);
1099
+ };
1100
+
1101
+ /**
1102
+ * @public
1103
+ * @ignore
1104
+ * @param {number} newValue
1105
+ * @param {number} oldValue
1106
+ * @return {number}
1107
+ */
1108
+ CellPainter.prototype.calcBlinkSignal = function(newValue, oldValue) {
1109
+ if (this._blinkCondition) {
1110
+ return this._blinkCondition._fn(newValue, oldValue);
1111
+ }
1112
+ return 0;
1113
+ };
1114
+
1120
1115
  /**
1121
1116
  * @public
1122
1117
  * @param {tr.grid.Cell} cell
@@ -1133,13 +1128,12 @@ CellPainter.prototype.verifyBlinking = function(cell, rowData) {
1133
1128
  }
1134
1129
  }
1135
1130
  };
1136
- /**
1131
+ /** Deprecated, the state has been moved out to support prioritization.
1137
1132
  * @public
1133
+ * @deprecated
1138
1134
  * @param {boolean=} disabled
1139
1135
  */
1140
- CellPainter.prototype.disableLevelColor = function(disabled) {
1141
- this._levelColorDisabled = disabled !== false;
1142
- };
1136
+ CellPainter.prototype.disableLevelColor = function(disabled) {};
1143
1137
  /**
1144
1138
  * @public
1145
1139
  * @param {number} duration
@@ -16,7 +16,8 @@ declare namespace Popup {
16
16
  contentElement?: Element|null,
17
17
  popupChild?: Popup|null,
18
18
  uiBlocking?: boolean|null,
19
- hideOnScroll?: boolean|null
19
+ hideOnScroll?: boolean|null,
20
+ zIndexReference?: Element|null
20
21
  };
21
22
 
22
23
  type Positioning = string;
@@ -41,6 +42,8 @@ declare class Popup extends EventDispatcher {
41
42
 
42
43
  public attachTo(elem: Element|null, positioning?: Popup.Positioning|null): void;
43
44
 
45
+ public getAttachedElement(): Element|null;
46
+
44
47
  public setAttachedElement(elem: Element|null, positioning?: Popup.Positioning|null): void;
45
48
 
46
49
  public addFocusElement(elem: Element|null): void;
@@ -53,6 +56,10 @@ declare class Popup extends EventDispatcher {
53
56
 
54
57
  public setParentElement(parentElement: Element|null): Element|null;
55
58
 
59
+ public getZIndexReference(): Element|null;
60
+
61
+ public setZIndexReference(elem: Element|null): void;
62
+
56
63
  public show(opt_shown?: boolean|null, parentElement?: Element|null): void;
57
64
 
58
65
  public hide(opt_hidden?: boolean|null): void;
@@ -85,7 +92,5 @@ declare class Popup extends EventDispatcher {
85
92
 
86
93
  declare function containElements(parentElem: Element|null, e: MouseEvent|null): boolean;
87
94
 
88
- declare function fe(elem: Element|null, positioning?: Popup.Positioning|null): void;
89
-
90
95
  export { Popup, containElements };
91
96
  export default Popup;
@@ -4,7 +4,7 @@ import { Dom } from './Dom.js';
4
4
 
5
5
  /** @typedef {Object} Popup~Options
6
6
  * @description Popup options
7
- * @property {Popup~Positioning=} positioning="under"
7
+ * @property {Popup~Positioning=} positioning="under" Avialable value are under, right, over, fixed, custom
8
8
  * @property {boolean=} autoHiding=true Hide on blur or clicking outside of popup elements
9
9
  * @property {boolean=} hoverToShow=false Show popup when mouse is over the attached element.
10
10
  * @property {boolean=} autoClipping=true Clip popup element when there is not enough space to show popup
@@ -16,16 +16,17 @@ import { Dom } from './Dom.js';
16
16
  * @property {Popup=} popupChild=null Popup instance that will be hidden when its parent is hidden
17
17
  * @property {boolean=} uiBlocking=false To attach overlay to block user from interact with ui behind popup
18
18
  * @property {boolean=} hideOnScroll=true If disabled, popup will not be hidden when scrolling
19
+ * @property {Element=} zIndexReference=null Popup will be opened with zIndex greater than the given element
19
20
  */
20
21
 
21
22
  /** @typedef {string} Popup~Positioning
22
23
  * @description Available positioning type are: <br>
23
- * <b>under</b> - popup appears under the attached element (Default) <br>
24
- * <b>right</b> - popup appears on the right side of the attached element <br>
25
- * <b>over</b> - popup appears on the top left of the attached element (i.e. over the element) <br>
26
- * <b>center</b> - popup appears at the center of the screen. No element should be supplied <br>
27
- * <b>fixed</b> - popup appears without any positioning <br>
28
- * <b>custom</b> - popup appears without any positioning <br>
24
+ * <b>under</b> : Popup appears under the attached element (Default) <br>
25
+ * <b>right</b> : Popup appears on the right side of the attached element <br>
26
+ * <b>over</b> : Popup appears on the top left of the attached element (i.e. over the element) <br>
27
+ * <b>center</b>: Deprecated. Popup appears at the center of the screen. No element should be supplied <br>
28
+ * <b>fixed</b> : Popup appears without any positioning <br>
29
+ * <b>custom</b>: Popup appears without any positioning <br>
29
30
  *
30
31
  */
31
32
 
@@ -167,6 +168,10 @@ Popup.prototype._resizeTimer = 0;
167
168
  * @private
168
169
  */
169
170
  Popup.prototype._attachedElem = null;
171
+ /** @type {Element}
172
+ * @private
173
+ */
174
+ Popup.prototype._zIndexRef = null;
170
175
  /** @type {string}
171
176
  * @private
172
177
  */
@@ -178,7 +183,7 @@ Popup.prototype._focusElements;
178
183
  /** @type {Element}
179
184
  * @private
180
185
  */
181
- Popup.prototype._parentElement;
186
+ Popup.prototype._parentElement = null;
182
187
  /** @type {!Array.<Popup>}
183
188
  * @private
184
189
  */
@@ -238,7 +243,7 @@ Popup.prototype.dispose = function () {
238
243
  this._inDoc = false;
239
244
  Dom.removeParent(this._elem);
240
245
  Dom.removeParent(this._overlay);
241
- this._elem = null;
246
+ this._elem = this._parentElement = this._attachedElem = this._zIndexRef = null;
242
247
  };
243
248
  /** @public
244
249
  * @return {Element}
@@ -274,41 +279,53 @@ Popup.prototype.enable = function (opt_bool) {
274
279
  Popup.prototype.init = function (options) {
275
280
  if (!options) { return; }
276
281
 
277
- if (options["positioning"]) {
278
- this._positioning = /** @type{string} */(options["positioning"]);
282
+ let val = options["positioning"];
283
+ if (val) {
284
+ this._positioning = val;
279
285
  }
280
- if (options["autoHiding"] != null) {
281
- this._autoHiding = options["autoHiding"] ? true : false;
286
+ val = options["autoHiding"];
287
+ if (val != null) {
288
+ this._autoHiding = val ? true : false;
282
289
  }
283
- if (options["uiBlocking"] != null) {
284
- this.enableUIBlocking(options["uiBlocking"]);
290
+ val = options["uiBlocking"];
291
+ if (val != null) {
292
+ this.enableUIBlocking(val);
285
293
  }
286
- if (options["hoverToShow"] != null) {
287
- this._hoverToShow = options["hoverToShow"] ? true : false;
294
+ val = options["hoverToShow"];
295
+ if (val != null) {
296
+ this._hoverToShow = val ? true : false;
288
297
  }
289
- if (options["autoClipping"] != null) {
290
- this._autoClipping = options["autoClipping"] ? true : false;
298
+ val = options["autoClipping"];
299
+ if (val != null) {
300
+ this._autoClipping = val ? true : false;
291
301
  }
292
- if (options["attachedElement"] != null) {
293
- this.attachTo(options["attachedElement"]);
302
+ val = options["attachedElement"];
303
+ if (val !== undefined) { // eslint-disable-line
304
+ this.attachTo(val);
294
305
  }
295
- if (options["contentElement"] != null) {
296
- this.appendChild(options["contentElement"]);
306
+ val = options["contentElement"];
307
+ if (val instanceof Element) {
308
+ this.appendChild(val);
297
309
  }
298
- if (options["parentElement"] != null) {
299
- this.setParentElement(options["parentElement"]);
310
+ val = options["parentElement"];
311
+ if (val !== undefined) { // eslint-disable-line
312
+ this.setParentElement(val);
300
313
  }
301
-
302
- if (options["popupChild"] != null) {
303
- this.addPopupChild(options["popupChild"]);
314
+ val = options["popupChild"];
315
+ if (val) {
316
+ this.addPopupChild(val);
304
317
  }
305
-
306
- if (options["hideOnScroll"] == false) {
307
- this._hideOnScroll = false;
318
+ val = options["hideOnScroll"];
319
+ if (val != null) {
320
+ this._hideOnScroll = val ? true : false;
308
321
  }
309
-
310
- if (options["autoRepositioning"] == false) {
311
- this._autoRepositioning = false;
322
+ val = options["autoRepositioning"];
323
+ if (val != null) {
324
+ this._autoRepositioning = val ? true : false;
325
+ }
326
+ val = options["zIndexReference"];
327
+ if (val !== undefined) { // eslint-disable-line
328
+ this.setZIndexReference(val);
312
329
  }
313
330
 
314
331
  this.addListener(options, "show");
@@ -358,6 +375,13 @@ Popup.prototype.attachTo = function (elem, positioning) {
358
375
  };
359
376
  /** @public
360
377
  * @function
378
+ * @returns {Element}
379
+ */
380
+ Popup.prototype.getAttachedElement = function() {
381
+ return this._attachedElem;
382
+ };
383
+ /** @public
384
+ * @function
361
385
  * @param {Element} elem
362
386
  * @param {Popup~Positioning=} positioning
363
387
  */
@@ -417,12 +441,73 @@ Popup.prototype.setPopupGap = function (gap) {
417
441
  Popup.prototype.setParentElement = function (parentElement) {
418
442
  if (parentElement instanceof Element) {
419
443
  this._parentElement = parentElement;
420
- } else if (!this._parentElement) {
444
+ } else {
421
445
  this._parentElement = document.body;
422
446
  }
423
447
  return this._parentElement;
424
448
  };
425
449
 
450
+ /** @public
451
+ * @returns {Element}
452
+ */
453
+ Popup.prototype.getZIndexReference = function () {
454
+ return this._zIndexRef;
455
+ };
456
+ /** @public
457
+ * @param {Element} elem
458
+ */
459
+ Popup.prototype.setZIndexReference = function (elem) {
460
+ this._zIndexRef = elem || null;
461
+ };
462
+ /** @private
463
+ * @param {Element} elem
464
+ * @returns {number}
465
+ */
466
+ let _getComputedZIndex = function (elem) {
467
+ if(elem) {
468
+ try {
469
+ let comp = getComputedStyle(elem);
470
+ let zIndex = comp.getPropertyValue("z-index");
471
+ if(zIndex) {
472
+ return (+zIndex) || 0;
473
+ }
474
+ } catch(err) {}
475
+ }
476
+ return 0;
477
+ };
478
+ /** @private
479
+ * @param {Element} elem
480
+ * @returns {number}
481
+ */
482
+ let _getElementZIndex = function (elem) {
483
+ if(!elem) {
484
+ return 0;
485
+ }
486
+
487
+ let zIndex = _getComputedZIndex(elem);
488
+ if(elem.getRootNode) {
489
+ let rn = elem.getRootNode();
490
+ let host = rn ? rn.host : null;
491
+ if(host) {
492
+ let rnZIndex = _getComputedZIndex(host);
493
+ return zIndex >= rnZIndex ? zIndex : rnZIndex;
494
+ }
495
+ }
496
+ return zIndex;
497
+ };
498
+ /** @private
499
+ * @param {Element} elem
500
+ * @param {number} zIndex
501
+ */
502
+ let _setElementZIndex = function (elem, zIndex) {
503
+ if(elem) {
504
+ if(zIndex) {
505
+ elem.style.zIndex = zIndex + "";
506
+ } else if(elem.style.zIndex) {
507
+ elem.style.zIndex = "";
508
+ }
509
+ }
510
+ };
426
511
  /** @public
427
512
  * @param {boolean=} opt_shown
428
513
  * @param {Element=} parentElement
@@ -454,12 +539,27 @@ Popup.prototype.show = function (opt_shown, parentElement) {
454
539
 
455
540
  if (shown) {
456
541
  t._inDoc = true;
542
+
543
+ let zIndex = _getElementZIndex(parentElement);
457
544
  if (!(parentElement instanceof Element)) {
458
545
  parentElement = t._parentElement;
459
546
  }
460
547
  if (t._uiBlocking) {
461
548
  t._attachOverlay(parentElement);
462
549
  }
550
+ let aez = _getElementZIndex(t._attachedElem);
551
+ let rez = _getElementZIndex(t._zIndexRef);
552
+ if(zIndex < aez) {
553
+ zIndex = aez;
554
+ }
555
+ if(zIndex < rez) {
556
+ zIndex = rez;
557
+ }
558
+ if(zIndex) {
559
+ ++zIndex;
560
+ }
561
+ _setElementZIndex(t._elem, zIndex);
562
+ _setElementZIndex(t._overlay, zIndex);
463
563
 
464
564
  parentElement.appendChild(t._elem);
465
565
  parentElement.addEventListener("scroll", t._onScroll, true); // TODO: Remove the listener
@@ -1,6 +1,6 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
3
+ import {extendObject, injectCss, prettifyCss, isEmptyObject} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';