@refinitiv-ui/efx-grid 6.0.0 → 6.0.3

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 (151) hide show
  1. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +13 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +15 -2
  3. package/lib/column-selection-dialog/lib/column-selection-dialog.js +226 -23
  4. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  5. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  6. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  7. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  8. package/lib/core/dist/core.css +1 -1
  9. package/lib/core/dist/core.js +10158 -7908
  10. package/lib/core/dist/core.min.js +1 -1
  11. package/lib/core/es6/data/DataTable.js +32 -10
  12. package/lib/core/es6/data/DataView.d.ts +16 -7
  13. package/lib/core/es6/data/DataView.js +172 -49
  14. package/lib/core/es6/data/Segment.d.ts +2 -0
  15. package/lib/core/es6/data/Segment.js +7 -0
  16. package/lib/core/es6/data/WrappedView.d.ts +289 -0
  17. package/lib/core/es6/data/WrappedView.js +1319 -0
  18. package/lib/core/es6/grid/Core.d.ts +13 -0
  19. package/lib/core/es6/grid/Core.js +406 -160
  20. package/lib/core/es6/grid/ILayoutGrid.d.ts +8 -0
  21. package/lib/core/es6/grid/ILayoutGrid.js +45 -2
  22. package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
  23. package/lib/core/es6/grid/LayoutGrid.js +257 -82
  24. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
  25. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +316 -24
  26. package/lib/core/es6/grid/components/Column.js +8 -2
  27. package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
  28. package/lib/core/es6/grid/components/HScrollbar.js +20 -4
  29. package/lib/core/es6/grid/util/TrackLayout.d.ts +1 -1
  30. package/lib/core/es6/grid/util/TrackLayout.js +2 -3
  31. package/lib/core/es6/tr-grid-theme.js +1 -1
  32. package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
  33. package/lib/filter-dialog/lib/filter-dialog.d.ts +13 -1
  34. package/lib/filter-dialog/lib/filter-dialog.js +24 -9
  35. package/lib/grid/lib/efx-grid.d.ts +27 -8
  36. package/lib/grid/lib/efx-grid.js +114 -115
  37. package/lib/grid/themes/base.less +5 -3
  38. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  39. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  40. package/lib/grid/themes/halo/efx-grid.less +69 -32
  41. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  42. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  43. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  44. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  45. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  46. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  47. package/lib/index.d.ts +56 -56
  48. package/lib/index.js +56 -56
  49. package/lib/row-segmenting/es6/RowSegmenting.d.ts +1 -0
  50. package/lib/row-segmenting/es6/RowSegmenting.js +43 -12
  51. package/lib/rt-grid/dist/rt-grid.js +10293 -7865
  52. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  53. package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
  54. package/lib/rt-grid/es6/ColumnDefinition.js +3 -0
  55. package/lib/rt-grid/es6/Grid.d.ts +14 -7
  56. package/lib/rt-grid/es6/Grid.js +244 -75
  57. package/lib/rt-grid/es6/RowDefinition.d.ts +4 -1
  58. package/lib/rt-grid/es6/RowDefinition.js +52 -2
  59. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
  60. package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
  61. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +4 -1
  62. package/lib/tr-grid-checkbox/es6/Checkbox.js +41 -14
  63. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  64. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
  65. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
  66. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +226 -4
  67. package/lib/tr-grid-column-stack/es6/ColumnStack.js +3 -0
  68. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +6 -1
  69. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
  70. package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
  71. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +1 -1
  72. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +13 -1
  73. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -3
  74. package/lib/tr-grid-row-dragging/es6/RowDragging.js +165 -70
  75. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
  76. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
  77. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +41 -31
  78. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +13 -9
  79. package/lib/tr-grid-row-selection/es6/RowSelection.js +220 -29
  80. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  81. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
  82. package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
  83. package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
  84. package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
  85. package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
  86. package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
  87. package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
  88. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
  89. package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
  90. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
  91. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
  92. package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
  93. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
  94. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
  95. package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
  96. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
  97. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +10 -2
  98. package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
  99. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  100. package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
  101. package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
  102. package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
  103. package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
  104. package/lib/tr-grid-util/es6/RowPainter.js +82 -20
  105. package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
  106. package/lib/tr-grid-util/es6/Table.d.ts +13 -13
  107. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
  108. package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
  109. package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
  110. package/lib/tr-grid-util/es6/Util.d.ts +6 -6
  111. package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
  112. package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
  113. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
  114. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
  115. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
  116. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
  117. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
  118. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
  119. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
  120. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
  121. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
  122. package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
  123. package/lib/types/es6/CellSelection.d.ts +1 -1
  124. package/lib/types/es6/Checkbox.d.ts +4 -1
  125. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  126. package/lib/types/es6/ColumnSelection.d.ts +5 -1
  127. package/lib/types/es6/Core/data/DataView.d.ts +16 -7
  128. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  129. package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
  130. package/lib/types/es6/Core/grid/Core.d.ts +13 -0
  131. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +8 -0
  132. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
  133. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
  134. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
  135. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +1 -1
  136. package/lib/types/es6/FilterInput.d.ts +4 -2
  137. package/lib/types/es6/InCellEditing.d.ts +1 -1
  138. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +4 -1
  139. package/lib/types/es6/RealtimeGrid/Grid.d.ts +15 -8
  140. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -1
  141. package/lib/types/es6/RowColoring.d.ts +2 -0
  142. package/lib/types/es6/RowDragging.d.ts +1 -3
  143. package/lib/types/es6/RowFiltering.d.ts +2 -0
  144. package/lib/types/es6/RowSegmenting.d.ts +1 -0
  145. package/lib/types/es6/RowSelection.d.ts +13 -9
  146. package/lib/types/es6/Zoom.d.ts +2 -1
  147. package/lib/types/es6/index.d.ts +3 -0
  148. package/lib/versions.json +19 -19
  149. package/lib/zoom/es6/Zoom.d.ts +2 -1
  150. package/lib/zoom/es6/Zoom.js +11 -4
  151. package/package.json +9 -2
