@refinitiv-ui/efx-grid 6.0.2 → 6.0.5

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 (203) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.d.ts +49 -0
  2. package/lib/column-dragging/es6/ColumnDragging.js +764 -0
  3. package/lib/column-dragging/es6/index.d.ts +1 -0
  4. package/lib/column-dragging/es6/index.js +1 -0
  5. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +13 -1
  6. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +15 -2
  7. package/lib/column-selection-dialog/lib/column-selection-dialog.js +146 -5
  8. package/lib/core/dist/core.css +1 -1
  9. package/lib/core/dist/core.js +468 -1092
  10. package/lib/core/dist/core.min.js +1 -1
  11. package/lib/core/es6/data/ColumnStats.d.ts +2 -2
  12. package/lib/core/es6/data/DataCache.d.ts +4 -4
  13. package/lib/core/es6/data/DataTable.d.ts +5 -5
  14. package/lib/core/es6/data/DataTable.js +33 -11
  15. package/lib/core/es6/data/DataView.d.ts +12 -18
  16. package/lib/core/es6/data/DataView.js +0 -4
  17. package/lib/core/es6/data/Segment.d.ts +2 -0
  18. package/lib/core/es6/data/Segment.js +7 -0
  19. package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
  20. package/lib/core/es6/data/WrappedView.d.ts +13 -13
  21. package/lib/core/es6/data/WrappedView.js +6 -6
  22. package/lib/core/es6/grid/Core.d.ts +31 -27
  23. package/lib/core/es6/grid/Core.js +47 -11
  24. package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
  25. package/lib/core/es6/grid/LayoutGrid.js +54 -26
  26. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +71 -0
  27. package/lib/core/es6/grid/components/Cell.d.ts +4 -4
  28. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
  29. package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
  30. package/lib/core/es6/grid/components/Column.d.ts +1 -1
  31. package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
  32. package/lib/core/es6/grid/components/Scrollbar.d.ts +3 -1
  33. package/lib/core/es6/grid/components/Scrollbar.js +13 -0
  34. package/lib/core/es6/grid/components/StretchedCells.js +2 -2
  35. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  36. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
  37. package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
  38. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
  39. package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
  40. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
  41. package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
  42. package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
  43. package/lib/core/es6/grid/util/SectionSettings.js +5 -0
  44. package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
  45. package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
  46. package/lib/core/es6/grid/util/TrackLayout.js +27 -0
  47. package/lib/core/es6/grid/util/util.d.ts +2 -2
  48. package/lib/core/es6/index.d.ts +1 -5
  49. package/lib/core/es6/index.js +1 -7
  50. package/lib/core/es6/tr-grid-theme.js +1 -1
  51. package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
  52. package/lib/filter-dialog/lib/filter-dialog.d.ts +14 -1
  53. package/lib/filter-dialog/lib/filter-dialog.js +86 -26
  54. package/lib/filter-dialog/themes/base-checkbox.less +8 -1
  55. package/lib/filter-dialog/themes/base.less +69 -1
  56. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  57. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  58. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  59. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  60. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  61. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  62. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  63. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  64. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  65. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  66. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  67. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  68. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  69. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  70. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  71. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  72. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  73. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  74. package/lib/grid/lib/efx-grid.d.ts +25 -10
  75. package/lib/grid/lib/efx-grid.js +22 -56
  76. package/lib/grid/themes/base.less +1 -1
  77. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  78. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  79. package/lib/grid/themes/halo/efx-grid.less +33 -39
  80. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  81. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  82. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  83. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  84. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  85. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  86. package/lib/index.d.ts +2 -0
  87. package/lib/index.js +2 -0
  88. package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
  89. package/lib/row-segmenting/es6/RowSegmenting.js +98 -11
  90. package/lib/rt-grid/dist/rt-grid.js +1244 -1249
  91. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  92. package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
  93. package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
  94. package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
  95. package/lib/rt-grid/es6/Grid.d.ts +24 -9
  96. package/lib/rt-grid/es6/Grid.js +285 -103
  97. package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
  98. package/lib/rt-grid/es6/RowDefSorter.js +137 -0
  99. package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
  100. package/lib/rt-grid/es6/RowDefinition.js +6 -0
  101. package/lib/rt-grid/es6/SnapshotFiller.d.ts +6 -1
  102. package/lib/rt-grid/es6/SnapshotFiller.js +144 -15
  103. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +4 -3
  104. package/lib/tr-grid-checkbox/es6/Checkbox.js +51 -21
  105. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
  106. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
  107. package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
  108. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +4 -3
  109. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +28 -13
  110. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +8 -5
  111. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +106 -3
  112. package/lib/tr-grid-percent-bar/es6/PercentBar.js +1 -1
  113. package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
  114. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
  115. package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
  116. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
  117. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
  118. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +3 -4
  119. package/lib/tr-grid-row-dragging/es6/RowDragging.js +86 -195
  120. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
  121. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
  122. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +8 -8
  123. package/lib/tr-grid-row-selection/es6/RowSelection.js +55 -31
  124. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
  125. package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
  126. package/lib/tr-grid-util/es6/CellPainter.js +1 -1
  127. package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
  128. package/lib/tr-grid-util/es6/DragUI.js +214 -0
  129. package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
  130. package/lib/tr-grid-util/es6/ElementObserver.js +32 -2
  131. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -1
  132. package/lib/tr-grid-util/es6/ElfUtil.js +131 -28
  133. package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
  134. package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
  135. package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
  136. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +8 -0
  137. package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
  138. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
  139. package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
  140. package/lib/tr-grid-util/es6/RowPainter.js +57 -19
  141. package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
  142. package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
  143. package/lib/types/es6/Checkbox.d.ts +4 -3
  144. package/lib/types/es6/ColumnStack.d.ts +8 -4
  145. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
  146. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
  147. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
  148. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
  149. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
  150. package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
  151. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
  152. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
  153. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
  154. package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
  155. package/lib/types/es6/ConditionalColoring.d.ts +4 -3
  156. package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
  157. package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
  158. package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
  159. package/lib/types/es6/Core/data/DataView.d.ts +12 -18
  160. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  161. package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
  162. package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
  163. package/lib/types/es6/Core/grid/Core.d.ts +31 -27
  164. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
  165. package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
  166. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
  167. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
  168. package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
  169. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
  170. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +3 -1
  171. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  172. package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
  173. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
  174. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
  175. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
  176. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
  177. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
  178. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
  179. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
  180. package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
  181. package/lib/types/es6/Core/index.d.ts +1 -5
  182. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  183. package/lib/types/es6/InCellEditing.d.ts +8 -5
  184. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
  185. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
  186. package/lib/types/es6/RealtimeGrid/Grid.d.ts +24 -9
  187. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
  188. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
  189. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +6 -1
  190. package/lib/types/es6/RowDragging.d.ts +3 -4
  191. package/lib/types/es6/RowGrouping.d.ts +7 -2
  192. package/lib/types/es6/RowSegmenting.d.ts +7 -2
  193. package/lib/types/es6/RowSelection.d.ts +8 -8
  194. package/lib/types/es6/TextFormatting.d.ts +1 -1
  195. package/lib/types/es6/index.d.ts +1 -0
  196. package/lib/versions.json +17 -16
  197. package/package.json +1 -1
  198. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  199. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
  200. package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
  201. package/lib/core/es6/grid/plugins/Plugin.js +0 -272
  202. package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  203. package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -1,7 +1,7 @@
