@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,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
  /** Dialog supporting language (selection dialog, formater dialog and filter dialog)
5
6
  * @type {!Object.<string, boolean>}
@@ -63,6 +64,22 @@ ElfUtil._dummyIcon = null;
63
64
  * @private
64
65
  */
65
66
  ElfUtil._iconLoaded = false;
67
+ /** @type {string|null}
68
+ * @private
69
+ */
70
+ ElfUtil._profileName = null;
71
+ /** @type {Array}
72
+ * @private
73
+ */
74
+ ElfUtil._callbacks = [];
75
+ /** @type {boolean}
76
+ * @private
77
+ */
78
+ ElfUtil._observed = false;
79
+ /** @type {boolean}
80
+ * @private
81
+ */
82
+ ElfUtil._pendingResolve = false;
66
83
 
67
84
  /** @type {Object.<string, Object>}
68
85
  * @private
@@ -78,7 +95,7 @@ ElfUtil._icons = {
78
95
  "sortable": "sort-up-down"
79
96
  },
80
97
  "columnStack": {
81
- "stack": "list",
98
+ "stack": "map-layers",
82
99
  "expand": "right",
83
100
  "collapse": "left"
84
101
  }
@@ -334,57 +351,146 @@ ElfUtil.getCssVariables = function (obj, optElem) {
334
351
  return obj || null;
335
352
  };
336
353
 
354
+ /** @public
355
+ * @param {Object} rtk
356
+ */
357
+ ElfUtil.setRTK = function(rtk) {
358
+ if(rtk != null) {
359
+ ElfUtil._rtk = rtk;
360
+ }
361
+ };
362
+
363
+ /** Get current profile name set on the root html element (document.documentElement)
364
+ * @public
365
+ * @return {string} Current profile name
366
+ */
367
+ ElfUtil.getMovementColorProfile = function() {
368
+ return document.documentElement.getAttribute("movement-color-profile");
369
+ };
370
+
371
+ /** @private
372
+ * @param {Function} cb
373
+ */
374
+ ElfUtil._addThemeChangedCallback = function(cb) {
375
+ var callbacks = ElfUtil._callbacks;
376
+ if(callbacks.indexOf(cb) < 0) {
377
+ callbacks.push(cb);
378
+ }
379
+ };
380
+
337
381
  /** Gets current theme colors from the document and returns a promise. <br>
338
- * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists. <br>
382
+ * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists or RTK is available. <br>
339
383
  * To re-request/reset theme colors, set ElfUtil.themeReady variable to null
340
384
  * @public
385
+ * @param {Function=} themeChangedCb
341
386
  * @return {Promise<Object>} A promise of object of theme colors
342
387
  */