@@ -38,7 +38,10 @@ declare namespace ColumnDefinition {
38
38
  hidden?: boolean,
39
39
  id?: string,
40
40
  textSelect?: boolean,
41
- keepModel?: boolean
41
+ keepModel?: boolean,
42
+ stationary?: boolean,
43
+ leftPinned?: boolean,
44
+ rightPinned?: boolean
42
45
  };
43
46
 
44
47
  }
@@ -45,6 +45,9 @@ import Engine from "../../tr-grid-util/es6/formula/Engine.js";
45
45
  * @property {string=} id Id for unique identifier
46
46
  * @property {boolean=} textSelect=false If enabled, user can select text in this column
47
47
  * @property {boolean=} keepModel If enabled, initial column's options will be kept
48
+ * @property {boolean=} stationary=false If enabled, the column order cannot be changed (i.e., this column and any column to its left cannot be moved)
49
+ * @property {boolean=} leftPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the left side
50
+ * @property {boolean=} rightPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the right side
48
51
  */
49
52
 
50
53
  /** mapping of field type to javascript type
@@ -1,13 +1,13 @@
1
- import {Dom} from "../../tr-grid-util/es6/Dom.js";
2
- import {Conflator} from "../../tr-grid-util/es6/Conflator.js";
3
- import {Ext} from "../../tr-grid-util/es6/Ext.js";
1
+ import { Dom } from "../../tr-grid-util/es6/Dom.js";
2
+ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
3
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
4
4
  import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
5
5
  import { Engine } from "../../tr-grid-util/es6/formula/Engine.js";
6
6
  import { cloneObject, extendObject, arrayToObject } from "../../tr-grid-util/es6/Util.js";
7
7
  import { DateTime } from "../../tr-grid-util/es6/DateTime.js";
8
8
 
9
- import {RowDefinition, ROW_DEF} from "./RowDefinition.js";
10
- import {ColumnDefinition, COL_DEF} from "./ColumnDefinition.js";
9
+ import { RowDefinition, ROW_DEF } from "./RowDefinition.js";
10
+ import { ColumnDefinition, COL_DEF } from "./ColumnDefinition.js";
11
11
  import SnapshotFiller from "./SnapshotFiller.js";
12
12
  import StyleLoader from "./StyleLoader.js";
13
13
  import FieldDefinition from "./FieldDefinition.js";
@@ -70,7 +70,8 @@ declare namespace Grid {
70
70
  dataComposed?: ((...params: any[]) => any),
71
71
  autoDateConversion?: boolean,
72
72
  textSelect?: boolean,
73
- lang?: string
73
+ lang?: string,
74
+ scrollbarParent?: Element
74
75
  };
75
76
 
76
77
  type RowReference = number|string|RowDefinition;
@@ -199,6 +200,8 @@ declare class Grid extends EventDispatcher {
199
200
 
200
201
  public getRowDefinitions(): (RowDefinition)[];
201
202
 
203
+ public getAllRowDefinitions(inclAutoGenerate?: boolean): (RowDefinition)[];
204
+
202
205
  public getRowData(rowIndex: number): any;
203
206
 
204
207
  public getMultipleRowData(obj?: any): (any)[];
@@ -219,7 +222,7 @@ declare class Grid extends EventDispatcher {
219
222
 
220
223
  public getAllFields(): (string)[];
221
224
 
222
- public freezeColumn(opt_colIndex?: number, pinnedRightColumns?: number): void;
225
+ public freezeColumn(colIndex?: number, pinnedRightColumns?: number): void;
223
226
 
224
227
  public updateColumnTitle(): void;
225
228
 
@@ -249,6 +252,10 @@ declare class Grid extends EventDispatcher {
249
252
 
250
253
  public requestRowRefresh(): void;
251
254
 
255
+ public updateLayout(): void;
256
+
257
+ public getExtension(str: string): any;
258
+
252
259
  public logDT(opt_options?: any): void;
253
260
 
254
261
  public logDV(opt_options?: any): void;
@@ -1,14 +1,14 @@
1
1
  /* eslint-disable */
