@refinitiv-ui/efx-grid 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.js +80 -18
  2. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  3. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  4. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  5. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  6. package/lib/core/dist/core.css +1 -1
  7. package/lib/core/dist/core.js +12961 -10749
  8. package/lib/core/dist/core.min.js +1 -1
  9. package/lib/core/es6/data/DataView.d.ts +22 -7
  10. package/lib/core/es6/data/DataView.js +176 -49
  11. package/lib/core/es6/data/WrappedView.d.ts +289 -0
  12. package/lib/core/es6/data/WrappedView.js +1319 -0
  13. package/lib/core/es6/grid/Core.d.ts +13 -0
  14. package/lib/core/es6/grid/Core.js +393 -155
  15. package/lib/core/es6/grid/ILayoutGrid.d.ts +8 -0
  16. package/lib/core/es6/grid/ILayoutGrid.js +45 -2
  17. package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
  18. package/lib/core/es6/grid/LayoutGrid.js +257 -82
  19. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
  20. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +314 -27
  21. package/lib/core/es6/grid/components/Column.js +8 -2
  22. package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
  23. package/lib/core/es6/grid/components/HScrollbar.js +20 -4
  24. package/lib/core/es6/grid/util/TrackLayout.d.ts +1 -1
  25. package/lib/core/es6/grid/util/TrackLayout.js +2 -3
  26. package/lib/core/es6/tr-grid-theme.js +1 -1
  27. package/lib/filter-dialog/lib/filter-dialog.js +8 -6
  28. package/lib/grid/lib/efx-grid.d.ts +14 -7
  29. package/lib/grid/lib/efx-grid.js +113 -114
  30. package/lib/grid/themes/base.less +4 -2
  31. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  32. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  33. package/lib/grid/themes/halo/efx-grid.less +69 -32
  34. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  35. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  36. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  37. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  38. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  39. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  40. package/lib/row-segmenting/es6/RowSegmenting.d.ts +1 -0
  41. package/lib/row-segmenting/es6/RowSegmenting.js +40 -11
  42. package/lib/rt-grid/dist/rt-grid.js +10290 -7864
  43. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  44. package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
  45. package/lib/rt-grid/es6/ColumnDefinition.js +3 -0
  46. package/lib/rt-grid/es6/Grid.d.ts +14 -7
  47. package/lib/rt-grid/es6/Grid.js +241 -74
  48. package/lib/rt-grid/es6/RowDefinition.d.ts +4 -1
  49. package/lib/rt-grid/es6/RowDefinition.js +52 -2
  50. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
  51. package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
  52. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
  53. package/lib/tr-grid-checkbox/es6/Checkbox.js +29 -14
  54. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  55. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
  56. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
  57. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +226 -4
  58. package/lib/tr-grid-column-stack/es6/ColumnStack.js +3 -0
  59. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -0
  60. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
  61. package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
  62. package/lib/tr-grid-row-dragging/es6/RowDragging.js +102 -12
  63. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
  64. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
  65. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +41 -31
  66. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +5 -1
  67. package/lib/tr-grid-row-selection/es6/RowSelection.js +188 -7
  68. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  69. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
  70. package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
  71. package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
  72. package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
  73. package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
  74. package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
  75. package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
  76. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
  77. package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
  78. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
  79. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
  80. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
  81. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
  82. package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
  83. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
  84. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +2 -2
  85. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  86. package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
  87. package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
  88. package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
  89. package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
  90. package/lib/tr-grid-util/es6/RowPainter.js +66 -12
  91. package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
  92. package/lib/tr-grid-util/es6/Table.d.ts +13 -13
  93. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
  94. package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
  95. package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
  96. package/lib/tr-grid-util/es6/Util.d.ts +6 -6
  97. package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
  98. package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
  99. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
  100. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
  101. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
  102. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
  103. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
  104. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
  105. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
  106. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
  107. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
  108. package/lib/types/es6/CellSelection.d.ts +1 -1
  109. package/lib/types/es6/Checkbox.d.ts +2 -0
  110. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  111. package/lib/types/es6/ColumnSelection.d.ts +5 -1
  112. package/lib/types/es6/Core/data/DataView.d.ts +22 -7
  113. package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
  114. package/lib/types/es6/Core/grid/Core.d.ts +13 -0
  115. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +8 -0
  116. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
  117. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
  118. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
  119. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +1 -1
  120. package/lib/types/es6/FilterInput.d.ts +4 -2
  121. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +4 -1
  122. package/lib/types/es6/RealtimeGrid/Grid.d.ts +15 -8
  123. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -1
  124. package/lib/types/es6/RowColoring.d.ts +2 -0
  125. package/lib/types/es6/RowFiltering.d.ts +2 -0
  126. package/lib/types/es6/RowSegmenting.d.ts +1 -0
  127. package/lib/types/es6/RowSelection.d.ts +5 -1
  128. package/lib/types/es6/Zoom.d.ts +2 -1
  129. package/lib/types/es6/index.d.ts +2 -0
  130. package/lib/versions.json +17 -17
  131. package/lib/zoom/es6/Zoom.d.ts +2 -1
  132. package/lib/zoom/es6/Zoom.js +11 -4
  133. package/package.json +7 -7
