@refinitiv-ui/efx-grid 6.0.0-next.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.js +80 -18
  2. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  3. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  4. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  5. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  6. package/lib/core/dist/core.css +1 -1
  7. package/lib/core/dist/core.js +12961 -10749
  8. package/lib/core/dist/core.min.js +1 -1
  9. package/lib/core/es6/data/DataView.d.ts +22 -7
  10. package/lib/core/es6/data/DataView.js +176 -49
  11. package/lib/core/es6/data/WrappedView.d.ts +289 -0
  12. package/lib/core/es6/data/WrappedView.js +1319 -0
  13. package/lib/core/es6/grid/Core.d.ts +13 -0
  14. package/lib/core/es6/grid/Core.js +393 -155
  15. package/lib/core/es6/grid/ILayoutGrid.d.ts +8 -0
  16. package/lib/core/es6/grid/ILayoutGrid.js +45 -2
  17. package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
  18. package/lib/core/es6/grid/LayoutGrid.js +257 -82
  19. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
  20. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +314 -27
  21. package/lib/core/es6/grid/components/Column.js +8 -2
  22. package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
  23. package/lib/core/es6/grid/components/HScrollbar.js +20 -4
  24. package/lib/core/es6/grid/util/TrackLayout.d.ts +1 -1
  25. package/lib/core/es6/grid/util/TrackLayout.js +2 -3
  26. package/lib/core/es6/tr-grid-theme.js +1 -1
  27. package/lib/filter-dialog/lib/filter-dialog.js +8 -6
  28. package/lib/grid/lib/efx-grid.d.ts +14 -7
  29. package/lib/grid/lib/efx-grid.js +113 -114
  30. package/lib/grid/themes/base.less +4 -2
  31. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  32. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  33. package/lib/grid/themes/halo/efx-grid.less +69 -32
  34. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  35. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  36. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  37. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  38. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  39. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  40. package/lib/index.d.ts +56 -56
  41. package/lib/index.js +56 -56
  42. package/lib/row-segmenting/es6/RowSegmenting.d.ts +1 -0
  43. package/lib/row-segmenting/es6/RowSegmenting.js +40 -11
  44. package/lib/rt-grid/dist/rt-grid.js +10290 -7864
  45. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  46. package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
  47. package/lib/rt-grid/es6/ColumnDefinition.js +3 -0
  48. package/lib/rt-grid/es6/Grid.d.ts +14 -7
  49. package/lib/rt-grid/es6/Grid.js +241 -74
  50. package/lib/rt-grid/es6/RowDefinition.d.ts +4 -1
  51. package/lib/rt-grid/es6/RowDefinition.js +52 -2
  52. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
  53. package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
  54. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
  55. package/lib/tr-grid-checkbox/es6/Checkbox.js +29 -14
  56. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  57. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
  58. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
  59. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +226 -4
  60. package/lib/tr-grid-column-stack/es6/ColumnStack.js +3 -0
  61. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -0
  62. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
  63. package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
  64. package/lib/tr-grid-row-dragging/es6/RowDragging.js +102 -12
  65. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
  66. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
  67. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +41 -31
  68. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +5 -1
  69. package/lib/tr-grid-row-selection/es6/RowSelection.js +188 -7
  70. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  71. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
  72. package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
  73. package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
  74. package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
  75. package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
  76. package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
  77. package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
  78. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
  79. package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
  80. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
  81. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
  82. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
  83. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
  84. package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
  85. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
  86. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +2 -2
  87. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  88. package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
  89. package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
  90. package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
  91. package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
  92. package/lib/tr-grid-util/es6/RowPainter.js +66 -12
  93. package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
  94. package/lib/tr-grid-util/es6/Table.d.ts +13 -13
  95. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
  96. package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
  97. package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
  98. package/lib/tr-grid-util/es6/Util.d.ts +6 -6
  99. package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
  100. package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
  101. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
  102. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
  103. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
  104. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
  105. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
  106. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
  107. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
  108. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
  109. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
  110. package/lib/types/es6/CellSelection.d.ts +1 -1
  111. package/lib/types/es6/Checkbox.d.ts +2 -0
  112. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  113. package/lib/types/es6/ColumnSelection.d.ts +5 -1
  114. package/lib/types/es6/Core/data/DataView.d.ts +22 -7
  115. package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
  116. package/lib/types/es6/Core/grid/Core.d.ts +13 -0
  117. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +8 -0
  118. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
  119. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
  120. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
  121. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +1 -1
  122. package/lib/types/es6/FilterInput.d.ts +4 -2
  123. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +4 -1
  124. package/lib/types/es6/RealtimeGrid/Grid.d.ts +15 -8
  125. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -1
  126. package/lib/types/es6/RowColoring.d.ts +2 -0
  127. package/lib/types/es6/RowFiltering.d.ts +2 -0
  128. package/lib/types/es6/RowSegmenting.d.ts +1 -0
  129. package/lib/types/es6/RowSelection.d.ts +5 -1
  130. package/lib/types/es6/Zoom.d.ts +2 -1
  131. package/lib/types/es6/index.d.ts +2 -0
  132. package/lib/versions.json +17 -17
  133. package/lib/zoom/es6/Zoom.d.ts +2 -1
  134. package/lib/zoom/es6/Zoom.js +11 -4
  135. 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,56 @@ 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