2
- import {Dom} from "../../tr-grid-util/es6/Dom.js";
3
- import {Conflator} from "../../tr-grid-util/es6/Conflator.js";
4
- import {Ext} from "../../tr-grid-util/es6/Ext.js";
2
+ import { Dom } from "../../tr-grid-util/es6/Dom.js";
3
+ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
4
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
5
5
  import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
6
6
  import { Engine } from "../../tr-grid-util/es6/formula/Engine.js";
7
7
  import { cloneObject, extendObject, arrayToObject } from "../../tr-grid-util/es6/Util.js";
8
8
  import { DateTime } from "../../tr-grid-util/es6/DateTime.js";
9
9
 
10
- import {RowDefinition, ROW_DEF} from "./RowDefinition.js";
11
- import {ColumnDefinition, COL_DEF} from "./ColumnDefinition.js";
10
+ import { RowDefinition, ROW_DEF } from "./RowDefinition.js";
11
+ import { ColumnDefinition, COL_DEF } from "./ColumnDefinition.js";
12
12
  import SnapshotFiller from "./SnapshotFiller.js";
13
13
  import StyleLoader from "./StyleLoader.js";
14
14
  import FieldDefinition from "./FieldDefinition.js";
@@ -51,9 +51,9 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
51
51
  * @property {boolean=} columnReorder=true Alias with noColumnDragging but in opposite value. This property deprecated in favor of noColumnDragging.
52
52
  * @property {boolean=} rowHighlighting=true Highlight a row when hovering mouse over grid
53
53
  * @property {(boolean|number)=} autoLayoutUpdate=false Grid will check for layout change periodically.