@@ -3,6 +3,8 @@ import { EventDispatcher } from '../../tr-grid-util/es6/EventDispatcher.js';
3
3
  import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
4
4
  import { isMac as isMacFn } from '../../tr-grid-util/es6/Util.js';
5
5
  import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
+ import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
7
+ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
8
  var isMac = isMacFn();
7
9
  /** Fired when selection is changed by mouse down or key press. A change by JavaScript APIs will not trigger this event.
8
10
  * @event RowSelectionPlugin#selectionChanged
@@ -25,6 +27,8 @@ var isMac = isMacFn();
25
27
  * @property {Function=} beforeSelection=null Handler executed before selection is made
26
28
  * @property {boolean=} basedOnContent=false Normally row selection will not move when data sorted, with this option turn on then selection will relocate strictly with row data.
27
29
  * @property {string=} selectionField=SELECTED_ROW Normally basedOnContent will set selection state in row data with field name "SELECTED_ROW" but you can change field name here.
30
+ * @property {Function=} menuClicked=null Event Handler when user clicks on menu icon.
31
+ * @property {string=} menuPosition="outside" show icon in column grid that have style outside and non-outside
28
32
  */
29
33
 
30
34
  /** @constructor
@@ -41,6 +45,9 @@ var RowSelectionPlugin = function (options) {
41
45
  t._onBeforeRowRemoved = t._onBeforeRowRemoved.bind(t);
42
46
  t._onReselection = t._onReselection.bind(t);
43
47
  t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
48
+ t._onThemeLoaded = t._onThemeLoaded.bind(t);
49
+ t._onRowPositionChanged = t._onRowPositionChanged.bind(t);
50
+ t._updateMenuIcon = t._updateMenuIcon.bind(t);
44
51
 
45
52
  t._hosts = [];
46
53
  t._anchorRowDict = {};
@@ -100,10 +107,26 @@ RowSelectionPlugin.prototype._isIE = false;
100
107
  * @private
101
108
  */
102
109
  RowSelectionPlugin.prototype._textRange = null;
110
+ /** @type {Function}
111
+ * @private
112
+ */
113
+ RowSelectionPlugin.prototype._onMenuClicked = null;
114
+ /** @type {Element}
115
+ * @private
116
+ */
117
+ RowSelectionPlugin.prototype._menuButton = null;
118
+ /** @type {string}
119
+ * @private
120
+ */
121
+ RowSelectionPlugin.prototype._menuPosition = "outside";
103
122
  /** @type {number}
104
123
  * @private
105
124
  */
106
125
  RowSelectionPlugin.prototype._timerId = 0;
126
+ /** @type {number}
127
+ * @private
128
+ */
129
+ RowSelectionPlugin.prototype._timerMenuId = 0;
107
130
  /** @type {(number|null)}
108
131
  * @private
109
132
  */