1
- import { Ext } from '../../tr-grid-util/es6/Ext.js';
2
- import { EventDispatcher } from '../../tr-grid-util/es6/EventDispatcher.js';
3
- import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
4
- import { isMac as isMacFn } from '../../tr-grid-util/es6/Util.js';
1
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
3
+ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
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
6
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
7
7
  import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
@@ -50,7 +50,6 @@ var RowSelectionPlugin = function (options) {
50
50
  t._updateMenuIcon = t._updateMenuIcon.bind(t);
51
51
 
52
52
  t._hosts = [];
53
- t._anchorRowDict = {};
54
53
  t._isIE = isIE();
55
54
  t._textRange = document.createRange();
56
55
 
@@ -94,11 +93,11 @@ RowSelectionPlugin.prototype._basedOnContent = false;
94
93
  * @private
95
94
  */
96
95
  RowSelectionPlugin.prototype._selectionField = "SELECTED_ROW";
97
- /** @type {Object}
96
+ /** @type {string}
98
97
  * @private
99
98
  * @description use with _basedOnContent mode for tracking current anchor row
100
99
  */
101
- RowSelectionPlugin.prototype._anchorRowDict = null;
100
+ RowSelectionPlugin.prototype._anchorRowId = "";
102
101
  /** @type {boolean}
103
102
  * @private
104
103
  */
@@ -367,13 +366,18 @@ RowSelectionPlugin.prototype.getActiveGrid = function () {
367
366
  * @return {number} rowIndex of anchor
368
367
  */
369
368
  RowSelectionPlugin.prototype.getRowAnchor = function (sectRef) {
370
- var section = this._getSection(sectRef);
371
- if (!section || !section.getRowAnchor) return -1;
372
369
  if (this._basedOnContent) {
373
- return this._anchorRowDict[section] || -1;
370
+ var dv = this._activeGrid ? this._activeGrid.getDataSource() : null;
371
+ if( dv && this._anchorRowId){
372
+ return dv.getRowIndex(this._anchorRowId);
373
+ }
374
374
  } else {
375
- return section.getRowAnchor();
375
+ var section = this._getSection(sectRef);
376
+ if (section && section.getRowAnchor){
377
+ return section.getRowAnchor();
378
+ }
376
379
  }
380
+ return -1;
377
381
  };
378
382
 
379
383
  /** @public
@@ -393,7 +397,7 @@ RowSelectionPlugin.prototype.getFirstSelectedIndex = function (sectRef) {
393
397
  var count = rows.length;
394
398
  var dataRow;
395
399
  for (var rowIndex = 0; rowIndex < count; rowIndex++) {
396
- dataRow = this._getRowData(rows[rowIndex]);
400
+ dataRow = this._rowGetter(rows[rowIndex]);
397
401
  if (dataRow && dataRow[this._selectionField]) {
398
402
  return rowIndex;
399
403
  }
@@ -421,7 +425,7 @@ RowSelectionPlugin.prototype.getLastSelectedIndex = function (sectRef) {
421
425
  var count = rows.length;
422
426
  var dataRow;
423
427
  for (var rowIndex = count - 1; rowIndex >= 0; rowIndex--) {
424
- dataRow = this._getRowData(rows[rowIndex]);
428
+ dataRow = this._rowGetter(rows[rowIndex]);
425
429
  if (dataRow && dataRow[this._selectionField]) {
426
430
  return rowIndex;
427
431
  }
@@ -451,7 +455,7 @@ RowSelectionPlugin.prototype.getSelectedRows = function (sectRef) {
451
455
  var selectedRows = [];
452
456
  var dataRow;
453
457
  for (var rowIndex = 0; rowIndex < count; rowIndex++) {
454
- dataRow = this._getRowData(rows[rowIndex]);
458
+ dataRow = this._rowGetter(rows[rowIndex]);
455
459
  if (dataRow && dataRow[this._selectionField]) {
456
460
  selectedRows.push(rowIndex);
457
461
  }
@@ -611,6 +615,9 @@ RowSelectionPlugin.prototype._onClick = function (e) {
611
615
  }
612
616
  this._dispatchSelectionChanged(e);
613
617
  }
618
+ if(this._activeGrid != null){
619
+ this._activeGrid.focus();
620
+ }
614
621
  };
615
622
  /** @private
616
623
  * @description Left click will cause single row selection <br>
@@ -643,8 +650,8 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
643
650
  if (!ctx["hit"] || ctx["sectionType"] !== "content") { return; }
644
651
  if (e.button === 2) { // Right click at the selected column should override clicking row to select;
645
652
  var csp = this._getPlugin("ColumnSelectionPlugin");
646
- if (csp && csp['isEnabled']()) {
647
- if (csp['isSelectedColumn'](ctx["colIndex"])) {
653
+ if (csp && csp["isEnabled"]()) {
654
+ if (csp["isSelectedColumn"](ctx["colIndex"])) {
648
655
  return;
649
656
  }
650
657
  }
@@ -740,7 +747,7 @@ RowSelectionPlugin.prototype._onMouseMove = function (e) {
740
747
  */
741
748
  RowSelectionPlugin.prototype._setPendingClickIndex = function (rowIndex, host) {
742
749
  this._pendingClickIndex = rowIndex;
743
- host && host.listen('mousemove', this._onMouseMove);
750
+ host && host.listen("mousemove", this._onMouseMove);
744
751
  };
745
752
 
746
753
  /** To clear _pendingClickIndex
@@ -749,7 +756,7 @@ RowSelectionPlugin.prototype._setPendingClickIndex = function (rowIndex, host) {
749
756
  */
750
757
  RowSelectionPlugin.prototype._clearPendingClickIndex = function (host) {
751
758
  this._pendingClickIndex = -1;
752
- host && host.unlisten('mousemove', this._onMouseMove);
759
+ host && host.unlisten("mousemove", this._onMouseMove);
753
760
  };
754
761
 
755
762
 
@@ -853,15 +860,25 @@ RowSelectionPlugin.prototype._onCopy = function (e) {
853
860
  */
854
861
  RowSelectionPlugin.prototype._onPostSectionDataBinding = function (e) {
855
862
  if (!this._basedOnContent
856
- || 'content' !== e.sectionType
863
+ || "content" !== e.sectionType
857
864
  || !this._activeGrid) {
858
865
  return;
859
866
  }
860
- var dataRow, isSelect;
861
- for (var rowIndex = e.fromRowIndex; rowIndex < e.toRowIndex; rowIndex++) {
862
- dataRow = this._getRowData(e.dataRows[rowIndex]);
863
- isSelect = dataRow ? dataRow[this._selectionField] : false;
864
- e.section.setSelectedRow(rowIndex, isSelect === true);
867
+ var section = e.section;
868
+ var dv = e.dataSource;
869
+
870
+ var field = this._selectionField;
871
+ section.clearSelectedRows();
872
+
873
+ var fromR = section.getFirstIndexInView();
874
+ var toR = section.getLastIndexInView();
875
+ for (var r = fromR; r <= toR; ++r) {
876
+ var dataRow = this._rowGetter(dv.getRowDataAt(r));
877
+ if(dataRow) {
878
+ if(dataRow[field]) {
879
+ section.setSelectedRow(r, true);
880
+ }
881
+ }
865
882
  }
866
883
  this._updateMenuIcon();
867
884
  };
@@ -956,7 +973,7 @@ RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { //
956
973
  var dataRow, firstIndex;
957
974
  var len = rows.length;
958
975
  for (i = 0; i < len; i++) {
959
- dataRow = this._getRowData(rows[i]);
976
+ dataRow = this._rowGetter(rows[i]);
960
977
  if (dataRow && dataRow[this._selectionField]) {
961
978
  valueList.push(false);
962
979
  ridList.push(rids[i]);
@@ -999,6 +1016,10 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
999
1016
 
1000
1017
  if (!this._anchorSection) { return; }
1001
1018
 
1019
+ if(this._activeGrid != null){
1020
+ this._activeGrid.focus();
1021
+ }
1022
+
1002
1023
  var shiftKey = e.shiftKey;
1003
1024
  var next = 0;
1004
1025
  var rowLimit = this._anchorSection.getRowCount() - 1;
@@ -1024,8 +1045,8 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
1024
1045
  }
1025
1046
  if (next < 0) {
1026
1047
  var csp = this._getPlugin("ColumnSelectionPlugin");
1027
- if (!shiftKey && csp && csp['isEnabled']()) {
1028
- csp['selectSingleColumn'](null, this._activeGrid);
1048
+ if (!shiftKey && csp && csp["isEnabled"]()) {
1049
+ csp["selectSingleColumn"](null, this._activeGrid);
1029
1050
 
1030
1051
  this.clearAllSelections();
1031
1052
  return;
@@ -1067,7 +1088,7 @@ RowSelectionPlugin.prototype._sectionSetSelectedRow = function (section, rowInde
1067
1088
  var dataRow = this._getRow(dv, rowIndex);
1068
1089
  if (dataRow) {
1069
1090
  this._setData(dv, rowIndex, this._selectionField, isSelect);
1070
- if (isSelect) this._anchorRowDict[section] = rowIndex;
1091
+ if (isSelect) this._anchorRowId = dv.getRowId(rowIndex);
1071
1092
  }
1072
1093
  }
1073
1094
  } else {
@@ -1125,7 +1146,7 @@ RowSelectionPlugin.prototype._sectionClearSelectedRows = function (section, pres
1125
1146
  }
1126
1147
  }
1127
1148
  if (!preserveAnchor) {
1128
- this._anchorRowDict[section] = -1;
1149
+ this._anchorRowId = "";
1129
1150
  }
1130
1151
  } else {
1131
1152
  section.clearSelectedRows();
@@ -1312,6 +1333,9 @@ RowSelectionPlugin.prototype._gotoGrid = function (gridIndex) {
1312
1333
  var sectionIndex = this._anchorSection.getIndex();
1313
1334
  this.clearSelectedRows(); // Clear all current grid's selections
1314
1335
  this.selectSingleRow(anchorRow, sectionIndex, this._hosts[gridIndex]); // go to the next grid at the first column
1336
+ if(this._activeGrid != null){
1337
+ this._activeGrid.focus();
1338
+ }
1315
1339
  };
1316
1340
 
1317
1341
  /** @private
@@ -1353,8 +1377,8 @@ RowSelectionPlugin.prototype._dispatchBeforeSelection = function (e, ctx) {
1353
1377
  RowSelectionPlugin.prototype._dispatchSelectionChanged = function (e, rowIndex, section) {
1354
1378
  if (this._activeGrid) {
1355
1379
  var csp = this._getPlugin("ColumnSelectionPlugin");
1356
- if (csp && csp['isEnabled']()) {
1357
- csp['clearSelection']();
1380
+ if (csp && csp["isEnabled"]()) {
1381
+ csp["clearSelection"]();
1358
1382
  }
1359
1383
  var cep = this._getPlugin("CellEditingPlugin");
1360
1384
  if (cep) {
@@ -65,7 +65,7 @@ declare class TextFormattingPlugin extends GridPlugin {
65
65
 
66
66
  public getColumnFormatOptions(colIndex: number, options?: any): any;
67
67
 
68
- public getFormatter(colIndex: number): FieldFormatter;
68
+ public getFormatter(colIndex: number): FieldFormatter|null;
69
69
 
70
70
  public formatText(colIndex: number, obj: any): string;
71
71
 
@@ -122,6 +122,18 @@ TextFormattingPlugin.prototype.initialize = function (host, options) {
122
122
  this.config(options);
123
123
  }
124
124
  };
125
+ /** @override
126
+ */
127
+
128
+
129
+ TextFormattingPlugin.prototype._afterInit = function () {
130
+ // WOWRKAROUND : In test-resource and tr-grid-util, avoid using static variables. duplicating DateTime
131
+ var rtGrid = this._realTimeGrid;
132
+
133
+ if (rtGrid && rtGrid.setDateTimeUtil) {
134
+ rtGrid.setDateTimeUtil(DateTime);
135
+ }
136
+ };
125
137
  /** @public
126
138
  * @param {Object} host core grid instance
127
139
  */
@@ -840,7 +840,7 @@ CellPainter._onThemeChanged = function(colors) {
840
840
  */
841
841
  CellPainter.loadThemeColors = function() {
842
842
  if(!CellPainter.themeReady) {
843
- CellPainter.themeReady = ElfUtil.getThemeColors().then(CellPainter._onThemeChanged);
843
+ CellPainter.themeReady = ElfUtil.getThemeColors(CellPainter._onThemeChanged).then(CellPainter._onThemeChanged);
844
844
  }
845
845
  return CellPainter.themeReady;
846
846
  };
@@ -0,0 +1,16 @@
1
+ import { injectCss, prettifyCss } from "./Util.js";
2
+ import Dom from "./Dom.js";
3
+ import ElfUtil from "./ElfUtil.js";
4
+
5
+ declare class DragUI {
6
+
7
+ constructor(options: any);
8
+
9
+ public static applyThemeColor(grid: any): void;
10
+
11
+ public onThemeLoaded(colors: any): void;
12
+
13
+ }
14
+
15
+ export default DragUI;
16
+ export {DragUI};
@@ -0,0 +1,214 @@
1
+ import { injectCss, prettifyCss } from "./Util.js";
2
+ import Dom from "./Dom.js";
3
+ import ElfUtil from "./ElfUtil.js";
4
+
5
+ /**
6
+ * @constructor
7
+ * @param {Object} options
8
+ */
9
+ var DragUI = function(options) {
10
+ this._dragBox = options.dragBox;
11
+ this._dragBoxIcon = options.dragBoxIcon;
12
+
13
+ };
14
+
15
+ /** @type {string}
16
+ * @private
17
+ */
18
+ DragUI._styles = ""; // Static variable
19
+ /** @type {Element}
20
+ * @private
21
+ */
22
+ DragUI.prototype._guideline = null;
23
+ /** @type {Element}
24
+ * @private
25
+ */
26
+ DragUI.prototype._dragBox = null;
27
+ /** @type {Element}
28
+ * @private
29
+ */
30
+ DragUI.prototype._dragBoxIcon = null;
31
+ /** Core grid instance
32
+ * @type {Object}
33
+ * @private
34
+ */
35
+ DragUI.prototype._grid = null;
36
+
37
+ /** @public
38
+ * @param {Object} grid core grid instance
39
+ */
40
+ DragUI.applyThemeColor = function(grid) {
41
+ // This call after onThemeLoaded from extensions initialize
42
+
43
+ if(!grid || grid._dragUIStyles) {
44
+ return;
45
+ }
46
+
47
+ if(DragUI._styles) {
48
+ grid._dragUIStyles = true; // Prevent loading the same style twice
49
+ injectCss(DragUI._styles, grid.getElement());
50
+ } else {
51
+ // TODO : Handle if can not load DragUI._styles try to set new DragUI._styles
52
+ // Warning: This process have to use ElfUtil.getThemeColors() that async process for Backward compatability.
53
+ // When use async process, then it can be load theme multiple times.
54
+
55
+ }
56
+ };
57
+
58
+ /** @public
59
+ * @param {Object} colors
60
+ */
61
+ DragUI.prototype.onThemeLoaded = function(colors) {
62
+ if(!DragUI._styles) {
63
+ var styles = [ // Main Styles without theme
64
+ ".tr-row-guideline", [ // Backward compatability of row dragging
65
+ "position: absolute;",
66
+ "left: 0;",
67
+ "top: 0;",
68
+ "pointer-events: none;",
69
+ "text-align: center;",
70
+ "border-top-width: 3px;",
71
+ "border-top-style: solid;"
72
+ ],
73
+ ".guideline", [
74
+ "position: absolute;",
75
+ "left: 0;",
76
+ "top: 0;",
77
+ "pointer-events: none;",
78
+ "text-align: center;",
79
+ "border-top-style: solid;",
80
+ "width: 3px;",
81
+ "border-top-color: var(--grid-title-icon-color);",
82
+ "color: var(--grid-title-icon-color);",
83
+ "background-color: var(--grid-title-icon-color);"
84
+ ],
85
+ ".drag-box", [
86
+ "position: absolute;",
87
+ "left: 0;",
88
+ "top: 0;",
89
+ "pointer-events: none;",
90
+ "background-color: var(--grid-dragbox-bgcolor);",
91
+ "border: solid 1px var(--grid-title-sort-icon-color);",
92
+ "width: 134px;",
93
+ "height: 29px;",
94
+ "line-height: 29px;",
95
+ "white-space: nowrap;",
96
+ "overflow-x: clip;",
97
+ "text-overflow: ellipsis;",
98
+ "padding: 0 7px 0 7px;",
99
+ "box-shadow: 0 0 8px var(--grid-dragbox-bordercolor);"
100
+ ],
101
+ ".drag-box-disabled", [
102
+ "width: 100px;",
103
+ "left: 0;",
104
+ "top: 0;",
105
+ "position: absolute;"
106
+ ],
107
+ ".drag-box-icon", [
108
+ "top: -4px;",
109
+ "left: 12px;",
110
+ "padding: 2px;",
111
+ "border-radius: 100%;",
112
+ "font-size: 11px;",
113
+ "position: absolute;"
114
+ ],
115
+ ".drag-box-icon[icon='void']", [
116
+ "background-color:var(--grid-void-icon-bgcolor);",
117
+ "color:var(--grid-void-icon-color);"
118
+ ],
119
+ ".drag-box-icon[icon='add']", [
120
+ "background-color:var(--grid-insertion-icon-bgcolor);",
121
+ "color:var(--grid-insertion-icon-color);"
122
+ ],
123
+ ":host", [
124
+ "--grid-dragbox-bgcolor: #ffffff;", // If the value cannot be found, default to halo-light
125
+ "--grid-insertion-icon-bgcolor: #39c46e;",
126
+ "--grid-insertion-icon-color: #1A1A1A;",
127
+ "--grid-void-icon-bgcolor: #F5475B;",
128
+ "--grid-void-icon-color: #FFFFFF;"
129
+ ],
130
+ ".mouse-dragging .cell:hover", [ // for change mouse cursor when hover header while dragging
131
+ "cursor: grabbing !important;"
132
+ ],
133
+ ":host .column .cell.drag-indicator", [
134
+ "border: var(--grid-drag-indicator);" // defualt is "none"
135
+ ],
136
+ ".tr-dragging, .tr-dragging *", [
137
+ "-webkit-touch-callout: none;",
138
+ ".user-select(none);"
139
+ ]
140
+ ];
141
+ var guidelineColor = "#ff9933";
142
+ var ElfVersion = ElfUtil.getElfVersion();
143
+ if(colors.primary) {
144
+ guidelineColor = colors.primary;
145
+ }
146
+ guidelineColor += ";";
147
+
148
+ styles.push(".tr-row-guideline", [
149
+ "border-top-color: " + guidelineColor,
150
+ "color: " + guidelineColor
151
+ ]);
152
+
153
+ if(ElfVersion < 3) { // Backward compatability
154
+ styles.push(".pearl .tr-row-guideline, *[theme=pearl] .tr-row-guideline", [
155
+ "border-top-color: #ee7600;",
156
+ "color: #ee7600;",
157
+ "background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));"
158
+ ]);
159
+ }
160
+ DragUI._styles = prettifyCss(styles);
161
+ }
162
+ };
163
+
164
+ /** @private
165
+ * @param {!Element|Event|MouseEvent} e
166
+ * @param {Object} grid
167
+ * @returns {boolean}=true means dragBox can be drop
168
+ */
169
+ DragUI.prototype.renderDragBox = function (e, grid) {
170
+ if(!grid) {
171
+ return false;
172
+ }
173
+
174
+ var gridElem = grid.getElement();
175
+ var gridParent = grid.getParent().parentNode;
176
+ var pn = this._dragBox.parentNode;
177
+ if(!pn) {
178
+ gridParent.appendChild(this._dragBox);
179
+ }
180
+
181
+ var iconParent = this._dragBoxIcon.parentNode;
182
+
183
+ var dragBoxIcon = e.dragBoxIcon || this._dragBox.dragBoxIcon;
184
+ this._dragBoxIcon.style.visibility = "visible";
185
+ var drop = true;
186
+ if(dragBoxIcon === "insertion") {
187
+ drop = false;
188
+ this._dragBoxIcon.icon = "add";
189
+ if(!iconParent) {
190
+ this._dragBox.appendChild(this._dragBoxIcon);
191
+ }
192
+ } else if (dragBoxIcon === "not-allowed" || dragBoxIcon === "no-drop" || dragBoxIcon === "void" ) {
193
+ drop = false;
194
+ this._dragBoxIcon.icon = "void";
195
+ if(!iconParent) {
196
+ this._dragBox.appendChild(this._dragBoxIcon);
197
+ }
198
+ } else {
199
+ Dom.removeParent(this._dragBoxIcon);
200
+ }
201
+
202
+ var gridRect = gridElem.getBoundingClientRect();
203
+
204
+ var x = e.clientX - gridRect.left;
205
+ var y = e.pageY - gridRect.top;
206
+
207
+ // space for mouse cursor
208
+ this._dragBox.style.left = x - 5 + "px";
209
+ this._dragBox.style.top = y + 8 + "px";
210
+ return drop;
211
+ };
212
+
213
+ export default DragUI;
214
+ export {DragUI};
@@ -4,6 +4,8 @@ declare namespace ElementObserver {
4
4
 
5
5
  function addLanguageListener(element: Element): void;
6
6
 
7
+ function addAttributeListener(element: Element, listener: ((...params: any[]) => any), attributeName?: string): void;
8
+
7
9
  }
8
10
 
9
11
  export default ElementObserver;
@@ -13,6 +13,23 @@ var _onLanguageMutated = function (elem, mutation) {
13
13
  }
14
14
  };
15
15
 
16
+ /** @private
17
+ * @param {Function} listener
18
+ * @param {string=} attributeName
19
+ * @param {MutationRecord} mutation
20
+ */
21
+ var _onAttributeMutated = function (listener, attributeName, mutation) {
22
+ if (mutation.type === "attributes") {
23
+ if (attributeName != null) {
24
+ if (mutation.attributeName === attributeName) {
25
+ listener(mutation.target.getAttribute(attributeName));
26
+ }
27
+ } else {
28
+ listener(mutation.target);
29
+ }
30
+ }
31
+ };
32
+
16
33
  /** @private
17
34
  * @return {string}
18
35
  */
@@ -61,9 +78,12 @@ ElementObserver._addListener = function(elem, fn) {
61
78
  }
62
79
  if (!elem._observeId) {
63
80
  var id = ElementObserver._getNewId();
64
- listeners[id] = [];
65
81
  elem._observeId = id;
66
82
  }
83
+ if (!listeners[elem._observeId]) { // Always check to support the using of separated ElfUtil module in testing page
84
+ listeners[elem._observeId] = [];
85
+ }
86
+
67
87
  var listener = listeners[elem._observeId];
68
88
  if (listener.indexOf(fn) < 0) {
69
89
  listener.push(fn);
@@ -71,7 +91,7 @@ ElementObserver._addListener = function(elem, fn) {
71
91
  };
72
92
 
73
93
  /** @public Add a listener to a html lang attribute
74
- * @param {Element} element A target element to listen to
94
+ * @param {Element} element An element within the DOM tree to watch for changes
75
95
  */
76
96
  ElementObserver.addLanguageListener = function(element) {
77
97
  if (!element) { return; }
@@ -81,6 +101,16 @@ ElementObserver.addLanguageListener = function(element) {
81
101
  ElementObserver._addObserver(document.documentElement, _onLanguageMutated.bind(null, element));
82
102
  };
83
103
 
104
+ /** @public Add a listener to a html attribute
105
+ * @param {Element} element An element within the DOM tree to watch for changes
106
+ * @param {Function} listener A function which will be called on each attribute change
107
+ * @param {string=} attributeName If not specified, listener will be called on every attribute change
108
+ */
109
+ ElementObserver.addAttributeListener = function(element, listener, attributeName) {
110
+ if (!element || !listener) { return; }
111
+ ElementObserver._addObserver(element, _onAttributeMutated.bind(null, listener, attributeName));
112
+ };
113
+
84
114
  /**
85
115
  * @type {MutationObserver}
86
116
  * @private
@@ -1,5 +1,6 @@
1
1
  import { nestedObjectToArray, rgb2Hex } from "./Util.js";
2
2
  import { Deferred } from "./Deferred.js";
3
+ import { ElementObserver } from "./ElementObserver.js";
3
4
 
4
5
  declare namespace ElfUtil {
5
6
 
@@ -23,10 +24,12 @@ declare namespace ElfUtil {
23
24
 
24
25
  function prepareIconPreloading(): (string)[]|null;
25
26
 
26
- function getThemeColors(): Promise<any>|null;
27
+ function setRTK(rtk: any): void;
27
28
 
28
29
  function getMovementColorProfile(): string;
29
30
 
31
+ function getThemeColors(themeChangedCb?: ((...params: any[]) => any)): Promise<any>|null;
32
+
30
33
  }
31
34
 
32
35
  export default ElfUtil;