54
- * @property {number=} columnFreezing Enable horizontal scrollbar after `columnFreezing` index
55
- * @property {number=} freezeColumn An alias to columnFreezing
56
- * @property {number=} pinnedRightColumns=0 Number of columns to be frozen/pinned on the right side.
54
+ * @property {number=} columnFreezing Deprecated in favor of column's leftPinned property. Enable horizontal scrollbar after `columnFreezing` index
55
+ * @property {number=} freezeColumn Deprecated in favor of column's leftPinned property. An alias to columnFreezing
56
+ * @property {number=} pinnedRightColumns=0 Deprecated in favor of column's rightPinned property. Number of columns to be frozen/pinned on the right side.
57
57
  * @property {Array=} staticDataRows Shorthand for calling {@link Grid#addStaticDataRows}
58
58
  * @property {Array.<string>=} dataFields Shorthand for calling {@link Grid#addDataFields}
59
59
  * @property {boolean=} rowVirtualization=true If disabled, all data rows will be rendered. This will greatly impact grid's performance if the data set is huge.
@@ -73,6 +73,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
73
73
  * @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
74
74
  * @property {boolean=} textSelect=false If enabled, user can select text
75
75
  * @property {string=} lang laguage for config localization date time, if null the default language is "en"
76
+ * @property {Element=} scrollbarParent=null Element to be attached by grid's scrollbars, allowing them to move outside and avoid overlapping with the content.
76
77
  */
77
78
 
78
79
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -152,7 +153,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
152
153
  var SUB_ID = "SUB_ID";
153
154
 
154
155
  /** @private
155
- * @param {*} rowDef
156
+ * @param {RowDefinition} rowDef
156
157
  * @return {Object}
157
158
  */
158
159
  var toRowData = function(rowDef) {
@@ -209,6 +210,14 @@ var mapRowOrder = function (sortField, elemData, index) { // edit name
209
210
  elemData[sortField] = index; // Make column for sort with user data array
210
211
  };
211
212
 
213
+ /** @private
214
+ * @param {RowDefinition} rowDef
215
+ * @return {boolean}
216
+ */
217
+ var excludeAutoGenerated = function (rowDef) {
218
+ return !rowDef.isAutoGenerated();
219
+ };
220
+
212
221
  /** @private
213
222
  * @param {string} rowDefA
214
223
  * @param {string} rowDefB
@@ -265,19 +274,59 @@ var Grid = function(placeholder, config) {
265
274
 
266
275
  t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
267
276
 
268
- t._stp = new SortableTitlePlugin({
269
- "userManagedLogic": true,
270
- "sortableColumns": true,
271
- "disableDoubleClickToSort": true,
272
- "ROW_DEF": true // Enable Row Definition Mode
273
- });
274
- t._stp.listen("preDataSorting", t._onPreDataSorting);
275
-
276
- t._dtp = new DragAndDropTitlePlugin();
277
+ if(config) {
278
+ if(config["dataView"]) {
279
+ t._sharedDataSource = true;
280
+ t._dv = config["dataView"];
281
+ t._dt = t._dv.getDataTable();
282
+ t._mainGrid = config["grid"];
277
283
 
278
- // WARNING: These two plugins don't have normal workflow unlike other extensions. defaultColumnOptions property does not work with these two.
279
- // beforeInit does not get called.
280
- t._grid.loadPlugin(t._stp, config);
284
+ var core = t._mainGrid.getCoreGrid();
285
+ t._stp = core.getPlugin("SortableTitlePlugin");
286
+ t._dtp = core.getPlugin("DragAndDropTitlePlugin");
287
+ }
288
+ if(config["SortableTitle"]) { // Exception for built-in plugin
289
+ t._stp = config["SortableTitle"];
290
+ }
291
+ if(config["DragAndDropTitle"]) { // Exception for built-in plugin
292
+ t._dtp = config["DragAndDropTitle"];
293
+ }
294
+ }
295
+ if(!t._sharedDataSource) {
296
+ t._dc = new DataCache();
297
+ t._dc.listen("dataChanged", t._onDataChanged);
298
+ t._dc.listen("dataComposed", t._onDataComposed);
299
+ t._dc.listen("dataComposed", t._recalculateFormulas); // This will be called after _onDataComposed
300
+
301
+ t._dt = new DataTable();
302
+ t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
303
+ t._dv = new DataView(t._dt);
304
+ t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
305
+ t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
306
+ }
307
+ t._grid.setDataSource(t._dv); // Avoid triggering sorting
308
+
309
+ if(t._stp) {
310
+ this._sharedSorter = true;
311
+ t._stp.listen("preDataSorting", t._onPreDataSorting);
312
+ t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
313
+ } else { // Create built-in plugin
314
+ t._stp = new SortableTitlePlugin({
315
+ "userManagedLogic": true,
316
+ "sortableColumns": true,
317
+ "disableDoubleClickToSort": true,
318
+ "ROW_DEF": true // Enable Row Definition Mode
319
+ });
320
+ t._stp.listen("preDataSorting", t._onPreDataSorting);
321
+
322
+ // TODO: Built-in plugins don't have normal workflow unlike other extensions. Make them have the same workflow like the others
323
+ // defaultColumnOptions property does not work with them.
324
+ // beforeInit is not called.
325
+ t._grid.loadPlugin(t._stp, config);
326
+ }
327
+ if(!t._dtp) { // Create built-in plugin
328
+ t._dtp = new DragAndDropTitlePlugin();
329
+ }
281
330
  t._grid.loadPlugin(t._dtp);
282
331
 
283
332
  t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
@@ -285,19 +334,7 @@ var Grid = function(placeholder, config) {
285
334
 
286
335
  t._grid.enableRowHighlighting(true);
287
336
 
288
- t._dc = new DataCache();
289
- t._dc.listen("dataChanged", t._onDataChanged);
290
- t._dc.listen("dataComposed", t._onDataComposed);
291
- t._dc.listen("dataComposed", t._recalculateFormulas); // This will be called after _onDataComposed
292
-
293
- t._dt = new DataTable();
294
- t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
295
- t._dv = new DataView(t._dt);
296
- t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
297
- t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
298
-
299
337
  t._addGridSections();
300
- t._grid.setDataSource(t._dv);
301
338
  t._grid.setParent(t._topNode);
302
339
 
303
340
  t._snapshot = new SnapshotFiller();
@@ -325,6 +362,10 @@ Ext.inherits(Grid, EventDispatcher);
325
362
  * @type {Element}
326
363
  */
327
364
  Grid.prototype._topNode = null;
365
+ /** @private
366
+ * @type {Grid}
367
+ */
368
+ Grid.prototype._mainGrid = null;
328
369
  /** @private
329
370
  * @type {Core}
330
371
  */
@@ -344,6 +385,15 @@ Grid.prototype._dt = null;
344
385
  * @private
345
386
  */
346
387
  Grid.prototype._dv = null;
388
+ /** @type {boolean}
389
+ * @private
390
+ */
391
+ Grid.prototype._sharedDataSource = false;
392
+ /** @type {boolean}
393
+ * @private
394
+ */
395
+ Grid.prototype._sharedSorter = false;
396
+
347
397
  /** JET.Quotes2 Subscription
348
398
  * @type {Object}
349
399
  * @private
@@ -450,6 +500,8 @@ Grid.prototype.dispose = function() {
450
500
  this._grid.dispose();
451
501
  this._connector.reset();
452
502
 
503
+ this._mainGrid = this._dt = this._dv = null;
504
+
453
505
  if(this._subs) {
454
506
  this._subs["dispose"]();
455
507
  this._subs = null;
@@ -476,7 +528,7 @@ Grid.prototype.listen = Grid.prototype.addEventListener;
476
528
  /** @public
477
529
  */
478
530
  Grid.prototype.initSubscription = function() {
479
- if(this._dc.getSubscriptions()) { // Subscription is already initialized
531
+ if(!this._dc || this._dc.getSubscriptions()) { // Subscription is already initialized
480
532
  return;
481
533
  }
482
534
 
@@ -519,7 +571,7 @@ Grid.prototype.updateLayout = function() {
519
571
  this._grid.updateLayout();
520
572
  this._stp.updateSortSymbols(); // HACK: There is a chance that grid may not yet be in the document
521
573
  };
522
- /** Force rerender of grid row. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
574
+ /** Force rerender of grid rows. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
523
575
  * @private
524
576
  * @param {number=} rowIndex
525
577
  */
@@ -637,6 +689,8 @@ Grid.prototype.initialize = function(gridOption) {
637
689
  var t = this; // For minimizing file size
638
690
  t._initializing = true;
639
691
  var grid = t._grid; // core grid
692
+ gridOption = grid.normalizeConfig(gridOption);
693
+
640
694
  var exts = gridOption["plugins"] || gridOption["extensions"];
641
695
 
642
696
  var cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
@@ -742,17 +796,13 @@ Grid.prototype.initialize = function(gridOption) {
742
796
  if(gridOption["autoHideScrollbar"] != null) {
743
797
  grid.autoHideScrollbars(gridOption["autoHideScrollbar"] ? true : false);
744
798
  }
799
+ if(gridOption["scrollbarParent"] != null) {
800
+ t._setScrollbarParent(gridOption["scrollbarParent"]);
801
+ }
745
802
 
746
803
  // Column operations
747
804
  t.setColumns(cols);
748
805
 
749
- var columnFreezing = gridOption["columnFreezing"] || gridOption["freezeColumn"];
750
- if(columnFreezing == null) {
751
- columnFreezing = -1; // Prevent disable scroll when passing null
752
- }
753
-
754
- var pinnedRightColumns = gridOption["pinnedRightColumns"];
755
-
756
806
  var rowVir = true;
757
807
  if (gridOption["rowVirtualRendering"] != null) {
758
808
  rowVir = gridOption["rowVirtualRendering"];
@@ -762,21 +812,18 @@ Grid.prototype.initialize = function(gridOption) {
762
812
  }
763
813
  grid.enableRowVirtualization(!!rowVir);
764
814
 
765
- if (!pinnedRightColumns) {
766
- var colVir = false;
767
- if (gridOption["columnVirtualRendering"] != null) {
768
- colVir = gridOption["columnVirtualRendering"];
769
- }
770
- if (gridOption["columnVirtualization"] != null) {
771
- colVir = gridOption["columnVirtualization"];
772
- }
773
- grid.enableColumnVirtualization(!!colVir);
815
+ var colVir = false;
816
+ if (gridOption["columnVirtualRendering"] != null) {
817
+ colVir = gridOption["columnVirtualRendering"];
818
+ }
819
+ if (gridOption["columnVirtualization"] != null) {
820
+ colVir = gridOption["columnVirtualization"];
774
821
  }
822
+ grid.enableColumnVirtualization(!!colVir);
775
823
 
776
824
  var scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
777
825
  if (scrollbar) {
778
826
  t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
779
- grid.freezeColumn(columnFreezing, pinnedRightColumns); // Enable horizontal scrollbar
780
827
  } else {
781
828
  grid.freezeSection(null); // Disable vertical scrollbar
782
829
  t._topNode.style.overflow = "";
@@ -923,8 +970,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
923
970
  grid.getConfigObject(obj);
924
971
  }
925
972
 
973
+ var i;
926
974
  var len = this.getColumnCount();
927
- for (var i = 0; i < len; ++i) {
975
+ for (i = 0; i < len; ++i) {
928
976
  var column = columns[i];
929
977
  if(!column) {
930
978
  column = columns[i] = {};
@@ -957,11 +1005,6 @@ Grid.prototype.getConfigObject = function (gridOptions) {
957
1005
  obj["autoLayoutUpdate"] = true;
958
1006
  }
959
1007
 
960
- val = grid.getHScrollStartIndex();
961
- if(val > 0) {
962
- obj["columnFreezing"] = val - 1;
963
- }
964
-
965
1008
  if (this._defaultColumnOptions) {
966
1009
  obj["defaultColumnOptions"] = this._defaultColumnOptions;
967
1010
  }
@@ -978,12 +1021,45 @@ Grid.prototype.getConfigObject = function (gridOptions) {
978
1021
  obj["lang"] = this._lang;
979
1022
  }
980
1023
 
1024
+ // get all rows config
1025
+ var rowDefs = this.getAllRowDefinitions();
1026
+ var rows = obj["rows"] = [];
1027
+ var rowDef, rowConfig, pluginInstance, retObj, row;
1028
+ len = rowDefs.length;
1029
+ for (i = 0; i < len; i++) {
1030
+ rowDef = rowDefs[i];
1031
+ rowConfig = rowDef.getConfigObject();
1032
+ rows.push(rowConfig);
1033
+ }
1034
+
1035
+ // get row config from extensions
1036
+ var extensions = grid.getPlugins();
1037
+ for(var key in extensions) {
1038
+ pluginInstance = extensions[key];
1039
+ if(typeof pluginInstance["getRowConfigObject"] === "function") {
1040
+ len = rows.length;
1041
+ for (i = 0; i < len; i++) {
1042
+ rowDef = rowDefs[i];
1043
+ row = rows[i];
1044
+ retObj = pluginInstance["getRowConfigObject"](rowDef.getRowId());
1045
+ if(retObj) {
1046
+ if(row.values) {
1047
+ // eslint-disable-next-line es5/no-es6-static-methods
1048
+ Object.assign(row.values, retObj); // Ignore lint
1049
+ } else {
1050
+ row.values = retObj;
1051
+ }
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+
981
1057
  // TODO: The following states need to be retrieved
982
1058
  // noColumnDragging
983
1059
  // rowHighlighting
984
- // pinnedRightColumns
985
1060
  // columnVirtualization
986
1061
  // topFreezingCount, bottomFreezingCount
1062
+ // scrollbarParent
987
1063
 
988
1064
  // NOTE: no need to export synapseApiKey and RTK
989
1065
 
@@ -1154,6 +1230,22 @@ Grid.prototype._onFieldLoaded = function (field, referrer) {
1154
1230
  this._connector.addFields(field, referrer);
1155
1231
  };
1156
1232
 
1233
+ /**
1234
+ * @private
1235
+ * @param {Element} host
1236
+ */
1237
+ Grid.prototype._setScrollbarParent = function (host) {
1238
+ host.style.boxSizing = "border-box";
1239
+ host.style.overflow = "hidden";
1240
+ host.style.position = "relative";
1241
+
1242
+ this._topNode.style.height = "100%";
1243
+
1244
+ this._grid.autoHideScrollbars(false);
1245
+ this._grid.getVScrollbar().attachToExternalElement(host);
1246
+ this._grid.getHScrollbar().attachToExternalElement(host);
1247
+ };
1248
+
1157
1249
  /**
1158
1250
  * @private
1159
1251
  * @param {string} field
@@ -1263,8 +1355,9 @@ Grid.prototype._onColumnAdded = function(e) {
1263
1355
  }
1264
1356
  var colField = colDef.getField();
1265
1357
  if (!colDef.isRealTimeField()) {
1266
- // not realtime filed
1267
- this._dc.addStaticFields([colField]);
1358
+ if(this._dc) {
1359
+ this._dc.addStaticFields([colField]);
1360
+ }
1268
1361
  }
1269
1362
  this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
1270
1363
 
@@ -1311,7 +1404,9 @@ Grid.prototype.removeColumn = function(colRef) {
1311
1404
 
1312
1405
  var colDef = this.getColumnDefinition(colIndex);
1313
1406
  if(!colDef.isRealTimeField()) {
1314
- this._dc.removeStaticFields([colDef.getField()]);
1407
+ if(this._dc) {
1408
+ this._dc.removeStaticFields([colDef.getField()]);
1409
+ }
1315
1410
  }
1316
1411
  colDef.dispose();
1317
1412
  this._grid.removeColumnAt(colIndex);
@@ -1351,7 +1446,9 @@ Grid.prototype.removeColumns = function(colRefs) {
1351
1446
  }
1352
1447
 
1353
1448
  if(staticFields.length) {
1354
- this._dc.removeStaticFields(staticFields);
1449
+ if(this._dc) {
1450
+ this._dc.removeStaticFields(staticFields);
1451
+ }
1355
1452
  }
1356
1453
  this._grid.freezeLayout(prevState);
1357
1454
  };
@@ -1366,7 +1463,9 @@ Grid.prototype.removeAllColumns = function() {
1366
1463
  return;
1367
1464
  }
1368
1465
 
1369
- this.clearSort();
1466
+ if(!this._sharedSorter) {
1467
+ this.clearSort();
1468
+ }
1370
1469
  for(var i = colCount; --i >= 0;) {
1371
1470
  // WARNING: This may affect plugins event listeners
1372
1471
  this._grid.setColumnDataBindingHandler(i, null);
@@ -1379,7 +1478,9 @@ Grid.prototype.removeAllColumns = function() {
1379
1478
 
1380
1479
  this._connector.removeAllFields();
1381
1480
  this._grid.setColumnCount(0);
1382
- this._dc.resetStaticFields();
1481
+ if(this._dc) {
1482
+ this._dc.resetStaticFields();
1483
+ }
1383
1484
  };
1384
1485
 
1385
1486
  /**
@@ -1686,6 +1787,10 @@ Grid.prototype._initDuplicateRicData = function(rowDef) {
1686
1787
  * grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
1687
1788
  */
1688
1789
  Grid.prototype.insertRow = function(rowOption, rowRef) {
1790
+ if(this._mainGrid) {
1791
+ return this._mainGrid.insertRow(rowOption, this._getRowId(rowRef));
1792
+ }
1793
+
1689
1794
  if(rowOption) {
1690
1795
  if(typeof rowOption === "string") {
1691
1796
  rowOption = { "ric": rowOption };
@@ -1703,6 +1808,9 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
1703
1808
  }
1704
1809
 
1705
1810
  rowDef.registerToView(this._dv, this._getRowId(rowRef));
1811
+ if(rowOption && rowOption["hidden"]) {
1812
+ this._dv.hideRow(rowDef.getRowId()); // Try to obtain rowId in rowDef since rowId is not assigned when new rows are created.
1813
+ }
1706
1814
  this._connector.addRic(rowDef);
1707
1815
  return rowDef;
1708
1816
  };
@@ -1720,6 +1828,10 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
1720
1828
  * ]); // 4 rows are appended
1721
1829
  */
1722
1830
  Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
1831
+ if(this._mainGrid) {
1832
+ this._mainGrid.insertRows(rowOptions, this._getRowId(rowRef));
1833
+ return;
1834
+ }
1723
1835
  if(!Array.isArray(rowOptions)) {
1724
1836
  return;
1725
1837
  }
@@ -1763,6 +1875,11 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
1763
1875
  * grid.logDV({"colNames": ["field1", "field2", "field3", "field4"]}); // See results in console
1764
1876
  */
1765
1877
  Grid.prototype.addStaticDataRows = function(dataRows, fields) {
1878
+ if(this._mainGrid) {
1879
+ this._mainGrid.addStaticDataRows(dataRows, fields);
1880
+ return;
1881
+ }
1882
+
1766
1883
  if(!Array.isArray(dataRows)) {
1767
1884
  var userObj = dataRows;
1768
1885
  dataRows = null;
@@ -1890,6 +2007,9 @@ Grid._dataToRowOptions = function(item) {
1890
2007
  * @see {@link Grid#removeAllRows}
1891
2008
  */
1892
2009
  Grid.prototype.removeRow = function(rowRef) {
2010
+ if(this._mainGrid) {
2011
+ return this._mainGrid.removeRow(this._getRowId(rowRef));
2012
+ }
1893
2013
  var rowDef = this._getRowDefinition(rowRef);
1894
2014
  if(rowDef) {
1895
2015
  if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
@@ -1911,6 +2031,9 @@ Grid.prototype.removeRows = function(rowRefs) {
1911
2031
  rowDef = this.removeRow(rowRefs);
1912
2032
  return rowDef ? [rowDef] : [];
1913
2033
  }
2034
+ if(this._mainGrid) {
2035
+ return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
2036
+ }
1914
2037
 
1915
2038
  var i;
1916
2039
  var rowDefs = [];
@@ -1946,14 +2069,19 @@ Grid.prototype.removeRows = function(rowRefs) {
1946
2069
  * @see {@link Grid#removeRows}
1947
2070
  */
1948
2071
  Grid.prototype.removeAllRows = function() {
2072
+ if(this._sharedDataSource) {
2073
+ return;
2074
+ }
1949
2075
  if(!this._dt.getRowCount()) {
1950
2076
  return;
1951
2077
  }
1952
2078
  var rowDefs = this._getAllRowDefinitions();
1953
2079
 
1954
- this._dc.clearAllData();
1955
- this._dt.clearAllData();
1956
- this._clearDataUpdates();
2080
+ if(!this._sharedDataSource) {
2081
+ this._dc.clearAllData();
2082
+ this._dt.clearAllData();
2083
+ this._clearDataUpdates();
2084
+ }
1957
2085
 
1958
2086
  rowDefs.forEach(RowDefinition.dispose);
1959
2087
 
@@ -1971,6 +2099,9 @@ Grid.prototype.removeAllRows = function() {
1971
2099
  * @param {!RowDefinition} rowDef
1972
2100
  */
1973
2101
  Grid.prototype._removeRow = function(rowDef) {
2102
+ if(this._sharedDataSource) {
2103
+ return;
2104
+ }
1974
2105
  this._dispatch("beforeRowRemoved", {});
1975
2106
 
1976
2107
  var rowIds = rowDef.getAllDescendantIds(); // TODO: Support nested child
@@ -1987,7 +2118,9 @@ Grid.prototype._removeRow = function(rowDef) {
1987
2118
  * @param {boolean=} hidden if false, show instead of hide
1988
2119
  */
1989
2120
  Grid.prototype.hideRow = function(rowRef, hidden) {
1990
- this._grid.hideRow(this._getRowId(rowRef), hidden);
2121
+ var rid = this._getRowId(rowRef);
2122
+ var grid = this._mainGrid || this._grid;
2123
+ grid.hideRow(rid, hidden);
1991
2124
  };
1992
2125
 
1993
2126
  /** Hide row(s) in the Grid by specifying the rIds
@@ -2000,7 +2133,8 @@ Grid.prototype.hideRows = function (rowRefs, hidden) {
2000
2133
  rowRefs = [rowRefs];
2001
2134
  }
2002
2135
  var rids = rowRefs.map(this._getRowId);
2003
- this._grid.hideRows(rids, hidden );
2136
+ var grid = this._mainGrid || this._grid;
2137
+ grid.hideRows(rids, hidden);
2004
2138
  };
2005
2139
  /**
2006
2140
  * Show row(s) in the Grid by specifying the rIds
@@ -2032,6 +2166,10 @@ Grid.prototype.hasHiddenRow = function(){
2032
2166
  * @param {string} str
2033
2167
  */
2034
2168
  Grid.prototype.setRic = function(rowRef, str) {
2169
+ if(this._mainGrid) {
2170
+ this._mainGrid.setRic(this._toRowId(rowRef), str);
2171
+ return;
2172
+ }
2035
2173
  var rowDef = this._getRowDefinition(rowRef);
2036
2174
  if(rowDef) {
2037
2175
  var oldRic = rowDef.getRic();
@@ -2225,6 +2363,17 @@ Grid.prototype.getRowDefinitions = function() {
2225
2363
  Grid.prototype._getAllRowDefinitions = function() {
2226
2364
  return this._dt.getColumnData(ROW_DEF); // no group header rows
2227
2365
  };
2366
+ /** Get all row definitions, including filtered and hidden rows, but without group header rows.
2367
+ * @public
2368
+ * @param {boolean=} inclAutoGenerate=false means exclude auto generate rows
2369
+ * @return {!Array.<RowDefinition>}
2370
+ */
2371
+ Grid.prototype.getAllRowDefinitions = function(inclAutoGenerate) {
2372
+ if(!inclAutoGenerate) {
2373
+ return this._dt.getColumnData(ROW_DEF).filter(excludeAutoGenerated);
2374
+ }
2375
+ return this._getAllRowDefinitions();
2376
+ };
2228
2377
  /** A shorthand to retrieve row data based on index of the specified row.
2229
2378
  * @public
2230
2379
  * @param {number} rowIndex Row index as shown in the view
@@ -2402,11 +2551,14 @@ Grid.prototype.getAllFields = function() {
2402
2551
  /** Freeze the column at the left side of the table starting from index 0 to the specified colIndex
2403
2552
  * If no index is specified (null or undefined index), unfreeze all columns.
2404
2553
  * @public
2405
- * @param {number=} opt_colIndex
2554
+ * @param {number=} colIndex Negative index is equivalent to null value
2406
2555
  * @param {number=} pinnedRightColumns Number of columns to be pinned/snapped on the right side
2407
2556
  */
2408
- Grid.prototype.freezeColumn = function(opt_colIndex, pinnedRightColumns) {
2409
- this._grid.freezeColumn(opt_colIndex, pinnedRightColumns);
2557
+ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
2558
+ if(colIndex == null) {
2559
+ colIndex = -1;
2560
+ }
2561
+ this._grid.freezeColumn(colIndex, pinnedRightColumns);
2410
2562
  };
2411
2563
 
2412
2564
  /** @private
@@ -2721,6 +2873,23 @@ Grid.prototype.focus = function() {
2721
2873
  Grid.prototype.requestRowRefresh = function() {
2722
2874
  this._grid.requestRowRefresh();
2723
2875
  };
2876
+ /** Force recalculation of grid's layout
2877
+ * @public
2878
+ */
2879
+ Grid.prototype.updateLayout = function() {
2880
+ this._grid.updateLayout();
2881
+ };
2882
+ /** Get extension instance
2883
+ * @public
2884
+ * @param {string} str Extension name
2885
+ * @return {*} Returns null, if the specified extension does not exist
2886
+ */
2887
+ Grid.prototype.getExtension = function(str) {
2888
+ if(str) {
2889
+ return this._grid.getPlugin(str.replace(/Extension/ig, ""));
2890
+ }
2891
+ return null;
2892
+ };
2724
2893
 
2725
2894
  /** @private
2726
2895
  * @param {Object} e
@@ -2801,9 +2970,9 @@ Grid.prototype._recalculateFormulas = function(e) {
2801
2970
  if(e && e["rid"]) {
2802
2971
  this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
2803
2972
  } else {
2804
- var rows = this._dc.getAllRowData(); // Slow
2973
+ var rows = this._dc ? this._dc.getAllRowData() : null; // Slow
2805
2974
 
2806
- var rowCount = rows.length;
2975
+ var rowCount = rows ? rows.length : 0;
2807
2976
  for(var r = 0; r < rowCount; ++r) { // WARNING: This is very slow
2808
2977
  this._fnEngine.calculate(rows[r]);
2809
2978
  }