343
- ElfUtil.getThemeColors = function() {
388
+ ElfUtil.getThemeColors = function(themeChangedCb) {
389
+ if(typeof themeChangedCb === "function") {
390
+ ElfUtil._addThemeChangedCallback(themeChangedCb);
391
+ }
392
+
344
393
  if(ElfUtil.themeReady) {
345
394
  return ElfUtil.themeReady;
346
395
  }
396
+
347
397
  var d = ElfUtil._deferred = new Deferred();
348
398
  ElfUtil.themeReady = d.promise;
349
399
 
350
- var jet = window ? window.JET : null;
351
- if(jet && jet.Settings) {
352
- try {
353
- jet.Settings.read(ElfUtil._onColorProfile, {
354
- providerName: "Configuration",
355
- settingName: "RDE_USER_CURRENT_TICK_COLOR"
356
- });
357
- } catch (err) {
358
- d.reject("Cannot read JET's settings");
400
+ var profileName = ElfUtil.getMovementColorProfile();
401
+ if(profileName) {
402
+ if(profileName !== ElfUtil._profileName) {
403
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
404
+ } else {
405
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
359
406
  }
360
407
  } else {
361
- setTimeout(ElfUtil._retrieveThemeColors, 100); // TODO: Find a proper way to ensure that theme is ready
408
+ var options = {
409
+ providerName: "Configuration",
410
+ settingName: "RDE_USER_CURRENT_TICK_COLOR"
411
+ };
412
+
413
+ var jet = window ? window.JET : null;
414
+ if(ElfUtil._rtk && ElfUtil._rtk.Settings) {
415
+ ElfUtil._rtk.Settings.getAsync(options).then(ElfUtil._loadingProfileSuccess, ElfUtil._loadingProfileFailure);
416
+ } else if(jet && jet.Settings) {
417
+ try {
418
+ jet.Settings.read(ElfUtil._loadingProfileSuccess, options);
419
+ } catch (err) {
420
+ ElfUtil._loadingProfileFailure();
421
+ }
422
+ } else {
423
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
424
+ }
362
425
  }
426
+
363
427
  return d.promise;
364
428
  };
365
429
 
366
- /** Get user's color profile from JET and set it to html tag (document.documentElement)
430
+ /** @private
431
+ * @param {string} profileName
432
+ */
433
+ var movementColorProfileChanged = function(profileName) {
434
+ if(profileName && profileName !== ElfUtil._profileName) {
435
+ ElfUtil._retrieveThemeColors(profileName);
436
+
437
+ if(ElfUtil._pendingResolve) {
438
+ ElfUtil._pendingResolve = false;
439
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
440
+ }
441
+
442
+ var callbacks = ElfUtil._callbacks;
443
+ for (var i = 0; i < callbacks.length; i++) {
444
+ callbacks[i]();
445
+ }
446
+ }
447
+ };
448
+
449
+ /** Get user's color profile from JET or TRK and set it to html tag (document.documentElement)
367
450
  * @private
368
- * @param {string} colorProfile Returned from JET.Settings
451
+ * @param {string} profileName Returned from JET.Settings or RTK.Settings
369
452
  */
370
- ElfUtil._onColorProfile = function (colorProfile) {
371
- if(colorProfile) {
372
- document.documentElement.setAttribute("movement-color-profile", colorProfile.toLowerCase());
453
+ ElfUtil._loadingProfileSuccess = function(profileName) {
454
+ if(profileName) {
455
+ document.documentElement.setAttribute("movement-color-profile", profileName.toLowerCase());
456
+ }
457
+
458
+ if(ElfUtil._observed) { // Let attribute listener does the job
459
+ ElfUtil._pendingResolve = true;
460
+ } else {
461
+ ElfUtil._profileNameRetrieved(profileName);
373
462
  }
374
- ElfUtil._retrieveThemeColors();
375
463
  };
376
- /** Get current profile name set on the root html element (document.documentElement)
377
- * @public
378
- * @return {string} Current profile name
464
+
465
+ /** @private
379
466
  */
380
- ElfUtil.getMovementColorProfile = function() {
381
- return document.documentElement.getAttribute("movement-color-profile");
467
+ ElfUtil._loadingProfileFailure = function() {
468
+ if(!ElfUtil._observed) {
469
+ ElfUtil._observed = true;
470
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
471
+ }
472
+ ElfUtil._deferred.reject("Failed to get movement color profile from settings.");
473
+ };
474
+
475
+ /** @private
476
+ */
477
+ ElfUtil._profileNameRetrieved = function() {
478
+ var profileName = ElfUtil.getMovementColorProfile();
479
+ ElfUtil._retrieveThemeColors(profileName);
480
+ if(!ElfUtil._observed) {
481
+ ElfUtil._observed = true;
482
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
483
+ }
484
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
382
485
  };
383
486
 
384
487
  /** Get theme colors from document
385
488
  * @private
489
+ * @param {string} profileName Movement color profile name
386
490
  */
387
- ElfUtil._retrieveThemeColors = function() {
491
+ ElfUtil._retrieveThemeColors = function(profileName) {
492
+ ElfUtil._profileName = profileName;
493
+
388
494
  var colors = ElfUtil.themeColors = ElfUtil.getCssVariables({
389
495
  "primary": "--color-scheme-primary", // Usually used in headers, and selection
390
496
  "secondary": "--color-scheme-secondary",
@@ -449,10 +555,7 @@ ElfUtil._retrieveThemeColors = function() {
449
555
  colors["baseGrid"] = colors["tableBg"];
450
556
  colors["baseText"] = colors["tableText"];
451
557
  colors["trackColor"] = colors["primary"] || ElfUtil._defaultColors["trackColor"];
452
-
453
- ElfUtil._deferred.resolve(colors);
454
558
  };
455
559
 
456
-
457
560
  export default ElfUtil;
458
561
  export { ElfUtil };
@@ -39,10 +39,10 @@ ExpanderIcon._iconName = ""; // static variable
39
39
  * @private
40
40
  */
41
41
  ExpanderIcon._styles = prettifyCss([
42
- ".tr-grid .expander-disabled .expander", [
42
+ ".tr-grid.expander-disabled .expander", [
43
43
  "cursor: default;"
44
44
  ],
45
- ".tr-grid .folder-disabled .column .cell.folder", [
45
+ ".tr-grid.folder-disabled .cell.folder", [
46
46
  "cursor: default;"
47
47
  ],
48
48
  ".tr-grid .expander", [
@@ -167,7 +167,7 @@ FieldFormatter.prototype.init = function(options) { // deserialize
167
167
  var utc = options["useUTCTime"];
168
168
  if(utc != null || dtf != null) {
169
169
  this.setDateTimeMeta(
170
- dtf || "MM/DD/YYYY",
170
+ dtf,
171
171
  utc,
172
172
  (options["idnSource"]) ? "idn" : "" // IDN Source will send time in second instead of millisecond.
173
173
  );
@@ -188,8 +188,10 @@ FieldFormatter.prototype.getOptions = function(options) { // serialize
188
188
 
189
189
  options["field"] = this._field;
190
190
  options["formatType"] = this._userFormatType ? this._userFormatType : this._formatType; // WARNING: Beware of case sensitivity
191
- options["dateTimeFormat"] = this._dateTimeFormat;
192
- options["useUTCTime"] = (this._timeZone == "GMT");
191
+ if(toDateTimeType(options["formatType"]) == DATE_TIME){
192
+ options["dateTimeFormat"] = this._dateTimeFormat;
193
+ options["useUTCTime"] = (this._timeZone == "GMT");
194
+ }
193
195
  return options;
194
196
  };
195
197
  /** @public
@@ -244,7 +246,7 @@ FieldFormatter.prototype.setField = function(field, combinedField, formattedFiel
244
246
  * @param {string=} lang
245
247
  */
246
248
  FieldFormatter.prototype.setDateTimeMeta = function(format, gmtTimeZone, inputSource, lang) {
247
- this._dateTimeFormat = format;
249
+ this._dateTimeFormat = format || "";
248
250
  this._timeZone = (gmtTimeZone !== false) ? "GMT" : "LOCAL";
249
251
  this._idnSource = (inputSource && inputSource.toLowerCase() == "idn") ? "idn" : "";
250
252
  DateTime.setLocale(lang);
@@ -385,7 +387,7 @@ FieldFormatter.prototype._formatDateTime = function(val, rowData) {
385
387
  }
386
388
  val = new Date(sec * 1000); // Convert real-time raw data (second) to millisecond
387
389
  }
388
- return this._df(val, this._dateTimeFormat, this._timeZone);
390
+ return this._df(val, this._dateTimeFormat || "MM/DD/YYYY", this._timeZone);
389
391
  };
390
392
  /** @private
391
393
  * @param {number|string|Date} val
@@ -262,13 +262,17 @@ GridPlugin.prototype.getColumnIndex = function (colId) {
262
262
  GridPlugin.prototype.getColumnIndices = function (colRefs) {
263
263
  if(this._compositeGrid) {
264
264
  var allFields = this._compositeGrid.getColumnFields();
265
+ var columnCount = this._compositeGrid.getColumnCount();
265
266
  var columnIndices = [];
267
+ var colRef;
266
268
  for (var i = 0; i < colRefs.length; i++) {
267
-
268
- if(typeof colRefs[i] === 'number') { // When user pass index
269
- columnIndices.push(colRefs[i]);
269
+ colRef = colRefs[i];
270
+ if(typeof colRef === 'number') { // When user pass index
271
+ if(colRef >= 0 && colRef < columnCount) {
272
+ columnIndices.push(colRef);
273
+ }
270
274
  } else {
271
- var columnIndex = allFields.indexOf(colRefs[i]); // Looping check column index of colRefs field
275
+ var columnIndex = allFields.indexOf(colRef); // Looping check column index of colRefs field
272
276
  if(columnIndex !== -1) {
273
277
  columnIndices.push(columnIndex);
274
278
  }
@@ -18,6 +18,8 @@ declare class MultiTableManager {
18
18
 
19
19
  public setTableCount(num: number): void;
20
20
 
21
+ public wrapTable(rowCount: number): void;
22
+
21
23
  public getTable(at?: number): Element|null;
22
24
 
23
25
  public insertRow(rowOption?: any, at?: number): void;
@@ -26,6 +28,12 @@ declare class MultiTableManager {
26
28
 
27
29
  public getRowCount(): number;
28
30
 
31
+ public insertColumn(columnOption: any, idx?: number): void;
32
+
33
+ public removeColumn(colRef: any): void;
34
+
35
+ public getColumnCount(): number;
36
+
29
37
  }
30
38
 
31
39
  export default MultiTableManager;
@@ -49,6 +49,10 @@ var _newArrayOfObject = function (num) {
49
49
  * @param {boolean=} bool
50
50
  */
51
51
  var _toggleInlineElement = function (elem, bool) {
52
+ if(!elem || elem.style.display === "none") {
53
+ return;
54
+ }
55
+
52
56
  var s = elem.style;
53
57
  if(bool == null) {
54
58
  bool = s.display !== "inline-block";
@@ -68,7 +72,7 @@ var _toggleInlineElement = function (elem, bool) {
68
72
  var MultiTableManager = function (gridElem) {
69
73
  this._onDelayedConfiguration = this._onDelayedConfiguration.bind(this);
70
74
  this._onConfiguration = this._onConfiguration.bind(this);
71
- this._onDataChanged = this._onDataChanged.bind(this);
75
+ this._onWrapCountChanged = this._onWrapCountChanged.bind(this);
72
76
 
73
77
  this._tables = [];
74
78
  if(gridElem) {
@@ -102,6 +106,10 @@ MultiTableManager.prototype._emeraldGrid = false;
102
106
  * @private
103
107
  */
104
108
  MultiTableManager.prototype._ready = false;
109
+ /** @type {number}
110
+ * @private
111
+ */
112
+ MultiTableManager.prototype._wrapSize = 0;
105
113
 
106
114
 
107
115
  /** @public
@@ -196,6 +204,7 @@ MultiTableManager._onVScrollbarSynchronization = function(vScrollbarHost, hScrol
196
204
  for(var i = 0; i < gridLen; ++i) {
197
205
  var gridElem = gridElems[i];
198
206
  var core = gridElem.api.getCoreGrid();
207
+
199
208
  _toggleInlineElement(gridElem, true);
200
209
  if(i > 0) {
201
210
  mainCore.synchronizeVScrollbar(core);
@@ -234,6 +243,8 @@ MultiTableManager.prototype.setGridConfig = function (configObj) {
234
243
  * @param {Object} e
235
244
  */
236
245
  MultiTableManager.prototype._onDelayedConfiguration = function (e) {
246
+ this._ready = false;
247
+ // TODO: Handle the case where config is changed at runtime
237
248
  setTimeout(this._onConfiguration, 10); // Add delay to ensure that scrollbars are synchronized first
238
249
  };
239
250
  /** @private
@@ -245,15 +256,16 @@ MultiTableManager.prototype._onConfiguration = function () {
245
256
  }
246
257
  this._ready = true;
247
258
 
248
- this.setTableCount(this._tableCount);
259
+ if(this._wrapSize) {
260
+ this._wrapTable(this._wrapSize);
261
+ } else {
262
+ this._setTableCount(this._tableCount);
263
+ }
249
264
  };
250
265
 
251
266
  /** @public
252
267
  */
253
268
  MultiTableManager.prototype.dispose = function () {
254
- // var main = this._tables[0];
255
- // main.api.getDataSource().unlisten("dataChanged", this._onDataChanged);
256
-
257
269
  var len = this._tables.length;
258
270
  for(var i = 0; i < len; ++i) {
259
271
  this._tables[i].dispose();
@@ -272,7 +284,8 @@ MultiTableManager.prototype._cloneConfig = function () {
272
284
  if(this._configObj) {
273
285
  obj = cloneObject(this._configObj);
274
286
  if(Array.isArray(obj.columns)) {
275
- obj.columns = this._configObj.columns.slice();
287
+ var runtimeConfig = this._tables[0].api ? this._tables[0].api.getConfigObject() : this._configObj;
288
+ obj.columns = runtimeConfig.columns.slice();
276
289
  }
277
290
  }
278
291
  return obj || {};
@@ -282,13 +295,12 @@ MultiTableManager.prototype._cloneConfig = function () {
282
295
  * @return {number}
283
296
  */
284
297
  MultiTableManager.prototype.getTableCount = function() {
285
- return this._tableCount;
298
+ return this._tables.length;
286
299
  };
287
- /**
288
- * @public
300
+ /** @private
289
301
  * @param {number} num Number of tables. Number cannot be less than one.
290
302
  */
291
- MultiTableManager.prototype.setTableCount = function(num) {
303
+ MultiTableManager.prototype._setTableCount = function(num) {
292
304
  this._tableCount = num > 0 ? num : 1;
293
305
 
294
306
  if(this._ready) {
@@ -301,30 +313,53 @@ MultiTableManager.prototype.setTableCount = function(num) {
301
313
  }
302
314
  };
303
315
  /**
316
+ * @public
317
+ * @param {number} num Number of tables. Number cannot be less than one.
318
+ */
319
+ MultiTableManager.prototype.setTableCount = function(num) {
320
+ if(this._wrapSize) {
321
+ this._wrapTable(0);
322
+ }
323
+ this._setTableCount(num);
324
+ };
325
+ /**
304
326
  * @private
327
+ * @param {number} tableIndex
305
328
  * @return {Element}
306
329
  */
307
- MultiTableManager.prototype._addTable = function() {
330
+ MultiTableManager.prototype._addTable = function(tableIndex) {
308
331
  var main = this._tables[0];
309
332
  var parentElem = main.parentNode;
333
+ var core = main.api.getCoreGrid();
310
334
  var mainDataView = main.api.getDataView();
311
335
  // var mainDataTable = main.api.getDataTable();
336
+ var stp = core.getPlugin("SortableTitlePlugin");
337
+ var dtp = core.getPlugin("DragAndDropTitlePlugin");
312
338
 
313
339
  var configObj = this._cloneConfig();
314
340
  configObj.extensions = this._generateExtensions();
341
+
315
342
  delete configObj.staticDataRows;
316
343
  delete configObj.rows;
317
344
  delete configObj.dataModel;
318
345
 
319
- var rowCount = mainDataView.getRowCount();
320
-
321
- var ary = _newArrayOfObject(rowCount);
322
- if(this._emeraldGrid) {
323
- configObj.dataModel = {
324
- data: ary
325
- };
346
+ if(this._wrapSize) {
347
+ var wrappedViews = mainDataView.getWrappedViews();
348
+ configObj.dataView = wrappedViews[tableIndex - 1];
349
+ configObj.grid = main.api;
326
350
  } else {
327
- configObj.rows = ary;
351
+ configObj["SortableTitle"] = stp;
352
+ configObj["DragAndDropTitle"] = dtp;
353
+ var rowCount = mainDataView.getRowCount();
354
+
355
+ var ary = _newArrayOfObject(rowCount);
356
+ if(this._emeraldGrid) {
357
+ configObj.dataModel = {
358
+ data: ary
359
+ };
360
+ } else {
361
+ configObj.rows = ary;
362
+ }
328
363
  }
329
364
 
330
365
  var sub = document.createElement(main.tagName);
@@ -347,19 +382,22 @@ MultiTableManager.prototype._addTables = function(num) {
347
382
 
348
383
  var main = this._tables[0];
349
384
  _toggleInlineElement(main, true); // TODO: Check if we need to do this every time
385
+
350
386
  // main.api.setFitContentWidth(true);
351
387
 
352
388
  for(var i = 0; i < num; ++i) {
353
- var grid = this._addTable();
389
+ var grid = this._addTable(this._tables.length);
354
390
  this._tables.push(grid);
355
391
  }
356
392
 
357
- if(main._vScrollbarSynchronization) {
358
- MultiTableManager.synchronizeVScrollbar(
359
- main.api.getCoreGrid().getVScrollbar().getParent(),
360
- main.parentNode,
361
- this._tables
362
- );
393
+ if(!this._wrapSize) {
394
+ if(main._vScrollbarSynchronization) {
395
+ MultiTableManager.synchronizeVScrollbar(
396
+ main.api.getCoreGrid().getVScrollbar().getParent(),
397
+ main.parentNode,
398
+ this._tables
399
+ );
400
+ }
363
401
  }
364
402
  };
365
403
  /**
@@ -381,20 +419,62 @@ MultiTableManager.prototype._removeTables = function(num) {
381
419
  sub.parentNode.removeChild(sub);
382
420
  }
383
421
  }
384
- if(this._tables.length === 1) {
385
- // TODO: Reset state
386
- this._tables[0].style.display = "";
422
+ // if(this._tables.length === 1) {
423
+ // TODO: Reset state
424
+ // this._tables[0].style.display = ""; // Remove display inline
425
+ // }
426
+ };
427
+
428
+
429
+ /** @private
430
+ * @param {number} rowCount Number of row per table. Set number to zero to turn off wrap mode.
431
+ */
432
+ MultiTableManager.prototype._wrapTable = function(rowCount) {
433
+ this._wrapSize = rowCount > 0 ? rowCount : 0;
434
+
435
+ if(this._ready) {
436
+ var main = this._tables[0];
437
+ if(this._wrapSize) {
438
+ main.style.display = "none";
439
+ main.api.getCoreGrid().getVScrollbar().disable();
440
+ } else {
441
+ main.style.display = "";
442
+ _toggleInlineElement(main, true);
443
+ main.api.getCoreGrid().getVScrollbar().disable(false);
444
+ }
445
+
446
+ var dv = main.api.getDataView();
447
+ dv.listen("wrapCountChanged", this._onWrapCountChanged);
448
+ dv.wrapView(this._wrapSize);
387
449
  }
388
450
  };
389
451
  /**
390
- * @private
452
+ * @public
453
+ * @param {number} rowCount Number of row per table. Set number to zero to turn off wrap mode.
454
+ */
455
+ MultiTableManager.prototype.wrapTable = function(rowCount) {
456
+ if(rowCount && this._tableCount > 1) {
457
+ this._setTableCount(1);
458
+ }
459
+ if(!rowCount || rowCount < 0) {
460
+ rowCount = 0;
461
+ }
462
+ if(this._wrapSize !== rowCount) {
463
+ this._wrapTable(rowCount);
464
+ }
465
+ };
466
+ /** @private
391
467
  * @param {Object} e
392
468
  */
393
- MultiTableManager.prototype._onDataChanged = function(e) {
394
-
469
+ MultiTableManager.prototype._onWrapCountChanged = function(e) {
470
+ if(e.prevCount < e.newCount) {
471
+ this._addTables(e.newCount - e.prevCount);
472
+ }
473
+ if(e.newCount < e.prevCount) {
474
+ this._removeTables(e.prevCount - e.newCount);
475
+ }
395
476
  };
396
477
 
397
-
398
478
  /** @public
399
479
  * @param {number=} at
400
480
  * @return {Element}
@@ -445,23 +525,6 @@ MultiTableManager.prototype._execAll = function(methodName, args) {
445
525
  }
446
526
  };
447
527
 
448
- /** @private
449
- * @param {number} num
450
- */
451
- MultiTableManager.prototype._setRtRowCount = function(num) {
452
- var tableCount = this._tables.length;
453
- // grid.api.getRowCount();
454
- for(var i = 1; i < tableCount; ++i) {
455
- var sub = this._tables[i];
456
- sub.api.insertRows(_newArrayOfObject(num));
457
- }
458
- };
459
- /** @private
460
- * @param {number} num
461
- */
462
- MultiTableManager.prototype._addCsRows = function(num) {
463
- };
464
-
465
528
  /** @public
466
529
  * @param {Object=} rowOption
467
530
  * @param {number=} at
@@ -471,10 +534,14 @@ MultiTableManager.prototype.insertRow = function(rowOption, at) {
471
534
  return; // TODO
472
535
  }
473
536
 
474
- var tableCount = this._tables.length;
475
- for(var i = 0; i < tableCount; ++i) {
476
- var tbl = this._tables[i];
477
- tbl.api.insertRow(rowOption, at);
537
+ if(this._wrapSize) {
538
+ this.getTable().api.insertRow(rowOption, at);
539
+ } else {
540
+ var tableCount = this._tables.length;
541
+ for(var i = 0; i < tableCount; ++i) {
542
+ var tbl = this._tables[i];
543
+ tbl.api.insertRow(rowOption, at);
544
+ }
478
545
  }
479
546
  };
480
547
  /** @public
@@ -488,18 +555,58 @@ MultiTableManager.prototype.removeRow = function(at) {
488
555
  at = this.getRowCount() - 1;
489
556
  }
490
557
 
558
+ if(this._wrapSize) {
559
+ this.getTable().api.removeRow(at);
560
+ } else {
561
+ var tableCount = this._tables.length;
562
+ for(var i = 0; i < tableCount; ++i) {
563
+ var tbl = this._tables[i];
564
+ tbl.api.removeRow(at);
565
+ }
566
+ }
567
+ };
568
+
569
+ /** @public
570
+ * @return {number}
571
+ */
572
+ MultiTableManager.prototype.getRowCount = function() {
573
+ return this.getTable().api.getRowCount();
574
+ };
575
+
576
+ /** @public
577
+ * @param {*} columnOption String will be treated as field, while object is treated as the column options
578
+ * @param {number=} idx
579
+ */
580
+ MultiTableManager.prototype.insertColumn = function(columnOption, idx) {
581
+ if(this._emeraldGrid) {
582
+ return; // TODO
583
+ }
584
+
491
585
  var tableCount = this._tables.length;
492
586
  for(var i = 0; i < tableCount; ++i) {
493
587
  var tbl = this._tables[i];
494
- tbl.api.removeRow(at);
588
+ tbl.api.insertColumn(columnOption, idx);
589
+ }
590
+ };
591
+ /** @public
592
+ * @param {*} colRef Column reference
593
+ */
594
+ MultiTableManager.prototype.removeColumn = function(colRef) {
595
+ if(this._emeraldGrid) {
596
+ return; // TODO
597
+ }
598
+ var tableCount = this._tables.length;
599
+ for(var i = 0; i < tableCount; ++i) {
600
+ var tbl = this._tables[i];
601
+ tbl.api.removeColumn(colRef);
495
602
  }
496
603
  };
497
604
 
498
605
  /** @public
499
606
  * @return {number}
500
607
  */
501
- MultiTableManager.prototype.getRowCount = function() {
502
- return this.getTable().api.getRowCount();
608
+ MultiTableManager.prototype.getColumnCount = function() {
609
+ return this.getTable().api.getColumnCount();
503
610
  };
504
611
 
505
612
  export default MultiTableManager;
@@ -27,6 +27,8 @@ declare class NumberFormatter {
27
27
 
28
28
  public static padDecimalPartWithZeroes(str: string, precision: number): string;
29
29
 
30
+ public static multiplyByHundred(num: number): number;
31
+
30
32
  public getOptions(options?: any): any;
31
33
 
32
34
  public format(origVal: number): string;