@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.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +49 -0
- package/lib/column-dragging/es6/ColumnDragging.js +764 -0
- package/lib/column-dragging/es6/index.d.ts +1 -0
- package/lib/column-dragging/es6/index.js +1 -0
- package/lib/column-format-dialog/lib/column-format-dialog.d.ts +13 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +15 -2
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +146 -5
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +468 -1092
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.d.ts +2 -2
- package/lib/core/es6/data/DataCache.d.ts +4 -4
- package/lib/core/es6/data/DataTable.d.ts +5 -5
- package/lib/core/es6/data/DataTable.js +33 -11
- package/lib/core/es6/data/DataView.d.ts +12 -18
- package/lib/core/es6/data/DataView.js +0 -4
- package/lib/core/es6/data/Segment.d.ts +2 -0
- package/lib/core/es6/data/Segment.js +7 -0
- package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
- package/lib/core/es6/data/WrappedView.d.ts +13 -13
- package/lib/core/es6/data/WrappedView.js +6 -6
- package/lib/core/es6/grid/Core.d.ts +31 -27
- package/lib/core/es6/grid/Core.js +47 -11
- package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
- package/lib/core/es6/grid/LayoutGrid.js +54 -26
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +71 -0
- package/lib/core/es6/grid/components/Cell.d.ts +4 -4
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
- package/lib/core/es6/grid/components/Column.d.ts +1 -1
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/core/es6/grid/components/Scrollbar.d.ts +3 -1
- package/lib/core/es6/grid/components/Scrollbar.js +13 -0
- package/lib/core/es6/grid/components/StretchedCells.js +2 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
- package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
- package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
- package/lib/core/es6/grid/util/SectionSettings.js +5 -0
- package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
- package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
- package/lib/core/es6/grid/util/TrackLayout.js +27 -0
- package/lib/core/es6/grid/util/util.d.ts +2 -2
- package/lib/core/es6/index.d.ts +1 -5
- package/lib/core/es6/index.js +1 -7
- package/lib/core/es6/tr-grid-theme.js +1 -1
- package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
- package/lib/filter-dialog/lib/filter-dialog.d.ts +14 -1
- package/lib/filter-dialog/lib/filter-dialog.js +86 -26
- package/lib/filter-dialog/themes/base-checkbox.less +8 -1
- package/lib/filter-dialog/themes/base.less +69 -1
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
- package/lib/grid/lib/efx-grid.d.ts +25 -10
- package/lib/grid/lib/efx-grid.js +22 -56
- package/lib/grid/themes/base.less +1 -1
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/efx-grid.less +33 -39
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
- package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
- package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
- package/lib/row-segmenting/es6/RowSegmenting.js +98 -11
- package/lib/rt-grid/dist/rt-grid.js +1244 -1249
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
- package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
- package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
- package/lib/rt-grid/es6/Grid.d.ts +24 -9
- package/lib/rt-grid/es6/Grid.js +285 -103
- package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
- package/lib/rt-grid/es6/RowDefSorter.js +137 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
- package/lib/rt-grid/es6/RowDefinition.js +6 -0
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +6 -1
- package/lib/rt-grid/es6/SnapshotFiller.js +144 -15
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +4 -3
- package/lib/tr-grid-checkbox/es6/Checkbox.js +51 -21
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +4 -3
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +28 -13
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +8 -5
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +106 -3
- package/lib/tr-grid-percent-bar/es6/PercentBar.js +1 -1
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
- package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
- package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +3 -4
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +86 -195
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +8 -8
- package/lib/tr-grid-row-selection/es6/RowSelection.js +55 -31
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
- package/lib/tr-grid-util/es6/CellPainter.js +1 -1
- package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
- package/lib/tr-grid-util/es6/DragUI.js +214 -0
- package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +32 -2
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -1
- package/lib/tr-grid-util/es6/ElfUtil.js +131 -28
- package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
- package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
- package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +8 -0
- package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
- package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
- package/lib/tr-grid-util/es6/RowPainter.js +57 -19
- package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
- package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
- package/lib/types/es6/Checkbox.d.ts +4 -3
- package/lib/types/es6/ColumnStack.d.ts +8 -4
- package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
- package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
- package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
- package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
- package/lib/types/es6/ConditionalColoring.d.ts +4 -3
- package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
- package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
- package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
- package/lib/types/es6/Core/data/DataView.d.ts +12 -18
- package/lib/types/es6/Core/data/Segment.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
- package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
- package/lib/types/es6/Core/grid/Core.d.ts +31 -27
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
- package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
- package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
- package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +3 -1
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
- package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
- package/lib/types/es6/Core/index.d.ts +1 -5
- package/lib/types/es6/ExtensionOptions.d.ts +2 -0
- package/lib/types/es6/InCellEditing.d.ts +8 -5
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +24 -9
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +6 -1
- package/lib/types/es6/RowDragging.d.ts +3 -4
- package/lib/types/es6/RowGrouping.d.ts +7 -2
- package/lib/types/es6/RowSegmenting.d.ts +7 -2
- package/lib/types/es6/RowSelection.d.ts +8 -8
- package/lib/types/es6/TextFormatting.d.ts +1 -1
- package/lib/types/es6/index.d.ts +1 -0
- package/lib/versions.json +17 -16
- package/package.json +1 -1
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
- package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
- package/lib/core/es6/grid/plugins/Plugin.js +0 -272
- package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -13,10 +13,10 @@ import SnapshotFiller from "./SnapshotFiller.js";
|
|
13
13
|
import StyleLoader from "./StyleLoader.js";
|
14
14
|
import FieldDefinition from "./FieldDefinition.js";
|
15
15
|
import DataConnector from "./DataConnector.js";
|
16
|
+
import RowDefSorter from "./RowDefSorter.js";
|
16
17
|
|
17
18
|
import { Core } from "../../core/es6/grid/Core.js";
|
18
19
|
import { SortableTitlePlugin } from "../../core/es6/grid/plugins/SortableTitlePlugin.js";
|
19
|
-
import { DragAndDropTitlePlugin } from "../../core/es6/grid/plugins/DragAndDropTitlePlugin.js";
|
20
20
|
import { DataCache } from "../../core/es6/data/DataCache.js";
|
21
21
|
import { DataTable } from "../../core/es6/data/DataTable.js";
|
22
22
|
import { DataView } from "../../core/es6/data/DataView.js";
|
@@ -31,6 +31,11 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
31
31
|
* @property {boolean=} debug=false If true, Synapse response will be mock
|
32
32
|
*/
|
33
33
|
|
34
|
+
/** @typedef {Object} Grid~ADCOptions
|
35
|
+
* @description ADC requesting level config from adc team
|
36
|
+
* @property {string=} productId=001 required parameter, it specifies the product for which you request data. Contact the adc staff to create one.
|
37
|
+
*/
|
38
|
+
|
34
39
|
/** @typedef {Object} Grid~GridOptions
|
35
40
|
* @description Configuration object that can be provided directly at the initialization phase
|
36
41
|
* @property {Array.<ColumnDefinition~Options|string>=} columns Collection of the column definitions
|
@@ -65,15 +70,18 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
65
70
|
* @property {boolean=} verticalLines=true Vertical lines for all sections
|
66
71
|
* @property {boolean=} horizontalLines=true Horizontal lines for all sections
|
67
72
|
* @property {*=} RTK=null rtk toolkit instance
|
73
|
+
* @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
|
68
74
|
* @property {Grid~SynapseConfig=} synapse=null synapse config object
|
69
75
|
* @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
|
70
76
|
* @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
|
71
77
|
* @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
|
72
78
|
* @property {Function=} dataComposed Handler for dataComposed event
|
73
79
|
* @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
|
74
|
-
* @property {boolean=} textSelect=false If enabled, user can select text
|
80
|
+
* @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
|
75
81
|
* @property {string=} lang laguage for config localization date time, if null the default language is "en"
|
76
82
|
* @property {Element=} scrollbarParent=null Element to be attached by grid's scrollbars, allowing them to move outside and avoid overlapping with the content.
|
83
|
+
* @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
|
84
|
+
* @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
|
77
85
|
*/
|
78
86
|
|
79
87
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -259,6 +267,7 @@ var Grid = function(placeholder, config) {
|
|
259
267
|
t._onFieldLoadedError = t._onFieldLoadedError.bind(t);
|
260
268
|
|
261
269
|
t._snapshotFillerDataChanged = t._snapshotFillerDataChanged.bind(t);
|
270
|
+
t._onPollingInterval = t._onPollingInterval.bind(t);
|
262
271
|
|
263
272
|
t._streamingConflator = new Conflator(50, t._updateStreamingData);
|
264
273
|
t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
|
@@ -272,6 +281,12 @@ var Grid = function(placeholder, config) {
|
|
272
281
|
t._grid = new Core();
|
273
282
|
t._grid._wrapper = this; // For back referencing
|
274
283
|
|
284
|
+
t._sorter = new RowDefSorter();
|
285
|
+
t._sorter.setContext("grid", this);
|
286
|
+
t._sorter.setContext("core", t._grid); // TODO: Handle multiple core grids
|
287
|
+
|
288
|
+
t._dateTimeUtil = DateTime;
|
289
|
+
|
275
290
|
t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
|
276
291
|
|
277
292
|
if(config) {
|
@@ -283,20 +298,15 @@ var Grid = function(placeholder, config) {
|
|
283
298
|
|
284
299
|
var core = t._mainGrid.getCoreGrid();
|
285
300
|
t._stp = core.getPlugin("SortableTitlePlugin");
|
286
|
-
t._dtp = core.getPlugin("DragAndDropTitlePlugin");
|
287
301
|
}
|
288
302
|
if(config["SortableTitle"]) { // Exception for built-in plugin
|
289
303
|
t._stp = config["SortableTitle"];
|
290
304
|
}
|
291
|
-
if(config["DragAndDropTitle"]) { // Exception for built-in plugin
|
292
|
-
t._dtp = config["DragAndDropTitle"];
|
293
|
-
}
|
294
305
|
}
|
295
306
|
if(!t._sharedDataSource) {
|
296
307
|
t._dc = new DataCache();
|
297
308
|
t._dc.listen("dataChanged", t._onDataChanged);
|
298
309
|
t._dc.listen("dataComposed", t._onDataComposed);
|
299
|
-
t._dc.listen("dataComposed", t._recalculateFormulas); // This will be called after _onDataComposed
|
300
310
|
|
301
311
|
t._dt = new DataTable();
|
302
312
|
t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
|
@@ -304,8 +314,11 @@ var Grid = function(placeholder, config) {
|
|
304
314
|
t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
|
305
315
|
t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
|
306
316
|
}
|
317
|
+
t._grid.setDataSource(t._dv); // Avoid triggering sorting
|
318
|
+
|
307
319
|
if(t._stp) {
|
308
|
-
|
320
|
+
t._sharedSorter = true;
|
321
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
309
322
|
t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
|
310
323
|
} else { // Create built-in plugin
|
311
324
|
t._stp = new SortableTitlePlugin({
|
@@ -321,10 +334,6 @@ var Grid = function(placeholder, config) {
|
|
321
334
|
// beforeInit is not called.
|
322
335
|
t._grid.loadPlugin(t._stp, config);
|
323
336
|
}
|
324
|
-
if(!t._dtp) { // Create built-in plugin
|
325
|
-
t._dtp = new DragAndDropTitlePlugin();
|
326
|
-
}
|
327
|
-
t._grid.loadPlugin(t._dtp);
|
328
337
|
|
329
338
|
t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
|
330
339
|
t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
|
@@ -332,7 +341,6 @@ var Grid = function(placeholder, config) {
|
|
332
341
|
t._grid.enableRowHighlighting(true);
|
333
342
|
|
334
343
|
t._addGridSections();
|
335
|
-
t._grid.setDataSource(t._dv);
|
336
344
|
t._grid.setParent(t._topNode);
|
337
345
|
|
338
346
|
t._snapshot = new SnapshotFiller();
|
@@ -345,10 +353,6 @@ var Grid = function(placeholder, config) {
|
|
345
353
|
t._connector.addEventListener("fieldAdded", t._onFieldAdded.bind(t));
|
346
354
|
t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
|
347
355
|
|
348
|
-
t._fnEngine = new Engine();
|
349
|
-
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
350
|
-
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
351
|
-
|
352
356
|
t.initialize(config);
|
353
357
|
t.initSubscription();
|
354
358
|
|
@@ -402,10 +406,6 @@ Grid.prototype._subs = null;
|
|
402
406
|
* @private
|
403
407
|
*/
|
404
408
|
Grid.prototype._stp = null;
|
405
|
-
/** @type {DragAndDropTitlePlugin}
|
406
|
-
* @private
|
407
|
-
*/
|
408
|
-
Grid.prototype._dtp = null;
|
409
409
|
/** @type {Function}
|
410
410
|
* @private
|
411
411
|
*/
|
@@ -423,6 +423,10 @@ Grid.prototype._snapshot = null;
|
|
423
423
|
* @type {DataConnector}
|
424
424
|
*/
|
425
425
|
Grid.prototype._connector = null;
|
426
|
+
/** @private
|
427
|
+
* @type {RowDefSorter}
|
428
|
+
*/
|
429
|
+
Grid.prototype._sorter = null;
|
426
430
|
|
427
431
|
/** @private
|
428
432
|
* @type {Engine}
|
@@ -442,10 +446,6 @@ Grid.prototype._chainMembers = null;
|
|
442
446
|
*/
|
443
447
|
Grid.prototype._chainConflator = null;
|
444
448
|
/** @private
|
445
|
-
* @type {boolean}
|
446
|
-
*/
|
447
|
-
Grid.prototype._hasGroup = false;
|
448
|
-
/** @private
|
449
449
|
* @type {number}
|
450
450
|
*/
|
451
451
|
Grid.prototype._clientWidth = NaN;
|
@@ -461,6 +461,10 @@ Grid.prototype._defaultColumnOptions = null;
|
|
461
461
|
* @type {*}
|
462
462
|
*/
|
463
463
|
Grid.prototype._RTK = null;
|
464
|
+
/** @private
|
465
|
+
* @type {Grid~ADCOptions}
|
466
|
+
*/
|
467
|
+
Grid.prototype._ADCOptions = null;
|
464
468
|
/** use for synapse service
|
465
469
|
* @private
|
466
470
|
* @type {string}
|
@@ -474,15 +478,34 @@ Grid.prototype._autoDateConversion = false;
|
|
474
478
|
* @type {boolean}
|
475
479
|
*/
|
476
480
|
Grid.prototype._textSelect = false;
|
477
|
-
/** @
|
478
|
-
* @
|
481
|
+
/** @type {string}
|
482
|
+
* @private
|
479
483
|
*/
|
480
484
|
Grid.prototype._lang = null;
|
481
|
-
/**
|
485
|
+
/** @type {Object}
|
486
|
+
* @private
|
487
|
+
*/
|
488
|
+
Grid.prototype._dateTimeUtil = null;
|
489
|
+
/** @type {boolean}
|
482
490
|
* @private
|
483
|
-
* @type {boolean}
|
484
491
|
*/
|
485
492
|
Grid.prototype._initializing = false;
|
493
|
+
/** @type {number}
|
494
|
+
* @private
|
495
|
+
*/
|
496
|
+
Grid.prototype._pollingInterval = 0;
|
497
|
+
/** @type {number}
|
498
|
+
* @private
|
499
|
+
*/
|
500
|
+
Grid.prototype._pollingTimerId = 0;
|
501
|
+
/** @type {number}
|
502
|
+
* @private
|
503
|
+
*/
|
504
|
+
Grid.prototype._lastPollingRequest = 0;
|
505
|
+
/** @type {boolean}
|
506
|
+
* @private
|
507
|
+
*/
|
508
|
+
Grid.prototype._pollingEnabled = true;
|
486
509
|
|
487
510
|
|
488
511
|
/** @public
|
@@ -493,8 +516,13 @@ Grid.prototype.dispose = function() {
|
|
493
516
|
clearInterval(this._autoLayoutTimer);
|
494
517
|
this._autoLayoutTimer = 0;
|
495
518
|
}
|
519
|
+
if(this._pollingTimerId) {
|
520
|
+
clearTimeout(this._pollingTimerId);
|
521
|
+
this._pollingTimerId = 0;
|
522
|
+
}
|
496
523
|
this.removeAllColumns(); // Some conflators are reset
|
497
524
|
this.removeAllRows(); // Some conflators are reset
|
525
|
+
this._sorter.dispose();
|
498
526
|
this._grid.dispose();
|
499
527
|
this._connector.reset();
|
500
528
|
|
@@ -711,6 +739,12 @@ Grid.prototype.initialize = function(gridOption) {
|
|
711
739
|
t._RTK = gridOption["RTK"];
|
712
740
|
t._snapshot.setRTK(t._RTK);
|
713
741
|
}
|
742
|
+
|
743
|
+
if (gridOption["ADC"]) {
|
744
|
+
t._ADCOptions = gridOption["ADC"];
|
745
|
+
t._snapshot.setADCOptions(t._ADCOptions);
|
746
|
+
}
|
747
|
+
|
714
748
|
if (gridOption["synapse"]) {
|
715
749
|
t._synapse = gridOption["synapse"];
|
716
750
|
FieldDefinition.setSynapseConfig(t._synapse);
|
@@ -720,6 +754,12 @@ Grid.prototype.initialize = function(gridOption) {
|
|
720
754
|
StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
|
721
755
|
}
|
722
756
|
|
757
|
+
if(gridOption["formulaEngine"]) {
|
758
|
+
t._fnEngine = new Engine();
|
759
|
+
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
760
|
+
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
761
|
+
}
|
762
|
+
|
723
763
|
var borders = gridOption["borders"];
|
724
764
|
if (borders != null) {
|
725
765
|
grid.toggleBorders(borders);
|
@@ -750,14 +790,6 @@ Grid.prototype.initialize = function(gridOption) {
|
|
750
790
|
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
751
791
|
}
|
752
792
|
|
753
|
-
var noColumnDragging = gridOption["noColumnDragging"];
|
754
|
-
if (noColumnDragging == null && gridOption["columnReorder"] != null) {
|
755
|
-
noColumnDragging = !gridOption["columnReorder"];
|
756
|
-
}
|
757
|
-
if (noColumnDragging) {
|
758
|
-
t._dtp.disable();
|
759
|
-
}
|
760
|
-
|
761
793
|
var val = gridOption["autoLayoutUpdate"];
|
762
794
|
if(!t._autoLayoutTimer && val) {
|
763
795
|
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
@@ -797,6 +829,10 @@ Grid.prototype.initialize = function(gridOption) {
|
|
797
829
|
if(gridOption["scrollbarParent"] != null) {
|
798
830
|
t._setScrollbarParent(gridOption["scrollbarParent"]);
|
799
831
|
}
|
832
|
+
var pollingInterval = gridOption["adcPollingInterval"];
|
833
|
+
if(pollingInterval != null) {
|
834
|
+
t._pollingInterval = pollingInterval ? +pollingInterval : 0;
|
835
|
+
}
|
800
836
|
|
801
837
|
// Column operations
|
802
838
|
t.setColumns(cols);
|
@@ -871,7 +907,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
871
907
|
var lang = gridOption["lang"];
|
872
908
|
if(lang != null) {
|
873
909
|
t._lang = lang;
|
874
|
-
|
910
|
+
t._dateTimeUtil.setLocale(lang);
|
875
911
|
}
|
876
912
|
|
877
913
|
// Row operations
|
@@ -1011,13 +1047,19 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1011
1047
|
obj["autoDateConversion"] = true;
|
1012
1048
|
}
|
1013
1049
|
|
1014
|
-
if
|
1050
|
+
if(this._textSelect) {
|
1015
1051
|
obj["textSelect"] = true;
|
1016
1052
|
}
|
1017
1053
|
|
1018
|
-
if
|
1054
|
+
if(this._lang) {
|
1019
1055
|
obj["lang"] = this._lang;
|
1020
1056
|
}
|
1057
|
+
if(this._fnEngine) {
|
1058
|
+
obj["formulaEngine"] = true;
|
1059
|
+
}
|
1060
|
+
if(this._pollingInterval) {
|
1061
|
+
obj["adcPollingInterval"] = this._pollingInterval;
|
1062
|
+
}
|
1021
1063
|
|
1022
1064
|
// get all rows config
|
1023
1065
|
var rowDefs = this.getAllRowDefinitions();
|
@@ -1053,17 +1095,37 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1053
1095
|
}
|
1054
1096
|
|
1055
1097
|
// TODO: The following states need to be retrieved
|
1056
|
-
// noColumnDragging
|
1057
1098
|
// rowHighlighting
|
1058
1099
|
// columnVirtualization
|
1059
1100
|
// topFreezingCount, bottomFreezingCount
|
1060
1101
|
// scrollbarParent
|
1061
1102
|
|
1062
|
-
// NOTE: no need to export synapseApiKey and RTK
|
1103
|
+
// NOTE: no need to export synapseApiKey, ADC and RTK
|
1063
1104
|
|
1064
1105
|
return obj;
|
1065
1106
|
};
|
1066
1107
|
|
1108
|
+
/** @public
|
1109
|
+
* @ignore
|
1110
|
+
* @param {Object} dateTimeUtil
|
1111
|
+
*/
|
1112
|
+
Grid.prototype.setDateTimeUtil = function(dateTimeUtil) {
|
1113
|
+
if(this._dateTimeUtil !== dateTimeUtil) {
|
1114
|
+
this._dateTimeUtil = dateTimeUtil;
|
1115
|
+
this._dateTimeUtil.setLocale(this._lang);
|
1116
|
+
}
|
1117
|
+
};
|
1118
|
+
/** @public
|
1119
|
+
* @param {string} lang
|
1120
|
+
*/
|
1121
|
+
Grid.prototype.setLocale = function(lang) {
|
1122
|
+
if(lang && this._lang !== lang) {
|
1123
|
+
this._lang = lang;
|
1124
|
+
this._dateTimeUtil.setLocale(lang);
|
1125
|
+
this._grid.requestRowRefresh();
|
1126
|
+
}
|
1127
|
+
};
|
1128
|
+
|
1067
1129
|
/** @private
|
1068
1130
|
* @param {Object} defaultCol
|
1069
1131
|
* @param {Array.<Object>} userColumns
|
@@ -1169,10 +1231,6 @@ Grid.prototype._onFieldRemoved = function(e) {
|
|
1169
1231
|
* @param {number=} idx
|
1170
1232
|
*/
|
1171
1233
|
Grid.prototype.insertColumn = function (columnOption, idx) {
|
1172
|
-
if (typeof columnOption === "string") {
|
1173
|
-
columnOption = { field: columnOption };
|
1174
|
-
}
|
1175
|
-
|
1176
1234
|
var colCount = this.getColumnCount();
|
1177
1235
|
if(idx == null || idx > colCount) {
|
1178
1236
|
idx = colCount;
|
@@ -1180,19 +1238,93 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
1180
1238
|
|
1181
1239
|
// no need to merge defaultColumn during initialize process
|
1182
1240
|
// because columnOption already mutate by initialize function
|
1183
|
-
var
|
1184
|
-
Grid._objectAssign(userOptions, columnOption);
|
1185
|
-
userOptions["formulaEngine"] = this._fnEngine; // Adding extra option
|
1241
|
+
var configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
1186
1242
|
|
1187
|
-
|
1188
|
-
|
1243
|
+
if (typeof columnOption === "string") {
|
1244
|
+
configObj["field"] = columnOption;
|
1245
|
+
} else { // columnOption is assumed to be an object
|
1246
|
+
for (var key in columnOption) {
|
1247
|
+
configObj[key] = columnOption[key];
|
1248
|
+
}
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
if(this._fnEngine) {
|
1252
|
+
configObj["formulaEngine"] = this._fnEngine; // Adding extra option
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
var colDef = new ColumnDefinition(configObj, this);
|
1256
|
+
configObj[COL_DEF] = colDef;
|
1189
1257
|
|
1190
1258
|
// WARNING: width is processed twice by tr-grid and rt-grid
|
1191
1259
|
// Inserting column also initializes prefined formatter
|
1192
|
-
this._grid.insertColumn(idx,
|
1260
|
+
this._grid.insertColumn(idx, configObj); // columnAdded is fired
|
1193
1261
|
};
|
1194
1262
|
|
1195
1263
|
|
1264
|
+
/** @public
|
1265
|
+
* @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
|
1266
|
+
* @param {Grid~ColumnReference} colRef
|
1267
|
+
*/
|
1268
|
+
Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
1269
|
+
var colIndex = this.getColumnIndex(colRef);
|
1270
|
+
if(colIndex < 0) {
|
1271
|
+
return;
|
1272
|
+
}
|
1273
|
+
var colConfig = {};
|
1274
|
+
var core = this._grid;
|
1275
|
+
var columnDef = core._getColumnDef(colIndex);
|
1276
|
+
|
1277
|
+
var value = core.getColumnScalability(colIndex);
|
1278
|
+
colConfig["scalable"] = value;
|
1279
|
+
|
1280
|
+
value = core.getColumnCustomLaneSize(colIndex);
|
1281
|
+
colConfig["width"] = value;
|
1282
|
+
|
1283
|
+
value = core.getMinimumColumnWidth(colIndex);
|
1284
|
+
if(value !== 32) {
|
1285
|
+
colConfig["minWidth"] = value;
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
value = core.isColumnVisible(colIndex);
|
1289
|
+
if(!value) {
|
1290
|
+
colConfig["hidden"] = true;
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
value = columnDef["stationary"];
|
1294
|
+
if (value) {
|
1295
|
+
colConfig["stationary"] = value;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
value = columnDef["leftPinned"];
|
1299
|
+
if (value) {
|
1300
|
+
colConfig["leftPinned"] = value;
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
value = columnDef["rightPinned"];
|
1304
|
+
if (value) {
|
1305
|
+
colConfig["rightPinned"] = value;
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
if(typeof columnOption === "string") {
|
1309
|
+
colConfig["field"] = columnOption;
|
1310
|
+
} else { // type object from user
|
1311
|
+
for (var key in columnOption) {
|
1312
|
+
colConfig[key] = columnOption[key];
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
if(columnOption["width"] && !columnOption["scalable"]) {
|
1317
|
+
colConfig["scalable"] = false;
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
if(columnOption["scalable"] && !columnOption["width"]) {
|
1321
|
+
colConfig["width"] = 1;
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
this.insertColumn(colConfig, colIndex);
|
1325
|
+
this.removeColumn(colIndex + 1); // remove existing column after insert
|
1326
|
+
};
|
1327
|
+
|
1196
1328
|
/** to update column name when field info is loaded
|
1197
1329
|
* @private
|
1198
1330
|
* @param {string} field
|
@@ -1657,6 +1789,11 @@ Grid.prototype.removeDataFields = function(fieldRef, referrer) {
|
|
1657
1789
|
* @param {string=} opt_order This can be "ascending", "descending", "none", "noOrder", or "originalOrder"
|
1658
1790
|
*/
|
1659
1791
|
Grid.prototype.sortColumn = function(colRef, opt_order) {
|
1792
|
+
if(typeof colRef === "string") {
|
1793
|
+
this._stp.sortColumn(colRef, opt_order); // Allow sorting by field
|
1794
|
+
return;
|
1795
|
+
}
|
1796
|
+
|
1660
1797
|
var colIndex = this.getColumnIndex(colRef);
|
1661
1798
|
if(colIndex < 0) {
|
1662
1799
|
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
@@ -1757,9 +1894,9 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
1757
1894
|
if(colDef) {
|
1758
1895
|
colDef.setSorter(func);
|
1759
1896
|
|
1760
|
-
var sortedColumn = this.getSortedColumnIndex();
|
1897
|
+
var sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
|
1761
1898
|
if(sortedColumn === colIndex) {
|
1762
|
-
this.
|
1899
|
+
this._stp.refresh();
|
1763
1900
|
}
|
1764
1901
|
}
|
1765
1902
|
};
|
@@ -1801,9 +1938,6 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
1801
1938
|
var rowDef = new RowDefinition(rowOption);
|
1802
1939
|
rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
|
1803
1940
|
this._initDuplicateRicData(rowDef);
|
1804
|
-
if(rowDef.isFixedPosition()) {
|
1805
|
-
this._hasGroup = true; // HACK: This is temporary solution
|
1806
|
-
}
|
1807
1941
|
|
1808
1942
|
rowDef.registerToView(this._dv, this._getRowId(rowRef));
|
1809
1943
|
if(rowOption && rowOption["hidden"]) {
|
@@ -1848,7 +1982,6 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
1848
1982
|
}
|
1849
1983
|
this.insertRow(rowOption, rowId); // Note that data view is being frozen, so only using row id will work properly
|
1850
1984
|
}
|
1851
|
-
this._updateGroupOrder(); // TODO: Update group order for all scenarios
|
1852
1985
|
this._dt.freeze(prevState);
|
1853
1986
|
};
|
1854
1987
|
/** Add multiple rows without `ric` property in {@link RowDefinition}
|
@@ -2621,7 +2754,7 @@ Grid.prototype.updateColumnTitle = function() {
|
|
2621
2754
|
* @return {boolean}
|
2622
2755
|
*/
|
2623
2756
|
Grid.prototype.isSorting = function() {
|
2624
|
-
return this.
|
2757
|
+
return this._stp.isSorting();
|
2625
2758
|
};
|
2626
2759
|
/** @public
|
2627
2760
|
* @return {number}
|
@@ -2638,7 +2771,7 @@ Grid.prototype.getSortOrder = function() {
|
|
2638
2771
|
/** @public
|
2639
2772
|
*/
|
2640
2773
|
Grid.prototype.clearSort = function() {
|
2641
|
-
this._stp.clearSortState();
|
2774
|
+
this._stp.clearSortState(); // WARNING: No event is dispatched
|
2642
2775
|
};
|
2643
2776
|
|
2644
2777
|
/** @private
|
@@ -2736,43 +2869,38 @@ Grid.prototype._updateStreamingData = function() {
|
|
2736
2869
|
this._dt.dispatchGlobalChange();
|
2737
2870
|
}
|
2738
2871
|
};
|
2872
|
+
|
2739
2873
|
/** @private
|
2874
|
+
* @param {Object} e
|
2740
2875
|
*/
|
2741
|
-
Grid.prototype.
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
//
|
2747
|
-
var
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
if(
|
2757
|
-
|
2876
|
+
Grid.prototype._onPreDataSorting = function (e) {
|
2877
|
+
var field = "";
|
2878
|
+
var rowSorting = false;
|
2879
|
+
var sortLogic = null;
|
2880
|
+
|
2881
|
+
var states = this._stp.getSortingStates(); // WARNING: Use of deprecated function
|
2882
|
+
var state = states ? states[0] : null; // TODO: Support multi-column sorting
|
2883
|
+
|
2884
|
+
if(state) {
|
2885
|
+
field = state["field"] || "";
|
2886
|
+
var colIndex = this._stp.getSortedColumnIndex(0);
|
2887
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
2888
|
+
this._sorter.setContext("colIndex", colIndex);
|
2889
|
+
this._sorter.setContext("colDef", colDef);
|
2890
|
+
|
2891
|
+
if(colDef) {
|
2892
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
2893
|
+
sortLogic = colDef.getSorter();
|
2894
|
+
rowSorting = colDef.isRowSorting();
|
2758
2895
|
}
|
2759
|
-
prevParent = curParent;
|
2760
|
-
prevFixedState = curFixedState;
|
2761
|
-
dirty |= rowDef.setGroupOrder(groupOrder);
|
2762
2896
|
}
|
2763
|
-
if(
|
2764
|
-
|
2897
|
+
if(!sortLogic && field) {
|
2898
|
+
sortLogic = state["sortLogic"];
|
2765
2899
|
}
|
2766
|
-
};
|
2767
2900
|
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
Grid.prototype._onPreDataSorting = function (e) {
|
2772
|
-
// TODO: Support multi-column sorting
|
2773
|
-
var colIndex = this._stp.getSortedColumnIndex();
|
2774
|
-
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
2775
|
-
this._columnSorter = (colDef) ? colDef._prepareSortContext(colIndex) : null;
|
2901
|
+
this._sorter.setField(field);
|
2902
|
+
this._sorter.setSortLogic(sortLogic);
|
2903
|
+
this._columnSorter = this._sorter.getSorter(rowSorting);
|
2776
2904
|
};
|
2777
2905
|
/** @private
|
2778
2906
|
* @param {RowDefinition} rowDefA
|
@@ -2932,6 +3060,9 @@ Grid.prototype._onDataComposed = function(e) {
|
|
2932
3060
|
if(!rowDef) {
|
2933
3061
|
return;
|
2934
3062
|
}
|
3063
|
+
if(!rowDef.getDataSource()) {
|
3064
|
+
return; // Somehow, rowDef is invalid and doesn't have data source
|
3065
|
+
}
|
2935
3066
|
|
2936
3067
|
if(this._autoDateConversion) { // auto data conversion
|
2937
3068
|
var field, value, dataType, colDef;
|
@@ -2957,13 +3088,17 @@ Grid.prototype._onDataComposed = function(e) {
|
|
2957
3088
|
e["rowDef"] = rowDef;
|
2958
3089
|
this._dispatch("dataComposed", e);
|
2959
3090
|
}
|
3091
|
+
|
3092
|
+
this._recalculateFormulas(e);
|
2960
3093
|
};
|
2961
3094
|
|
2962
3095
|
/** @private
|
2963
3096
|
* @param {Object=} e
|
2964
3097
|
*/
|
2965
3098
|
Grid.prototype._recalculateFormulas = function(e) {
|
2966
|
-
if(this._fnEngine.getFormulaCount() <= 0) {
|
3099
|
+
if(!this._fnEngine || this._fnEngine.getFormulaCount() <= 0) {
|
3100
|
+
return;
|
3101
|
+
}
|
2967
3102
|
|
2968
3103
|
if(e && e["rid"]) {
|
2969
3104
|
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
@@ -2987,6 +3122,64 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
|
|
2987
3122
|
for (var ric in data) {
|
2988
3123
|
this.setRicData(ric, data[ric]);
|
2989
3124
|
}
|
3125
|
+
if(!this._lastPollingRequest) { // This is the first time we receive successful ADC response
|
3126
|
+
this._lastPollingRequest = 1; // Allow polling to be started
|
3127
|
+
}
|
3128
|
+
this._startPolling();
|
3129
|
+
};
|
3130
|
+
/** @private
|
3131
|
+
*/
|
3132
|
+
Grid.prototype._startPolling = function () {
|
3133
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
3134
|
+
if(this._lastPollingRequest && !this._pollingTimerId) {
|
3135
|
+
var now = new Date();
|
3136
|
+
this._lastPollingRequest = now.getTime();
|
3137
|
+
this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
|
3138
|
+
}
|
3139
|
+
}
|
3140
|
+
};
|
3141
|
+
/** @private
|
3142
|
+
*/
|
3143
|
+
Grid.prototype._onPollingInterval = function () {
|
3144
|
+
this._pollingTimerId = 0;
|
3145
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
3146
|
+
this.refreshADCData();
|
3147
|
+
this._startPolling();
|
3148
|
+
}
|
3149
|
+
};
|
3150
|
+
/** @public
|
3151
|
+
* @param {boolean=} activated=true
|
3152
|
+
*/
|
3153
|
+
Grid.prototype.activateADCPolling = function (activated) {
|
3154
|
+
if(activated !== false) {
|
3155
|
+
this._pollingEnabled = true;
|
3156
|
+
// Make immediate request after re-activation if it has been a long time
|
3157
|
+
var now = new Date();
|
3158
|
+
if(this._lastPollingRequest) {
|
3159
|
+
var diff = now.getTime() - this._lastPollingRequest;
|
3160
|
+
if(diff > this._pollingInterval) {
|
3161
|
+
this.refreshADCData();
|
3162
|
+
}
|
3163
|
+
}
|
3164
|
+
this._startPolling();
|
3165
|
+
} else {
|
3166
|
+
this._pollingEnabled = false;
|
3167
|
+
}
|
3168
|
+
};
|
3169
|
+
/** Force re-requesting ADC data to immediately update the data
|
3170
|
+
* @public
|
3171
|
+
* @return {boolean} Return true, if a request has been made
|
3172
|
+
*/
|
3173
|
+
Grid.prototype.refreshADCData = function () {
|
3174
|
+
var dirty = this._snapshot.addFields(this._connector.getAllFields());
|
3175
|
+
if(dirty) {
|
3176
|
+
dirty = this._snapshot.addRics(this._connector.getAllRics());
|
3177
|
+
if(dirty) {
|
3178
|
+
return true;
|
3179
|
+
}
|
3180
|
+
}
|
3181
|
+
this._lastPollingRequest = 0; // No ADC field or RIC detected. Prevent polling from continuing
|
3182
|
+
return false;
|
2990
3183
|
};
|
2991
3184
|
|
2992
3185
|
/** @private
|
@@ -3045,16 +3238,5 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
3045
3238
|
console.table(tbl); // eslint-disable-line
|
3046
3239
|
};
|
3047
3240
|
|
3048
|
-
/** @private
|
3049
|
-
* @function
|
3050
|
-
* @param {Object} to
|
3051
|
-
* @param {Object} from
|
3052
|
-
*/
|
3053
|
-
Grid._objectAssign = function (to, from) {
|
3054
|
-
for (var key in from) {
|
3055
|
-
to[key] = from[key];
|
3056
|
-
}
|
3057
|
-
};
|
3058
|
-
|
3059
3241
|
export { Grid };
|
3060
3242
|
export default Grid;
|