+ if(t._stp) {
308
+ this._sharedSorter = true;
309
+ t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
310
+ } else { // Create built-in plugin
311
+ t._stp = new SortableTitlePlugin({
312
+ "userManagedLogic": true,
313
+ "sortableColumns": true,
314
+ "disableDoubleClickToSort": true,
315
+ "ROW_DEF": true // Enable Row Definition Mode
316
+ });
317
+ t._stp.listen("preDataSorting", t._onPreDataSorting);
318
+
319
+ // TODO: Built-in plugins don't have normal workflow unlike other extensions. Make them have the same workflow like the others
320
+ // defaultColumnOptions property does not work with them.
321
+ // beforeInit is not called.
322
+ t._grid.loadPlugin(t._stp, config);
323
+ }
324
+ if(!t._dtp) { // Create built-in plugin
325
+ t._dtp = new DragAndDropTitlePlugin();
326
+ }
281
327
  t._grid.loadPlugin(t._dtp);
282
328
 
283
329
  t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
@@ -285,17 +331,6 @@ var Grid = function(placeholder, config) {
285
331
 
286
332
  t._grid.enableRowHighlighting(true);
287
333
 
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
334
  t._addGridSections();
300
335
  t._grid.setDataSource(t._dv);
301
336
  t._grid.setParent(t._topNode);
@@ -325,6 +360,10 @@ Ext.inherits(Grid, EventDispatcher);
325
360
  * @type {Element}
326
361
  */
327
362
  Grid.prototype._topNode = null;
363
+ /** @private
364
+ * @type {Grid}
365
+ */
366
+ Grid.prototype._mainGrid = null;
328
367
  /** @private
329
368
  * @type {Core}
330
369
  */
@@ -344,6 +383,15 @@ Grid.prototype._dt = null;
344
383
  * @private
345
384
  */
346
385
  Grid.prototype._dv = null;
386
+ /** @type {boolean}
387
+ * @private
388
+ */
389
+ Grid.prototype._sharedDataSource = false;
390
+ /** @type {boolean}
391
+ * @private
392
+ */
393
+ Grid.prototype._sharedSorter = false;
394
+
347
395
  /** JET.Quotes2 Subscription
348
396
  * @type {Object}
349
397
  * @private
@@ -450,6 +498,8 @@ Grid.prototype.dispose = function() {
450
498
  this._grid.dispose();
451
499
  this._connector.reset();
452
500
 
501
+ this._mainGrid = this._dt = this._dv = null;
502
+
453
503
  if(this._subs) {
454
504
  this._subs["dispose"]();
455
505
  this._subs = null;
@@ -476,7 +526,7 @@ Grid.prototype.listen = Grid.prototype.addEventListener;
476
526
  /** @public
477
527
  */
478
528
  Grid.prototype.initSubscription = function() {
479
- if(this._dc.getSubscriptions()) { // Subscription is already initialized
529
+ if(!this._dc || this._dc.getSubscriptions()) { // Subscription is already initialized
480
530
  return;
481
531
  }
482
532
 
@@ -519,7 +569,7 @@ Grid.prototype.updateLayout = function() {
519
569
  this._grid.updateLayout();
520
570
  this._stp.updateSortSymbols(); // HACK: There is a chance that grid may not yet be in the document
521
571
  };
522
- /** Force rerender of grid row. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
572
+ /** Force rerender of grid rows. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
523
573
  * @private
524
574
  * @param {number=} rowIndex
525
575
  */
@@ -637,6 +687,8 @@ Grid.prototype.initialize = function(gridOption) {
637
687
  var t = this; // For minimizing file size
638
688
  t._initializing = true;
639
689
  var grid = t._grid; // core grid
690
+ gridOption = grid.normalizeConfig(gridOption);
691
+
640
692
  var exts = gridOption["plugins"] || gridOption["extensions"];
641
693
 
642
694
  var cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
@@ -742,17 +794,13 @@ Grid.prototype.initialize = function(gridOption) {
742
794
  if(gridOption["autoHideScrollbar"] != null) {
743
795
  grid.autoHideScrollbars(gridOption["autoHideScrollbar"] ? true : false);
744
796
  }
797
+ if(gridOption["scrollbarParent"] != null) {
798
+ t._setScrollbarParent(gridOption["scrollbarParent"]);
799
+ }
745
800
 
746
801
  // Column operations
747
802
  t.setColumns(cols);
748
803
 
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
804
  var rowVir = true;
757
805
  if (gridOption["rowVirtualRendering"] != null) {
758
806
  rowVir = gridOption["rowVirtualRendering"];
@@ -762,21 +810,18 @@ Grid.prototype.initialize = function(gridOption) {
762
810
  }
763
811
  grid.enableRowVirtualization(!!rowVir);
764
812
 
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);
813
+ var colVir = false;
814
+ if (gridOption["columnVirtualRendering"] != null) {
815
+ colVir = gridOption["columnVirtualRendering"];
816
+ }
817
+ if (gridOption["columnVirtualization"] != null) {
818
+ colVir = gridOption["columnVirtualization"];
774
819
  }
820
+ grid.enableColumnVirtualization(!!colVir);
775
821
 
776
822
  var scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
777
823
  if (scrollbar) {
778
824
  t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
779
- grid.freezeColumn(columnFreezing, pinnedRightColumns); // Enable horizontal scrollbar
780
825
  } else {
781
826
  grid.freezeSection(null); // Disable vertical scrollbar
782
827
  t._topNode.style.overflow = "";
@@ -923,8 +968,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
923
968
  grid.getConfigObject(obj);
924
969
  }
925
970
 
971
+ var i;
926
972
  var len = this.getColumnCount();
927
- for (var i = 0; i < len; ++i) {
973
+ for (i = 0; i < len; ++i) {
928
974
  var column = columns[i];
929
975
  if(!column) {
930
976
  column = columns[i] = {};
@@ -957,11 +1003,6 @@ Grid.prototype.getConfigObject = function (gridOptions) {
957
1003
  obj["autoLayoutUpdate"] = true;
958
1004
  }
959
1005
 
960
- val = grid.getHScrollStartIndex();
961
- if(val > 0) {
962
- obj["columnFreezing"] = val - 1;
963
- }
964
-
965
1006
  if (this._defaultColumnOptions) {
966
1007
  obj["defaultColumnOptions"] = this._defaultColumnOptions;
967
1008
  }
@@ -978,12 +1019,45 @@ Grid.prototype.getConfigObject = function (gridOptions) {
978
1019
  obj["lang"] = this._lang;
979
1020
  }
980
1021
 
1022
+ // get all rows config
1023
+ var rowDefs = this.getAllRowDefinitions();
1024
+ var rows = obj["rows"] = [];
1025
+ var rowDef, rowConfig, pluginInstance, retObj, row;
1026
+ len = rowDefs.length;
1027
+ for (i = 0; i < len; i++) {
1028
+ rowDef = rowDefs[i];
1029
+ rowConfig = rowDef.getConfigObject();
1030
+ rows.push(rowConfig);
1031
+ }
1032
+
1033
+ // get row config from extensions
1034
+ var extensions = grid.getPlugins();
1035
+ for(var key in extensions) {
1036
+ pluginInstance = extensions[key];
1037
+ if(typeof pluginInstance["getRowConfigObject"] === "function") {
1038
+ len = rows.length;
1039
+ for (i = 0; i < len; i++) {
1040
+ rowDef = rowDefs[i];
1041
+ row = rows[i];
1042
+ retObj = pluginInstance["getRowConfigObject"](rowDef.getRowId());
1043
+ if(retObj) {
1044
+ if(row.values) {
1045
+ // eslint-disable-next-line es5/no-es6-static-methods
1046
+ Object.assign(row.values, retObj); // Ignore lint
1047
+ } else {
1048
+ row.values = retObj;
1049
+ }
1050
+ }
1051
+ }
1052
+ }
1053
+ }
1054
+
981
1055
  // TODO: The following states need to be retrieved
982
1056
  // noColumnDragging
983
1057
  // rowHighlighting
984
- // pinnedRightColumns
985
1058
  // columnVirtualization
986
1059
  // topFreezingCount, bottomFreezingCount
1060
+ // scrollbarParent
987
1061
 
988
1062
  // NOTE: no need to export synapseApiKey and RTK
989
1063
 
@@ -1154,6 +1228,22 @@ Grid.prototype._onFieldLoaded = function (field, referrer) {
1154
1228
  this._connector.addFields(field, referrer);
1155
1229
  };
1156
1230
 
1231
+ /**
1232
+ * @private
1233
+ * @param {Element} host
1234
+ */
1235
+ Grid.prototype._setScrollbarParent = function (host) {
1236
+ host.style.boxSizing = "border-box";
1237
+ host.style.overflow = "hidden";
1238
+ host.style.position = "relative";
1239
+
1240
+ this._topNode.style.height = "100%";
1241
+
1242
+ this._grid.autoHideScrollbars(false);
1243
+ this._grid.getVScrollbar().attachToExternalElement(host);
1244
+ this._grid.getHScrollbar().attachToExternalElement(host);
1245
+ };
1246
+
1157
1247
  /**
1158
1248
  * @private
1159
1249
  * @param {string} field
@@ -1263,8 +1353,9 @@ Grid.prototype._onColumnAdded = function(e) {
1263
1353
  }
1264
1354
  var colField = colDef.getField();
1265
1355
  if (!colDef.isRealTimeField()) {
1266
- // not realtime filed
1267
- this._dc.addStaticFields([colField]);
1356
+ if(this._dc) {
1357
+ this._dc.addStaticFields([colField]);
1358
+ }
1268
1359
  }
1269
1360
  this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
1270
1361
 
@@ -1311,7 +1402,9 @@ Grid.prototype.removeColumn = function(colRef) {
1311
1402
 
1312
1403
  var colDef = this.getColumnDefinition(colIndex);
1313
1404
  if(!colDef.isRealTimeField()) {
1314
- this._dc.removeStaticFields([colDef.getField()]);
1405
+ if(this._dc) {
1406
+ this._dc.removeStaticFields([colDef.getField()]);
1407
+ }
1315
1408
  }
1316
1409
  colDef.dispose();
1317
1410
  this._grid.removeColumnAt(colIndex);
@@ -1351,7 +1444,9 @@ Grid.prototype.removeColumns = function(colRefs) {
1351
1444
  }
1352
1445
 
1353
1446
  if(staticFields.length) {
1354
- this._dc.removeStaticFields(staticFields);
1447
+ if(this._dc) {
1448
+ this._dc.removeStaticFields(staticFields);
1449
+ }
1355
1450
  }
1356
1451
  this._grid.freezeLayout(prevState);
1357
1452
  };
@@ -1366,7 +1461,9 @@ Grid.prototype.removeAllColumns = function() {
1366
1461
  return;
1367
1462
  }
1368
1463
 
1369
- this.clearSort();
1464
+ if(!this._sharedSorter) {
1465
+ this.clearSort();
1466
+ }
1370
1467
  for(var i = colCount; --i >= 0;) {
1371
1468
  // WARNING: This may affect plugins event listeners
1372
1469
  this._grid.setColumnDataBindingHandler(i, null);
@@ -1379,7 +1476,9 @@ Grid.prototype.removeAllColumns = function() {
1379
1476
 
1380
1477
  this._connector.removeAllFields();
1381
1478
  this._grid.setColumnCount(0);
1382
- this._dc.resetStaticFields();
1479
+ if(this._dc) {
1480
+ this._dc.resetStaticFields();
1481
+ }
1383
1482
  };
1384
1483
 
1385
1484
  /**
@@ -1686,6 +1785,10 @@ Grid.prototype._initDuplicateRicData = function(rowDef) {
1686
1785
  * grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
1687
1786
  */
1688
1787
  Grid.prototype.insertRow = function(rowOption, rowRef) {
1788
+ if(this._mainGrid) {
1789
+ return this._mainGrid.insertRow(rowOption, this._getRowId(rowRef));
1790
+ }
1791
+
1689
1792
  if(rowOption) {
1690
1793
  if(typeof rowOption === "string") {
1691
1794
  rowOption = { "ric": rowOption };
@@ -1703,6 +1806,9 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
1703
1806
  }
1704
1807
 
1705
1808
  rowDef.registerToView(this._dv, this._getRowId(rowRef));
1809
+ if(rowOption && rowOption["hidden"]) {
1810
+ this._dv.hideRow(rowDef.getRowId()); // Try to obtain rowId in rowDef since rowId is not assigned when new rows are created.
1811
+ }
1706
1812
  this._connector.addRic(rowDef);
1707
1813
  return rowDef;
1708
1814
  };
@@ -1720,6 +1826,10 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
1720
1826
  * ]); // 4 rows are appended
1721
1827
  */
1722
1828
  Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
1829
+ if(this._mainGrid) {
1830
+ this._mainGrid.insertRows(rowOptions, this._getRowId(rowRef));
1831
+ return;
1832
+ }
1723
1833
  if(!Array.isArray(rowOptions)) {
1724
1834
  return;
1725
1835
  }
@@ -1763,6 +1873,11 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
1763
1873
  * grid.logDV({"colNames": ["field1", "field2", "field3", "field4"]}); // See results in console
1764
1874
  */
1765
1875
  Grid.prototype.addStaticDataRows = function(dataRows, fields) {
1876
+ if(this._mainGrid) {
1877
+ this._mainGrid.addStaticDataRows(dataRows, fields);
1878
+ return;
1879
+ }
1880
+
1766
1881
  if(!Array.isArray(dataRows)) {
1767
1882
  var userObj = dataRows;
1768
1883
  dataRows = null;
@@ -1890,6 +2005,9 @@ Grid._dataToRowOptions = function(item) {
1890
2005
  * @see {@link Grid#removeAllRows}
1891
2006
  */
1892
2007
  Grid.prototype.removeRow = function(rowRef) {
2008
+ if(this._mainGrid) {
2009
+ return this._mainGrid.removeRow(this._getRowId(rowRef));
2010
+ }
1893
2011
  var rowDef = this._getRowDefinition(rowRef);
1894
2012
  if(rowDef) {
1895
2013
  if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
@@ -1911,6 +2029,9 @@ Grid.prototype.removeRows = function(rowRefs) {
1911
2029
  rowDef = this.removeRow(rowRefs);
1912
2030
  return rowDef ? [rowDef] : [];
1913
2031
  }
2032
+ if(this._mainGrid) {
2033
+ return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
2034
+ }
1914
2035
 
1915
2036
  var i;
1916
2037
  var rowDefs = [];
@@ -1946,14 +2067,19 @@ Grid.prototype.removeRows = function(rowRefs) {
1946
2067
  * @see {@link Grid#removeRows}
1947
2068
  */
1948
2069
  Grid.prototype.removeAllRows = function() {
2070
+ if(this._sharedDataSource) {
2071
+ return;
2072
+ }
1949
2073
  if(!this._dt.getRowCount()) {
1950
2074
  return;
1951
2075
  }
1952
2076
  var rowDefs = this._getAllRowDefinitions();
1953
2077
 
1954
- this._dc.clearAllData();
1955
- this._dt.clearAllData();
1956
- this._clearDataUpdates();
2078
+ if(!this._sharedDataSource) {
2079
+ this._dc.clearAllData();
2080
+ this._dt.clearAllData();
2081
+ this._clearDataUpdates();
2082
+ }
1957
2083
 
1958
2084
  rowDefs.forEach(RowDefinition.dispose);
1959
2085
 
@@ -1971,6 +2097,9 @@ Grid.prototype.removeAllRows = function() {
1971
2097
  * @param {!RowDefinition} rowDef
1972
2098
  */
1973
2099
  Grid.prototype._removeRow = function(rowDef) {
2100
+ if(this._sharedDataSource) {
2101
+ return;
2102
+ }
1974
2103
  this._dispatch("beforeRowRemoved", {});
1975
2104
 
1976
2105
  var rowIds = rowDef.getAllDescendantIds(); // TODO: Support nested child
@@ -1987,7 +2116,9 @@ Grid.prototype._removeRow = function(rowDef) {
1987
2116
  * @param {boolean=} hidden if false, show instead of hide
1988
2117
  */
1989
2118
  Grid.prototype.hideRow = function(rowRef, hidden) {
1990
- this._grid.hideRow(this._getRowId(rowRef), hidden);
2119
+ var rid = this._getRowId(rowRef);
2120
+ var grid = this._mainGrid || this._grid;
2121
+ grid.hideRow(rid, hidden);
1991
2122
  };
1992
2123
 
1993
2124
  /** Hide row(s) in the Grid by specifying the rIds
@@ -2000,7 +2131,8 @@ Grid.prototype.hideRows = function (rowRefs, hidden) {
2000
2131
  rowRefs = [rowRefs];
2001
2132
  }
2002
2133
  var rids = rowRefs.map(this._getRowId);
2003
- this._grid.hideRows(rids, hidden );
2134
+ var grid = this._mainGrid || this._grid;
2135
+ grid.hideRows(rids, hidden);
2004
2136
  };
2005
2137
  /**
2006
2138
  * Show row(s) in the Grid by specifying the rIds
@@ -2032,6 +2164,10 @@ Grid.prototype.hasHiddenRow = function(){
2032
2164
  * @param {string} str
2033
2165
  */
2034
2166
  Grid.prototype.setRic = function(rowRef, str) {
2167
+ if(this._mainGrid) {
2168
+ this._mainGrid.setRic(this._toRowId(rowRef), str);
2169
+ return;
2170
+ }
2035
2171
  var rowDef = this._getRowDefinition(rowRef);
2036
2172
  if(rowDef) {
2037
2173
  var oldRic = rowDef.getRic();
@@ -2225,6 +2361,17 @@ Grid.prototype.getRowDefinitions = function() {
2225
2361
  Grid.prototype._getAllRowDefinitions = function() {
2226
2362
  return this._dt.getColumnData(ROW_DEF); // no group header rows
2227
2363
  };
2364
+ /** Get all row definitions, including filtered and hidden rows, but without group header rows.
2365
+ * @public
2366
+ * @param {boolean=} inclAutoGenerate=false means exclude auto generate rows
2367
+ * @return {!Array.<RowDefinition>}
2368
+ */
2369
+ Grid.prototype.getAllRowDefinitions = function(inclAutoGenerate) {
2370
+ if(!inclAutoGenerate) {
2371
+ return this._dt.getColumnData(ROW_DEF).filter(excludeAutoGenerated);
2372
+ }
2373
+ return this._getAllRowDefinitions();
2374
+ };
2228
2375
  /** A shorthand to retrieve row data based on index of the specified row.
2229
2376
  * @public
2230
2377
  * @param {number} rowIndex Row index as shown in the view
@@ -2402,11 +2549,14 @@ Grid.prototype.getAllFields = function() {
2402
2549
  /** Freeze the column at the left side of the table starting from index 0 to the specified colIndex
2403
2550
  * If no index is specified (null or undefined index), unfreeze all columns.
2404
2551
  * @public
2405
- * @param {number=} opt_colIndex
2552
+ * @param {number=} colIndex Negative index is equivalent to null value
2406
2553
  * @param {number=} pinnedRightColumns Number of columns to be pinned/snapped on the right side
2407
2554
  */
2408
- Grid.prototype.freezeColumn = function(opt_colIndex, pinnedRightColumns) {
2409
- this._grid.freezeColumn(opt_colIndex, pinnedRightColumns);
2555
+ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
2556
+ if(colIndex == null) {
2557
+ colIndex = -1;
2558
+ }
2559
+ this._grid.freezeColumn(colIndex, pinnedRightColumns);
2410
2560
  };
2411
2561
 
2412
2562
  /** @private
@@ -2721,6 +2871,23 @@ Grid.prototype.focus = function() {
2721
2871
  Grid.prototype.requestRowRefresh = function() {
2722
2872
  this._grid.requestRowRefresh();
2723
2873
  };
2874
+ /** Force recalculation of grid's layout
2875
+ * @public
2876
+ */
2877
+ Grid.prototype.updateLayout = function() {
2878
+ this._grid.updateLayout();
2879
+ };
2880
+ /** Get extension instance
2881
+ * @public
2882
+ * @param {string} str Extension name
2883
+ * @return {*} Returns null, if the specified extension does not exist
2884
+ */
2885
+ Grid.prototype.getExtension = function(str) {
2886
+ if(str) {
2887
+ return this._grid.getPlugin(str.replace(/Extension/ig, ""));
2888
+ }
2889
+ return null;
2890
+ };
2724
2891
 
2725
2892
  /** @private
2726
2893
  * @param {Object} e
@@ -2801,9 +2968,9 @@ Grid.prototype._recalculateFormulas = function(e) {
2801
2968
  if(e && e["rid"]) {
2802
2969
  this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
2803
2970
  } else {
2804
- var rows = this._dc.getAllRowData(); // Slow
2971
+ var rows = this._dc ? this._dc.getAllRowData() : null; // Slow
2805
2972
 
2806
- var rowCount = rows.length;
2973
+ var rowCount = rows ? rows.length : 0;
2807
2974
  for(var r = 0; r < rowCount; ++r) { // WARNING: This is very slow
2808
2975
  this._fnEngine.calculate(rows[r]);
2809
2976
  }