@refinitiv-ui/efx-grid 6.0.1 → 6.0.4
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 +226 -23
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +17835 -16266
- 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 +26 -17
- package/lib/core/es6/data/DataView.js +172 -49
- 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 +289 -0
- package/lib/core/es6/data/WrappedView.js +1319 -0
- package/lib/core/es6/grid/Core.d.ts +42 -27
- package/lib/core/es6/grid/Core.js +431 -163
- package/lib/core/es6/grid/ILayoutGrid.d.ts +23 -15
- package/lib/core/es6/grid/ILayoutGrid.js +45 -2
- package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
- package/lib/core/es6/grid/LayoutGrid.js +311 -108
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +382 -24
- 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/Column.js +8 -2
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
- package/lib/core/es6/grid/components/HScrollbar.js +20 -4
- package/lib/core/es6/grid/components/Scrollbar.d.ts +1 -1
- 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 +29 -3
- 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 +94 -32
- 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 +30 -8
- package/lib/grid/lib/efx-grid.js +120 -115
- package/lib/grid/themes/base.less +5 -3
- 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 +72 -41
- 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 +8 -2
- package/lib/row-segmenting/es6/RowSegmenting.js +137 -21
- package/lib/rt-grid/dist/rt-grid.js +11017 -9193
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +9 -4
- package/lib/rt-grid/es6/ColumnDefinition.js +20 -108
- package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
- package/lib/rt-grid/es6/Grid.d.ts +30 -15
- package/lib/rt-grid/es6/Grid.js +436 -167
- 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 +12 -7
- package/lib/rt-grid/es6/RowDefinition.js +58 -2
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -1
- package/lib/rt-grid/es6/SnapshotFiller.js +23 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +6 -3
- package/lib/tr-grid-checkbox/es6/Checkbox.js +79 -34
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +269 -10
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +243 -125
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +24 -13
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
- package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
- 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-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 +108 -127
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +138 -38
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +13 -9
- package/lib/tr-grid-row-selection/es6/RowSelection.js +230 -29
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
- 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.d.ts +8 -8
- package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
- package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
- package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
- package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
- package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
- 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 +28 -1
- package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
- package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +1 -1
- package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
- package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
- package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
- package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
- package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +10 -2
- 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/PercentBar.d.ts +1 -1
- package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
- package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
- package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
- package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
- package/lib/tr-grid-util/es6/RowPainter.js +120 -28
- package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
- package/lib/tr-grid-util/es6/Table.d.ts +13 -13
- package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
- package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
- package/lib/tr-grid-util/es6/Util.d.ts +6 -6
- package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
- package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
- package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
- package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
- package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
- package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
- package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
- package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
- package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
- package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
- package/lib/types/es6/CellSelection.d.ts +1 -1
- package/lib/types/es6/Checkbox.d.ts +6 -3
- package/lib/types/es6/ColumnGrouping.d.ts +1 -0
- package/lib/types/es6/ColumnSelection.d.ts +5 -1
- 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 +1 -1
- 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 +26 -17
- 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 +289 -0
- package/lib/types/es6/Core/grid/Core.d.ts +42 -27
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +23 -15
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
- 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/HScrollbar.d.ts +4 -0
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +1 -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/FilterInput.d.ts +4 -2
- package/lib/types/es6/InCellEditing.d.ts +8 -5
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +9 -4
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +31 -16
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +12 -7
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -1
- package/lib/types/es6/RowColoring.d.ts +2 -0
- package/lib/types/es6/RowDragging.d.ts +3 -4
- package/lib/types/es6/RowFiltering.d.ts +2 -0
- package/lib/types/es6/RowGrouping.d.ts +7 -2
- package/lib/types/es6/RowSegmenting.d.ts +8 -2
- package/lib/types/es6/RowSelection.d.ts +13 -9
- package/lib/types/es6/TextFormatting.d.ts +1 -1
- package/lib/types/es6/Zoom.d.ts +2 -1
- package/lib/types/es6/index.d.ts +3 -0
- package/lib/versions.json +22 -21
- package/lib/zoom/es6/Zoom.d.ts +2 -1
- package/lib/zoom/es6/Zoom.js +11 -4
- package/package.json +7 -7
- 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
@@ -1,22 +1,22 @@
|
|
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";
|
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";
|
@@ -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.
|
@@ -71,8 +71,11 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
71
71
|
* @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
|
72
72
|
* @property {Function=} dataComposed Handler for dataComposed event
|
73
73
|
* @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
|
74
|
+
* @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
|
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.
|
77
|
+
* @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.
|
78
|
+
* @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
|
76
79
|
*/
|
77
80
|
|
78
81
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -152,7 +155,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
152
155
|
var SUB_ID = "SUB_ID";
|
153
156
|
|
154
157
|
/** @private
|
155
|
-
* @param {
|
158
|
+
* @param {RowDefinition} rowDef
|
156
159
|
* @return {Object}
|
157
160
|
*/
|
158
161
|
var toRowData = function(rowDef) {
|
@@ -209,6 +212,14 @@ var mapRowOrder = function (sortField, elemData, index) { // edit name
|
|
209
212
|
elemData[sortField] = index; // Make column for sort with user data array
|
210
213
|
};
|
211
214
|
|
215
|
+
/** @private
|
216
|
+
* @param {RowDefinition} rowDef
|
217
|
+
* @return {boolean}
|
218
|
+
*/
|
219
|
+
var excludeAutoGenerated = function (rowDef) {
|
220
|
+
return !rowDef.isAutoGenerated();
|
221
|
+
};
|
222
|
+
|
212
223
|
/** @private
|
213
224
|
* @param {string} rowDefA
|
214
225
|
* @param {string} rowDefB
|
@@ -250,6 +261,7 @@ var Grid = function(placeholder, config) {
|
|
250
261
|
t._onFieldLoadedError = t._onFieldLoadedError.bind(t);
|
251
262
|
|
252
263
|
t._snapshotFillerDataChanged = t._snapshotFillerDataChanged.bind(t);
|
264
|
+
t._onPollingInterval = t._onPollingInterval.bind(t);
|
253
265
|
|
254
266
|
t._streamingConflator = new Conflator(50, t._updateStreamingData);
|
255
267
|
t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
|
@@ -263,41 +275,66 @@ var Grid = function(placeholder, config) {
|
|
263
275
|
t._grid = new Core();
|
264
276
|
t._grid._wrapper = this; // For back referencing
|
265
277
|
|
266
|
-
t.
|
278
|
+
t._sorter = new RowDefSorter();
|
279
|
+
t._sorter.setContext("grid", this);
|
280
|
+
t._sorter.setContext("core", t._grid); // TODO: Handle multiple core grids
|
281
|
+
|
282
|
+
t._dateTimeUtil = DateTime;
|
267
283
|
|
268
|
-
t.
|
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);
|
284
|
+
t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
|
275
285
|
|
276
|
-
|
286
|
+
if(config) {
|
287
|
+
if(config["dataView"]) {
|
288
|
+
t._sharedDataSource = true;
|
289
|
+
t._dv = config["dataView"];
|
290
|
+
t._dt = t._dv.getDataTable();
|
291
|
+
t._mainGrid = config["grid"];
|
277
292
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
293
|
+
var core = t._mainGrid.getCoreGrid();
|
294
|
+
t._stp = core.getPlugin("SortableTitlePlugin");
|
295
|
+
}
|
296
|
+
if(config["SortableTitle"]) { // Exception for built-in plugin
|
297
|
+
t._stp = config["SortableTitle"];
|
298
|
+
}
|
299
|
+
}
|
300
|
+
if(!t._sharedDataSource) {
|
301
|
+
t._dc = new DataCache();
|
302
|
+
t._dc.listen("dataChanged", t._onDataChanged);
|
303
|
+
t._dc.listen("dataComposed", t._onDataComposed);
|
304
|
+
|
305
|
+
t._dt = new DataTable();
|
306
|
+
t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
|
307
|
+
t._dv = new DataView(t._dt);
|
308
|
+
t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
|
309
|
+
t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
|
310
|
+
}
|
311
|
+
t._grid.setDataSource(t._dv); // Avoid triggering sorting
|
312
|
+
|
313
|
+
if(t._stp) {
|
314
|
+
t._sharedSorter = true;
|
315
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
316
|
+
t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
|
317
|
+
} else { // Create built-in plugin
|
318
|
+
t._stp = new SortableTitlePlugin({
|
319
|
+
"userManagedLogic": true,
|
320
|
+
"sortableColumns": true,
|
321
|
+
"disableDoubleClickToSort": true,
|
322
|
+
"ROW_DEF": true // Enable Row Definition Mode
|
323
|
+
});
|
324
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
325
|
+
|
326
|
+
// TODO: Built-in plugins don't have normal workflow unlike other extensions. Make them have the same workflow like the others
|
327
|
+
// defaultColumnOptions property does not work with them.
|
328
|
+
// beforeInit is not called.
|
329
|
+
t._grid.loadPlugin(t._stp, config);
|
330
|
+
}
|
282
331
|
|
283
332
|
t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
|
284
333
|
t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
|
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();
|
@@ -310,10 +347,6 @@ var Grid = function(placeholder, config) {
|
|
310
347
|
t._connector.addEventListener("fieldAdded", t._onFieldAdded.bind(t));
|
311
348
|
t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
|
312
349
|
|
313
|
-
t._fnEngine = new Engine();
|
314
|
-
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
315
|
-
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
316
|
-
|
317
350
|
t.initialize(config);
|
318
351
|
t.initSubscription();
|
319
352
|
|
@@ -325,6 +358,10 @@ Ext.inherits(Grid, EventDispatcher);
|
|
325
358
|
* @type {Element}
|
326
359
|
*/
|
327
360
|
Grid.prototype._topNode = null;
|
361
|
+
/** @private
|
362
|
+
* @type {Grid}
|
363
|
+
*/
|
364
|
+
Grid.prototype._mainGrid = null;
|
328
365
|
/** @private
|
329
366
|
* @type {Core}
|
330
367
|
*/
|
@@ -344,6 +381,15 @@ Grid.prototype._dt = null;
|
|
344
381
|
* @private
|
345
382
|
*/
|
346
383
|
Grid.prototype._dv = null;
|
384
|
+
/** @type {boolean}
|
385
|
+
* @private
|
386
|
+
*/
|
387
|
+
Grid.prototype._sharedDataSource = false;
|
388
|
+
/** @type {boolean}
|
389
|
+
* @private
|
390
|
+
*/
|
391
|
+
Grid.prototype._sharedSorter = false;
|
392
|
+
|
347
393
|
/** JET.Quotes2 Subscription
|
348
394
|
* @type {Object}
|
349
395
|
* @private
|
@@ -354,10 +400,6 @@ Grid.prototype._subs = null;
|
|
354
400
|
* @private
|
355
401
|
*/
|
356
402
|
Grid.prototype._stp = null;
|
357
|
-
/** @type {DragAndDropTitlePlugin}
|
358
|
-
* @private
|
359
|
-
*/
|
360
|
-
Grid.prototype._dtp = null;
|
361
403
|
/** @type {Function}
|
362
404
|
* @private
|
363
405
|
*/
|
@@ -375,6 +417,10 @@ Grid.prototype._snapshot = null;
|
|
375
417
|
* @type {DataConnector}
|
376
418
|
*/
|
377
419
|
Grid.prototype._connector = null;
|
420
|
+
/** @private
|
421
|
+
* @type {RowDefSorter}
|
422
|
+
*/
|
423
|
+
Grid.prototype._sorter = null;
|
378
424
|
|
379
425
|
/** @private
|
380
426
|
* @type {Engine}
|
@@ -394,10 +440,6 @@ Grid.prototype._chainMembers = null;
|
|
394
440
|
*/
|
395
441
|
Grid.prototype._chainConflator = null;
|
396
442
|
/** @private
|
397
|
-
* @type {boolean}
|
398
|
-
*/
|
399
|
-
Grid.prototype._hasGroup = false;
|
400
|
-
/** @private
|
401
443
|
* @type {number}
|
402
444
|
*/
|
403
445
|
Grid.prototype._clientWidth = NaN;
|
@@ -426,15 +468,34 @@ Grid.prototype._autoDateConversion = false;
|
|
426
468
|
* @type {boolean}
|
427
469
|
*/
|
428
470
|
Grid.prototype._textSelect = false;
|
429
|
-
/** @
|
430
|
-
* @
|
471
|
+
/** @type {string}
|
472
|
+
* @private
|
431
473
|
*/
|
432
474
|
Grid.prototype._lang = null;
|
433
|
-
/**
|
475
|
+
/** @type {Object}
|
476
|
+
* @private
|
477
|
+
*/
|
478
|
+
Grid.prototype._dateTimeUtil = null;
|
479
|
+
/** @type {boolean}
|
434
480
|
* @private
|
435
|
-
* @type {boolean}
|
436
481
|
*/
|
437
482
|
Grid.prototype._initializing = false;
|
483
|
+
/** @type {number}
|
484
|
+
* @private
|
485
|
+
*/
|
486
|
+
Grid.prototype._pollingInterval = 0;
|
487
|
+
/** @type {number}
|
488
|
+
* @private
|
489
|
+
*/
|
490
|
+
Grid.prototype._pollingTimerId = 0;
|
491
|
+
/** @type {number}
|
492
|
+
* @private
|
493
|
+
*/
|
494
|
+
Grid.prototype._lastPollingRequest = 0;
|
495
|
+
/** @type {boolean}
|
496
|
+
* @private
|
497
|
+
*/
|
498
|
+
Grid.prototype._pollingEnabled = true;
|
438
499
|
|
439
500
|
|
440
501
|
/** @public
|
@@ -445,11 +506,18 @@ Grid.prototype.dispose = function() {
|
|
445
506
|
clearInterval(this._autoLayoutTimer);
|
446
507
|
this._autoLayoutTimer = 0;
|
447
508
|
}
|
509
|
+
if(this._pollingTimerId) {
|
510
|
+
clearTimeout(this._pollingTimerId);
|
511
|
+
this._pollingTimerId = 0;
|
512
|
+
}
|
448
513
|
this.removeAllColumns(); // Some conflators are reset
|
449
514
|
this.removeAllRows(); // Some conflators are reset
|
515
|
+
this._sorter.dispose();
|
450
516
|
this._grid.dispose();
|
451
517
|
this._connector.reset();
|
452
518
|
|
519
|
+
this._mainGrid = this._dt = this._dv = null;
|
520
|
+
|
453
521
|
if(this._subs) {
|
454
522
|
this._subs["dispose"]();
|
455
523
|
this._subs = null;
|
@@ -476,7 +544,7 @@ Grid.prototype.listen = Grid.prototype.addEventListener;
|
|
476
544
|
/** @public
|
477
545
|
*/
|
478
546
|
Grid.prototype.initSubscription = function() {
|
479
|
-
if(this._dc.getSubscriptions()) { // Subscription is already initialized
|
547
|
+
if(!this._dc || this._dc.getSubscriptions()) { // Subscription is already initialized
|
480
548
|
return;
|
481
549
|
}
|
482
550
|
|
@@ -519,7 +587,7 @@ Grid.prototype.updateLayout = function() {
|
|
519
587
|
this._grid.updateLayout();
|
520
588
|
this._stp.updateSortSymbols(); // HACK: There is a chance that grid may not yet be in the document
|
521
589
|
};
|
522
|
-
/** Force rerender of grid
|
590
|
+
/** Force rerender of grid rows. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
|
523
591
|
* @private
|
524
592
|
* @param {number=} rowIndex
|
525
593
|
*/
|
@@ -637,6 +705,8 @@ Grid.prototype.initialize = function(gridOption) {
|
|
637
705
|
var t = this; // For minimizing file size
|
638
706
|
t._initializing = true;
|
639
707
|
var grid = t._grid; // core grid
|
708
|
+
gridOption = grid.normalizeConfig(gridOption);
|
709
|
+
|
640
710
|
var exts = gridOption["plugins"] || gridOption["extensions"];
|
641
711
|
|
642
712
|
var cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
|
@@ -668,6 +738,12 @@ Grid.prototype.initialize = function(gridOption) {
|
|
668
738
|
StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
|
669
739
|
}
|
670
740
|
|
741
|
+
if(gridOption["formulaEngine"]) {
|
742
|
+
t._fnEngine = new Engine();
|
743
|
+
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
744
|
+
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
745
|
+
}
|
746
|
+
|
671
747
|
var borders = gridOption["borders"];
|
672
748
|
if (borders != null) {
|
673
749
|
grid.toggleBorders(borders);
|
@@ -698,14 +774,6 @@ Grid.prototype.initialize = function(gridOption) {
|
|
698
774
|
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
699
775
|
}
|
700
776
|
|
701
|
-
var noColumnDragging = gridOption["noColumnDragging"];
|
702
|
-
if (noColumnDragging == null && gridOption["columnReorder"] != null) {
|
703
|
-
noColumnDragging = !gridOption["columnReorder"];
|
704
|
-
}
|
705
|
-
if (noColumnDragging) {
|
706
|
-
t._dtp.disable();
|
707
|
-
}
|
708
|
-
|
709
777
|
var val = gridOption["autoLayoutUpdate"];
|
710
778
|
if(!t._autoLayoutTimer && val) {
|
711
779
|
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
@@ -742,17 +810,17 @@ Grid.prototype.initialize = function(gridOption) {
|
|
742
810
|
if(gridOption["autoHideScrollbar"] != null) {
|
743
811
|
grid.autoHideScrollbars(gridOption["autoHideScrollbar"] ? true : false);
|
744
812
|
}
|
813
|
+
if(gridOption["scrollbarParent"] != null) {
|
814
|
+
t._setScrollbarParent(gridOption["scrollbarParent"]);
|
815
|
+
}
|
816
|
+
var pollingInterval = gridOption["adcPollingInterval"];
|
817
|
+
if(pollingInterval != null) {
|
818
|
+
t._pollingInterval = pollingInterval ? +pollingInterval : 0;
|
819
|
+
}
|
745
820
|
|
746
821
|
// Column operations
|
747
822
|
t.setColumns(cols);
|
748
823
|
|
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
824
|
var rowVir = true;
|
757
825
|
if (gridOption["rowVirtualRendering"] != null) {
|
758
826
|
rowVir = gridOption["rowVirtualRendering"];
|
@@ -762,21 +830,18 @@ Grid.prototype.initialize = function(gridOption) {
|
|
762
830
|
}
|
763
831
|
grid.enableRowVirtualization(!!rowVir);
|
764
832
|
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
colVir = gridOption["columnVirtualRendering"];
|
769
|
-
}
|
770
|
-
if (gridOption["columnVirtualization"] != null) {
|
771
|
-
colVir = gridOption["columnVirtualization"];
|
772
|
-
}
|
773
|
-
grid.enableColumnVirtualization(!!colVir);
|
833
|
+
var colVir = false;
|
834
|
+
if (gridOption["columnVirtualRendering"] != null) {
|
835
|
+
colVir = gridOption["columnVirtualRendering"];
|
774
836
|
}
|
837
|
+
if (gridOption["columnVirtualization"] != null) {
|
838
|
+
colVir = gridOption["columnVirtualization"];
|
839
|
+
}
|
840
|
+
grid.enableColumnVirtualization(!!colVir);
|
775
841
|
|
776
842
|
var scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
|
777
843
|
if (scrollbar) {
|
778
844
|
t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
|
779
|
-
grid.freezeColumn(columnFreezing, pinnedRightColumns); // Enable horizontal scrollbar
|
780
845
|
} else {
|
781
846
|
grid.freezeSection(null); // Disable vertical scrollbar
|
782
847
|
t._topNode.style.overflow = "";
|
@@ -826,7 +891,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
826
891
|
var lang = gridOption["lang"];
|
827
892
|
if(lang != null) {
|
828
893
|
t._lang = lang;
|
829
|
-
|
894
|
+
t._dateTimeUtil.setLocale(lang);
|
830
895
|
}
|
831
896
|
|
832
897
|
// Row operations
|
@@ -923,8 +988,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
923
988
|
grid.getConfigObject(obj);
|
924
989
|
}
|
925
990
|
|
991
|
+
var i;
|
926
992
|
var len = this.getColumnCount();
|
927
|
-
for (
|
993
|
+
for (i = 0; i < len; ++i) {
|
928
994
|
var column = columns[i];
|
929
995
|
if(!column) {
|
930
996
|
column = columns[i] = {};
|
@@ -957,11 +1023,6 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
957
1023
|
obj["autoLayoutUpdate"] = true;
|
958
1024
|
}
|
959
1025
|
|
960
|
-
val = grid.getHScrollStartIndex();
|
961
|
-
if(val > 0) {
|
962
|
-
obj["columnFreezing"] = val - 1;
|
963
|
-
}
|
964
|
-
|
965
1026
|
if (this._defaultColumnOptions) {
|
966
1027
|
obj["defaultColumnOptions"] = this._defaultColumnOptions;
|
967
1028
|
}
|
@@ -970,26 +1031,85 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
970
1031
|
obj["autoDateConversion"] = true;
|
971
1032
|
}
|
972
1033
|
|
973
|
-
if
|
1034
|
+
if(this._textSelect) {
|
974
1035
|
obj["textSelect"] = true;
|
975
1036
|
}
|
976
1037
|
|
977
|
-
if
|
1038
|
+
if(this._lang) {
|
978
1039
|
obj["lang"] = this._lang;
|
979
1040
|
}
|
1041
|
+
if(this._fnEngine) {
|
1042
|
+
obj["formulaEngine"] = true;
|
1043
|
+
}
|
1044
|
+
if(this._pollingInterval) {
|
1045
|
+
obj["adcPollingInterval"] = this._pollingInterval;
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
// get all rows config
|
1049
|
+
var rowDefs = this.getAllRowDefinitions();
|
1050
|
+
var rows = obj["rows"] = [];
|
1051
|
+
var rowDef, rowConfig, pluginInstance, retObj, row;
|
1052
|
+
len = rowDefs.length;
|
1053
|
+
for (i = 0; i < len; i++) {
|
1054
|
+
rowDef = rowDefs[i];
|
1055
|
+
rowConfig = rowDef.getConfigObject();
|
1056
|
+
rows.push(rowConfig);
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
// get row config from extensions
|
1060
|
+
var extensions = grid.getPlugins();
|
1061
|
+
for(var key in extensions) {
|
1062
|
+
pluginInstance = extensions[key];
|
1063
|
+
if(typeof pluginInstance["getRowConfigObject"] === "function") {
|
1064
|
+
len = rows.length;
|
1065
|
+
for (i = 0; i < len; i++) {
|
1066
|
+
rowDef = rowDefs[i];
|
1067
|
+
row = rows[i];
|
1068
|
+
retObj = pluginInstance["getRowConfigObject"](rowDef.getRowId());
|
1069
|
+
if(retObj) {
|
1070
|
+
if(row.values) {
|
1071
|
+
// eslint-disable-next-line es5/no-es6-static-methods
|
1072
|
+
Object.assign(row.values, retObj); // Ignore lint
|
1073
|
+
} else {
|
1074
|
+
row.values = retObj;
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
}
|
1078
|
+
}
|
1079
|
+
}
|
980
1080
|
|
981
1081
|
// TODO: The following states need to be retrieved
|
982
|
-
// noColumnDragging
|
983
1082
|
// rowHighlighting
|
984
|
-
// pinnedRightColumns
|
985
1083
|
// columnVirtualization
|
986
1084
|
// topFreezingCount, bottomFreezingCount
|
1085
|
+
// scrollbarParent
|
987
1086
|
|
988
1087
|
// NOTE: no need to export synapseApiKey and RTK
|
989
1088
|
|
990
1089
|
return obj;
|
991
1090
|
};
|
992
1091
|
|
1092
|
+
/** @public
|
1093
|
+
* @ignore
|
1094
|
+
* @param {Object} dateTimeUtil
|
1095
|
+
*/
|
1096
|
+
Grid.prototype.setDateTimeUtil = function(dateTimeUtil) {
|
1097
|
+
if(this._dateTimeUtil !== dateTimeUtil) {
|
1098
|
+
this._dateTimeUtil = dateTimeUtil;
|
1099
|
+
this._dateTimeUtil.setLocale(this._lang);
|
1100
|
+
}
|
1101
|
+
};
|
1102
|
+
/** @public
|
1103
|
+
* @param {string} lang
|
1104
|
+
*/
|
1105
|
+
Grid.prototype.setLocale = function(lang) {
|
1106
|
+
if(lang && this._lang !== lang) {
|
1107
|
+
this._lang = lang;
|
1108
|
+
this._dateTimeUtil.setLocale(lang);
|
1109
|
+
this._grid.requestRowRefresh();
|
1110
|
+
}
|
1111
|
+
};
|
1112
|
+
|
993
1113
|
/** @private
|
994
1114
|
* @param {Object} defaultCol
|
995
1115
|
* @param {Array.<Object>} userColumns
|
@@ -1095,10 +1215,6 @@ Grid.prototype._onFieldRemoved = function(e) {
|
|
1095
1215
|
* @param {number=} idx
|
1096
1216
|
*/
|
1097
1217
|
Grid.prototype.insertColumn = function (columnOption, idx) {
|
1098
|
-
if (typeof columnOption === "string") {
|
1099
|
-
columnOption = { field: columnOption };
|
1100
|
-
}
|
1101
|
-
|
1102
1218
|
var colCount = this.getColumnCount();
|
1103
1219
|
if(idx == null || idx > colCount) {
|
1104
1220
|
idx = colCount;
|
@@ -1106,16 +1222,26 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
1106
1222
|
|
1107
1223
|
// no need to merge defaultColumn during initialize process
|
1108
1224
|
// because columnOption already mutate by initialize function
|
1109
|
-
var
|
1110
|
-
Grid._objectAssign(userOptions, columnOption);
|
1111
|
-
userOptions["formulaEngine"] = this._fnEngine; // Adding extra option
|
1225
|
+
var configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
1112
1226
|
|
1113
|
-
|
1114
|
-
|
1227
|
+
if (typeof columnOption === "string") {
|
1228
|
+
configObj["field"] = columnOption;
|
1229
|
+
} else { // columnOption is assumed to be an object
|
1230
|
+
for (var key in columnOption) {
|
1231
|
+
configObj[key] = columnOption[key];
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
if(this._fnEngine) {
|
1236
|
+
configObj["formulaEngine"] = this._fnEngine; // Adding extra option
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
var colDef = new ColumnDefinition(configObj, this);
|
1240
|
+
configObj[COL_DEF] = colDef;
|
1115
1241
|
|
1116
1242
|
// WARNING: width is processed twice by tr-grid and rt-grid
|
1117
1243
|
// Inserting column also initializes prefined formatter
|
1118
|
-
this._grid.insertColumn(idx,
|
1244
|
+
this._grid.insertColumn(idx, configObj); // columnAdded is fired
|
1119
1245
|
};
|
1120
1246
|
|
1121
1247
|
|
@@ -1154,6 +1280,22 @@ Grid.prototype._onFieldLoaded = function (field, referrer) {
|
|
1154
1280
|
this._connector.addFields(field, referrer);
|
1155
1281
|
};
|
1156
1282
|
|
1283
|
+
/**
|
1284
|
+
* @private
|
1285
|
+
* @param {Element} host
|
1286
|
+
*/
|
1287
|
+
Grid.prototype._setScrollbarParent = function (host) {
|
1288
|
+
host.style.boxSizing = "border-box";
|
1289
|
+
host.style.overflow = "hidden";
|
1290
|
+
host.style.position = "relative";
|
1291
|
+
|
1292
|
+
this._topNode.style.height = "100%";
|
1293
|
+
|
1294
|
+
this._grid.autoHideScrollbars(false);
|
1295
|
+
this._grid.getVScrollbar().attachToExternalElement(host);
|
1296
|
+
this._grid.getHScrollbar().attachToExternalElement(host);
|
1297
|
+
};
|
1298
|
+
|
1157
1299
|
/**
|
1158
1300
|
* @private
|
1159
1301
|
* @param {string} field
|
@@ -1263,8 +1405,9 @@ Grid.prototype._onColumnAdded = function(e) {
|
|
1263
1405
|
}
|
1264
1406
|
var colField = colDef.getField();
|
1265
1407
|
if (!colDef.isRealTimeField()) {
|
1266
|
-
|
1267
|
-
|
1408
|
+
if(this._dc) {
|
1409
|
+
this._dc.addStaticFields([colField]);
|
1410
|
+
}
|
1268
1411
|
}
|
1269
1412
|
this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
|
1270
1413
|
|
@@ -1311,7 +1454,9 @@ Grid.prototype.removeColumn = function(colRef) {
|
|
1311
1454
|
|
1312
1455
|
var colDef = this.getColumnDefinition(colIndex);
|
1313
1456
|
if(!colDef.isRealTimeField()) {
|
1314
|
-
this._dc
|
1457
|
+
if(this._dc) {
|
1458
|
+
this._dc.removeStaticFields([colDef.getField()]);
|
1459
|
+
}
|
1315
1460
|
}
|
1316
1461
|
colDef.dispose();
|
1317
1462
|
this._grid.removeColumnAt(colIndex);
|
@@ -1351,7 +1496,9 @@ Grid.prototype.removeColumns = function(colRefs) {
|
|
1351
1496
|
}
|
1352
1497
|
|
1353
1498
|
if(staticFields.length) {
|
1354
|
-
this._dc
|
1499
|
+
if(this._dc) {
|
1500
|
+
this._dc.removeStaticFields(staticFields);
|
1501
|
+
}
|
1355
1502
|
}
|
1356
1503
|
this._grid.freezeLayout(prevState);
|
1357
1504
|
};
|
@@ -1366,7 +1513,9 @@ Grid.prototype.removeAllColumns = function() {
|
|
1366
1513
|
return;
|
1367
1514
|
}
|
1368
1515
|
|
1369
|
-
this.
|
1516
|
+
if(!this._sharedSorter) {
|
1517
|
+
this.clearSort();
|
1518
|
+
}
|
1370
1519
|
for(var i = colCount; --i >= 0;) {
|
1371
1520
|
// WARNING: This may affect plugins event listeners
|
1372
1521
|
this._grid.setColumnDataBindingHandler(i, null);
|
@@ -1379,7 +1528,9 @@ Grid.prototype.removeAllColumns = function() {
|
|
1379
1528
|
|
1380
1529
|
this._connector.removeAllFields();
|
1381
1530
|
this._grid.setColumnCount(0);
|
1382
|
-
this._dc
|
1531
|
+
if(this._dc) {
|
1532
|
+
this._dc.resetStaticFields();
|
1533
|
+
}
|
1383
1534
|
};
|
1384
1535
|
|
1385
1536
|
/**
|
@@ -1558,6 +1709,11 @@ Grid.prototype.removeDataFields = function(fieldRef, referrer) {
|
|
1558
1709
|
* @param {string=} opt_order This can be "ascending", "descending", "none", "noOrder", or "originalOrder"
|
1559
1710
|
*/
|
1560
1711
|
Grid.prototype.sortColumn = function(colRef, opt_order) {
|
1712
|
+
if(typeof colRef === "string") {
|
1713
|
+
this._stp.sortColumn(colRef, opt_order); // Allow sorting by field
|
1714
|
+
return;
|
1715
|
+
}
|
1716
|
+
|
1561
1717
|
var colIndex = this.getColumnIndex(colRef);
|
1562
1718
|
if(colIndex < 0) {
|
1563
1719
|
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
@@ -1658,9 +1814,9 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
1658
1814
|
if(colDef) {
|
1659
1815
|
colDef.setSorter(func);
|
1660
1816
|
|
1661
|
-
var sortedColumn = this.getSortedColumnIndex();
|
1817
|
+
var sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
|
1662
1818
|
if(sortedColumn === colIndex) {
|
1663
|
-
this.
|
1819
|
+
this._stp.refresh();
|
1664
1820
|
}
|
1665
1821
|
}
|
1666
1822
|
};
|
@@ -1686,6 +1842,10 @@ Grid.prototype._initDuplicateRicData = function(rowDef) {
|
|
1686
1842
|
* grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
|
1687
1843
|
*/
|
1688
1844
|
Grid.prototype.insertRow = function(rowOption, rowRef) {
|
1845
|
+
if(this._mainGrid) {
|
1846
|
+
return this._mainGrid.insertRow(rowOption, this._getRowId(rowRef));
|
1847
|
+
}
|
1848
|
+
|
1689
1849
|
if(rowOption) {
|
1690
1850
|
if(typeof rowOption === "string") {
|
1691
1851
|
rowOption = { "ric": rowOption };
|
@@ -1698,11 +1858,11 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
1698
1858
|
var rowDef = new RowDefinition(rowOption);
|
1699
1859
|
rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
|
1700
1860
|
this._initDuplicateRicData(rowDef);
|
1701
|
-
if(rowDef.isFixedPosition()) {
|
1702
|
-
this._hasGroup = true; // HACK: This is temporary solution
|
1703
|
-
}
|
1704
1861
|
|
1705
1862
|
rowDef.registerToView(this._dv, this._getRowId(rowRef));
|
1863
|
+
if(rowOption && rowOption["hidden"]) {
|
1864
|
+
this._dv.hideRow(rowDef.getRowId()); // Try to obtain rowId in rowDef since rowId is not assigned when new rows are created.
|
1865
|
+
}
|
1706
1866
|
this._connector.addRic(rowDef);
|
1707
1867
|
return rowDef;
|
1708
1868
|
};
|
@@ -1720,6 +1880,10 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
1720
1880
|
* ]); // 4 rows are appended
|
1721
1881
|
*/
|
1722
1882
|
Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
1883
|
+
if(this._mainGrid) {
|
1884
|
+
this._mainGrid.insertRows(rowOptions, this._getRowId(rowRef));
|
1885
|
+
return;
|
1886
|
+
}
|
1723
1887
|
if(!Array.isArray(rowOptions)) {
|
1724
1888
|
return;
|
1725
1889
|
}
|
@@ -1738,7 +1902,6 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
1738
1902
|
}
|
1739
1903
|
this.insertRow(rowOption, rowId); // Note that data view is being frozen, so only using row id will work properly
|
1740
1904
|
}
|
1741
|
-
this._updateGroupOrder(); // TODO: Update group order for all scenarios
|
1742
1905
|
this._dt.freeze(prevState);
|
1743
1906
|
};
|
1744
1907
|
/** Add multiple rows without `ric` property in {@link RowDefinition}
|
@@ -1763,6 +1926,11 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
1763
1926
|
* grid.logDV({"colNames": ["field1", "field2", "field3", "field4"]}); // See results in console
|
1764
1927
|
*/
|
1765
1928
|
Grid.prototype.addStaticDataRows = function(dataRows, fields) {
|
1929
|
+
if(this._mainGrid) {
|
1930
|
+
this._mainGrid.addStaticDataRows(dataRows, fields);
|
1931
|
+
return;
|
1932
|
+
}
|
1933
|
+
|
1766
1934
|
if(!Array.isArray(dataRows)) {
|
1767
1935
|
var userObj = dataRows;
|
1768
1936
|
dataRows = null;
|
@@ -1890,6 +2058,9 @@ Grid._dataToRowOptions = function(item) {
|
|
1890
2058
|
* @see {@link Grid#removeAllRows}
|
1891
2059
|
*/
|
1892
2060
|
Grid.prototype.removeRow = function(rowRef) {
|
2061
|
+
if(this._mainGrid) {
|
2062
|
+
return this._mainGrid.removeRow(this._getRowId(rowRef));
|
2063
|
+
}
|
1893
2064
|
var rowDef = this._getRowDefinition(rowRef);
|
1894
2065
|
if(rowDef) {
|
1895
2066
|
if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
|
@@ -1911,6 +2082,9 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
1911
2082
|
rowDef = this.removeRow(rowRefs);
|
1912
2083
|
return rowDef ? [rowDef] : [];
|
1913
2084
|
}
|
2085
|
+
if(this._mainGrid) {
|
2086
|
+
return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
|
2087
|
+
}
|
1914
2088
|
|
1915
2089
|
var i;
|
1916
2090
|
var rowDefs = [];
|
@@ -1946,14 +2120,19 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
1946
2120
|
* @see {@link Grid#removeRows}
|
1947
2121
|
*/
|
1948
2122
|
Grid.prototype.removeAllRows = function() {
|
2123
|
+
if(this._sharedDataSource) {
|
2124
|
+
return;
|
2125
|
+
}
|
1949
2126
|
if(!this._dt.getRowCount()) {
|
1950
2127
|
return;
|
1951
2128
|
}
|
1952
2129
|
var rowDefs = this._getAllRowDefinitions();
|
1953
2130
|
|
1954
|
-
this.
|
1955
|
-
|
1956
|
-
|
2131
|
+
if(!this._sharedDataSource) {
|
2132
|
+
this._dc.clearAllData();
|
2133
|
+
this._dt.clearAllData();
|
2134
|
+
this._clearDataUpdates();
|
2135
|
+
}
|
1957
2136
|
|
1958
2137
|
rowDefs.forEach(RowDefinition.dispose);
|
1959
2138
|
|
@@ -1971,6 +2150,9 @@ Grid.prototype.removeAllRows = function() {
|
|
1971
2150
|
* @param {!RowDefinition} rowDef
|
1972
2151
|
*/
|
1973
2152
|
Grid.prototype._removeRow = function(rowDef) {
|
2153
|
+
if(this._sharedDataSource) {
|
2154
|
+
return;
|
2155
|
+
}
|
1974
2156
|
this._dispatch("beforeRowRemoved", {});
|
1975
2157
|
|
1976
2158
|
var rowIds = rowDef.getAllDescendantIds(); // TODO: Support nested child
|
@@ -1987,7 +2169,9 @@ Grid.prototype._removeRow = function(rowDef) {
|
|
1987
2169
|
* @param {boolean=} hidden if false, show instead of hide
|
1988
2170
|
*/
|
1989
2171
|
Grid.prototype.hideRow = function(rowRef, hidden) {
|
1990
|
-
this.
|
2172
|
+
var rid = this._getRowId(rowRef);
|
2173
|
+
var grid = this._mainGrid || this._grid;
|
2174
|
+
grid.hideRow(rid, hidden);
|
1991
2175
|
};
|
1992
2176
|
|
1993
2177
|
/** Hide row(s) in the Grid by specifying the rIds
|
@@ -2000,7 +2184,8 @@ Grid.prototype.hideRows = function (rowRefs, hidden) {
|
|
2000
2184
|
rowRefs = [rowRefs];
|
2001
2185
|
}
|
2002
2186
|
var rids = rowRefs.map(this._getRowId);
|
2003
|
-
this.
|
2187
|
+
var grid = this._mainGrid || this._grid;
|
2188
|
+
grid.hideRows(rids, hidden);
|
2004
2189
|
};
|
2005
2190
|
/**
|
2006
2191
|
* Show row(s) in the Grid by specifying the rIds
|
@@ -2032,6 +2217,10 @@ Grid.prototype.hasHiddenRow = function(){
|
|
2032
2217
|
* @param {string} str
|
2033
2218
|
*/
|
2034
2219
|
Grid.prototype.setRic = function(rowRef, str) {
|
2220
|
+
if(this._mainGrid) {
|
2221
|
+
this._mainGrid.setRic(this._toRowId(rowRef), str);
|
2222
|
+
return;
|
2223
|
+
}
|
2035
2224
|
var rowDef = this._getRowDefinition(rowRef);
|
2036
2225
|
if(rowDef) {
|
2037
2226
|
var oldRic = rowDef.getRic();
|
@@ -2225,6 +2414,17 @@ Grid.prototype.getRowDefinitions = function() {
|
|
2225
2414
|
Grid.prototype._getAllRowDefinitions = function() {
|
2226
2415
|
return this._dt.getColumnData(ROW_DEF); // no group header rows
|
2227
2416
|
};
|
2417
|
+
/** Get all row definitions, including filtered and hidden rows, but without group header rows.
|
2418
|
+
* @public
|
2419
|
+
* @param {boolean=} inclAutoGenerate=false means exclude auto generate rows
|
2420
|
+
* @return {!Array.<RowDefinition>}
|
2421
|
+
*/
|
2422
|
+
Grid.prototype.getAllRowDefinitions = function(inclAutoGenerate) {
|
2423
|
+
if(!inclAutoGenerate) {
|
2424
|
+
return this._dt.getColumnData(ROW_DEF).filter(excludeAutoGenerated);
|
2425
|
+
}
|
2426
|
+
return this._getAllRowDefinitions();
|
2427
|
+
};
|
2228
2428
|
/** A shorthand to retrieve row data based on index of the specified row.
|
2229
2429
|
* @public
|
2230
2430
|
* @param {number} rowIndex Row index as shown in the view
|
@@ -2402,11 +2602,14 @@ Grid.prototype.getAllFields = function() {
|
|
2402
2602
|
/** Freeze the column at the left side of the table starting from index 0 to the specified colIndex
|
2403
2603
|
* If no index is specified (null or undefined index), unfreeze all columns.
|
2404
2604
|
* @public
|
2405
|
-
* @param {number=}
|
2605
|
+
* @param {number=} colIndex Negative index is equivalent to null value
|
2406
2606
|
* @param {number=} pinnedRightColumns Number of columns to be pinned/snapped on the right side
|
2407
2607
|
*/
|
2408
|
-
Grid.prototype.freezeColumn = function(
|
2409
|
-
|
2608
|
+
Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
|
2609
|
+
if(colIndex == null) {
|
2610
|
+
colIndex = -1;
|
2611
|
+
}
|
2612
|
+
this._grid.freezeColumn(colIndex, pinnedRightColumns);
|
2410
2613
|
};
|
2411
2614
|
|
2412
2615
|
/** @private
|
@@ -2471,7 +2674,7 @@ Grid.prototype.updateColumnTitle = function() {
|
|
2471
2674
|
* @return {boolean}
|
2472
2675
|
*/
|
2473
2676
|
Grid.prototype.isSorting = function() {
|
2474
|
-
return this.
|
2677
|
+
return this._stp.isSorting();
|
2475
2678
|
};
|
2476
2679
|
/** @public
|
2477
2680
|
* @return {number}
|
@@ -2488,7 +2691,7 @@ Grid.prototype.getSortOrder = function() {
|
|
2488
2691
|
/** @public
|
2489
2692
|
*/
|
2490
2693
|
Grid.prototype.clearSort = function() {
|
2491
|
-
this._stp.clearSortState();
|
2694
|
+
this._stp.clearSortState(); // WARNING: No event is dispatched
|
2492
2695
|
};
|
2493
2696
|
|
2494
2697
|
/** @private
|
@@ -2586,43 +2789,38 @@ Grid.prototype._updateStreamingData = function() {
|
|
2586
2789
|
this._dt.dispatchGlobalChange();
|
2587
2790
|
}
|
2588
2791
|
};
|
2792
|
+
|
2589
2793
|
/** @private
|
2794
|
+
* @param {Object} e
|
2590
2795
|
*/
|
2591
|
-
Grid.prototype.
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
//
|
2597
|
-
var
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
if(
|
2607
|
-
|
2796
|
+
Grid.prototype._onPreDataSorting = function (e) {
|
2797
|
+
var field = "";
|
2798
|
+
var rowSorting = false;
|
2799
|
+
var sortLogic = null;
|
2800
|
+
|
2801
|
+
var states = this._stp.getSortingStates(); // WARNING: Use of deprecated function
|
2802
|
+
var state = states ? states[0] : null; // TODO: Support multi-column sorting
|
2803
|
+
|
2804
|
+
if(state) {
|
2805
|
+
field = state["field"] || "";
|
2806
|
+
var colIndex = this._stp.getSortedColumnIndex(0);
|
2807
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
2808
|
+
this._sorter.setContext("colIndex", colIndex);
|
2809
|
+
this._sorter.setContext("colDef", colDef);
|
2810
|
+
|
2811
|
+
if(colDef) {
|
2812
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
2813
|
+
sortLogic = colDef.getSorter();
|
2814
|
+
rowSorting = colDef.isRowSorting();
|
2608
2815
|
}
|
2609
|
-
prevParent = curParent;
|
2610
|
-
prevFixedState = curFixedState;
|
2611
|
-
dirty |= rowDef.setGroupOrder(groupOrder);
|
2612
2816
|
}
|
2613
|
-
if(
|
2614
|
-
|
2817
|
+
if(!sortLogic && field) {
|
2818
|
+
sortLogic = state["sortLogic"];
|
2615
2819
|
}
|
2616
|
-
};
|
2617
2820
|
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
Grid.prototype._onPreDataSorting = function (e) {
|
2622
|
-
// TODO: Support multi-column sorting
|
2623
|
-
var colIndex = this._stp.getSortedColumnIndex();
|
2624
|
-
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
2625
|
-
this._columnSorter = (colDef) ? colDef._prepareSortContext(colIndex) : null;
|
2821
|
+
this._sorter.setField(field);
|
2822
|
+
this._sorter.setSortLogic(sortLogic);
|
2823
|
+
this._columnSorter = this._sorter.getSorter(rowSorting);
|
2626
2824
|
};
|
2627
2825
|
/** @private
|
2628
2826
|
* @param {RowDefinition} rowDefA
|
@@ -2721,6 +2919,23 @@ Grid.prototype.focus = function() {
|
|
2721
2919
|
Grid.prototype.requestRowRefresh = function() {
|
2722
2920
|
this._grid.requestRowRefresh();
|
2723
2921
|
};
|
2922
|
+
/** Force recalculation of grid's layout
|
2923
|
+
* @public
|
2924
|
+
*/
|
2925
|
+
Grid.prototype.updateLayout = function() {
|
2926
|
+
this._grid.updateLayout();
|
2927
|
+
};
|
2928
|
+
/** Get extension instance
|
2929
|
+
* @public
|
2930
|
+
* @param {string} str Extension name
|
2931
|
+
* @return {*} Returns null, if the specified extension does not exist
|
2932
|
+
*/
|
2933
|
+
Grid.prototype.getExtension = function(str) {
|
2934
|
+
if(str) {
|
2935
|
+
return this._grid.getPlugin(str.replace(/Extension/ig, ""));
|
2936
|
+
}
|
2937
|
+
return null;
|
2938
|
+
};
|
2724
2939
|
|
2725
2940
|
/** @private
|
2726
2941
|
* @param {Object} e
|
@@ -2765,6 +2980,9 @@ Grid.prototype._onDataComposed = function(e) {
|
|
2765
2980
|
if(!rowDef) {
|
2766
2981
|
return;
|
2767
2982
|
}
|
2983
|
+
if(!rowDef.getDataSource()) {
|
2984
|
+
return; // Somehow, rowDef is invalid and doesn't have data source
|
2985
|
+
}
|
2768
2986
|
|
2769
2987
|
if(this._autoDateConversion) { // auto data conversion
|
2770
2988
|
var field, value, dataType, colDef;
|
@@ -2790,20 +3008,24 @@ Grid.prototype._onDataComposed = function(e) {
|
|
2790
3008
|
e["rowDef"] = rowDef;
|
2791
3009
|
this._dispatch("dataComposed", e);
|
2792
3010
|
}
|
3011
|
+
|
3012
|
+
this._recalculateFormulas(e);
|
2793
3013
|
};
|
2794
3014
|
|
2795
3015
|
/** @private
|
2796
3016
|
* @param {Object=} e
|
2797
3017
|
*/
|
2798
3018
|
Grid.prototype._recalculateFormulas = function(e) {
|
2799
|
-
if(this._fnEngine.getFormulaCount() <= 0) {
|
3019
|
+
if(!this._fnEngine || this._fnEngine.getFormulaCount() <= 0) {
|
3020
|
+
return;
|
3021
|
+
}
|
2800
3022
|
|
2801
3023
|
if(e && e["rid"]) {
|
2802
3024
|
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
2803
3025
|
} else {
|
2804
|
-
var rows = this._dc.getAllRowData(); // Slow
|
3026
|
+
var rows = this._dc ? this._dc.getAllRowData() : null; // Slow
|
2805
3027
|
|
2806
|
-
var rowCount = rows.length;
|
3028
|
+
var rowCount = rows ? rows.length : 0;
|
2807
3029
|
for(var r = 0; r < rowCount; ++r) { // WARNING: This is very slow
|
2808
3030
|
this._fnEngine.calculate(rows[r]);
|
2809
3031
|
}
|
@@ -2820,6 +3042,64 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
|
|
2820
3042
|
for (var ric in data) {
|
2821
3043
|
this.setRicData(ric, data[ric]);
|
2822
3044
|
}
|
3045
|
+
if(!this._lastPollingRequest) { // This is the first time we receive successful ADC response
|
3046
|
+
this._lastPollingRequest = 1; // Allow polling to be started
|
3047
|
+
}
|
3048
|
+
this._startPolling();
|
3049
|
+
};
|
3050
|
+
/** @private
|
3051
|
+
*/
|
3052
|
+
Grid.prototype._startPolling = function () {
|
3053
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
3054
|
+
if(this._lastPollingRequest && !this._pollingTimerId) {
|
3055
|
+
var now = new Date();
|
3056
|
+
this._lastPollingRequest = now.getTime();
|
3057
|
+
this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
|
3058
|
+
}
|
3059
|
+
}
|
3060
|
+
};
|
3061
|
+
/** @private
|
3062
|
+
*/
|
3063
|
+
Grid.prototype._onPollingInterval = function () {
|
3064
|
+
this._pollingTimerId = 0;
|
3065
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
3066
|
+
this.refreshADCData();
|
3067
|
+
this._startPolling();
|
3068
|
+
}
|
3069
|
+
};
|
3070
|
+
/** @public
|
3071
|
+
* @param {boolean=} activated=true
|
3072
|
+
*/
|
3073
|
+
Grid.prototype.activateADCPolling = function (activated) {
|
3074
|
+
if(activated !== false) {
|
3075
|
+
this._pollingEnabled = true;
|
3076
|
+
// Make immediate request after re-activation if it has been a long time
|
3077
|
+
var now = new Date();
|
3078
|
+
if(this._lastPollingRequest) {
|
3079
|
+
var diff = now.getTime() - this._lastPollingRequest;
|
3080
|
+
if(diff > this._pollingInterval) {
|
3081
|
+
this.refreshADCData();
|
3082
|
+
}
|
3083
|
+
}
|
3084
|
+
this._startPolling();
|
3085
|
+
} else {
|
3086
|
+
this._pollingEnabled = false;
|
3087
|
+
}
|
3088
|
+
};
|
3089
|
+
/** Force re-requesting ADC data to immediately update the data
|
3090
|
+
* @public
|
3091
|
+
* @return {boolean} Return true, if a request has been made
|
3092
|
+
*/
|
3093
|
+
Grid.prototype.refreshADCData = function () {
|
3094
|
+
var dirty = this._snapshot.addFields(this._connector.getAllFields());
|
3095
|
+
if(dirty) {
|
3096
|
+
dirty = this._snapshot.addRics(this._connector.getAllRics());
|
3097
|
+
if(dirty) {
|
3098
|
+
return true;
|
3099
|
+
}
|
3100
|
+
}
|
3101
|
+
this._lastPollingRequest = 0; // No ADC field or RIC detected. Prevent polling from continuing
|
3102
|
+
return false;
|
2823
3103
|
};
|
2824
3104
|
|
2825
3105
|
/** @private
|
@@ -2878,16 +3158,5 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
2878
3158
|
console.table(tbl); // eslint-disable-line
|
2879
3159
|
};
|
2880
3160
|
|
2881
|
-
/** @private
|
2882
|
-
* @function
|
2883
|
-
* @param {Object} to
|
2884
|
-
* @param {Object} from
|
2885
|
-
*/
|
2886
|
-
Grid._objectAssign = function (to, from) {
|
2887
|
-
for (var key in from) {
|
2888
|
-
to[key] = from[key];
|
2889
|
-
}
|
2890
|
-
};
|
2891
|
-
|
2892
3161
|
export { Grid };
|
2893
3162
|
export default Grid;
|