@@ -136,6 +159,7 @@ RowSelectionPlugin.prototype.initialize = function (host, options) {
136
159
  host.listen("click", this._onClick);
137
160
  host.listen("keydown", this._onKeyDown);
138
161
  host.listen("postSectionDataBinding", this._onPostSectionDataBinding);
162
+ host.listen("rowPositionChanged", this._onRowPositionChanged);
139
163
 
140
164
  var wrapper = this.getGridApi(host);
141
165
  if(wrapper) {
@@ -147,6 +171,59 @@ RowSelectionPlugin.prototype.initialize = function (host, options) {
147
171
  // host.listen("cut", this._onCopy);
148
172
 
149
173
  this.config(options);
174
+
175
+ if(this._onMenuClicked) { // use styles menu icon only when want to use icon menu
176
+ if(RowSelectionPlugin._stylePromise) {
177
+ RowSelectionPlugin._applyThemeColor(host);
178
+ } else {
179
+ RowSelectionPlugin._stylePromise = ElfUtil.getThemeColors();
180
+ RowSelectionPlugin._stylePromise.then(this._onThemeLoaded);
181
+ }
182
+ }
183
+
184
+ };
185
+
186
+ /** @private
187
+ * @param {Object} colors
188
+ */
189
+ RowSelectionPlugin.prototype._onThemeLoaded = function(colors) {
190
+ if(!RowSelectionPlugin._styles) {
191
+ var styles = [
192
+ ".row-selection-menu", [
193
+ "position: absolute;",
194
+ "background-color: var(--grid-column-menu-icon-bgcolor);",
195
+ "color: var(--grid-column-menu-icon-color);",
196
+ "z-index: 1;",
197
+ "cursor: pointer;",
198
+ "text-align: center;",
199
+ "width: 16px;",
200
+ "height: 16px;",
201
+ "padding: 6px;"
202
+ ],
203
+ ".row-selection-menu:hover", [
204
+ "background-color: var(--grid-column-menu-icon-hover-bgcolor);"
205
+ ],
206
+ ".row-selection-menu-inside", [
207
+ "padding: 4px;"
208
+ ]
209
+ ];
210
+ RowSelectionPlugin._styles = prettifyCss(styles);
211
+ }
212
+ for(var i = this._hosts.length; --i >= 0;) {
213
+ RowSelectionPlugin._applyThemeColor(this._hosts[i]);
214
+ }
215
+ };
216
+ /** @private
217
+ * @param {Object} grid core grid instance
218
+ */
219
+ RowSelectionPlugin._applyThemeColor = function(grid) {
220
+ if(!grid || grid._rowSelectionStyles) {
221
+ return;
222
+ }
223
+ if(RowSelectionPlugin._styles) {
224
+ grid._rowSelectionStyles = true; // Prevent loading the same style twice
225
+ injectCss(RowSelectionPlugin._styles, grid.getParent());
226
+ }
150
227
  };
151
228
  /** @public
152
229
  * @param {Object=} host core grid instance
@@ -161,12 +238,15 @@ RowSelectionPlugin.prototype.unload = function (host) {
161
238
  host.unlisten("click", this._onClick);
162
239
  host.unlisten("keydown", this._onKeyDown);
163
240
  host.unlisten("postSectionDataBinding", this._onPostSectionDataBinding);
241
+ host.unlisten("rowPositionChanged", this._onRowPositionChanged);
242
+
164
243
  this._hosts.splice(at, 1);
165
244
 
166
245
  if (!this._hosts.length) {
167
246
  if(this._timerId) {
168
247
  clearTimeout(this._timerId);
169
248
  this._timerId = 0;
249
+ this._timerMenuId = 0;
170
250
  this._pendingSelection = null;
171
251
  }
172
252
  }
@@ -197,6 +277,14 @@ RowSelectionPlugin.prototype.config = function (options) {
197
277
  if (pluginOptions["selectionField"]) {
198
278
  this._selectionField = pluginOptions["selectionField"];
199
279
  }
280
+ var val = pluginOptions["menuClicked"];
281
+ if(typeof val === "function"){
282
+ this._onMenuClicked = val;
283
+ }
284
+ val = pluginOptions["menuPosition"];
285
+ if(val) {
286
+ this._menuPosition = val;
287
+ }
200
288
  } else if (pluginOptions === "single") {
201
289
  this._singleSelMode = true;
202
290
  }
@@ -300,7 +388,7 @@ RowSelectionPlugin.prototype.getFirstSelectedIndex = function (sectRef) {
300
388
  var dv = this._activeGrid ? this._activeGrid.getDataSource() : null;
301
389
  if (!dv) return null;
302
390
 
303
- var rids = dv.getAllRowIds(true, true);
391
+ var rids = dv.getVisibleRowIds(true);
304
392
  var rows = dv.getMultipleRowData(rids);
305
393
  var count = rows.length;
306
394
  var dataRow;
@@ -328,7 +416,7 @@ RowSelectionPlugin.prototype.getLastSelectedIndex = function (sectRef) {
328
416
  var dv = this._activeGrid ? this._activeGrid.getDataSource() : null;
329
417
  if (!dv) return null;
330
418
 
331
- var rids = dv.getAllRowIds(true, true);
419
+ var rids = dv.getVisibleRowIds(true);
332
420
  var rows = dv.getMultipleRowData(rids);
333
421
  var count = rows.length;
334
422
  var dataRow;
@@ -357,7 +445,7 @@ RowSelectionPlugin.prototype.getSelectedRows = function (sectRef) {
357
445
  var dv = this._activeGrid ? this._activeGrid.getDataSource() : null;
358
446
  if (!dv) return null;
359
447
 
360
- var rids = dv.getAllRowIds(true, true);
448
+ var rids = dv.getVisibleRowIds(true);
361
449
  var rows = dv.getMultipleRowData(rids);
362
450
  var count = rows.length;
363
451
  var selectedRows = [];
@@ -385,7 +473,7 @@ RowSelectionPlugin.prototype.getSelectedRowIds = function (sectRef) {
385
473
  var selRows = this.getSelectedRows(sectRef);
386
474
  if (selRows) {
387
475
  var dv = this._activeGrid.getDataSource();
388
- var rowIds = dv.getAllRowIds(true, true);
476
+ var rowIds = dv.getVisibleRowIds(true);
389
477
  len = selRows.length;
390
478
  rids = new Array(len);
391
479
  for (i = 0; i < len; ++i) {
@@ -471,6 +559,7 @@ RowSelectionPlugin.prototype.selectAllRows = function (activeGrid) {
471
559
  }
472
560
  }
473
561
  }
562
+ this._updateMenuIcon();
474
563
  };
475
564
 
476
565
  /** @public
@@ -485,6 +574,7 @@ RowSelectionPlugin.prototype.selectRowRange = function (rowIndex, length, sectRe
485
574
  if (opt_scrollToRow) {
486
575
  this._scrollToRow(rowIndex);
487
576
  }
577
+ this._updateMenuIcon();
488
578
  };
489
579
 
490
580
  /** @public
@@ -516,6 +606,9 @@ RowSelectionPlugin.prototype._onClick = function (e) {
516
606
  var host = this.getRelativeGrid(e);
517
607
  this._clearPendingClickIndex(host);
518
608
 
609
+ if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
610
+ this._updateMenuIcon();
611
+ }
519
612
  this._dispatchSelectionChanged(e);
520
613
  }
521
614
  };
@@ -624,6 +717,9 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
624
717
  host.getParent().focus();
625
718
  }
626
719
  }
720
+ if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
721
+ this._updateMenuIcon();
722
+ }
627
723
 
628
724
  this._dispatchSelectionChanged(e, rowIndex, section);
629
725
  };
@@ -767,6 +863,20 @@ RowSelectionPlugin.prototype._onPostSectionDataBinding = function (e) {
767
863
  isSelect = dataRow ? dataRow[this._selectionField] : false;
768
864
  e.section.setSelectedRow(rowIndex, isSelect === true);
769
865
  }
866
+ this._updateMenuIcon();
867
+ };
868
+
869
+ /** @private
870
+ * @param {Object} e
871
+ */
872
+ RowSelectionPlugin.prototype._onRowPositionChanged = function (e) {
873
+ if(this._timerMenuId) {
874
+ return;
875
+ }
876
+ if(e.sender && e.sender === this._activeGrid) {
877
+ this._clearMenuIcon(); // Clear icon before re-renderer
878
+ this._timerMenuId = setTimeout(this._updateMenuIcon, 800);
879
+ }
770
880
  };
771
881
 
772
882
  /** Get text from selected cells. If no selection, return empty string. <br>
@@ -839,7 +949,7 @@ RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { //
839
949
  if (this._basedOnContent) {
840
950
  var dv = this._activeGrid.getDataSource();
841
951
  if (dv) {
842
- var rids = dv.getAllRowIds(true, true);
952
+ var rids = dv.getVisibleRowIds(true);
843
953
  var rows = dv.getMultipleRowData(rids);
844
954
  var valueList = [];
845
955
  var ridList = [];
@@ -875,6 +985,7 @@ RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { //
875
985
  this._anchorSection = null;
876
986
  }
877
987
  this._clearPendingClickIndex(this._activeGrid);
988
+ this._clearMenuIcon();
878
989
  }
879
990
  };
880
991
  /** @private
@@ -937,7 +1048,9 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
937
1048
  }
938
1049
 
939
1050
  this._scrollToRow(next);
940
-
1051
+ if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
1052
+ this._updateMenuIcon();
1053
+ }
941
1054
  this._dispatchSelectionChanged(e, next);
942
1055
  };
943
1056
  /** @private
@@ -975,7 +1088,7 @@ RowSelectionPlugin.prototype._sectionSelectRowRange = function (section, rowInde
975
1088
 
976
1089
  if (dv) {
977
1090
  var toRowIndex = rowIndex + length - 1;
978
- var rids = dv.getAllRowIds(true, true);
1091
+ var rids = dv.getVisibleRowIds(true);
979
1092
  var ridList = [];
980
1093
  var valueList = [];
981
1094
  for (var r = rowIndex; r <= toRowIndex; r++) {
@@ -1034,6 +1147,74 @@ RowSelectionPlugin.prototype._selectSingleRow = function (section, rowIndex) {
1034
1147
  return true;
1035
1148
  };
1036
1149
 
1150
+ /** @private
1151
+ * @return {boolean} return true if can added icon
1152
+ */
1153
+ RowSelectionPlugin.prototype._updateMenuIcon = function () {
1154
+ this._timerMenuId = 0;
1155
+ if(!this._onMenuClicked) {
1156
+ return false;
1157
+ }
1158
+ var host = this._activeGrid;
1159
+ var startRowIndex = this.getFirstSelectedIndex();
1160
+ if(startRowIndex == null || !host) { // have no selected rows
1161
+ return false;
1162
+ }
1163
+ var endRowIndex = this.getLastSelectedIndex();
1164
+ var parentEl = host.getParent().parentNode;
1165
+
1166
+ if(!this._menuButton) {
1167
+ this._menuButton = document.createElement("div");
1168
+ this._menuButton.classList.add("row-selection-menu");
1169
+ this._menuButton.addEventListener("click", this._onMenuClicked);
1170
+ var coralIcon = document.createElement("ef-icon");
1171
+ coralIcon.icon = "most-detail";
1172
+ this._menuButton.appendChild(coralIcon);
1173
+ }
1174
+
1175
+ parentEl.appendChild(this._menuButton);
1176
+
1177
+ var menuIconSize = 28; // Currently support 28 and 24 pixel only
1178
+ var rowRect = host.getRowRect(startRowIndex, endRowIndex);
1179
+
1180
+ if( rowRect.scrollViewSize <= rowRect.top || rowRect.height + rowRect.top <= 0) { // hide icon when have no selection in view both left and right
1181
+ this._clearMenuIcon();
1182
+ return false;
1183
+ }
1184
+
1185
+ var leftOffset = rowRect.left + rowRect.width;
1186
+ var topOffset = rowRect.top + rowRect.scrollViewTop;
1187
+ if(this._menuPosition !== "outside") {
1188
+ menuIconSize = 24;
1189
+ this._menuButton.classList.add("row-selection-menu-inside");
1190
+ leftOffset = rowRect.left + rowRect.width - menuIconSize;
1191
+ topOffset = rowRect.top + rowRect.scrollViewTop - menuIconSize;
1192
+
1193
+ if(rowRect.top < menuIconSize) {
1194
+ topOffset = rowRect.top + rowRect.scrollViewTop;
1195
+ }
1196
+
1197
+ } else {
1198
+ if(rowRect.top <= 0) {
1199
+ topOffset = rowRect.scrollViewTop;
1200
+ }
1201
+
1202
+ if(rowRect.top + menuIconSize >= rowRect.scrollViewSize) { // when move from top to bottom and try to set new position icon
1203
+ topOffset = rowRect.scrollViewSize;
1204
+ }
1205
+ }
1206
+
1207
+ this._menuButton.style.left = leftOffset + "px";
1208
+ this._menuButton.style.top = topOffset + "px";
1209
+ return true;
1210
+ };
1211
+
1212
+ /** @private */
1213
+ RowSelectionPlugin.prototype._clearMenuIcon = function () {
1214
+ if(this._menuButton && this._menuButton.parentNode) {
1215
+ this._menuButton.parentNode.removeChild(this._menuButton);
1216
+ }
1217
+ };
1037
1218
  /** @private
1038
1219
  * @param {number} rowIndex
1039
1220
  * @param {number} length
@@ -30,6 +30,8 @@ declare class RowColoringPlugin extends GridPlugin {
30
30
 
31
31
  public getConfigObject(gridOptions?: any): any;
32
32
 
33
+ public getRowConfigObject(rowId: string): any|null;
34
+
33
35
  public setRowColor(rowRef: string|number, bgColor?: (string|null), txtColor?: (string|null)): void;
34
36
 
35
37
  public getRowColor(rowRef: string|number): string;
@@ -231,6 +231,42 @@ RowColoringPlugin.prototype.getConfigObject = function (gridOptions) {
231
231
  return obj;
232
232
  };
233
233
  /** @public
234
+ * @param {string} rowId
235
+ * @return {Object|null} If this row doesn't contain a config object, return null.
236
+ */
237
+
238
+
239
+ RowColoringPlugin.prototype.getRowConfigObject = function (rowId) {
240
+ // TODO: Should be call a method for get data from dataTable in tr-grid-util instead of call direct in dataTable
241
+ var dv = this._getDataView();
242
+
243
+ if (!dv) {
244
+ return null;
245
+ }
246
+
247
+ var dt = dv.getDataSource();
248
+
249
+ if (!dt) {
250
+ return null;
251
+ }
252
+
253
+ var rowData = this._rowGetter(dt.getRowData(rowId)); // get data from dataTable
254
+
255
+
256
+ if (!rowData) {
257
+ return null;
258
+ }
259
+
260
+ var obj = {}; // Only css field for predefine user color classes are currently supported
261
+
262
+ if (rowData[this._cssField]) {
263
+ obj[this._cssField] = rowData[this._cssField];
264
+ return obj;
265
+ }
266
+
267
+ return null;
268
+ };
269
+ /** @public
234
270
  * @param {string|number} rowRef Row id in the data table or row index
235
271
  * @param {(string|null)=} bgColor
236
272
  * @param {(string|null)=} txtColor
@@ -44,9 +44,9 @@ declare class CellPainter {
44
44
 
45
45
  constructor();
46
46
 
47
- public static readonly themeReady: Promise<any>;
47
+ public static readonly themeReady: Promise<any>|null;
48
48
 
49
- public static parse(expression: string|((...params: any[]) => any)): ((...params: any[]) => any);
49
+ public static parse(expression: string|((...params: any[]) => any)): ((...params: any[]) => any)|null;
50
50
 
51
51
  public dispose(): void;
52
52
 
@@ -64,9 +64,9 @@ declare class CellPainter {
64
64
 
65
65
  public applyThemeColor(): void;
66
66
 
67
- public getConditions(): (any)[];
67
+ public getConditions(): (any)[]|null;
68
68
 
69
- public getColoringType(): CellPainter.ColoringTypes;
69
+ public getColoringType(): CellPainter.ColoringTypes|null;
70
70
 
71
71
  public setConditions(conditions: (CellPainter.Condition)[]): void;
72
72
 
@@ -96,7 +96,7 @@ declare class CellPainter {
96
96
 
97
97
  public renderForPrinting(cell: Element, rowData: any, min: number, max: number): void;
98
98
 
99
- public static blendColor(baseColor: string, maxColor: string, ratio: number): (number)[];
99
+ public static blendColor(baseColor: string, maxColor: string, ratio: number): (number)[]|null;
100
100
 
101
101
  public static rgb2Hex(rgbCode: string): string;
102
102
 
@@ -104,15 +104,15 @@ declare class CellPainter {
104
104
 
105
105
  public static num2Rgb(triplet: (number)[]): string;
106
106
 
107
- public static hex2Num(hex: string): (number)[];
107
+ public static hex2Num(hex: string): (number)[]|null;
108
108
 
109
109
  public static hex2Rgb(hex: string): string;
110
110
 
111
111
  public static setThemeColors(): void;
112
112
 
113
- public static loadThemeColors(): Promise<any>;
113
+ public static loadThemeColors(): Promise<any>|null;
114
114
 
115
- public static reloadThemeColors(): Promise<any>;
115
+ public static reloadThemeColors(): Promise<any>|null;
116
116
 
117
117
  public static getOppositeColor(hexCode: string|(number)[]): string;
118
118
 
@@ -4,9 +4,9 @@ declare class Conflator {
4
4
 
5
5
  constructor(func?: (((...params: any[]) => any)|number), ms?: (number|((...params: any[]) => any)), thisObj?: any);
6
6
 
7
- public reset(): any[];
7
+ public reset(): any[]|null;
8
8
 
9
- public popAllData(): any[];
9
+ public popAllData(): any[]|null;
10
10
 
11
11
  public dispose(): void;
12
12
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  declare namespace CoralItems {
4
4
 
5
- function create(userItems: any[]): (any)[];
5
+ function create(userItems: any[]): (any)[]|null;
6
6
 
7
7
  }
8
8
 
@@ -41,13 +41,13 @@ declare const SECONDS_IN_HOUR: number;
41
41
 
42
42
  declare const SECONDS_IN_MINUTE: number;
43
43
 
44
- declare const SHORT_DAYS: (string)[];
44
+ declare const SHORT_DAYS: (string)[]|null;
45
45
 
46
- declare const FULL_DAYS: (string)[];
46
+ declare const FULL_DAYS: (string)[]|null;
47
47
 
48
- declare const SHORT_MONTHS: (string)[];
48
+ declare const SHORT_MONTHS: (string)[]|null;
49
49
 
50
- declare const FULL_MONTHS: (string)[];
50
+ declare const FULL_MONTHS: (string)[]|null;
51
51
 
52
52
  declare function prefixZero(num: number): string;
53
53
 
@@ -6,7 +6,7 @@ declare class Delay {
6
6
 
7
7
  public static readonly promise: Promise<any>;
8
8
 
9
- public static for(ms?: number, ctx?: any): Delay;
9
+ public static for(ms?: number, ctx?: any): Delay|null;
10
10
 
11
11
  public resolve(): void;
12
12
 
@@ -8,9 +8,9 @@ declare namespace Dom {
8
8
 
9
9
  function text(textContent?: string, className?: string): Element;
10
10
 
11
- function appendChild(parentElem: Element, children: Node|any[]): Element;
11
+ function appendChild(parentElem: Element, children: Node|any[]): Element|null;
12
12
 
13
- function buildTree(parentElem: Element, children: Node|any[]): Element;
13
+ function buildTree(parentElem: Element, children: Node|any[]): Element|null;
14
14
 
15
15
  function setContent(elem: Element, val: any): void;
16
16
 
@@ -22,9 +22,9 @@ declare namespace Dom {
22
22
 
23
23
  function getRelativePosition(A: Element|Event|MouseEvent, B: Element|Event|MouseEvent, retObj?: any): any;
24
24
 
25
- function closestElement(elem: Element|Node|undefined, classStr: string): Element;
25
+ function closestElement(elem: Element|Node|undefined, classStr: string): Element|null;
26
26
 
27
- function closestTagName(elem: Element|Node|undefined, tn: string): Element;
27
+ function closestTagName(elem: Element|Node|undefined, tn: string): Element|null;
28
28
 
29
29
  }
30
30
 
@@ -5,7 +5,7 @@ declare class ElementWrapper extends EventDispatcher {
5
5
 
6
6
  constructor();
7
7
 
8
- public getElement(): Element;
8
+ public getElement(): Element|null;
9
9
 
10
10
  public setParent(parent: Node|ElementWrapper): void;
11
11
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  declare namespace ElfDate {
4
4
 
5
- function from(val: any): Date;
5
+ function from(val: any): Date|null;
6
6
 
7
7
  function isValid(d: Date): boolean;
8
8
 
@@ -12,13 +12,13 @@ declare namespace ElfDate {
12
12
 
13
13
  function setDate(edtp: Element, val: any): void;
14
14
 
15
- function getDate(edtp: Element): Date;
15
+ function getDate(edtp: Element): Date|null;
16
16
 
17
17
  function compare(valA: any, valB: any): number;
18
18
 
19
19
  function equal(valA: any, valB: any): boolean;
20
20
 
21
- function extractDate(d: Date): (number)[];
21
+ function extractDate(d: Date): (number)[]|null;
22
22
 
23
23
  }
24
24
 
@@ -3,9 +3,9 @@ import { Deferred } from "./Deferred.js";
3
3
 
4
4
  declare namespace ElfUtil {
5
5
 
6
- const themeReady: Promise<any>;
6
+ const themeReady: Promise<any>|null;
7
7
 
8
- const themeColors: { [key: string]: string };
8
+ const themeColors: { [key: string]: string }|null;
9
9
 
10
10
  function getElfVersion(): number;
11
11
 
@@ -21,9 +21,9 @@ declare namespace ElfUtil {
21
21
 
22
22
  function getIconList(): (string)[];
23
23
 
24
- function prepareIconPreloading(): (string)[];
24
+ function prepareIconPreloading(): (string)[]|null;
25
25
 
26
- function getThemeColors(): Promise<any>;
26
+ function getThemeColors(): Promise<any>|null;
27
27
 
28
28
  function getMovementColorProfile(): string;
29
29
 
@@ -12,7 +12,7 @@ declare class EventDispatcher {
12
12
 
13
13
  public hasListener(type: string): boolean;
14
14
 
15
- public getListener(type: string, idx?: number): ((...params: any[]) => any);
15
+ public getListener(type: string, idx?: number): ((...params: any[]) => any)|null;
16
16
 
17
17
  public addListener(obj: any, type: string): void;
18
18
 
@@ -25,7 +25,7 @@ declare class FieldFormatter {
25
25
 
26
26
  public getField(): string;
27
27
 
28
- public clone(): FieldFormatter;
28
+ public clone(): FieldFormatter|null;
29
29
 
30
30
  public setFormatType(type: string): void;
31
31
 
@@ -32,17 +32,17 @@ declare class FilterBuilder {
32
32
 
33
33
  public addConditions(conditions: FilterBuilder.Conditions): number;
34
34
 
35
- public getConditions(): FilterBuilder.Conditions;
35
+ public getConditions(): FilterBuilder.Conditions|null;
36
36
 
37
- public buildFilter(): ((...params: any[]) => any);
37
+ public buildFilter(): ((...params: any[]) => any)|null;
38
38
 
39
- public buildMonitorFilter(filterStr: string, field: string, formatter?: ((...params: any[]) => any), formattedField?: string): ((...params: any[]) => any);
39
+ public buildMonitorFilter(filterStr: string, field: string, formatter?: ((...params: any[]) => any), formattedField?: string): ((...params: any[]) => any)|null;
40
40
 
41
- public parse(condition: any, field?: string, formatter?: ((...params: any[]) => any), formattedField?: string, rawDataAccessor?: ((...params: any[]) => any), formattedDataAccessor?: ((...params: any[]) => any)): ((...params: any[]) => any);
41
+ public parse(condition: any, field?: string, formatter?: ((...params: any[]) => any), formattedField?: string, rawDataAccessor?: ((...params: any[]) => any), formattedDataAccessor?: ((...params: any[]) => any)): ((...params: any[]) => any)|null;
42
42
 
43
43
  }
44
44
 
45
- declare function buildFilterFromObjectMap(obj: any, field: string, rawDataAccessor?: ((...params: any[]) => any)): ((...params: any[]) => any);
45
+ declare function buildFilterFromObjectMap(obj: any, field: string, rawDataAccessor?: ((...params: any[]) => any)): ((...params: any[]) => any)|null;
46
46
 
47
47
  export default FilterBuilder;
48
48
  export { FilterBuilder, buildFilterFromObjectMap };
@@ -20,7 +20,7 @@ declare class GridPlugin extends EventDispatcher {
20
20
 
21
21
  public unload(host?: any): void;
22
22
 
23
- public getRelativeGrid(e: Event|Element|any): any;
23
+ public getRelativeGrid(e: Event|Element|any): any|null;
24
24
 
25
25
  public setGridWrapper(gridType: string, wrapperInstance: any): void;
26
26
 
@@ -30,13 +30,13 @@ declare class GridPlugin extends EventDispatcher {
30
30
 
31
31
  public getColumnIndex(colId: number|string): number;
32
32
 
33
- public getColumnIndices(colRefs: (number|string)[]): (number)[];
33
+ public getColumnIndices(colRefs: (number|string)[]): (number)[]|null;
34
34
 
35
35
  public getColumnId(colIndex: number|string): string;
36
36
 
37
37
  public getColumnCount(): number;
38
38
 
39
- public static requestPlugin(ref: any, pluginRef: any, configObj?: any, compositeGrid?: any, realTimeGrid?: any): Promise<any>;
39
+ public static requestPlugin(ref: any, pluginRef: any, configObj?: any, compositeGrid?: any, realTimeGrid?: any): Promise<any>|null;
40
40
 
41
41
  }
42
42
 
@@ -22,7 +22,7 @@ declare class MouseDownTrait extends EventDispatcher {
22
22
 
23
23
  public enable(opt_bool?: boolean): void;
24
24
 
25
- public getElement(): Element;
25
+ public getElement(): Element|null;
26
26
 
27
27
  public setElement(elem?: Element): void;
28
28