@refinitiv-ui/efx-grid 0.0.0-dev.12023565035.1
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/LICENSE +17 -0
- package/README.md +61 -0
- package/lib/column-dragging/es6/ColumnDragging.d.ts +51 -0
- package/lib/column-dragging/es6/ColumnDragging.js +968 -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/index.d.ts +2 -0
- package/lib/column-format-dialog/index.js +2 -0
- package/lib/column-format-dialog/lib/column-format-dialog.d.ts +77 -0
- package/lib/column-format-dialog/lib/column-format-dialog.js +2688 -0
- package/lib/column-format-dialog/lib/locale/translation-de.d.ts +7 -0
- package/lib/column-format-dialog/lib/locale/translation-de.js +94 -0
- package/lib/column-format-dialog/lib/locale/translation-en.d.ts +7 -0
- package/lib/column-format-dialog/lib/locale/translation-en.js +94 -0
- package/lib/column-format-dialog/lib/locale/translation-ja.d.ts +7 -0
- package/lib/column-format-dialog/lib/locale/translation-ja.js +94 -0
- package/lib/column-format-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
- package/lib/column-format-dialog/lib/locale/translation-zh-hant.js +94 -0
- package/lib/column-format-dialog/lib/locale/translation-zh.d.ts +7 -0
- package/lib/column-format-dialog/lib/locale/translation-zh.js +94 -0
- package/lib/column-format-dialog/lib/locale/translation.d.ts +11 -0
- package/lib/column-format-dialog/lib/locale/translation.js +18 -0
- package/lib/column-format-dialog/lib/preview-table.d.ts +151 -0
- package/lib/column-format-dialog/lib/preview-table.js +982 -0
- package/lib/column-format-dialog/themes/base.less +429 -0
- package/lib/column-format-dialog/themes/elemental/column-format-dialog.less +1 -0
- package/lib/column-format-dialog/themes/elemental/dark/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/elemental/dark/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/elemental/dark/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/elemental/dark/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/elemental/dark/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/elemental/dark/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/elemental/dark.js +16 -0
- package/lib/column-format-dialog/themes/elemental/defaults.less +1 -0
- package/lib/column-format-dialog/themes/elemental/index.less +5 -0
- package/lib/column-format-dialog/themes/elemental/light/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/elemental/light/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/elemental/light/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/elemental/light/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/elemental/light/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/elemental/light/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/elemental/light.js +16 -0
- package/lib/column-format-dialog/themes/halo/column-format-dialog.less +6 -0
- package/lib/column-format-dialog/themes/halo/dark/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/halo/dark/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/halo/dark/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/halo/dark/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/halo/dark/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/halo/dark/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/halo/dark.js +16 -0
- package/lib/column-format-dialog/themes/halo/defaults.less +1 -0
- package/lib/column-format-dialog/themes/halo/index.less +5 -0
- package/lib/column-format-dialog/themes/halo/light/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/halo/light/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/halo/light/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/halo/light/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/halo/light/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/halo/light/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/halo/light.js +16 -0
- package/lib/column-format-dialog/themes/luna/column-format-dialog.less +1 -0
- package/lib/column-format-dialog/themes/luna/default/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/luna/default/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/luna/default/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/luna/default/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/luna/default/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/luna/default/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/luna/defaults.less +1 -0
- package/lib/column-format-dialog/themes/luna/index.less +5 -0
- package/lib/column-format-dialog/themes/solar/charcoal/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/solar/charcoal/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/solar/charcoal/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/solar/charcoal/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/solar/charcoal/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/solar/charcoal/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/solar/charcoal.js +16 -0
- package/lib/column-format-dialog/themes/solar/column-format-dialog.less +6 -0
- package/lib/column-format-dialog/themes/solar/defaults.less +1 -0
- package/lib/column-format-dialog/themes/solar/index.less +5 -0
- package/lib/column-format-dialog/themes/solar/pearl/column-format-dialog.js +4 -0
- package/lib/column-format-dialog/themes/solar/pearl/css/native-elements.css +0 -0
- package/lib/column-format-dialog/themes/solar/pearl/es5/all-elements.js +2 -0
- package/lib/column-format-dialog/themes/solar/pearl/imports/all-elements.js +1 -0
- package/lib/column-format-dialog/themes/solar/pearl/imports/custom-elements.js +1 -0
- package/lib/column-format-dialog/themes/solar/pearl/imports/native-elements.js +0 -0
- package/lib/column-format-dialog/themes/solar/pearl.js +16 -0
- package/lib/column-selection-dialog/index.d.ts +2 -0
- package/lib/column-selection-dialog/index.js +2 -0
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +66 -0
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +2034 -0
- package/lib/column-selection-dialog/lib/locale/translation-de.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-de.js +20 -0
- package/lib/column-selection-dialog/lib/locale/translation-en.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-en.js +20 -0
- package/lib/column-selection-dialog/lib/locale/translation-ja.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-ja.js +20 -0
- package/lib/column-selection-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-zh-hant.js +20 -0
- package/lib/column-selection-dialog/lib/locale/translation-zh.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-zh.js +20 -0
- package/lib/column-selection-dialog/lib/locale/translation.d.ts +11 -0
- package/lib/column-selection-dialog/lib/locale/translation.js +18 -0
- package/lib/column-selection-dialog/themes/base.less +258 -0
- package/lib/column-selection-dialog/themes/elemental/column-selection-dialog.less +1 -0
- package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +4 -0
- package/lib/column-selection-dialog/themes/elemental/dark/css/native-elements.css +0 -0
- package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +2 -0
- package/lib/column-selection-dialog/themes/elemental/dark/imports/all-elements.js +1 -0
- package/lib/column-selection-dialog/themes/elemental/dark/imports/custom-elements.js +1 -0
- package/lib/column-selection-dialog/themes/elemental/dark/imports/native-elements.js +0 -0
- package/lib/column-selection-dialog/themes/elemental/dark.js +8 -0
- package/lib/column-selection-dialog/themes/elemental/defaults.less +1 -0
- package/lib/column-selection-dialog/themes/elemental/index.less +5 -0
- package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +4 -0
- package/lib/column-selection-dialog/themes/elemental/light/css/native-elements.css +0 -0
- package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +2 -0
- package/lib/column-selection-dialog/themes/elemental/light/imports/all-elements.js +1 -0
- package/lib/column-selection-dialog/themes/elemental/light/imports/custom-elements.js +1 -0
- package/lib/column-selection-dialog/themes/elemental/light/imports/native-elements.js +0 -0
- package/lib/column-selection-dialog/themes/elemental/light.js +8 -0
- package/lib/column-selection-dialog/themes/halo/column-selection-dialog.less +25 -0
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +4 -0
- package/lib/column-selection-dialog/themes/halo/dark/css/native-elements.css +0 -0
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +2 -0
- package/lib/column-selection-dialog/themes/halo/dark/imports/all-elements.js +1 -0
- package/lib/column-selection-dialog/themes/halo/dark/imports/custom-elements.js +1 -0
- package/lib/column-selection-dialog/themes/halo/dark/imports/native-elements.js +0 -0
- package/lib/column-selection-dialog/themes/halo/dark.js +8 -0
- package/lib/column-selection-dialog/themes/halo/defaults.less +1 -0
- package/lib/column-selection-dialog/themes/halo/index.less +6 -0
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +4 -0
- package/lib/column-selection-dialog/themes/halo/light/css/native-elements.css +0 -0
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +2 -0
- package/lib/column-selection-dialog/themes/halo/light/imports/all-elements.js +1 -0
- package/lib/column-selection-dialog/themes/halo/light/imports/custom-elements.js +1 -0
- package/lib/column-selection-dialog/themes/halo/light/imports/native-elements.js +0 -0
- package/lib/column-selection-dialog/themes/halo/light.js +8 -0
- package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +4 -0
- package/lib/column-selection-dialog/themes/solar/charcoal/css/native-elements.css +0 -0
- package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +2 -0
- package/lib/column-selection-dialog/themes/solar/charcoal/imports/all-elements.js +1 -0
- package/lib/column-selection-dialog/themes/solar/charcoal/imports/custom-elements.js +1 -0
- package/lib/column-selection-dialog/themes/solar/charcoal/imports/native-elements.js +0 -0
- package/lib/column-selection-dialog/themes/solar/charcoal.js +8 -0
- package/lib/column-selection-dialog/themes/solar/column-selection-dialog.less +5 -0
- package/lib/column-selection-dialog/themes/solar/defaults.less +1 -0
- package/lib/column-selection-dialog/themes/solar/index.less +6 -0
- package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +4 -0
- package/lib/column-selection-dialog/themes/solar/pearl/css/native-elements.css +0 -0
- package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +2 -0
- package/lib/column-selection-dialog/themes/solar/pearl/imports/all-elements.js +1 -0
- package/lib/column-selection-dialog/themes/solar/pearl/imports/custom-elements.js +1 -0
- package/lib/column-selection-dialog/themes/solar/pearl/imports/native-elements.js +0 -0
- package/lib/column-selection-dialog/themes/solar/pearl.js +8 -0
- package/lib/core/dist/core.css +1 -0
- package/lib/core/dist/core.js +33910 -0
- package/lib/core/dist/core.min.js +1 -0
- package/lib/core/es6/data/ColumnStats.d.ts +42 -0
- package/lib/core/es6/data/ColumnStats.js +428 -0
- package/lib/core/es6/data/DataCache.d.ts +43 -0
- package/lib/core/es6/data/DataCache.js +597 -0
- package/lib/core/es6/data/DataTable.d.ts +156 -0
- package/lib/core/es6/data/DataTable.js +2206 -0
- package/lib/core/es6/data/DataView.d.ts +332 -0
- package/lib/core/es6/data/DataView.js +4144 -0
- package/lib/core/es6/data/Segment.d.ts +91 -0
- package/lib/core/es6/data/Segment.js +1001 -0
- package/lib/core/es6/data/SegmentCollection.d.ts +84 -0
- package/lib/core/es6/data/SegmentCollection.js +713 -0
- package/lib/core/es6/data/WrappedView.d.ts +290 -0
- package/lib/core/es6/data/WrappedView.js +1320 -0
- package/lib/core/es6/grid/Core.d.ts +455 -0
- package/lib/core/es6/grid/Core.js +6196 -0
- package/lib/core/es6/grid/ILayoutGrid.d.ts +212 -0
- package/lib/core/es6/grid/ILayoutGrid.js +706 -0
- package/lib/core/es6/grid/LayoutGrid.d.ts +37 -0
- package/lib/core/es6/grid/LayoutGrid.js +2975 -0
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +28 -0
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +1241 -0
- package/lib/core/es6/grid/components/Cell.d.ts +52 -0
- package/lib/core/es6/grid/components/Cell.js +826 -0
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +21 -0
- package/lib/core/es6/grid/components/CellFloatingPanel.js +130 -0
- package/lib/core/es6/grid/components/CellSpan.d.ts +18 -0
- package/lib/core/es6/grid/components/CellSpan.js +99 -0
- package/lib/core/es6/grid/components/CellSpans.d.ts +40 -0
- package/lib/core/es6/grid/components/CellSpans.js +368 -0
- package/lib/core/es6/grid/components/Column.d.ts +22 -0
- package/lib/core/es6/grid/components/Column.js +618 -0
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +127 -0
- package/lib/core/es6/grid/components/ElementWrapper.js +718 -0
- package/lib/core/es6/grid/components/HScrollbar.d.ts +28 -0
- package/lib/core/es6/grid/components/HScrollbar.js +241 -0
- package/lib/core/es6/grid/components/Scrollbar.d.ts +63 -0
- package/lib/core/es6/grid/components/Scrollbar.js +1413 -0
- package/lib/core/es6/grid/components/StretchedCells.d.ts +17 -0
- package/lib/core/es6/grid/components/StretchedCells.js +342 -0
- package/lib/core/es6/grid/components/VScrollbar.d.ts +18 -0
- package/lib/core/es6/grid/components/VScrollbar.js +139 -0
- package/lib/core/es6/grid/components/VirtualItems.d.ts +12 -0
- package/lib/core/es6/grid/components/VirtualItems.js +51 -0
- package/lib/core/es6/grid/event/EventDispatcher.d.ts +16 -0
- package/lib/core/es6/grid/event/EventDispatcher.js +138 -0
- package/lib/core/es6/grid/event/EventListeners.d.ts +34 -0
- package/lib/core/es6/grid/event/EventListeners.js +166 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +155 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +1977 -0
- package/lib/core/es6/grid/util/CellBoundPainter.d.ts +16 -0
- package/lib/core/es6/grid/util/CellBoundPainter.js +171 -0
- package/lib/core/es6/grid/util/Conflator.d.ts +32 -0
- package/lib/core/es6/grid/util/Conflator.js +191 -0
- package/lib/core/es6/grid/util/Reverter.d.ts +14 -0
- package/lib/core/es6/grid/util/Reverter.js +79 -0
- package/lib/core/es6/grid/util/SectionSettings.d.ts +79 -0
- package/lib/core/es6/grid/util/SectionSettings.js +679 -0
- package/lib/core/es6/grid/util/SelectionList.d.ts +54 -0
- package/lib/core/es6/grid/util/SelectionList.js +491 -0
- package/lib/core/es6/grid/util/TrackLayout.d.ts +92 -0
- package/lib/core/es6/grid/util/TrackLayout.js +902 -0
- package/lib/core/es6/grid/util/Virtualizer.d.ts +40 -0
- package/lib/core/es6/grid/util/Virtualizer.js +340 -0
- package/lib/core/es6/grid/util/util.d.ts +20 -0
- package/lib/core/es6/grid/util/util.js +391 -0
- package/lib/core/es6/index.d.ts +79 -0
- package/lib/core/es6/index.js +125 -0
- package/lib/core/es6/tr-grid-theme.d.ts +5 -0
- package/lib/core/es6/tr-grid-theme.js +5 -0
- package/lib/filter-dialog/index.d.ts +2 -0
- package/lib/filter-dialog/index.js +2 -0
- package/lib/filter-dialog/lib/checkbox-list.d.ts +52 -0
- package/lib/filter-dialog/lib/checkbox-list.js +444 -0
- package/lib/filter-dialog/lib/filter-dialog.d.ts +75 -0
- package/lib/filter-dialog/lib/filter-dialog.js +1160 -0
- package/lib/filter-dialog/lib/locale/translation-de.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-de.js +40 -0
- package/lib/filter-dialog/lib/locale/translation-en.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-en.js +40 -0
- package/lib/filter-dialog/lib/locale/translation-ja.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-ja.js +40 -0
- package/lib/filter-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-zh-hant.js +40 -0
- package/lib/filter-dialog/lib/locale/translation-zh.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-zh.js +40 -0
- package/lib/filter-dialog/lib/locale/translation.d.ts +11 -0
- package/lib/filter-dialog/lib/locale/translation.js +18 -0
- package/lib/filter-dialog/themes/base-checkbox.less +42 -0
- package/lib/filter-dialog/themes/base.less +191 -0
- package/lib/filter-dialog/themes/elemental/checkbox-list.less +3 -0
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +4 -0
- package/lib/filter-dialog/themes/elemental/dark/css/native-elements.css +0 -0
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +4 -0
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +5 -0
- package/lib/filter-dialog/themes/elemental/dark/imports/all-elements.js +2 -0
- package/lib/filter-dialog/themes/elemental/dark/imports/custom-elements.js +2 -0
- package/lib/filter-dialog/themes/elemental/dark/imports/native-elements.js +0 -0
- package/lib/filter-dialog/themes/elemental/dark.js +11 -0
- package/lib/filter-dialog/themes/elemental/defaults.less +3 -0
- package/lib/filter-dialog/themes/elemental/filter-dialog.less +1 -0
- package/lib/filter-dialog/themes/elemental/index.less +6 -0
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +4 -0
- package/lib/filter-dialog/themes/elemental/light/css/native-elements.css +0 -0
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +4 -0
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +5 -0
- package/lib/filter-dialog/themes/elemental/light/imports/all-elements.js +2 -0
- package/lib/filter-dialog/themes/elemental/light/imports/custom-elements.js +2 -0
- package/lib/filter-dialog/themes/elemental/light/imports/native-elements.js +0 -0
- package/lib/filter-dialog/themes/elemental/light.js +11 -0
- package/lib/filter-dialog/themes/halo/checkbox-list.less +3 -0
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +4 -0
- package/lib/filter-dialog/themes/halo/dark/css/native-elements.css +0 -0
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +4 -0
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +5 -0
- package/lib/filter-dialog/themes/halo/dark/imports/all-elements.js +2 -0
- package/lib/filter-dialog/themes/halo/dark/imports/custom-elements.js +2 -0
- package/lib/filter-dialog/themes/halo/dark/imports/native-elements.js +0 -0
- package/lib/filter-dialog/themes/halo/dark.js +11 -0
- package/lib/filter-dialog/themes/halo/defaults.less +3 -0
- package/lib/filter-dialog/themes/halo/filter-dialog.less +15 -0
- package/lib/filter-dialog/themes/halo/index.less +6 -0
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +4 -0
- package/lib/filter-dialog/themes/halo/light/css/native-elements.css +0 -0
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +4 -0
- package/lib/filter-dialog/themes/halo/light/filter-dialog.js +5 -0
- package/lib/filter-dialog/themes/halo/light/imports/all-elements.js +2 -0
- package/lib/filter-dialog/themes/halo/light/imports/custom-elements.js +2 -0
- package/lib/filter-dialog/themes/halo/light/imports/native-elements.js +0 -0
- package/lib/filter-dialog/themes/halo/light.js +11 -0
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +4 -0
- package/lib/filter-dialog/themes/solar/charcoal/css/native-elements.css +0 -0
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +4 -0
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +5 -0
- package/lib/filter-dialog/themes/solar/charcoal/imports/all-elements.js +2 -0
- package/lib/filter-dialog/themes/solar/charcoal/imports/custom-elements.js +2 -0
- package/lib/filter-dialog/themes/solar/charcoal/imports/native-elements.js +0 -0
- package/lib/filter-dialog/themes/solar/charcoal.js +11 -0
- package/lib/filter-dialog/themes/solar/checkbox-list.less +3 -0
- package/lib/filter-dialog/themes/solar/defaults.less +3 -0
- package/lib/filter-dialog/themes/solar/filter-dialog.less +5 -0
- package/lib/filter-dialog/themes/solar/index.less +6 -0
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +4 -0
- package/lib/filter-dialog/themes/solar/pearl/css/native-elements.css +0 -0
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +4 -0
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +5 -0
- package/lib/filter-dialog/themes/solar/pearl/imports/all-elements.js +2 -0
- package/lib/filter-dialog/themes/solar/pearl/imports/custom-elements.js +2 -0
- package/lib/filter-dialog/themes/solar/pearl/imports/native-elements.js +0 -0
- package/lib/filter-dialog/themes/solar/pearl.js +11 -0
- package/lib/formatters/es6/CoralButtonFormatter.d.ts +20 -0
- package/lib/formatters/es6/CoralButtonFormatter.js +45 -0
- package/lib/formatters/es6/CoralCheckboxFormatter.d.ts +12 -0
- package/lib/formatters/es6/CoralCheckboxFormatter.js +50 -0
- package/lib/formatters/es6/CoralComboBoxFormatter.d.ts +23 -0
- package/lib/formatters/es6/CoralComboBoxFormatter.js +103 -0
- package/lib/formatters/es6/CoralIconFormatter.d.ts +21 -0
- package/lib/formatters/es6/CoralIconFormatter.js +50 -0
- package/lib/formatters/es6/CoralInputFormatter.d.ts +12 -0
- package/lib/formatters/es6/CoralInputFormatter.js +45 -0
- package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +20 -0
- package/lib/formatters/es6/CoralRadioButtonFormatter.js +85 -0
- package/lib/formatters/es6/CoralSelectFormatter.d.ts +23 -0
- package/lib/formatters/es6/CoralSelectFormatter.js +71 -0
- package/lib/formatters/es6/CoralToggleFormatter.d.ts +12 -0
- package/lib/formatters/es6/CoralToggleFormatter.js +47 -0
- package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +14 -0
- package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.js +119 -0
- package/lib/formatters/es6/EFButtonFormatter.d.ts +20 -0
- package/lib/formatters/es6/EFButtonFormatter.js +45 -0
- package/lib/formatters/es6/EFCheckboxFormatter.d.ts +12 -0
- package/lib/formatters/es6/EFCheckboxFormatter.js +50 -0
- package/lib/formatters/es6/EFComboBoxFormatter.d.ts +23 -0
- package/lib/formatters/es6/EFComboBoxFormatter.js +78 -0
- package/lib/formatters/es6/EFDateTimePickerFormatter.d.ts +13 -0
- package/lib/formatters/es6/EFDateTimePickerFormatter.js +60 -0
- package/lib/formatters/es6/EFIconFormatter.d.ts +21 -0
- package/lib/formatters/es6/EFIconFormatter.js +50 -0
- package/lib/formatters/es6/EFNumberFieldFormatter.d.ts +12 -0
- package/lib/formatters/es6/EFNumberFieldFormatter.js +45 -0
- package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +20 -0
- package/lib/formatters/es6/EFRadioButtonFormatter.js +132 -0
- package/lib/formatters/es6/EFSelectFormatter.d.ts +23 -0
- package/lib/formatters/es6/EFSelectFormatter.js +76 -0
- package/lib/formatters/es6/EFTextFieldFormatter.d.ts +12 -0
- package/lib/formatters/es6/EFTextFieldFormatter.js +40 -0
- package/lib/formatters/es6/EFToggleFormatter.d.ts +12 -0
- package/lib/formatters/es6/EFToggleFormatter.js +47 -0
- package/lib/formatters/es6/EmeraldDateTimePickerFormatter.d.ts +13 -0
- package/lib/formatters/es6/EmeraldDateTimePickerFormatter.js +55 -0
- package/lib/formatters/es6/FormatterBuilder.d.ts +26 -0
- package/lib/formatters/es6/FormatterBuilder.js +493 -0
- package/lib/formatters/es6/NumericInputFormatter.d.ts +13 -0
- package/lib/formatters/es6/NumericInputFormatter.js +64 -0
- package/lib/formatters/es6/PercentBarFormatter.d.ts +25 -0
- package/lib/formatters/es6/PercentBarFormatter.js +62 -0
- package/lib/formatters/es6/SimpleImageFormatter.d.ts +21 -0
- package/lib/formatters/es6/SimpleImageFormatter.js +64 -0
- package/lib/formatters/es6/SimpleInputFormatter.d.ts +12 -0
- package/lib/formatters/es6/SimpleInputFormatter.js +40 -0
- package/lib/formatters/es6/SimpleLinkFormatter.d.ts +21 -0
- package/lib/formatters/es6/SimpleLinkFormatter.js +48 -0
- package/lib/formatters/es6/SimpleTickerFormatter.d.ts +23 -0
- package/lib/formatters/es6/SimpleTickerFormatter.js +66 -0
- package/lib/formatters/es6/SimpleToggleFormatter.d.ts +22 -0
- package/lib/formatters/es6/SimpleToggleFormatter.js +132 -0
- package/lib/formatters/es6/TextFormatter.d.ts +12 -0
- package/lib/formatters/es6/TextFormatter.js +35 -0
- package/lib/formatters/es6/index.d.ts +64 -0
- package/lib/formatters/es6/index.js +88 -0
- package/lib/grid/index.d.ts +2 -0
- package/lib/grid/index.js +3 -0
- package/lib/grid/lib/efx-grid.d.ts +53 -0
- package/lib/grid/lib/efx-grid.js +444 -0
- package/lib/grid/themes/base.less +137 -0
- package/lib/grid/themes/ds/dark/css/native-elements.css +0 -0
- package/lib/grid/themes/ds/dark/efx-grid.js +4 -0
- package/lib/grid/themes/ds/dark/es5/all-elements.js +2 -0
- package/lib/grid/themes/ds/dark/imports/all-elements.js +1 -0
- package/lib/grid/themes/ds/dark/imports/custom-elements.js +1 -0
- package/lib/grid/themes/ds/dark/imports/native-elements.js +0 -0
- package/lib/grid/themes/ds/dark.js +3 -0
- package/lib/grid/themes/ds/efx-grid.less +207 -0
- package/lib/grid/themes/ds/index.less +3 -0
- package/lib/grid/themes/ds/light/css/native-elements.css +0 -0
- package/lib/grid/themes/ds/light/efx-grid.js +4 -0
- package/lib/grid/themes/ds/light/es5/all-elements.js +2 -0
- package/lib/grid/themes/ds/light/imports/all-elements.js +1 -0
- package/lib/grid/themes/ds/light/imports/custom-elements.js +1 -0
- package/lib/grid/themes/ds/light/imports/native-elements.js +0 -0
- package/lib/grid/themes/ds/light.js +3 -0
- package/lib/grid/themes/halo/dark/css/native-elements.css +0 -0
- package/lib/grid/themes/halo/dark/efx-grid.js +4 -0
- package/lib/grid/themes/halo/dark/es5/all-elements.js +2 -0
- package/lib/grid/themes/halo/dark/imports/all-elements.js +1 -0
- package/lib/grid/themes/halo/dark/imports/custom-elements.js +1 -0
- package/lib/grid/themes/halo/dark/imports/native-elements.js +0 -0
- package/lib/grid/themes/halo/dark.js +3 -0
- package/lib/grid/themes/halo/efx-grid.less +127 -0
- package/lib/grid/themes/halo/index.less +3 -0
- package/lib/grid/themes/halo/light/css/native-elements.css +0 -0
- package/lib/grid/themes/halo/light/efx-grid.js +4 -0
- package/lib/grid/themes/halo/light/es5/all-elements.js +2 -0
- package/lib/grid/themes/halo/light/imports/all-elements.js +1 -0
- package/lib/grid/themes/halo/light/imports/custom-elements.js +1 -0
- package/lib/grid/themes/halo/light/imports/native-elements.js +0 -0
- package/lib/grid/themes/halo/light.js +3 -0
- package/lib/grid/themes/solar/charcoal/css/native-elements.css +0 -0
- package/lib/grid/themes/solar/charcoal/efx-grid.js +4 -0
- package/lib/grid/themes/solar/charcoal/es5/all-elements.js +2 -0
- package/lib/grid/themes/solar/charcoal/imports/all-elements.js +1 -0
- package/lib/grid/themes/solar/charcoal/imports/custom-elements.js +1 -0
- package/lib/grid/themes/solar/charcoal/imports/native-elements.js +0 -0
- package/lib/grid/themes/solar/charcoal.js +3 -0
- package/lib/grid/themes/solar/efx-grid.less +27 -0
- package/lib/grid/themes/solar/index.less +3 -0
- package/lib/grid/themes/solar/pearl/css/native-elements.css +0 -0
- package/lib/grid/themes/solar/pearl/efx-grid.js +4 -0
- package/lib/grid/themes/solar/pearl/es5/all-elements.js +2 -0
- package/lib/grid/themes/solar/pearl/imports/all-elements.js +1 -0
- package/lib/grid/themes/solar/pearl/imports/custom-elements.js +1 -0
- package/lib/grid/themes/solar/pearl/imports/native-elements.js +0 -0
- package/lib/grid/themes/solar/pearl.js +3 -0
- package/lib/index.d.ts +100 -0
- package/lib/index.js +100 -0
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +115 -0
- package/lib/row-segmenting/es6/RowSegmenting.js +1182 -0
- package/lib/row-segmenting/es6/index.d.ts +1 -0
- package/lib/row-segmenting/es6/index.js +1 -0
- package/lib/rt-grid/dist/rt-grid.js +54547 -0
- package/lib/rt-grid/dist/rt-grid.min.js +1 -0
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +174 -0
- package/lib/rt-grid/es6/ColumnDefinition.js +1203 -0
- package/lib/rt-grid/es6/DataConnector.d.ts +43 -0
- package/lib/rt-grid/es6/DataConnector.js +290 -0
- package/lib/rt-grid/es6/FieldDefinition.d.ts +40 -0
- package/lib/rt-grid/es6/FieldDefinition.js +560 -0
- package/lib/rt-grid/es6/Grid.d.ts +376 -0
- package/lib/rt-grid/es6/Grid.js +4653 -0
- package/lib/rt-grid/es6/PredefinedFormula.d.ts +16 -0
- package/lib/rt-grid/es6/PredefinedFormula.js +33 -0
- package/lib/rt-grid/es6/ReferenceCounter.d.ts +40 -0
- package/lib/rt-grid/es6/ReferenceCounter.js +251 -0
- package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
- package/lib/rt-grid/es6/RowDefSorter.js +231 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +156 -0
- package/lib/rt-grid/es6/RowDefinition.js +1478 -0
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +36 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +537 -0
- package/lib/rt-grid/es6/StyleLoader.d.ts +17 -0
- package/lib/rt-grid/es6/StyleLoader.js +47 -0
- package/lib/rt-grid/es6/index.d.ts +8 -0
- package/lib/rt-grid/es6/index.js +43 -0
- package/lib/statistics-row/es6/StatisticsRow.d.ts +68 -0
- package/lib/statistics-row/es6/StatisticsRow.js +807 -0
- package/lib/statistics-row/es6/index.d.ts +1 -0
- package/lib/statistics-row/es6/index.js +1 -0
- package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.d.ts +46 -0
- package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.js +617 -0
- package/lib/tr-grid-auto-tooltip/es6/index.d.ts +1 -0
- package/lib/tr-grid-auto-tooltip/es6/index.js +1 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +70 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +1695 -0
- package/lib/tr-grid-cell-selection/es6/index.d.ts +1 -0
- package/lib/tr-grid-cell-selection/es6/index.js +1 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +82 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.js +1704 -0
- package/lib/tr-grid-checkbox/es6/index.d.ts +1 -0
- package/lib/tr-grid-checkbox/es6/index.js +1 -0
- package/lib/tr-grid-column-fitter/es6/ColumnFitter.d.ts +56 -0
- package/lib/tr-grid-column-fitter/es6/ColumnFitter.js +817 -0
- package/lib/tr-grid-column-fitter/es6/index.d.ts +1 -0
- package/lib/tr-grid-column-fitter/es6/index.js +1 -0
- package/lib/tr-grid-column-formatting/es6/ColumnFormatting.d.ts +91 -0
- package/lib/tr-grid-column-formatting/es6/ColumnFormatting.js +617 -0
- package/lib/tr-grid-column-formatting/es6/index.d.ts +1 -0
- package/lib/tr-grid-column-formatting/es6/index.js +1 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +110 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +2028 -0
- package/lib/tr-grid-column-grouping/es6/index.d.ts +1 -0
- package/lib/tr-grid-column-grouping/es6/index.js +1 -0
- package/lib/tr-grid-column-resizing/es6/ColumnResizing.d.ts +68 -0
- package/lib/tr-grid-column-resizing/es6/ColumnResizing.js +1010 -0
- package/lib/tr-grid-column-resizing/es6/index.d.ts +1 -0
- package/lib/tr-grid-column-resizing/es6/index.js +1 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +77 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +1405 -0
- package/lib/tr-grid-column-selection/es6/index.d.ts +1 -0
- package/lib/tr-grid-column-selection/es6/index.js +1 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +160 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +2155 -0
- package/lib/tr-grid-column-stack/es6/index.d.ts +1 -0
- package/lib/tr-grid-column-stack/es6/index.js +1 -0
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +100 -0
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1513 -0
- package/lib/tr-grid-conditional-coloring/es6/index.d.ts +1 -0
- package/lib/tr-grid-conditional-coloring/es6/index.js +1 -0
- package/lib/tr-grid-content-wrap/es6/ContentWrap.d.ts +43 -0
- package/lib/tr-grid-content-wrap/es6/ContentWrap.js +519 -0
- package/lib/tr-grid-content-wrap/es6/index.d.ts +1 -0
- package/lib/tr-grid-content-wrap/es6/index.js +1 -0
- package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +83 -0
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +453 -0
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +22 -0
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +138 -0
- package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +41 -0
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +285 -0
- package/lib/tr-grid-contextmenu/es6/PopupMenu.d.ts +33 -0
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +303 -0
- package/lib/tr-grid-contextmenu/es6/index.d.ts +1 -0
- package/lib/tr-grid-contextmenu/es6/index.js +1 -0
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +64 -0
- package/lib/tr-grid-filter-input/es6/FilterInput.js +1027 -0
- package/lib/tr-grid-filter-input/es6/index.d.ts +1 -0
- package/lib/tr-grid-filter-input/es6/index.js +1 -0
- package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +45 -0
- package/lib/tr-grid-heat-map/es6/HeatMap.js +401 -0
- package/lib/tr-grid-heat-map/es6/index.d.ts +1 -0
- package/lib/tr-grid-heat-map/es6/index.js +1 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +148 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +2671 -0
- package/lib/tr-grid-in-cell-editing/es6/index.d.ts +1 -0
- package/lib/tr-grid-in-cell-editing/es6/index.js +1 -0
- package/lib/tr-grid-pagination/es6/Pagination.d.ts +58 -0
- package/lib/tr-grid-pagination/es6/Pagination.js +433 -0
- package/lib/tr-grid-pagination/es6/index.d.ts +1 -0
- package/lib/tr-grid-pagination/es6/index.js +1 -0
- package/lib/tr-grid-percent-bar/es6/PercentBar.d.ts +60 -0
- package/lib/tr-grid-percent-bar/es6/PercentBar.js +804 -0
- package/lib/tr-grid-percent-bar/es6/index.d.ts +1 -0
- package/lib/tr-grid-percent-bar/es6/index.js +1 -0
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +50 -0
- package/lib/tr-grid-printer/es6/CellWriter.js +234 -0
- package/lib/tr-grid-printer/es6/ColumnWriter.d.ts +13 -0
- package/lib/tr-grid-printer/es6/ColumnWriter.js +23 -0
- package/lib/tr-grid-printer/es6/GridPrinter.d.ts +33 -0
- package/lib/tr-grid-printer/es6/GridPrinter.js +794 -0
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +39 -0
- package/lib/tr-grid-printer/es6/PrintTrait.js +494 -0
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +57 -0
- package/lib/tr-grid-printer/es6/SectionWriter.js +238 -0
- package/lib/tr-grid-printer/es6/index.d.ts +1 -0
- package/lib/tr-grid-printer/es6/index.js +1 -0
- package/lib/tr-grid-range-bar/es6/LEDGuage.d.ts +39 -0
- package/lib/tr-grid-range-bar/es6/LEDGuage.js +261 -0
- package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +56 -0
- package/lib/tr-grid-range-bar/es6/RangeBar.js +514 -0
- package/lib/tr-grid-range-bar/es6/index.d.ts +1 -0
- package/lib/tr-grid-range-bar/es6/index.js +1 -0
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +81 -0
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +1479 -0
- package/lib/tr-grid-row-dragging/es6/index.d.ts +1 -0
- package/lib/tr-grid-row-dragging/es6/index.js +1 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +159 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +2568 -0
- package/lib/tr-grid-row-filtering/es6/index.d.ts +1 -0
- package/lib/tr-grid-row-filtering/es6/index.js +1 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +123 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +1728 -0
- package/lib/tr-grid-row-grouping/es6/index.d.ts +1 -0
- package/lib/tr-grid-row-grouping/es6/index.js +1 -0
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +75 -0
- package/lib/tr-grid-row-selection/es6/RowSelection.js +1447 -0
- package/lib/tr-grid-row-selection/es6/index.d.ts +1 -0
- package/lib/tr-grid-row-selection/es6/index.js +1 -0
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +64 -0
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +615 -0
- package/lib/tr-grid-rowcoloring/es6/index.d.ts +1 -0
- package/lib/tr-grid-rowcoloring/es6/index.js +1 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +72 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +543 -0
- package/lib/tr-grid-textformatting/es6/index.d.ts +1 -0
- package/lib/tr-grid-textformatting/es6/index.js +1 -0
- package/lib/tr-grid-titlewrap/es6/TitleWrap.d.ts +27 -0
- package/lib/tr-grid-titlewrap/es6/TitleWrap.js +431 -0
- package/lib/tr-grid-titlewrap/es6/index.d.ts +1 -0
- package/lib/tr-grid-titlewrap/es6/index.js +1 -0
- package/lib/tr-grid-util/es6/CellPainter.d.ts +142 -0
- package/lib/tr-grid-util/es6/CellPainter.js +1183 -0
- package/lib/tr-grid-util/es6/Color.d.ts +40 -0
- package/lib/tr-grid-util/es6/Color.js +210 -0
- package/lib/tr-grid-util/es6/Conflator.d.ts +34 -0
- package/lib/tr-grid-util/es6/Conflator.js +193 -0
- package/lib/tr-grid-util/es6/CoralItems.d.ts +10 -0
- package/lib/tr-grid-util/es6/CoralItems.js +42 -0
- package/lib/tr-grid-util/es6/DateTime.d.ts +57 -0
- package/lib/tr-grid-util/es6/DateTime.js +508 -0
- package/lib/tr-grid-util/es6/Deferred.d.ts +16 -0
- package/lib/tr-grid-util/es6/Deferred.js +108 -0
- package/lib/tr-grid-util/es6/Delay.d.ts +20 -0
- package/lib/tr-grid-util/es6/Delay.js +96 -0
- package/lib/tr-grid-util/es6/Dom.d.ts +32 -0
- package/lib/tr-grid-util/es6/Dom.js +350 -0
- package/lib/tr-grid-util/es6/DragUI.d.ts +20 -0
- package/lib/tr-grid-util/es6/DragUI.js +263 -0
- package/lib/tr-grid-util/es6/ElementObserver.d.ts +12 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +134 -0
- package/lib/tr-grid-util/es6/ElementWrapper.d.ts +23 -0
- package/lib/tr-grid-util/es6/ElementWrapper.js +84 -0
- package/lib/tr-grid-util/es6/ElfDate.d.ts +26 -0
- package/lib/tr-grid-util/es6/ElfDate.js +164 -0
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +46 -0
- package/lib/tr-grid-util/es6/ElfUtil.js +637 -0
- package/lib/tr-grid-util/es6/EventDispatcher.d.ts +26 -0
- package/lib/tr-grid-util/es6/EventDispatcher.js +161 -0
- package/lib/tr-grid-util/es6/ExpanderIcon.d.ts +24 -0
- package/lib/tr-grid-util/es6/ExpanderIcon.js +120 -0
- package/lib/tr-grid-util/es6/ExpressionParser.d.ts +10 -0
- package/lib/tr-grid-util/es6/ExpressionParser.js +408 -0
- package/lib/tr-grid-util/es6/Ext.d.ts +10 -0
- package/lib/tr-grid-util/es6/Ext.js +52 -0
- package/lib/tr-grid-util/es6/FieldFormatter.d.ts +55 -0
- package/lib/tr-grid-util/es6/FieldFormatter.js +440 -0
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +54 -0
- package/lib/tr-grid-util/es6/FilterBuilder.js +580 -0
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +56 -0
- package/lib/tr-grid-util/es6/FilterOperators.js +255 -0
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +86 -0
- package/lib/tr-grid-util/es6/GridPlugin.js +1055 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +74 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.js +642 -0
- package/lib/tr-grid-util/es6/Icon.d.ts +14 -0
- package/lib/tr-grid-util/es6/Icon.js +62 -0
- package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +42 -0
- package/lib/tr-grid-util/es6/MouseDownTrait.js +250 -0
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +40 -0
- package/lib/tr-grid-util/es6/MultiTableManager.js +611 -0
- package/lib/tr-grid-util/es6/NumberFormatter.d.ts +85 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +528 -0
- package/lib/tr-grid-util/es6/PercentBar.d.ts +71 -0
- package/lib/tr-grid-util/es6/PercentBar.js +600 -0
- package/lib/tr-grid-util/es6/Perf.d.ts +32 -0
- package/lib/tr-grid-util/es6/Perf.js +163 -0
- package/lib/tr-grid-util/es6/Popup.d.ts +98 -0
- package/lib/tr-grid-util/es6/Popup.js +991 -0
- package/lib/tr-grid-util/es6/RangeBar.d.ts +33 -0
- package/lib/tr-grid-util/es6/RangeBar.js +260 -0
- package/lib/tr-grid-util/es6/RequestQueue.d.ts +30 -0
- package/lib/tr-grid-util/es6/RequestQueue.js +228 -0
- package/lib/tr-grid-util/es6/RowPainter.d.ts +60 -0
- package/lib/tr-grid-util/es6/RowPainter.js +448 -0
- package/lib/tr-grid-util/es6/SubTable.d.ts +78 -0
- package/lib/tr-grid-util/es6/SubTable.js +642 -0
- package/lib/tr-grid-util/es6/Table.d.ts +146 -0
- package/lib/tr-grid-util/es6/Table.js +832 -0
- package/lib/tr-grid-util/es6/TextHighlighter.d.ts +16 -0
- package/lib/tr-grid-util/es6/TextHighlighter.js +268 -0
- package/lib/tr-grid-util/es6/TickCodes.d.ts +8 -0
- package/lib/tr-grid-util/es6/TickCodes.js +33 -0
- package/lib/tr-grid-util/es6/Timer.d.ts +16 -0
- package/lib/tr-grid-util/es6/Timer.js +49 -0
- package/lib/tr-grid-util/es6/TouchProxy.d.ts +46 -0
- package/lib/tr-grid-util/es6/TouchProxy.js +212 -0
- package/lib/tr-grid-util/es6/Util.d.ts +66 -0
- package/lib/tr-grid-util/es6/Util.js +508 -0
- package/lib/tr-grid-util/es6/formula/ADCService.d.ts +11 -0
- package/lib/tr-grid-util/es6/formula/ADCService.js +72 -0
- package/lib/tr-grid-util/es6/formula/ADCSubscription.d.ts +17 -0
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +317 -0
- package/lib/tr-grid-util/es6/formula/AdFinService.d.ts +12 -0
- package/lib/tr-grid-util/es6/formula/AdFinService.js +61 -0
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.d.ts +19 -0
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +310 -0
- package/lib/tr-grid-util/es6/formula/Engine.d.ts +56 -0
- package/lib/tr-grid-util/es6/formula/Engine.js +592 -0
- package/lib/tr-grid-util/es6/formula/Formula.d.ts +68 -0
- package/lib/tr-grid-util/es6/formula/Formula.js +890 -0
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.d.ts +16 -0
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +165 -0
- package/lib/tr-grid-util/es6/formula/Realtime.d.ts +18 -0
- package/lib/tr-grid-util/es6/formula/Realtime.js +279 -0
- package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +18 -0
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +203 -0
- package/lib/tr-grid-util/es6/formula/TSIService.d.ts +11 -0
- package/lib/tr-grid-util/es6/formula/TSIService.js +51 -0
- package/lib/tr-grid-util/es6/formula/TSISubscription.d.ts +18 -0
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +1015 -0
- package/lib/tr-grid-util/es6/formula/VariableToken.d.ts +30 -0
- package/lib/tr-grid-util/es6/formula/VariableToken.js +314 -0
- package/lib/tr-grid-util/es6/formula/functions/AdFin.d.ts +9 -0
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +1778 -0
- package/lib/tr-grid-util/es6/formula/functions/Excel.d.ts +8 -0
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +21 -0
- package/lib/tr-grid-util/es6/formula/functions/Info.d.ts +8 -0
- package/lib/tr-grid-util/es6/formula/functions/Info.js +192 -0
- package/lib/tr-grid-util/es6/formula/functions/Internal.d.ts +8 -0
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +90 -0
- package/lib/tr-grid-util/es6/formula/functions/Logic.d.ts +12 -0
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +176 -0
- package/lib/tr-grid-util/es6/formula/functions/Math.d.ts +18 -0
- package/lib/tr-grid-util/es6/formula/functions/Math.js +1624 -0
- package/lib/tr-grid-util/es6/formula/functions/Statistics.d.ts +18 -0
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +234 -0
- package/lib/tr-grid-util/es6/formula/functions/Text.d.ts +10 -0
- package/lib/tr-grid-util/es6/formula/functions/Text.js +676 -0
- package/lib/tr-grid-util/es6/index.d.ts +65 -0
- package/lib/tr-grid-util/es6/index.js +102 -0
- package/lib/tr-grid-util/es6/jet/Adc.d.ts +9 -0
- package/lib/tr-grid-util/es6/jet/Adc.js +268 -0
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +28 -0
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +151 -0
- package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +136 -0
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +860 -0
- package/lib/tr-grid-util/es6/jet/DataSet.d.ts +8 -0
- package/lib/tr-grid-util/es6/jet/DataSet.js +392 -0
- package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +21 -0
- package/lib/tr-grid-util/es6/jet/MockArchive.js +56 -0
- package/lib/tr-grid-util/es6/jet/MockJET.d.ts +25 -0
- package/lib/tr-grid-util/es6/jet/MockJET.js +71 -0
- package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +37 -0
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +199 -0
- package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +82 -0
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +890 -0
- package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +48 -0
- package/lib/tr-grid-util/es6/jet/MockRTK.js +82 -0
- package/lib/tr-grid-util/es6/jet/MockUtil.d.ts +7 -0
- package/lib/tr-grid-util/es6/jet/MockUtil.js +25 -0
- package/lib/tr-grid-util/es6/jet/index.d.ts +9 -0
- package/lib/tr-grid-util/es6/jet/index.js +18 -0
- package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +11 -0
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +111 -0
- package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
- package/lib/tr-grid-util/es6/locale/translation-de.d.ts +7 -0
- package/lib/tr-grid-util/es6/locale/translation-de.js +51 -0
- package/lib/tr-grid-util/es6/locale/translation-en.d.ts +7 -0
- package/lib/tr-grid-util/es6/locale/translation-en.js +51 -0
- package/lib/tr-grid-util/es6/locale/translation-ja.d.ts +7 -0
- package/lib/tr-grid-util/es6/locale/translation-ja.js +51 -0
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.d.ts +7 -0
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +51 -0
- package/lib/tr-grid-util/es6/locale/translation-zh.d.ts +7 -0
- package/lib/tr-grid-util/es6/locale/translation-zh.js +51 -0
- package/lib/tr-grid-util/es6/locale/translation.d.ts +11 -0
- package/lib/tr-grid-util/es6/locale/translation.js +18 -0
- package/lib/types/es6/AutoTooltip.d.ts +46 -0
- package/lib/types/es6/CellSelection.d.ts +70 -0
- package/lib/types/es6/Checkbox.d.ts +82 -0
- package/lib/types/es6/ColumnDragging.d.ts +51 -0
- package/lib/types/es6/ColumnFitter.d.ts +56 -0
- package/lib/types/es6/ColumnFormatting.d.ts +92 -0
- package/lib/types/es6/ColumnGrouping.d.ts +107 -0
- package/lib/types/es6/ColumnResizing.d.ts +68 -0
- package/lib/types/es6/ColumnSelection.d.ts +77 -0
- package/lib/types/es6/ColumnStack.d.ts +160 -0
- package/lib/types/es6/CompositeGrid/CollapsibleHeaderPlugin.d.ts +11 -0
- package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +41 -0
- package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +45 -0
- package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +289 -0
- package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +23 -0
- package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +41 -0
- package/lib/types/es6/CompositeGrid/Plugin.d.ts +30 -0
- package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +32 -0
- package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +44 -0
- package/lib/types/es6/CompositeGrid/TextWidthCalculator.d.ts +24 -0
- package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +46 -0
- package/lib/types/es6/CompositeGrid/index.d.ts +9 -0
- package/lib/types/es6/ConditionalColoring.d.ts +100 -0
- package/lib/types/es6/ContentWrap.d.ts +43 -0
- package/lib/types/es6/ContextMenu.d.ts +83 -0
- package/lib/types/es6/CoralButtonFormatter.d.ts +20 -0
- package/lib/types/es6/CoralCheckboxFormatter.d.ts +12 -0
- package/lib/types/es6/CoralComboBoxFormatter.d.ts +23 -0
- package/lib/types/es6/CoralIconFormatter.d.ts +21 -0
- package/lib/types/es6/CoralInputFormatter.d.ts +12 -0
- package/lib/types/es6/CoralRadioButtonFormatter.d.ts +20 -0
- package/lib/types/es6/CoralSelectFormatter.d.ts +23 -0
- package/lib/types/es6/CoralToggleFormatter.d.ts +12 -0
- package/lib/types/es6/Core/data/ColumnStats.d.ts +42 -0
- package/lib/types/es6/Core/data/DataCache.d.ts +43 -0
- package/lib/types/es6/Core/data/DataTable.d.ts +156 -0
- package/lib/types/es6/Core/data/DataView.d.ts +332 -0
- package/lib/types/es6/Core/data/Segment.d.ts +91 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +84 -0
- package/lib/types/es6/Core/data/WrappedView.d.ts +290 -0
- package/lib/types/es6/Core/grid/Core.d.ts +455 -0
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +212 -0
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +37 -0
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +28 -0
- package/lib/types/es6/Core/grid/components/Cell.d.ts +52 -0
- package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +21 -0
- package/lib/types/es6/Core/grid/components/CellSpan.d.ts +18 -0
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +40 -0
- package/lib/types/es6/Core/grid/components/Column.d.ts +22 -0
- package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +127 -0
- package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +28 -0
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +63 -0
- package/lib/types/es6/Core/grid/components/StretchedCells.d.ts +17 -0
- package/lib/types/es6/Core/grid/components/VScrollbar.d.ts +18 -0
- package/lib/types/es6/Core/grid/components/VirtualItems.d.ts +12 -0
- package/lib/types/es6/Core/grid/event/EventDispatcher.d.ts +16 -0
- package/lib/types/es6/Core/grid/event/EventListeners.d.ts +34 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +155 -0
- package/lib/types/es6/Core/grid/util/CellBoundPainter.d.ts +16 -0
- package/lib/types/es6/Core/grid/util/Conflator.d.ts +32 -0
- package/lib/types/es6/Core/grid/util/Reverter.d.ts +14 -0
- package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +79 -0
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +54 -0
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +92 -0
- package/lib/types/es6/Core/grid/util/Virtualizer.d.ts +40 -0
- package/lib/types/es6/Core/grid/util/util.d.ts +20 -0
- package/lib/types/es6/Core/index.d.ts +79 -0
- package/lib/types/es6/Core/tr-grid-theme.d.ts +5 -0
- package/lib/types/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +14 -0
- package/lib/types/es6/EFButtonFormatter.d.ts +20 -0
- package/lib/types/es6/EFCheckboxFormatter.d.ts +12 -0
- package/lib/types/es6/EFComboBoxFormatter.d.ts +23 -0
- package/lib/types/es6/EFDateTimePickerFormatter.d.ts +13 -0
- package/lib/types/es6/EFIconFormatter.d.ts +21 -0
- package/lib/types/es6/EFNumberFieldFormatter.d.ts +12 -0
- package/lib/types/es6/EFRadioButtonFormatter.d.ts +20 -0
- package/lib/types/es6/EFSelectFormatter.d.ts +23 -0
- package/lib/types/es6/EFTextFieldFormatter.d.ts +12 -0
- package/lib/types/es6/EFToggleFormatter.d.ts +12 -0
- package/lib/types/es6/EmeraldDateTimePickerFormatter.d.ts +13 -0
- package/lib/types/es6/ExtensionColumnOptions.d.ts +41 -0
- package/lib/types/es6/ExtensionOptions.d.ts +58 -0
- package/lib/types/es6/Extensions.d.ts +63 -0
- package/lib/types/es6/FilterInput.d.ts +64 -0
- package/lib/types/es6/FormatterBuilder.d.ts +26 -0
- package/lib/types/es6/GridFormatter.d.ts +63 -0
- package/lib/types/es6/HeatMap.d.ts +45 -0
- package/lib/types/es6/InCellEditing.d.ts +148 -0
- package/lib/types/es6/MenuEventAPI.d.ts +22 -0
- package/lib/types/es6/MenuItem.d.ts +41 -0
- package/lib/types/es6/NumericInputFormatter.d.ts +13 -0
- package/lib/types/es6/Pagination.d.ts +58 -0
- package/lib/types/es6/PercentBar.d.ts +60 -0
- package/lib/types/es6/PercentBarFormatter.d.ts +25 -0
- package/lib/types/es6/PopupMenu.d.ts +33 -0
- package/lib/types/es6/RangeBar.d.ts +39 -0
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +176 -0
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +43 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +40 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +413 -0
- package/lib/types/es6/RealtimeGrid/PredefinedFormula.d.ts +16 -0
- package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +40 -0
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +156 -0
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +36 -0
- package/lib/types/es6/RealtimeGrid/StyleLoader.d.ts +17 -0
- package/lib/types/es6/RealtimeGrid/index.d.ts +8 -0
- package/lib/types/es6/RowColoring.d.ts +64 -0
- package/lib/types/es6/RowDragging.d.ts +81 -0
- package/lib/types/es6/RowFiltering.d.ts +159 -0
- package/lib/types/es6/RowGrouping.d.ts +123 -0
- package/lib/types/es6/RowSegmenting.d.ts +109 -0
- package/lib/types/es6/RowSelection.d.ts +75 -0
- package/lib/types/es6/SimpleImageFormatter.d.ts +21 -0
- package/lib/types/es6/SimpleInputFormatter.d.ts +12 -0
- package/lib/types/es6/SimpleLinkFormatter.d.ts +21 -0
- package/lib/types/es6/SimpleTickerFormatter.d.ts +23 -0
- package/lib/types/es6/SimpleToggleFormatter.d.ts +22 -0
- package/lib/types/es6/StatisticsRow.d.ts +68 -0
- package/lib/types/es6/TextFormatter.d.ts +12 -0
- package/lib/types/es6/TextFormatting.d.ts +72 -0
- package/lib/types/es6/TitleWrap.d.ts +27 -0
- package/lib/types/es6/Zoom.d.ts +52 -0
- package/lib/types/es6/index.d.ts +80 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.js +7 -0
- package/lib/versions.json +37 -0
- package/lib/window-exporter.js +18 -0
- package/lib/zoom/es6/Zoom.d.ts +52 -0
- package/lib/zoom/es6/Zoom.js +438 -0
- package/lib/zoom/es6/index.d.ts +1 -0
- package/lib/zoom/es6/index.js +1 -0
- package/package.json +69 -0
@@ -0,0 +1,4653 @@
|
|
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";
|
5
|
+
import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
|
6
|
+
import { Engine } from "../../tr-grid-util/es6/formula/Engine.js";
|
7
|
+
import { cloneObject, extendObject, arrayToObject, isEmptyObject, deepEqual } from "../../tr-grid-util/es6/Util.js";
|
8
|
+
import { DateTime } from "../../tr-grid-util/es6/DateTime.js";
|
9
|
+
|
10
|
+
import { RowDefinition, ROW_DEF } from "./RowDefinition.js";
|
11
|
+
import { ColumnDefinition, COL_DEF } from "./ColumnDefinition.js";
|
12
|
+
import SnapshotFiller from "./SnapshotFiller.js";
|
13
|
+
import StyleLoader from "./StyleLoader.js";
|
14
|
+
import FieldDefinition from "./FieldDefinition.js";
|
15
|
+
import DataConnector from "./DataConnector.js";
|
16
|
+
import RowDefSorter from "./RowDefSorter.js";
|
17
|
+
|
18
|
+
import { Core } from "../../core/es6/grid/Core.js";
|
19
|
+
import { SortableTitlePlugin } from "../../core/es6/grid/plugins/SortableTitlePlugin.js";
|
20
|
+
import { DataCache } from "../../core/es6/data/DataCache.js";
|
21
|
+
import { DataTable } from "../../core/es6/data/DataTable.js";
|
22
|
+
import { DataView } from "../../core/es6/data/DataView.js";
|
23
|
+
import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js";
|
24
|
+
/* eslint-enable */
|
25
|
+
|
26
|
+
/** @typedef {Object} Grid~SynapseConfig
|
27
|
+
* @description Configuration object that can be provided directly at the initialization phase
|
28
|
+
* @property {string} apiKey Synapse api key
|
29
|
+
* @property {string} contextApp Synapse context app name
|
30
|
+
* @property {string=} auth Synapse authen token
|
31
|
+
* @property {boolean=} debug=false If true, Synapse response will be mock
|
32
|
+
*/
|
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
|
+
|
39
|
+
/** @typedef {Object} Grid~GridOptions
|
40
|
+
* @description Configuration object that can be provided directly at the initialization phase
|
41
|
+
* @property {Array.<ColumnDefinition~Options|string>=} columns Collection of the column definitions
|
42
|
+
* @property {ColumnDefinition~Options=} defaultColumnOptions All Columns will inherit from this default object
|
43
|
+
* @property {Array.<RowDefinition~Options>=} rows Collection of the row definitions
|
44
|
+
* @property {Array.<string>=} fields Shorthand for setting fields
|
45
|
+
* @property {Array.<string>=} rics Shorthand for creating row definition
|
46
|
+
* @property {Array=} plugins Additional plugins for core grid (from getBlotter()/getCoreGrid())
|
47
|
+
* @property {Array=} extensions Alias to `plugins`
|
48
|
+
* @property {boolean=} scrollbar=true Enable both vertical and horizontal scrollbar in grid
|
49
|
+
* @property {boolean=} linearWheelScrolling=false If enabled, wheel scrolling will move the content linearly regardless of how long the content is (i.e. no skipping).
|
50
|
+
* @property {boolean=} stepScroll=false If enabled, a full row will be scrolled at a time instead of actual scroll value.
|
51
|
+
* @property {boolean=} autoHideScrollbar=true Fading in/out Scrollbar on hover.
|
52
|
+
* @property {string=} pageSize=0 Make grid show specified number of row
|
53
|
+
* @property {number=} rowHeight=32 Set default row height for body (content) section
|
54
|
+
* @property {number=} headerRowHeight=32 Set default row height for header section
|
55
|
+
* @property {boolean=} noColumnDragging=false All columns can be moved by dragging. If this option is true, the feature is disabled
|
56
|
+
* @property {boolean=} columnReorder=true Alias with noColumnDragging but in opposite value. This property deprecated in favor of noColumnDragging.
|
57
|
+
* @property {boolean=} rowHighlighting=true Highlight a row when hovering mouse over grid
|
58
|
+
* @property {(boolean|number)=} autoLayoutUpdate=false Grid will check for layout change periodically.
|
59
|
+
* @property {number=} columnFreezing Deprecated in favor of column's leftPinned property. Enable horizontal scrollbar after `columnFreezing` index
|
60
|
+
* @property {number=} freezeColumn Deprecated in favor of column's leftPinned property. An alias to columnFreezing
|
61
|
+
* @property {number=} pinnedRightColumns=0 Deprecated in favor of column's rightPinned property. Number of columns to be frozen/pinned on the right side.
|
62
|
+
* @property {Array=} staticDataRows Shorthand for calling {@link Grid#addStaticDataRows}
|
63
|
+
* @property {Array.<string>=} dataFields Shorthand for calling {@link Grid#addDataFields}
|
64
|
+
* @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.
|
65
|
+
* @property {boolean=} columnVirtualization=false If enabled, columns that are out of grid's view will NOT be rendered. This could greatly improve grid's performance when there are a lot of columns.
|
66
|
+
* @property {(number|null|boolean)=} topFreezingCount=null If number >= 0 will fix number of frozen title section, If false = disabled scrollbar, if null then title section will freeze auto when new section added, this option will not work with scrollbar option.
|
67
|
+
* @property {(number|null)=} bottomFreezingCount=null If number >= 0 will fix nuber of frozen footer section, if null then footer section will freeze auto when new section added, this option will not work with scrollbar option.
|
68
|
+
* @property {boolean=} borders=false Lines around grid element
|
69
|
+
* @property {boolean=} gridlines Horizontal and Vertical lines for ONLY content sections
|
70
|
+
* @property {boolean=} verticalLines=false Vertical lines for all sections
|
71
|
+
* @property {boolean=} contentVerticalLines=false Vertical lines for all content section
|
72
|
+
* @property {boolean=} horizontalLines=true Horizontal lines for all sections
|
73
|
+
* @property {*=} RTK=null rtk toolkit instance
|
74
|
+
* @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
|
75
|
+
* @property {Grid~SynapseConfig=} synapse=null synapse config object
|
76
|
+
* @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
|
77
|
+
* @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
|
78
|
+
* @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
|
79
|
+
* @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
|
80
|
+
* @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
|
81
|
+
* @property {string=} lang laguage for config localization date time, if null the default language is "en"
|
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.
|
85
|
+
* @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
|
86
|
+
* @property {boolean=} timeSeriesExpansion=true If disabled, the time series field will be treated as a normal field and not expanded.
|
87
|
+
* @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
|
88
|
+
* @property {boolean=} topSection=true If disabled, title section will not be rendered
|
89
|
+
* @property {SortableTitlePlugin~Options=} sorting Options for sorting
|
90
|
+
* @property {Function=} dataComposed Handler for dataComposed event
|
91
|
+
* @property {Function=} beforeContentBinding Handler for beforeContentBinding event
|
92
|
+
* @property {Function=} firstRendered Handler for firstRendered event
|
93
|
+
* @property {Function=} afterContentBinding Handler for afterContentBinding event
|
94
|
+
*/
|
95
|
+
|
96
|
+
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
97
|
+
* @description A row in Grid can be referred by the following values: <br>
|
98
|
+
* <b>number</b> : Row index of a visible rows, excluding invisible (hidden) rows<br>
|
99
|
+
* <b>RowDefinition</b> : Row definition object<br>
|
100
|
+
* <b>string</b> : Unique row Id existing in current data table, including invisible rows<br>
|
101
|
+
*/
|
102
|
+
|
103
|
+
/** @typedef {number|string|ColumnDefinition} Grid~ColumnReference
|
104
|
+
* @description A column in Grid can be referred by the following values:<br>
|
105
|
+
* <b>number</b> : Column index including all invisible (hidden) columns<br>
|
106
|
+
* <b>string</b> : Field name or column id of the column<br>
|
107
|
+
* <b>ColumnDefinition</b> : Column definition object<br>
|
108
|
+
*/
|
109
|
+
|
110
|
+
/** @event Grid#fieldAdded
|
111
|
+
* @description Fired after the field has been added to the data table.
|
112
|
+
* @property {string} type "fieldAdded"
|
113
|
+
* @property {Array.<string>} addedFields An array of newly added fields
|
114
|
+
* @property {Array.<string>} fields All fields
|
115
|
+
* @property {Array.<string>} rics All rics
|
116
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
117
|
+
*/
|
118
|
+
/** @event Grid#fieldRemoved
|
119
|
+
* @description Fired after the field has been removed from the data table.
|
120
|
+
* @property {string} type "fieldRemoved"
|
121
|
+
* @property {Array.<string>} removedFields An array of recently removed fields
|
122
|
+
* @property {Array.<string>} fields All fields
|
123
|
+
* @property {Array.<string>} rics All rics
|
124
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
125
|
+
*/
|
126
|
+
/** @event Grid#ricAdded
|
127
|
+
* @description Fired after the ric has been added to the data table.
|
128
|
+
* @property {string} type "ricAdded"
|
129
|
+
* @property {Array.<string>} addedRics An array of newly added rics
|
130
|
+
* @property {Array.<string>} fields All fields
|
131
|
+
* @property {Array.<string>} rics All rics
|
132
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
133
|
+
*/
|
134
|
+
/** @event Grid#ricRemoved
|
135
|
+
* @description Fired after the ric has been removed from the data table.
|
136
|
+
* @property {string} type "ricRemoved"
|
137
|
+
* @property {Array.<string>} removedRics An array of recently removed rics
|
138
|
+
* @property {Array.<string>} fields All fields
|
139
|
+
* @property {Array.<string>} rics All rics
|
140
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
141
|
+
*/
|
142
|
+
|
143
|
+
/** @event Grid#adcDataReceived
|
144
|
+
* @description Fired after ADC data or response received from the server
|
145
|
+
* @property {Array.<Array>} data Data part of the server response
|
146
|
+
*/
|
147
|
+
/** @event Grid#pageIndexChanged
|
148
|
+
* @description Fired after page index in the data view is changed during the active pagination mode
|
149
|
+
*/
|
150
|
+
/** @event Grid#pageCountChanged
|
151
|
+
* @description Fired after page count in the data view is changed during the active pagination mode
|
152
|
+
*/
|
153
|
+
/** @event Grid#dataComposed
|
154
|
+
* @description Trigger before dataChanged. Perform any data update during the event will NOT cause more dataChanged events
|
155
|
+
* @property {Grid} grid
|
156
|
+
* @property {RowDefinition} rowDef
|
157
|
+
*/
|
158
|
+
|
159
|
+
/** @event Grid#beforeContentBinding
|
160
|
+
* @property {Object} e Event of beforeContentBinding, we can use e.actualUpdate to check the actual data update, otherwise It will be empty when it is rendered by row virtualization or only the UI changes.
|
161
|
+
* @description Trigger before content binding.
|
162
|
+
*/
|
163
|
+
|
164
|
+
/** @event Grid#firstRendered
|
165
|
+
* @property {Object} e Event of firstRendered
|
166
|
+
* @description This event is triggered when the content is rendered for the first time.
|
167
|
+
*/
|
168
|
+
|
169
|
+
/** @event Grid#afterContentBinding
|
170
|
+
* @property {Object} e Event of afterContentBinding
|
171
|
+
* @description Trigger after content binding.
|
172
|
+
*/
|
173
|
+
|
174
|
+
/** @event Grid#beforeRowRemoved
|
175
|
+
* @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
|
176
|
+
*/
|
177
|
+
|
178
|
+
/** @event Grid#beforeUnlinked
|
179
|
+
* @description Trigger before unlinking a chain row.
|
180
|
+
* @type {Object}
|
181
|
+
* @property {RowDefinition} chain An row definition object of a chain row.
|
182
|
+
* @property {boolean} collapsed Collapsing state of a chain row.
|
183
|
+
* @property {Object} ridMap A map of constituent rics and row ids used to customize row ids.
|
184
|
+
*/
|
185
|
+
|
186
|
+
/** @private
|
187
|
+
* @param {RowDefinition} rowDef
|
188
|
+
* @return {Object}
|
189
|
+
*/
|
190
|
+
let toRowData = function(rowDef) {
|
191
|
+
return rowDef ? rowDef.getRowData() : null;
|
192
|
+
};
|
193
|
+
|
194
|
+
/** @private
|
195
|
+
* @param {RowDefinition} rowDef
|
196
|
+
* @return {boolean}
|
197
|
+
*/
|
198
|
+
let excludeAutoGenerated = function (rowDef) {
|
199
|
+
return !rowDef.isAutoGenerated();
|
200
|
+
};
|
201
|
+
|
202
|
+
/** @private
|
203
|
+
* @param {Object} colConfig column config
|
204
|
+
* @return {boolean}
|
205
|
+
*/
|
206
|
+
let _byNonAutoGeneratedColumn = function (colConfig) {
|
207
|
+
return !colConfig.autoGenerated;
|
208
|
+
};
|
209
|
+
/** @private
|
210
|
+
* @param {string} rowDefA
|
211
|
+
* @param {string} rowDefB
|
212
|
+
* @param {string} sortOrder
|
213
|
+
* @param {string} fieldName
|
214
|
+
* @return {number} The outcome of the value comparison
|
215
|
+
*/
|
216
|
+
let compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit name
|
217
|
+
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
218
|
+
};
|
219
|
+
|
220
|
+
/**
|
221
|
+
* @private
|
222
|
+
* @param {string} rowDefA
|
223
|
+
* @param {string} rowDefB
|
224
|
+
* @param {string} sortOrder
|
225
|
+
* @return {number} The outcome of the value comparison
|
226
|
+
*/
|
227
|
+
let _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
228
|
+
let parentA = rowDefA.getParent();
|
229
|
+
|
230
|
+
if (!parentA) {
|
231
|
+
return 0;
|
232
|
+
}
|
233
|
+
|
234
|
+
let parentB = rowDefB.getParent();
|
235
|
+
|
236
|
+
if (!parentB) {
|
237
|
+
return 0;
|
238
|
+
}
|
239
|
+
|
240
|
+
if (parentA !== parentB) {
|
241
|
+
return 0;
|
242
|
+
}
|
243
|
+
|
244
|
+
let a = rowDefA.getData('CHILD_ORDER');
|
245
|
+
|
246
|
+
if (a == null) {
|
247
|
+
return 0;
|
248
|
+
}
|
249
|
+
|
250
|
+
let b = rowDefB.getData('CHILD_ORDER');
|
251
|
+
|
252
|
+
if (b == null) {
|
253
|
+
return 0;
|
254
|
+
}
|
255
|
+
|
256
|
+
return ( a - b ) * sortOrder;
|
257
|
+
};
|
258
|
+
|
259
|
+
/** @private
|
260
|
+
* @param {ColumnDefinition} colDef
|
261
|
+
* @return {string}
|
262
|
+
*/
|
263
|
+
let _getName = function(colDef) {
|
264
|
+
if(colDef) {
|
265
|
+
return colDef.getName();
|
266
|
+
}
|
267
|
+
return "";
|
268
|
+
};
|
269
|
+
/** @private
|
270
|
+
* @param {ColumnDefinition} colDef
|
271
|
+
* @param {string} str
|
272
|
+
* @return {boolean}
|
273
|
+
*/
|
274
|
+
let _hasFieldOrId = function(colDef, str) {
|
275
|
+
return (colDef.getField() === str) || (colDef.getId() === str);
|
276
|
+
};
|
277
|
+
|
278
|
+
/** Compare the difference in the 'id' property.
|
279
|
+
* @private
|
280
|
+
* @param {Object} obj1
|
281
|
+
* @param {Object} obj2
|
282
|
+
* @returns {boolean} If the id property of two objects is equal, the return will be true, otherwise it will be false.
|
283
|
+
*/
|
284
|
+
let _hasMatchingId = function(obj1, obj2) {
|
285
|
+
if(!obj1 || !obj2 || !obj1.id || !obj2.id) { // Handle nullable, if the object or id have null, it's means difference value
|
286
|
+
return false;
|
287
|
+
}
|
288
|
+
return obj1.id === obj2.id;
|
289
|
+
};
|
290
|
+
|
291
|
+
/** @private
|
292
|
+
* @param {Object} e
|
293
|
+
*/
|
294
|
+
let _preventDefault = function(e) {
|
295
|
+
if(e) {
|
296
|
+
e.preventDefault();
|
297
|
+
}
|
298
|
+
};
|
299
|
+
/** @private
|
300
|
+
* @param {number=} id
|
301
|
+
* @returns {number} Always return 0
|
302
|
+
*/
|
303
|
+
let _clearTimeout = function(id) {
|
304
|
+
if(id) {
|
305
|
+
clearTimeout(id);
|
306
|
+
}
|
307
|
+
return 0;
|
308
|
+
};
|
309
|
+
|
310
|
+
/** @constructor
|
311
|
+
* @extends {EventDispatcher}
|
312
|
+
* @param {(Element|null)=} placeholder
|
313
|
+
* @param {Grid~GridOptions=} config
|
314
|
+
*/
|
315
|
+
let Grid = function(placeholder, config) {
|
316
|
+
let t = this; // This is to primarily reduce file size
|
317
|
+
|
318
|
+
t._onDataChanged = t._onDataChanged.bind(t);
|
319
|
+
t._onQuote2PostUpdate = t._onQuote2PostUpdate.bind(t);
|
320
|
+
t._onQ2DataChanged = t._onQ2DataChanged.bind(t);
|
321
|
+
t._onDataComposed = t._onDataComposed.bind(t);
|
322
|
+
t._onSubSegmentChanged = t._onSubSegmentChanged.bind(t);
|
323
|
+
t._recalculateFormulas = t._recalculateFormulas.bind(t);
|
324
|
+
t.updateColumnTitle = t.updateColumnTitle.bind(t);
|
325
|
+
t._populateTimeSeriesChildren = t._populateTimeSeriesChildren.bind(t);
|
326
|
+
|
327
|
+
t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
|
328
|
+
t._asyncClearDataUpdates = t._asyncClearDataUpdates.bind(t);
|
329
|
+
t._clearDataUpdates = t._clearDataUpdates.bind(t);
|
330
|
+
t._onPreDataSorting = t._onPreDataSorting.bind(t);
|
331
|
+
t._mainSorter = t._mainSorter.bind(t);
|
332
|
+
t._updateRowData = t._updateRowData.bind(t);
|
333
|
+
t._onFormulaDataChanged = t._onFormulaDataChanged.bind(t);
|
334
|
+
t._onFormulaDataRequired = t._onFormulaDataRequired.bind(t);
|
335
|
+
t._registerConstituents = t._registerConstituents.bind(t);
|
336
|
+
t._onColumnAdded = t._onColumnAdded.bind(t);
|
337
|
+
t._onRowExpansionBinding = t._onRowExpansionBinding.bind(t);
|
338
|
+
t._onColumnHeaderBinding = t._onColumnHeaderBinding.bind(t);
|
339
|
+
t._getRowId = t._getRowId.bind(t);
|
340
|
+
t._onFieldLoadedError = t._onFieldLoadedError.bind(t);
|
341
|
+
|
342
|
+
t._snapshotFillerDataChanged = t._snapshotFillerDataChanged.bind(t);
|
343
|
+
t._onPollingInterval = t._onPollingInterval.bind(t);
|
344
|
+
|
345
|
+
t._onTabNavigation = t._onTabNavigation.bind(t);
|
346
|
+
t._requestScroll = t._requestScroll.bind(t);
|
347
|
+
t._onVScroll = t._onVScroll.bind(t);
|
348
|
+
t._selfScrollToRow = t._selfScrollToRow.bind(t);
|
349
|
+
|
350
|
+
t._dcConflator = new Conflator(50, t._onDataChanged);
|
351
|
+
t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
|
352
|
+
t._chainConflator = new Conflator(100, t._registerConstituents);
|
353
|
+
t._columnTitleConflator = new Conflator(0, t.updateColumnTitle);
|
354
|
+
t._timeSeriesChildConflator = new Conflator(0, t._populateTimeSeriesChildren);
|
355
|
+
|
356
|
+
|
357
|
+
t._defaultColumnOptions = {};
|
358
|
+
|
359
|
+
t._topNode = placeholder || Dom.div();
|
360
|
+
t._topNode.classList.add("rt-grid");
|
361
|
+
t._grid = new Core();
|
362
|
+
t._grid._wrapper = this; // For back referencing
|
363
|
+
|
364
|
+
t._sorter = new RowDefSorter();
|
365
|
+
t._sorter.setContext("grid", this);
|
366
|
+
t._sorter.setContext("core", t._grid); // TODO: Handle multiple core grids
|
367
|
+
|
368
|
+
t._dateTimeUtil = DateTime;
|
369
|
+
|
370
|
+
t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
|
371
|
+
|
372
|
+
if(config) {
|
373
|
+
if(config["dataView"]) {
|
374
|
+
t._sharedDataSource = true;
|
375
|
+
t._dv = config["dataView"];
|
376
|
+
t._dt = t._dv.getDataTable();
|
377
|
+
t._mainGrid = config["grid"];
|
378
|
+
|
379
|
+
let core = t._mainGrid.getCoreGrid();
|
380
|
+
t._stp = core.getPlugin("SortableTitlePlugin");
|
381
|
+
}
|
382
|
+
if(config["SortableTitle"]) { // Exception for built-in plugin
|
383
|
+
t._stp = config["SortableTitle"];
|
384
|
+
}
|
385
|
+
if(config["topSection"] === false) {
|
386
|
+
t._topSection = false;
|
387
|
+
}
|
388
|
+
}
|
389
|
+
if(!t._sharedDataSource) {
|
390
|
+
t._dc = new DataCache();
|
391
|
+
t._dc.listen("dataChanged", t._onDataChanged);
|
392
|
+
t._dc.listen("dataComposed", t._onDataComposed);
|
393
|
+
|
394
|
+
t._dt = new DataTable();
|
395
|
+
t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
|
396
|
+
t._dt.setClassificationSource(t._dc);
|
397
|
+
t._dt.listen("subSegmentChanged", t._onSubSegmentChanged);
|
398
|
+
t._dv = new DataView(t._dt);
|
399
|
+
t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
|
400
|
+
t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
|
401
|
+
}
|
402
|
+
t._grid.setDataSource(t._dv); // Avoid triggering sorting
|
403
|
+
|
404
|
+
if(t._stp) {
|
405
|
+
t._sharedSorter = true;
|
406
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
407
|
+
t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
|
408
|
+
} else { // Create built-in plugin
|
409
|
+
t._stp = new SortableTitlePlugin({
|
410
|
+
"userManagedLogic": true,
|
411
|
+
"sortableColumns": true,
|
412
|
+
"disableDoubleClickToSort": true,
|
413
|
+
"ROW_DEF": true // Enable Row Definition Mode
|
414
|
+
});
|
415
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
416
|
+
|
417
|
+
// TODO: Built-in plugins don't have normal workflow unlike other extensions. Make them have the same workflow like the others
|
418
|
+
// defaultColumnOptions property does not work with them.
|
419
|
+
// beforeInit is not called.
|
420
|
+
t._grid.loadPlugin(t._stp, config);
|
421
|
+
}
|
422
|
+
|
423
|
+
t._grid.listen("beforeContentBinding", t._dispatch.bind(t, "beforeContentBinding"));
|
424
|
+
t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
|
425
|
+
t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
|
426
|
+
t._grid.listen("firstRendered", t._dispatch.bind(t, "firstRendered"));
|
427
|
+
t._grid.listen("afterContentBinding", t._dispatch.bind(t, "afterContentBinding"));
|
428
|
+
t._grid.listen("tabNavigation", t._onTabNavigation);
|
429
|
+
|
430
|
+
t._grid.getVScrollbar().listen("scroll", t._onVScroll);
|
431
|
+
|
432
|
+
t._grid.enableRowHighlighting(true);
|
433
|
+
|
434
|
+
t._addGridSections();
|
435
|
+
t._grid.setParent(t._topNode);
|
436
|
+
|
437
|
+
t._snapshot = new SnapshotFiller();
|
438
|
+
t._snapshot.addEventListener("adcDataReceived", t._dispatch.bind(t, "adcDataReceived"));
|
439
|
+
t._snapshot.addEventListener("dataChanged", this._snapshotFillerDataChanged);
|
440
|
+
|
441
|
+
t._connector = new DataConnector();
|
442
|
+
t._connector.addEventListener("ricAdded", t._onRicAdded.bind(t));
|
443
|
+
t._connector.addEventListener("ricRemoved", t._onRicRemoved.bind(t));
|
444
|
+
t._connector.addEventListener("fieldAdded", t._onFieldAdded.bind(t));
|
445
|
+
t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
|
446
|
+
|
447
|
+
t.initialize(config);
|
448
|
+
|
449
|
+
StyleLoader.applyStyle(t._grid);
|
450
|
+
};
|
451
|
+
Ext.inherits(Grid, EventDispatcher);
|
452
|
+
|
453
|
+
/** @private
|
454
|
+
* @type {Element}
|
455
|
+
*/
|
456
|
+
Grid.prototype._topNode = null;
|
457
|
+
/** @private
|
458
|
+
* @type {Grid}
|
459
|
+
*/
|
460
|
+
Grid.prototype._mainGrid = null;
|
461
|
+
/** @private
|
462
|
+
* @type {Core}
|
463
|
+
*/
|
464
|
+
Grid.prototype._grid = null;
|
465
|
+
/** Store all actual data including streaming data, ADC data, snapshot data, user input data.
|
466
|
+
* @type {DataCache}
|
467
|
+
* @private
|
468
|
+
*/
|
469
|
+
Grid.prototype._dc = null;
|
470
|
+
/** Used for hiding and filtering out rows. Always have greater or equal number of rows than that in grid
|
471
|
+
* @type {DataTable}
|
472
|
+
* @private
|
473
|
+
*/
|
474
|
+
Grid.prototype._dt = null;
|
475
|
+
/** Used for sorting. Number of rows is always the same as that in grid
|
476
|
+
* @type {DataView}
|
477
|
+
* @private
|
478
|
+
*/
|
479
|
+
Grid.prototype._dv = null;
|
480
|
+
/** @type {boolean}
|
481
|
+
* @private
|
482
|
+
*/
|
483
|
+
Grid.prototype._sharedDataSource = false;
|
484
|
+
/** @type {boolean}
|
485
|
+
* @private
|
486
|
+
*/
|
487
|
+
Grid.prototype._sharedSorter = false;
|
488
|
+
|
489
|
+
/** JET/RTK's Quotes2 subscription object
|
490
|
+
* @type {Object}
|
491
|
+
* @private
|
492
|
+
*/
|
493
|
+
Grid.prototype._subs = null;
|
494
|
+
|
495
|
+
/** @type {SortableTitlePlugin}
|
496
|
+
* @private
|
497
|
+
*/
|
498
|
+
Grid.prototype._stp = null;
|
499
|
+
/** @type {Function}
|
500
|
+
* @private
|
501
|
+
*/
|
502
|
+
Grid.prototype._columnSorter = null;
|
503
|
+
|
504
|
+
/** @private
|
505
|
+
* @type {Conflator}
|
506
|
+
*/
|
507
|
+
Grid.prototype._dcConflator = null;
|
508
|
+
/** @private
|
509
|
+
* @type {SnapshotFiller}
|
510
|
+
*/
|
511
|
+
Grid.prototype._snapshot = null;
|
512
|
+
/** @private
|
513
|
+
* @type {DataConnector}
|
514
|
+
*/
|
515
|
+
Grid.prototype._connector = null;
|
516
|
+
/** @private
|
517
|
+
* @type {RowDefSorter}
|
518
|
+
*/
|
519
|
+
Grid.prototype._sorter = null;
|
520
|
+
|
521
|
+
/** @private
|
522
|
+
* @type {Engine}
|
523
|
+
*/
|
524
|
+
Grid.prototype._fnEngine = null;
|
525
|
+
/** @private
|
526
|
+
* @type {Conflator}
|
527
|
+
*/
|
528
|
+
Grid.prototype._formulaConflator = null;
|
529
|
+
|
530
|
+
/** @private
|
531
|
+
* @type {Conflator}
|
532
|
+
*/
|
533
|
+
Grid.prototype._chainConflator = null;
|
534
|
+
/** @private
|
535
|
+
* @type {Object}
|
536
|
+
*/
|
537
|
+
Grid.prototype._constituentMap = null;
|
538
|
+
/** @private
|
539
|
+
* @type {number}
|
540
|
+
*/
|
541
|
+
Grid.prototype._clientWidth = NaN;
|
542
|
+
/** @private
|
543
|
+
* @type {number}
|
544
|
+
*/
|
545
|
+
Grid.prototype._autoLayoutTimer = 0;
|
546
|
+
/** @private
|
547
|
+
* @type {ColumnDefinition~Options}
|
548
|
+
*/
|
549
|
+
Grid.prototype._defaultColumnOptions = null;
|
550
|
+
/** @private
|
551
|
+
* @type {*}
|
552
|
+
*/
|
553
|
+
Grid.prototype._RTK = null;
|
554
|
+
/** @private
|
555
|
+
* @type {Grid~ADCOptions}
|
556
|
+
*/
|
557
|
+
Grid.prototype._ADCOptions = null;
|
558
|
+
/** use for synapse service
|
559
|
+
* @private
|
560
|
+
* @type {string}
|
561
|
+
*/
|
562
|
+
Grid.prototype._synapse = null;
|
563
|
+
/** @private
|
564
|
+
* @type {boolean}
|
565
|
+
*/
|
566
|
+
Grid.prototype._autoDateConversion = false;
|
567
|
+
/** @private
|
568
|
+
* @type {boolean}
|
569
|
+
*/
|
570
|
+
Grid.prototype._textSelect = false;
|
571
|
+
/** @type {string}
|
572
|
+
* @private
|
573
|
+
*/
|
574
|
+
Grid.prototype._lang = null;
|
575
|
+
/** @type {Object}
|
576
|
+
* @private
|
577
|
+
*/
|
578
|
+
Grid.prototype._dateTimeUtil = null;
|
579
|
+
/** @type {boolean}
|
580
|
+
* @private
|
581
|
+
*/
|
582
|
+
Grid.prototype._initializing = false;
|
583
|
+
/** @type {number}
|
584
|
+
* @private
|
585
|
+
*/
|
586
|
+
Grid.prototype._pollingInterval = 0;
|
587
|
+
/** @type {number}
|
588
|
+
* @private
|
589
|
+
*/
|
590
|
+
Grid.prototype._pollingTimerId = 0;
|
591
|
+
/** @type {number}
|
592
|
+
* @private
|
593
|
+
*/
|
594
|
+
Grid.prototype._lastPollingRequest = 0;
|
595
|
+
/** @type {boolean}
|
596
|
+
* @private
|
597
|
+
*/
|
598
|
+
Grid.prototype._pollingEnabled = true;
|
599
|
+
/** @type {boolean}
|
600
|
+
* @private
|
601
|
+
*/
|
602
|
+
Grid.prototype._fieldCaching = false;
|
603
|
+
/** @type {boolean}
|
604
|
+
* @private
|
605
|
+
*/
|
606
|
+
Grid.prototype._timeSeriesExpansion = true;
|
607
|
+
|
608
|
+
/** @type {string}
|
609
|
+
* @private
|
610
|
+
*/
|
611
|
+
Grid.prototype._childDataField = "";
|
612
|
+
/** @type {boolean}
|
613
|
+
* @private
|
614
|
+
*/
|
615
|
+
Grid.prototype._topSection = true;
|
616
|
+
/** @type {Object}
|
617
|
+
* @private
|
618
|
+
*/
|
619
|
+
Grid.prototype._focusingArgs = null;
|
620
|
+
/** @type {boolean}
|
621
|
+
* @private
|
622
|
+
*/
|
623
|
+
Grid.prototype._hasNewUpdates = false;
|
624
|
+
|
625
|
+
/** @public
|
626
|
+
*/
|
627
|
+
Grid.prototype.dispose = function() {
|
628
|
+
this.removeAllEventListeners();
|
629
|
+
if(this._autoLayoutTimer) {
|
630
|
+
clearInterval(this._autoLayoutTimer);
|
631
|
+
this._autoLayoutTimer = 0;
|
632
|
+
}
|
633
|
+
this._pollingTimerId = _clearTimeout(this._pollingTimerId);
|
634
|
+
|
635
|
+
this.removeAllColumns(); // Some conflators are reset
|
636
|
+
this.removeAllRows(); // Some conflators are reset
|
637
|
+
this._sorter.dispose();
|
638
|
+
this._grid.dispose();
|
639
|
+
this._snapshot.dispose();
|
640
|
+
this._connector.dispose();
|
641
|
+
this._connector = null;
|
642
|
+
|
643
|
+
if(!this._sharedDataSource) { // Make sure that this is the final grid, and its data is disposed
|
644
|
+
if(this._subs) {
|
645
|
+
this._subs.removeEventListener("postUpdate", this._onQuote2PostUpdate);
|
646
|
+
this._subs.removeEventListener("dataChanged", this._onQ2DataChanged);
|
647
|
+
this._subs["dispose"]();
|
648
|
+
}
|
649
|
+
if(this._dc) {
|
650
|
+
this._dc.dispose();
|
651
|
+
}
|
652
|
+
if(this._dt) {
|
653
|
+
this._dt.dispose();
|
654
|
+
}
|
655
|
+
if(this._dv) {
|
656
|
+
this._dv.dispose();
|
657
|
+
}
|
658
|
+
}
|
659
|
+
this._mainGrid = this._dc = this._dt = this._dv = this._subs = null;
|
660
|
+
|
661
|
+
if(this._focusingArgs) {
|
662
|
+
_clearTimeout(this._focusingArgs.id);
|
663
|
+
_clearTimeout(this._focusingArgs.timeoutId);
|
664
|
+
this._focusingArgs = null;
|
665
|
+
}
|
666
|
+
};
|
667
|
+
/** @public
|
668
|
+
* @return {Element}
|
669
|
+
*/
|
670
|
+
Grid.prototype.getElement = function() {
|
671
|
+
return this._topNode;
|
672
|
+
};
|
673
|
+
/** Alias to {@link EventDispatcher#removeAllEventListeners}
|
674
|
+
* @public
|
675
|
+
* @function
|
676
|
+
*/
|
677
|
+
Grid.prototype.removeEventListeners = Grid.prototype.removeAllEventListeners;
|
678
|
+
/** Alias to {@link EventDispatcher#addEventListener}
|
679
|
+
* @public
|
680
|
+
* @function
|
681
|
+
* @param {string} type Event name
|
682
|
+
* @param {Function} handler Event handler
|
683
|
+
*/
|
684
|
+
Grid.prototype.listen = Grid.prototype.addEventListener;
|
685
|
+
/** @public
|
686
|
+
*/
|
687
|
+
Grid.prototype.initSubscription = function() {
|
688
|
+
if(this._subs) { // Subscription is already initialized
|
689
|
+
return;
|
690
|
+
}
|
691
|
+
if(this._sharedDataSource) {
|
692
|
+
this._subs = this._mainGrid._subs;
|
693
|
+
return;
|
694
|
+
}
|
695
|
+
|
696
|
+
let jet, q, s;
|
697
|
+
jet = window["JET"]; // Assume that JET is already exist.
|
698
|
+
if (this._RTK) {
|
699
|
+
q = this._RTK.Quotes;
|
700
|
+
} else if(jet) {
|
701
|
+
q = jet["Quotes2"];
|
702
|
+
}
|
703
|
+
if(q) {
|
704
|
+
s = q["create"]();
|
705
|
+
if(this._RTK && this._RTK.prefetchWorkaround) { // The workaround for RTK Quotes has a bug concerning the removal of the last row; it isn't removed.
|
706
|
+
s.addRic("DUMMY.WORKAROUND", "DUMMY.WORKAROUND");
|
707
|
+
}
|
708
|
+
}
|
709
|
+
if(!s) {
|
710
|
+
return;
|
711
|
+
}
|
712
|
+
if(s["filter"]) {
|
713
|
+
s["filter"](-2, -1); // Enable skip header for chains
|
714
|
+
}
|
715
|
+
|
716
|
+
this._subs = s;
|
717
|
+
this._subs["start"]();
|
718
|
+
this._subs.addEventListener("postUpdate", this._onQuote2PostUpdate);
|
719
|
+
this._subs.addEventListener("dataChanged", this._onQ2DataChanged);
|
720
|
+
|
721
|
+
// TODO: Subscriptions should be registered per row.
|
722
|
+
// However, chain subscription cannot be integrated with DataConnector in this current implementation.
|
723
|
+
let rowDefs = this._getAllRowDefinitions();
|
724
|
+
let len = rowDefs.length;
|
725
|
+
for(let i = 0; i < len; ++i) {
|
726
|
+
let rowDef = rowDefs[i];
|
727
|
+
if(rowDef) {
|
728
|
+
rowDef.subscribeForUpdates(s);
|
729
|
+
}
|
730
|
+
}
|
731
|
+
};
|
732
|
+
|
733
|
+
/** @public
|
734
|
+
*/
|
735
|
+
Grid.prototype.updateLayout = function() {
|
736
|
+
this._grid.updateLayout();
|
737
|
+
this._stp.updateSortSymbols(); // HACK: There is a chance that grid may not yet be in the document
|
738
|
+
};
|
739
|
+
/** Force rerender of grid rows. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
|
740
|
+
* @private
|
741
|
+
* @param {number=} rowIndex
|
742
|
+
*/
|
743
|
+
Grid.prototype._updateRowData = function(rowIndex) {
|
744
|
+
if(rowIndex >= 0) {
|
745
|
+
let rowId = this._dv.getRowId(rowIndex);
|
746
|
+
if(rowId) {
|
747
|
+
this._dt.setRowData(rowId, {});
|
748
|
+
}
|
749
|
+
} else {
|
750
|
+
this._dt.dispatchGlobalChange(); // Trigger sorting too
|
751
|
+
}
|
752
|
+
};
|
753
|
+
/** @public
|
754
|
+
* @function
|
755
|
+
* @param {number=} opt_rowIndex
|
756
|
+
*/
|
757
|
+
Grid.prototype.updateRowData = Grid.prototype._updateRowData;
|
758
|
+
|
759
|
+
/** @private
|
760
|
+
*/
|
761
|
+
Grid.prototype._addGridSections = function () {
|
762
|
+
let title = this._grid.addSection("title");
|
763
|
+
if(this._topSection == false){
|
764
|
+
title.setRowCount(0);
|
765
|
+
} else {
|
766
|
+
title.setRowCount(1);
|
767
|
+
}
|
768
|
+
this._grid.addSection("content");
|
769
|
+
|
770
|
+
let titleSettings = this._grid.getSectionSettings("title");
|
771
|
+
titleSettings.disableDataBinding();
|
772
|
+
|
773
|
+
let contentSettings = this._grid.getSectionSettings("content");
|
774
|
+
contentSettings.setAutoSyncRowCount(true);
|
775
|
+
contentSettings.setParent(titleSettings);
|
776
|
+
};
|
777
|
+
/** @public
|
778
|
+
* @param {string=} sectionName
|
779
|
+
* @return {*} Return Section instance
|
780
|
+
*/
|
781
|
+
Grid.prototype.addHeaderSection = function (sectionName) {
|
782
|
+
let titleSects = this._grid.getAllSections("title");
|
783
|
+
|
784
|
+
let headerSect = this._grid.addSectionAt(titleSects.length, "title", sectionName);
|
785
|
+
if(headerSect) {
|
786
|
+
headerSect.setRowCount(1);
|
787
|
+
|
788
|
+
let headerSettings = this._grid.getSectionSettings(headerSect);
|
789
|
+
headerSettings.disableDataBinding();
|
790
|
+
}
|
791
|
+
|
792
|
+
return headerSect;
|
793
|
+
};
|
794
|
+
/** @public
|
795
|
+
* @param {string=} sectionName
|
796
|
+
* @return {*} Return Section instance
|
797
|
+
*/
|
798
|
+
Grid.prototype.addFooterSection = function (sectionName) {
|
799
|
+
let footerSect = this._grid.addSection("footer", sectionName);
|
800
|
+
if(footerSect) {
|
801
|
+
footerSect.setRowCount(1);
|
802
|
+
|
803
|
+
let footerSettings = this._grid.getSectionSettings(footerSect);
|
804
|
+
footerSettings.disableDataBinding();
|
805
|
+
}
|
806
|
+
|
807
|
+
return footerSect;
|
808
|
+
};
|
809
|
+
|
810
|
+
/** @public
|
811
|
+
* @param {Element} elem Parent element
|
812
|
+
*/
|
813
|
+
Grid.prototype.setParent = function (elem) {
|
814
|
+
Dom.appendChild(elem, this._topNode);
|
815
|
+
this.updateLayout();
|
816
|
+
};
|
817
|
+
/** @public
|
818
|
+
* @param {Element} elem Sibling element
|
819
|
+
*/
|
820
|
+
Grid.prototype.insertBefore = function (elem) {
|
821
|
+
if(elem) {
|
822
|
+
let pn = elem.parentNode;
|
823
|
+
if(pn) {
|
824
|
+
pn.insertBefore(this._topNode, elem);
|
825
|
+
this.updateLayout();
|
826
|
+
}
|
827
|
+
}
|
828
|
+
};
|
829
|
+
/** The returned object contains <br>
|
830
|
+
* `boolean` hit : Indicates whether the given position is on the grid <br>
|
831
|
+
* `number` x : Horizontal coordinate that is relative to the top-left of the grid (Zero means left-most) <br>
|
832
|
+
* `number` y : Vertical coordinate that is relative to the top-left of the grid (Zero means top-most) <br>
|
833
|
+
* `number` colIndex <br>
|
834
|
+
* `number` sectionIndex <br>
|
835
|
+
* `number` rowIndex <br>
|
836
|
+
* and other related property to the given position.
|
837
|
+
* @public
|
838
|
+
* @param {!ElementWrapper|Element|Event|MouseEvent} obj Element, Browser's Event object, Browser's Mouse Event object are all valid
|
839
|
+
* @return {!Object}
|
840
|
+
*/
|
841
|
+
Grid.prototype.getRelativePosition = function (obj) {
|
842
|
+
return this._grid.getRelativePosition(obj);
|
843
|
+
};
|
844
|
+
/** The returned core grid
|
845
|
+
* @public
|
846
|
+
* @return {Core}
|
847
|
+
*/
|
848
|
+
Grid.prototype.getCoreGrid = function () {
|
849
|
+
return this._grid;
|
850
|
+
};
|
851
|
+
|
852
|
+
/** @public
|
853
|
+
* @param {Grid~GridOptions=} gridOption
|
854
|
+
*/
|
855
|
+
Grid.prototype.initialize = function(gridOption) {
|
856
|
+
if (!gridOption) {
|
857
|
+
this.initSubscription();
|
858
|
+
return;
|
859
|
+
}
|
860
|
+
// TODO: clear all data before re-initialization
|
861
|
+
let t = this; // For minimizing file size
|
862
|
+
t._initializing = true;
|
863
|
+
let grid = t._grid; // core grid
|
864
|
+
grid.resetInternalState();
|
865
|
+
gridOption = grid.normalizeConfig(gridOption);
|
866
|
+
|
867
|
+
let exts = gridOption["plugins"] || gridOption["extensions"];
|
868
|
+
|
869
|
+
let cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
|
870
|
+
if (gridOption["defaultColumnOptions"]) {
|
871
|
+
t._defaultColumnOptions = gridOption["defaultColumnOptions"];
|
872
|
+
t._defaultColumnSetup(t._defaultColumnOptions, cols);
|
873
|
+
}
|
874
|
+
|
875
|
+
// Tell all plugins that the initialization phase has started
|
876
|
+
t._processExtension(exts, "beforeInit", [grid.getElement(), gridOption]);
|
877
|
+
|
878
|
+
// option flag text-select
|
879
|
+
// allow user to select text for copy or so something
|
880
|
+
if (gridOption['textSelect']) {
|
881
|
+
t._textSelect = true;
|
882
|
+
grid.addClass('tr-text-select');
|
883
|
+
}
|
884
|
+
|
885
|
+
if (gridOption["RTK"]) {
|
886
|
+
t._RTK = gridOption["RTK"];
|
887
|
+
t._snapshot.setRTK(t._RTK);
|
888
|
+
}
|
889
|
+
|
890
|
+
if (gridOption["ADC"]) {
|
891
|
+
t._ADCOptions = gridOption["ADC"];
|
892
|
+
t._snapshot.setADCOptions(t._ADCOptions);
|
893
|
+
}
|
894
|
+
|
895
|
+
if (gridOption["synapse"]) {
|
896
|
+
t._synapse = gridOption["synapse"];
|
897
|
+
FieldDefinition.setSynapseConfig(t._synapse);
|
898
|
+
}
|
899
|
+
|
900
|
+
if (gridOption["fieldCaching"]) {
|
901
|
+
t._fieldCaching = gridOption["fieldCaching"];
|
902
|
+
}
|
903
|
+
|
904
|
+
if(gridOption["timeSeriesExpansion"] != null) {
|
905
|
+
t._timeSeriesExpansion = gridOption["timeSeriesExpansion"];
|
906
|
+
FieldDefinition.disableTimeSeriesExpansion(!t._timeSeriesExpansion);
|
907
|
+
}
|
908
|
+
|
909
|
+
if (gridOption["icons"] && gridOption["icons"]["rowGrouping"] && gridOption["icons"]["rowGrouping"]["expander"]) {
|
910
|
+
StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
|
911
|
+
}
|
912
|
+
|
913
|
+
if(gridOption["formulaEngine"]) {
|
914
|
+
t._fnEngine = new Engine();
|
915
|
+
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
916
|
+
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
917
|
+
}
|
918
|
+
|
919
|
+
let borders = gridOption["borders"];
|
920
|
+
if (borders != null) {
|
921
|
+
grid.toggleBorders(borders);
|
922
|
+
}
|
923
|
+
let gridlines = gridOption["gridlines"];
|
924
|
+
if (gridlines != null) {
|
925
|
+
grid.toggleGridlines(gridlines);
|
926
|
+
}
|
927
|
+
let vLines = gridOption["verticalLines"];
|
928
|
+
if (vLines != null) {
|
929
|
+
grid.toggleVerticalLines(vLines);
|
930
|
+
}
|
931
|
+
let cvLines = gridOption["contentVerticalLines"];
|
932
|
+
if (cvLines != null) {
|
933
|
+
grid.toggleContentVerticalLines(cvLines);
|
934
|
+
}
|
935
|
+
let hLines = gridOption["horizontalLines"];
|
936
|
+
if (hLines != null) {
|
937
|
+
grid.toggleHorizontalLines(hLines);
|
938
|
+
}
|
939
|
+
|
940
|
+
if(gridOption["pageSize"]) {
|
941
|
+
t._dv.setPageSize(+gridOption["pageSize"]);
|
942
|
+
}
|
943
|
+
|
944
|
+
let rowHeight = +gridOption["rowHeight"];
|
945
|
+
if(rowHeight) { // Non empty or zero
|
946
|
+
grid.setDefaultRowHeight(rowHeight);
|
947
|
+
}
|
948
|
+
let hRowHeight = +gridOption["headerRowHeight"];
|
949
|
+
if(hRowHeight) { // Non empty or zero
|
950
|
+
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
951
|
+
}
|
952
|
+
|
953
|
+
let val = gridOption["autoLayoutUpdate"];
|
954
|
+
if(!t._autoLayoutTimer && val) {
|
955
|
+
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
956
|
+
t._autoLayoutTimer = setInterval(t._onAutoLayoutUpdate.bind(t), 2000);
|
957
|
+
}
|
958
|
+
}
|
959
|
+
|
960
|
+
let bool = gridOption["rowHighlighting"];
|
961
|
+
if(bool != null) {
|
962
|
+
grid.enableRowHighlighting(!!bool);
|
963
|
+
}
|
964
|
+
|
965
|
+
let rowExpansionBinding = gridOption["rowExpansionBinding"];
|
966
|
+
if(typeof rowExpansionBinding === "function") {
|
967
|
+
grid.listen("rowExpansionBinding", t._onRowExpansionBinding); // TODO: Support multi-table feature
|
968
|
+
t.listen("rowExpansionBinding", rowExpansionBinding);
|
969
|
+
}
|
970
|
+
|
971
|
+
this.addListener(gridOption, "dataComposed");
|
972
|
+
this.addListener(gridOption, "beforeContentBinding");
|
973
|
+
this.addListener(gridOption, "firstRendered");
|
974
|
+
this.addListener(gridOption, "afterContentBinding");
|
975
|
+
this.addListener(gridOption, "tabNavigation");
|
976
|
+
|
977
|
+
if(gridOption["autoDateConversion"]) {
|
978
|
+
t._autoDateConversion = true;
|
979
|
+
}
|
980
|
+
|
981
|
+
if(gridOption["stepScroll"]) {
|
982
|
+
grid.setRowScrollingStep(1);
|
983
|
+
}
|
984
|
+
if(gridOption["linearWheelScrolling"]) {
|
985
|
+
grid.getVScrollbar().setMouseWheelSpeed("linear");
|
986
|
+
}
|
987
|
+
if(gridOption["autoHideScrollbar"] != null) {
|
988
|
+
grid.autoHideScrollbars(gridOption["autoHideScrollbar"] ? true : false);
|
989
|
+
}
|
990
|
+
if(gridOption["scrollbarParent"] != null) {
|
991
|
+
t._setScrollbarParent(gridOption["scrollbarParent"]);
|
992
|
+
}
|
993
|
+
let pollingInterval = gridOption["adcPollingInterval"];
|
994
|
+
if(pollingInterval != null) {
|
995
|
+
t._pollingInterval = pollingInterval ? +pollingInterval : 0;
|
996
|
+
}
|
997
|
+
|
998
|
+
// Column operations
|
999
|
+
t.setColumns(cols);
|
1000
|
+
|
1001
|
+
let rowVir = true;
|
1002
|
+
if (gridOption["rowVirtualRendering"] != null) {
|
1003
|
+
rowVir = gridOption["rowVirtualRendering"];
|
1004
|
+
}
|
1005
|
+
if (gridOption["rowVirtualization"] != null) {
|
1006
|
+
rowVir = gridOption["rowVirtualization"];
|
1007
|
+
}
|
1008
|
+
grid.enableRowVirtualization(!!rowVir);
|
1009
|
+
|
1010
|
+
let colVir = false;
|
1011
|
+
if (gridOption["columnVirtualRendering"] != null) {
|
1012
|
+
colVir = gridOption["columnVirtualRendering"];
|
1013
|
+
}
|
1014
|
+
if (gridOption["columnVirtualization"] != null) {
|
1015
|
+
colVir = gridOption["columnVirtualization"];
|
1016
|
+
}
|
1017
|
+
grid.enableColumnVirtualization(!!colVir);
|
1018
|
+
|
1019
|
+
let scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
|
1020
|
+
if (scrollbar) {
|
1021
|
+
t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
|
1022
|
+
} else {
|
1023
|
+
grid.freezeSection(null); // Disable vertical scrollbar
|
1024
|
+
t._topNode.style.overflow = "";
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
let topFreezingCount = gridOption["topFreezingCount"];
|
1028
|
+
if (typeof topFreezingCount === "number") {
|
1029
|
+
topFreezingCount = (topFreezingCount > 0) ? topFreezingCount : 0;
|
1030
|
+
let sectionIndex = topFreezingCount - 1;
|
1031
|
+
grid.freezeSection(sectionIndex);
|
1032
|
+
} else if (topFreezingCount === false) {
|
1033
|
+
grid.freezeSection(null);
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
let bottomFreezingCount = gridOption["bottomFreezingCount"];
|
1037
|
+
if (typeof bottomFreezingCount === "number") {
|
1038
|
+
bottomFreezingCount = (bottomFreezingCount > 0) ? bottomFreezingCount : 0;
|
1039
|
+
grid.freezeFooter(bottomFreezingCount);
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
t.addDataFields(gridOption["dataFields"]);
|
1043
|
+
|
1044
|
+
// Plugins
|
1045
|
+
gridOption[ROW_DEF] = true; // Enable ROW_DEF mode
|
1046
|
+
if (Array.isArray(exts)) {
|
1047
|
+
for (let i = 0; i < exts.length; ++i) {
|
1048
|
+
let ext = exts[i];
|
1049
|
+
let extInstance = null;
|
1050
|
+
if (ext) {
|
1051
|
+
let extName = ext["name"];
|
1052
|
+
if(extName) {
|
1053
|
+
extInstance = grid.loadPlugin(extName, ext); // pass plugin object as an argument for initialization
|
1054
|
+
} else {
|
1055
|
+
extInstance = grid.loadPlugin(ext, gridOption);
|
1056
|
+
}
|
1057
|
+
}
|
1058
|
+
if (extInstance && extInstance["setGridWrapper"]) {
|
1059
|
+
let hasApi = (typeof extInstance["getGridApi"] === "function") ? extInstance["getGridApi"]() : false;
|
1060
|
+
if(!hasApi) {
|
1061
|
+
extInstance["setGridWrapper"]("realTimeGrid", t);
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
t._initializing = false;
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
let lang = gridOption["lang"];
|
1069
|
+
if(lang != null) {
|
1070
|
+
t._lang = lang;
|
1071
|
+
t._dateTimeUtil.setLocale(lang);
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
// Row operations
|
1075
|
+
if(gridOption["childDataField"] != null) {
|
1076
|
+
this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
|
1077
|
+
}
|
1078
|
+
let rows = gridOption["rows"];
|
1079
|
+
if(!rows) {
|
1080
|
+
rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
|
1081
|
+
}
|
1082
|
+
let bodies = /** @type{Array} */(gridOption["bodies"]);
|
1083
|
+
if(!bodies) {
|
1084
|
+
bodies = [];
|
1085
|
+
if(gridOption["body"]) {
|
1086
|
+
bodies.push(gridOption["body"]);
|
1087
|
+
}
|
1088
|
+
if(rows) {
|
1089
|
+
for(let m = 0; m < rows.length; m++) {
|
1090
|
+
if(typeof rows[m] === "string") {
|
1091
|
+
rows[m] = { "ric": rows[m] };
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
bodies.push({ "rows": rows });
|
1095
|
+
}
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
// Merge rows with static data rows
|
1099
|
+
let staticRows = gridOption["staticDataRows"] || gridOption["dataModel"];
|
1100
|
+
if(rows && staticRows) {
|
1101
|
+
let ary = staticRows["data"] ? staticRows["data"] : staticRows;
|
1102
|
+
let fields = staticRows["fields"] || t.getColumnFields();
|
1103
|
+
let values, data;
|
1104
|
+
let len = rows.length;
|
1105
|
+
for(let n = 0; n < len; n++) {
|
1106
|
+
if(rows[n]["values"]) { // merge row's values, values can be object or array
|
1107
|
+
values = arrayToObject(rows[n]["values"], fields);
|
1108
|
+
data = arrayToObject(ary[n], fields);
|
1109
|
+
rows[n]["values"] = extendObject(values, data);
|
1110
|
+
} else {
|
1111
|
+
rows[n]["values"] = ary[n];
|
1112
|
+
}
|
1113
|
+
}
|
1114
|
+
ary = ary.slice(len, ary.length);
|
1115
|
+
if(staticRows["data"]) {
|
1116
|
+
staticRows["data"] = ary;
|
1117
|
+
} else {
|
1118
|
+
staticRows = ary;
|
1119
|
+
}
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
for(let j = 0; j < bodies.length; ++j) {
|
1123
|
+
t.insertRows(bodies[j]["rows"]);
|
1124
|
+
// break; // TODO: The first version supports only 1 grid
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
t.addStaticDataRows(staticRows);
|
1128
|
+
|
1129
|
+
if(gridOption.contentBottomPadding) {
|
1130
|
+
grid.setBottomPaddingSection(gridOption.contentBottomPadding);
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
let contentRightPadding = gridOption.contentRightPadding;
|
1134
|
+
if(contentRightPadding) {
|
1135
|
+
if (typeof contentRightPadding !== "number") {
|
1136
|
+
contentRightPadding = 6;
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
grid.reserveRightSpace(contentRightPadding);
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
// Let everything init first
|
1143
|
+
// then set conflationRate to grid for better perfomance on rapidly updating
|
1144
|
+
let dataConflationRate = gridOption['dataConflationRate'];
|
1145
|
+
if (dataConflationRate != null) {
|
1146
|
+
grid.setDataConflationRate(dataConflationRate);
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
// Tell all plugins that the initialization phase has ended
|
1150
|
+
let extObjects = grid.getPluginList().map(grid.getPlugin.bind(grid));
|
1151
|
+
t._processExtension(extObjects, "afterInit");
|
1152
|
+
t.initSubscription();
|
1153
|
+
};
|
1154
|
+
|
1155
|
+
/** @public
|
1156
|
+
* @param {Object=} gridOptions
|
1157
|
+
* @return {!Object}
|
1158
|
+
*/
|
1159
|
+
Grid.prototype.getConfigObject = function (gridOptions) {
|
1160
|
+
let obj = gridOptions || {};
|
1161
|
+
|
1162
|
+
let columns = obj.columns;
|
1163
|
+
if(!columns) {
|
1164
|
+
columns = obj.columns = [];
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
let grid = this._grid;
|
1168
|
+
if(grid.getConfigObject) {
|
1169
|
+
grid.getConfigObject(obj);
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
// Difference from composite grid in default config
|
1173
|
+
if(obj["columnVirtualization"] === false) {
|
1174
|
+
delete obj["columnVirtualization"];
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
if(obj["rowVirtualization"] === true) {
|
1178
|
+
delete obj["rowVirtualization"];
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
if(obj["rowHighlighting"] === true) {
|
1182
|
+
delete obj["rowHighlighting"];
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
if(obj["contentVerticalLines"] === false) { // the default value change in wrapper (atlas-blotter)
|
1186
|
+
delete obj["contentVerticalLines"];
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
if(obj["borders"] === false) { // the default value change in wrapper (atlas-blotter)
|
1190
|
+
delete obj["borders"];
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
|
1194
|
+
let i, len, prevTimeSeriesField;
|
1195
|
+
len = this.getColumnCount();
|
1196
|
+
for (i = 0; i < len; ++i) {
|
1197
|
+
let column = columns[i];
|
1198
|
+
if(!column) {
|
1199
|
+
column = columns[i] = {};
|
1200
|
+
}
|
1201
|
+
let colDef = this.getColumnDefinition(i);
|
1202
|
+
// TODO: Update width and scalability changed by the extensions
|
1203
|
+
colDef.getConfigObject(column);
|
1204
|
+
let parentField = FieldDefinition.getFieldProperty(colDef.getField(), "timeSeriesParent");
|
1205
|
+
if(parentField && !prevTimeSeriesField) { // Assume first column of time series child to convert to time series parent
|
1206
|
+
prevTimeSeriesField = parentField;
|
1207
|
+
column.field = parentField;
|
1208
|
+
delete column.name; // WARNING: Name of child should be retained
|
1209
|
+
delete column.autoGenerated; // Convert to parent time series field
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
if(!parentField && prevTimeSeriesField) { // Handled duplicate parent time series field in difference position of column
|
1213
|
+
prevTimeSeriesField = null;
|
1214
|
+
}
|
1215
|
+
}
|
1216
|
+
obj.columns = columns = columns.filter(_byNonAutoGeneratedColumn); // Time series child will be filtered out
|
1217
|
+
|
1218
|
+
if(this._topNode.style.overflow === "") {
|
1219
|
+
obj["scrollbar"] = false;
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
let val = this._dv.getPageSize();
|
1223
|
+
if(val > 0) {
|
1224
|
+
obj["pageSize"] = val;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
val = grid.getDefaultRowHeight();
|
1228
|
+
if(val !== 28) { // the default value change in wrapper (atlas-blotter)
|
1229
|
+
obj["rowHeight"] = val;
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
val = grid.getSection("title").getDefaultRowHeight();
|
1233
|
+
if(val !== 28) { // the default value change in wrapper (atlas-blotter)
|
1234
|
+
obj["headerRowHeight"] = val;
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
if(this._autoLayoutTimer) {
|
1238
|
+
obj["autoLayoutUpdate"] = true;
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
val = isEmptyObject(this._defaultColumnOptions);
|
1242
|
+
if (!val) { // Currently, this variable is the object, we need to check empty array for default value
|
1243
|
+
obj["defaultColumnOptions"] = this._defaultColumnOptions;
|
1244
|
+
}
|
1245
|
+
|
1246
|
+
if(this._autoDateConversion) {
|
1247
|
+
obj["autoDateConversion"] = true;
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
if(this._textSelect) {
|
1251
|
+
obj["textSelect"] = true;
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
if(this._lang) {
|
1255
|
+
obj["lang"] = this._lang;
|
1256
|
+
}
|
1257
|
+
if(this._fnEngine) {
|
1258
|
+
obj["formulaEngine"] = true;
|
1259
|
+
}
|
1260
|
+
if(this._pollingInterval) {
|
1261
|
+
obj["adcPollingInterval"] = this._pollingInterval;
|
1262
|
+
}
|
1263
|
+
if(this._fieldCaching) {
|
1264
|
+
obj["fieldCaching"] = this._fieldCaching;
|
1265
|
+
}
|
1266
|
+
if(this._timeSeriesExpansion != true) {
|
1267
|
+
obj["timeSeriesExpansion"] = this._timeSeriesExpansion;
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
if(this._childDataField) {
|
1271
|
+
obj["childDataField"] = this._childDataField;
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
// get all rows config
|
1275
|
+
let rowDefs = this.getAllRowDefinitions();
|
1276
|
+
let rows = obj["rows"] = [];
|
1277
|
+
let rowDef, rowConfig;
|
1278
|
+
len = rowDefs.length;
|
1279
|
+
for (i = 0; i < len; i++) {
|
1280
|
+
rowDef = rowDefs[i];
|
1281
|
+
rowConfig = rowDef.getConfigObject();
|
1282
|
+
rows.push(rowConfig);
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
// get row config from extensions
|
1286
|
+
let extensions = grid.getPlugins();
|
1287
|
+
let pluginInstance, row;
|
1288
|
+
for(let key in extensions) {
|
1289
|
+
pluginInstance = extensions[key];
|
1290
|
+
if(typeof pluginInstance["getRowConfigObject"] === "function") {
|
1291
|
+
len = rows.length;
|
1292
|
+
for (i = 0; i < len; i++) {
|
1293
|
+
rowDef = rowDefs[i];
|
1294
|
+
row = rows[i];
|
1295
|
+
pluginInstance["getRowConfigObject"](row, rowDef.getRowId());
|
1296
|
+
}
|
1297
|
+
}
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
// TODO: The following states need to be retrieved
|
1301
|
+
// topFreezingCount, bottomFreezingCount
|
1302
|
+
// scrollbarParent
|
1303
|
+
// linearWheelScrolling
|
1304
|
+
// stepScroll
|
1305
|
+
// noColumnDragging
|
1306
|
+
// columnReorder
|
1307
|
+
// topSection
|
1308
|
+
|
1309
|
+
// NOTE: no need to export synapseApiKey, ADC and RTK
|
1310
|
+
|
1311
|
+
return obj;
|
1312
|
+
};
|
1313
|
+
|
1314
|
+
/** @public
|
1315
|
+
* @ignore
|
1316
|
+
* @param {Object} dateTimeUtil
|
1317
|
+
*/
|
1318
|
+
Grid.prototype.setDateTimeUtil = function(dateTimeUtil) {
|
1319
|
+
if(this._dateTimeUtil !== dateTimeUtil) {
|
1320
|
+
this._dateTimeUtil = dateTimeUtil;
|
1321
|
+
this._dateTimeUtil.setLocale(this._lang);
|
1322
|
+
}
|
1323
|
+
};
|
1324
|
+
/** @public
|
1325
|
+
* @param {string} lang
|
1326
|
+
*/
|
1327
|
+
Grid.prototype.setLocale = function(lang) {
|
1328
|
+
if(lang && this._lang !== lang) {
|
1329
|
+
this._lang = lang;
|
1330
|
+
this._dateTimeUtil.setLocale(lang);
|
1331
|
+
this._grid.requestRowRefresh();
|
1332
|
+
}
|
1333
|
+
};
|
1334
|
+
|
1335
|
+
/** @private
|
1336
|
+
* @param {Object} defaultCol
|
1337
|
+
* @param {Array.<Object>} userColumns
|
1338
|
+
*/
|
1339
|
+
Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
|
1340
|
+
let c = userColumns.length;
|
1341
|
+
for (let i = 0; i < c; i++) {
|
1342
|
+
let column = userColumns[i];
|
1343
|
+
if (typeof column === 'object') {
|
1344
|
+
for (let key in defaultCol) {
|
1345
|
+
if (column[key] == null) {
|
1346
|
+
column[key] = defaultCol[key];
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
}
|
1350
|
+
// TODO: Handle columnOption type string
|
1351
|
+
// else if (typeof column === 'string') { }
|
1352
|
+
}
|
1353
|
+
};
|
1354
|
+
|
1355
|
+
/** @private
|
1356
|
+
* @param {Array.<Object>} exts List of plugin instance
|
1357
|
+
* @param {string} field A function name of plugin instance
|
1358
|
+
* @param {Array.<*>} params Inputs that will pass to a function call
|
1359
|
+
*/
|
1360
|
+
Grid.prototype._processExtension = function (exts, field, params) {
|
1361
|
+
if(Array.isArray(exts)) {
|
1362
|
+
for (let i = 0; i < exts.length; i++) {
|
1363
|
+
if (exts[i][field]) {
|
1364
|
+
exts[i][field].apply(exts[i], params);
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
}
|
1368
|
+
};
|
1369
|
+
|
1370
|
+
/** @private
|
1371
|
+
* @param {Object} e
|
1372
|
+
*/
|
1373
|
+
Grid.prototype._onRicAdded = function(e) {
|
1374
|
+
let addedRics = e.addedRics;
|
1375
|
+
this._snapshot.addFields(e.fields);
|
1376
|
+
let len = addedRics.length;
|
1377
|
+
for (let i = 0; i < len; ++i) {
|
1378
|
+
let ric = addedRics[i];
|
1379
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
1380
|
+
let jLen = rowDefs ? rowDefs.length : 0;
|
1381
|
+
for (let j = 0; j < jLen; ++j) {
|
1382
|
+
let rowDef = rowDefs[j];
|
1383
|
+
if (rowDef.getSymbol() === ric) {
|
1384
|
+
this._snapshot.addRic(ric); // ADC
|
1385
|
+
}
|
1386
|
+
}
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
this._dispatch(e.type, e);
|
1390
|
+
};
|
1391
|
+
|
1392
|
+
/** @private
|
1393
|
+
* @param {Object} e
|
1394
|
+
*/
|
1395
|
+
Grid.prototype._onRicRemoved = function(e) {
|
1396
|
+
this._dispatch(e.type, e);
|
1397
|
+
};
|
1398
|
+
|
1399
|
+
/** @private
|
1400
|
+
* @param {Object} e
|
1401
|
+
*/
|
1402
|
+
Grid.prototype._onFieldAdded = function(e) {
|
1403
|
+
let rowDefs = e.rowDefs;
|
1404
|
+
let addedFields = e.addedFields;
|
1405
|
+
|
1406
|
+
// ADC
|
1407
|
+
for (let i in rowDefs) {
|
1408
|
+
this._snapshot.addRic(rowDefs[i].getSymbol());
|
1409
|
+
}
|
1410
|
+
this._snapshot.addFields(addedFields);
|
1411
|
+
|
1412
|
+
// JET
|
1413
|
+
if (this._subs) {
|
1414
|
+
let realtimeFields = addedFields.filter(FieldDefinition.isRealTimeField);
|
1415
|
+
if(realtimeFields.length > 0) {
|
1416
|
+
this._subs["addFields"](realtimeFields);
|
1417
|
+
}
|
1418
|
+
}
|
1419
|
+
|
1420
|
+
this._dispatch(e.type, e);
|
1421
|
+
};
|
1422
|
+
/** @private
|
1423
|
+
* @param {Object} e
|
1424
|
+
*/
|
1425
|
+
Grid.prototype._onFieldRemoved = function(e) {
|
1426
|
+
let removedFields = e.removedFields;
|
1427
|
+
|
1428
|
+
// TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
|
1429
|
+
// JET
|
1430
|
+
if(this._subs) {
|
1431
|
+
this._subs["removeFields"](removedFields);
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
this._dispatch(e.type, e);
|
1435
|
+
};
|
1436
|
+
|
1437
|
+
/** @public
|
1438
|
+
* @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
|
1439
|
+
* @param {number=} idx
|
1440
|
+
*/
|
1441
|
+
Grid.prototype.insertColumn = function (columnOption, idx) {
|
1442
|
+
let colCount = this.getColumnCount();
|
1443
|
+
if(idx == null || idx > colCount) {
|
1444
|
+
idx = colCount;
|
1445
|
+
}
|
1446
|
+
|
1447
|
+
// no need to merge defaultColumn during initialize process
|
1448
|
+
// because columnOption already mutate by initialize function
|
1449
|
+
let configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
1450
|
+
|
1451
|
+
if (typeof columnOption === "string") {
|
1452
|
+
configObj["field"] = columnOption;
|
1453
|
+
} else { // columnOption is assumed to be an object
|
1454
|
+
for (let key in columnOption) {
|
1455
|
+
configObj[key] = columnOption[key];
|
1456
|
+
}
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
if(this._fnEngine) {
|
1460
|
+
configObj["formulaEngine"] = this._fnEngine; // Adding extra option
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
let colDef = new ColumnDefinition(configObj, this);
|
1464
|
+
configObj[COL_DEF] = colDef;
|
1465
|
+
|
1466
|
+
// WARNING: width is processed twice by tr-grid and rt-grid
|
1467
|
+
// Inserting column also initializes prefined formatter
|
1468
|
+
this._grid.insertColumn(idx, configObj); // columnAdded is fired
|
1469
|
+
};
|
1470
|
+
|
1471
|
+
/**
|
1472
|
+
* @private
|
1473
|
+
* @param {Object} e snapshort change event object
|
1474
|
+
*/
|
1475
|
+
Grid.prototype._updateTimeSeriesFields = function (e) {
|
1476
|
+
let childField;
|
1477
|
+
let snapShotData = e.data;
|
1478
|
+
let childFields = {};
|
1479
|
+
for (let ric in snapShotData) {
|
1480
|
+
// childFields = snapShotData[ric];
|
1481
|
+
for (childField in snapShotData[ric]) {
|
1482
|
+
childFields[childField] = true; // Merge child fields to parent (Don't truth each ric it will be have some empty data)
|
1483
|
+
}
|
1484
|
+
this.setRicData(ric, snapShotData[ric]); // update cell data if exist
|
1485
|
+
}
|
1486
|
+
let parentField, field, colIndex, parentColDef, childColIndex;
|
1487
|
+
let parentMap = {}; // map parent time series field and their first child
|
1488
|
+
for (field in childFields) { // Warning: data change can be differ time series child field
|
1489
|
+
parentField = e.childrenFieldToParent[field];
|
1490
|
+
if(!parentMap[parentField]) {
|
1491
|
+
parentMap[parentField] = [field];
|
1492
|
+
} else {
|
1493
|
+
parentMap[parentField].push(field);
|
1494
|
+
}
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
for (parentField in parentMap) { // WARNING: one dataChanged event can be multiple fields
|
1498
|
+
let childrenField = parentMap[parentField];
|
1499
|
+
colIndex = this.getColumnIndex(parentField);
|
1500
|
+
parentColDef = this._getColumnDefinition(colIndex);
|
1501
|
+
let i, len;
|
1502
|
+
len = childrenField.length;
|
1503
|
+
for (i = 0; i < len; i++) {
|
1504
|
+
childField = childrenField[i];
|
1505
|
+
childColIndex = this.getColumnIndex(childField);
|
1506
|
+
if(childColIndex < 0) { // not found column index in view tried to clone from parent
|
1507
|
+
colIndex = this.getColumnIndex(parentField);
|
1508
|
+
parentColDef = this._getColumnDefinition(colIndex);
|
1509
|
+
this._cloneTimeSeriesColumn(parentColDef, childField, colIndex);
|
1510
|
+
FieldDefinition.addTimeSeriesChild(parentField, childField); // TODO: time series child can be difference of response even if the input is the same, It should be dynamic add/remove fields
|
1511
|
+
}
|
1512
|
+
}
|
1513
|
+
this.removeColumn(parentField);
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
};
|
1517
|
+
|
1518
|
+
|
1519
|
+
/** @private
|
1520
|
+
* @param {ColumnDefinition} colDef
|
1521
|
+
*/
|
1522
|
+
Grid.prototype._populateTimeSeriesChildren = function (colDef) {
|
1523
|
+
if(this._timeSeriesChildConflator.conflate(colDef) ) {
|
1524
|
+
return;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
let colDefs = this._timeSeriesChildConflator.popAllData();
|
1528
|
+
let i, j, len, childField, idx;
|
1529
|
+
|
1530
|
+
for (i = 0; i < colDefs.length; i++) {
|
1531
|
+
colDef = colDefs[i];
|
1532
|
+
idx = this.getColumnIndex(colDef);
|
1533
|
+
|
1534
|
+
if(!colDef) {
|
1535
|
+
continue;
|
1536
|
+
}
|
1537
|
+
let parentField = colDef.getField();
|
1538
|
+
let childFields = FieldDefinition.getTimeSeriesChildren(parentField);
|
1539
|
+
if(!childFields) { // not found time series field
|
1540
|
+
return;
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
len = childFields.length;
|
1544
|
+
if(len < 1) {
|
1545
|
+
return; // normal field
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
for (j = 0; j < len; j++) {
|
1549
|
+
idx = this.getColumnIndex(colDef);
|
1550
|
+
childField = childFields[j];
|
1551
|
+
this._cloneTimeSeriesColumn(colDef, childField, idx);
|
1552
|
+
}
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
};
|
1556
|
+
|
1557
|
+
/** @private
|
1558
|
+
* @param {ColumnDefinition} parentColDef Parent definition
|
1559
|
+
* @param {string} childField field
|
1560
|
+
* @param {number} idx index of insertion column
|
1561
|
+
*/
|
1562
|
+
Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx) {
|
1563
|
+
let parentConfig, columnOption;
|
1564
|
+
parentConfig = parentColDef.getConfigObject();
|
1565
|
+
columnOption = cloneObject(parentConfig);
|
1566
|
+
columnOption["field"] = childField.replace("TR.", ""); // We need to remove the 'TR' prefix from the field to avoid confusion with time series fields.
|
1567
|
+
columnOption["name"] = childField.split("_")[1].split("T")[0]; // Currently, response server format utc date ex "2022-11-23T00:00:00"
|
1568
|
+
columnOption["parent"] = parentColDef;
|
1569
|
+
columnOption["timeSeriesName"] = parentColDef.getName();
|
1570
|
+
columnOption["timeSeriesId"] = parentColDef.getId();
|
1571
|
+
this.insertColumn(columnOption, idx++);
|
1572
|
+
|
1573
|
+
};
|
1574
|
+
|
1575
|
+
/** @public
|
1576
|
+
* @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
|
1577
|
+
* @param {Grid~ColumnReference} colRef
|
1578
|
+
*/
|
1579
|
+
Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
1580
|
+
let colIndex = this.getColumnIndex(colRef);
|
1581
|
+
if(colIndex < 0) {
|
1582
|
+
return;
|
1583
|
+
}
|
1584
|
+
let colConfig = {};
|
1585
|
+
let core = this._grid;
|
1586
|
+
let columnDef = core._getColumnDef(colIndex);
|
1587
|
+
|
1588
|
+
let value = core.getColumnScalability(colIndex);
|
1589
|
+
colConfig["scalable"] = value;
|
1590
|
+
|
1591
|
+
value = core.getColumnCustomLaneSize(colIndex);
|
1592
|
+
colConfig["width"] = value;
|
1593
|
+
|
1594
|
+
value = core.getMinimumColumnWidth(colIndex);
|
1595
|
+
if(value > 0) {
|
1596
|
+
colConfig["minWidth"] = value;
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
value = core.getColumnVisibility(colIndex, 0); // flag 0 means get only core api hidden state
|
1600
|
+
if(!value) {
|
1601
|
+
colConfig["hidden"] = true;
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
value = columnDef["stationary"];
|
1605
|
+
if (value) {
|
1606
|
+
colConfig["stationary"] = value;
|
1607
|
+
}
|
1608
|
+
|
1609
|
+
value = columnDef["leftPinned"];
|
1610
|
+
if (value) {
|
1611
|
+
colConfig["leftPinned"] = value;
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
value = columnDef["rightPinned"];
|
1615
|
+
if (value) {
|
1616
|
+
colConfig["rightPinned"] = value;
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
if(typeof columnOption === "string") {
|
1620
|
+
colConfig["field"] = columnOption;
|
1621
|
+
} else { // type object from user
|
1622
|
+
for (let key in columnOption) {
|
1623
|
+
colConfig[key] = columnOption[key];
|
1624
|
+
}
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
if(columnOption["width"] && !columnOption["scalable"]) {
|
1628
|
+
colConfig["scalable"] = false;
|
1629
|
+
}
|
1630
|
+
|
1631
|
+
if(columnOption["scalable"] && !columnOption["width"]) {
|
1632
|
+
colConfig["width"] = 1;
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
let colDef = this.getColumnDefinition(colIndex);
|
1636
|
+
if(colDef && colConfig.id == null) {
|
1637
|
+
colConfig.id = colDef.getId(); // retain ID
|
1638
|
+
}
|
1639
|
+
this._grid.startBatch("reset");
|
1640
|
+
this.removeColumn(colIndex);
|
1641
|
+
this.insertColumn(colConfig, colIndex);
|
1642
|
+
this._grid.stopBatch("reset");
|
1643
|
+
};
|
1644
|
+
|
1645
|
+
/** to update column name when field info is loaded
|
1646
|
+
* @private
|
1647
|
+
* @param {string} field
|
1648
|
+
* @param {ColumnDefinition} colDef
|
1649
|
+
* @param {Object} response
|
1650
|
+
*/
|
1651
|
+
Grid.prototype._onFieldLoadedSuccess = function (field, colDef, response) {
|
1652
|
+
if(this._connector && response && response.id) {
|
1653
|
+
let fieldDef = response;
|
1654
|
+
if (colDef && colDef.getField() === field) {
|
1655
|
+
if (colDef.isDefaultName() && fieldDef.name) {
|
1656
|
+
colDef.setName(fieldDef.name);
|
1657
|
+
this.updateColumnTitle(); // has conflator -> async operation
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
}
|
1661
|
+
};
|
1662
|
+
|
1663
|
+
/**
|
1664
|
+
* @private
|
1665
|
+
* @param {Object} err
|
1666
|
+
*/
|
1667
|
+
Grid.prototype._onFieldLoadedError = function (err) {
|
1668
|
+
// TODO: May implement retry mechanism here, if need
|
1669
|
+
};
|
1670
|
+
|
1671
|
+
/**
|
1672
|
+
* @private
|
1673
|
+
* @param {string} field
|
1674
|
+
* @param {string} referrer
|
1675
|
+
*/
|
1676
|
+
Grid.prototype._onFieldLoaded = function (field, referrer) {
|
1677
|
+
if(this._connector) {
|
1678
|
+
// For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
|
1679
|
+
if(FieldDefinition.isTimeSeries(field)) {
|
1680
|
+
let colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
|
1681
|
+
this._populateTimeSeriesChildren(colDef);
|
1682
|
+
}
|
1683
|
+
this._connector.addFields(field, referrer);
|
1684
|
+
}
|
1685
|
+
};
|
1686
|
+
|
1687
|
+
/**
|
1688
|
+
* @private
|
1689
|
+
* @param {Element} host
|
1690
|
+
*/
|
1691
|
+
Grid.prototype._setScrollbarParent = function (host) {
|
1692
|
+
host.style.boxSizing = "border-box";
|
1693
|
+
host.style.overflow = "hidden";
|
1694
|
+
host.style.position = "relative";
|
1695
|
+
|
1696
|
+
this._topNode.style.height = "100%";
|
1697
|
+
|
1698
|
+
this._grid.autoHideScrollbars(false);
|
1699
|
+
this._grid.getVScrollbar().attachToExternalElement(host);
|
1700
|
+
this._grid.getHScrollbar().attachToExternalElement(host);
|
1701
|
+
};
|
1702
|
+
|
1703
|
+
/** Get stored field information. If field information has not been requested or no data has been received yet, null value is returned.
|
1704
|
+
* @public
|
1705
|
+
* @function
|
1706
|
+
* @param {string} field
|
1707
|
+
* @return {Object}
|
1708
|
+
*/
|
1709
|
+
Grid.prototype.getFieldInfo = function(field) {
|
1710
|
+
return FieldDefinition.getFieldInfo(field);
|
1711
|
+
};
|
1712
|
+
/** Request field information from Synapse service. If field information already exists, a resolved promise is returned. Synapse config must be supplied before the request can be made.
|
1713
|
+
* @public
|
1714
|
+
* @function
|
1715
|
+
* @param {string} field
|
1716
|
+
* @return {Promise}
|
1717
|
+
* @example
|
1718
|
+
* let gridConfig = {
|
1719
|
+
* synapse: { // define synapse configuration
|
1720
|
+
* apiKey: "xxx",
|
1721
|
+
* contextApp: "xxx",
|
1722
|
+
* auth: "xxx" (optional)
|
1723
|
+
* }
|
1724
|
+
* };
|
1725
|
+
* let promise = grid.loadFieldInfo("CF_LAST");
|
1726
|
+
*/
|
1727
|
+
Grid.prototype.loadFieldInfo = function(field) {
|
1728
|
+
return FieldDefinition.loadFieldInfo(field);
|
1729
|
+
};
|
1730
|
+
|
1731
|
+
/**
|
1732
|
+
* @private
|
1733
|
+
* @param {string} field
|
1734
|
+
* @returns {boolean}
|
1735
|
+
*/
|
1736
|
+
Grid.prototype._shouldLoadFieldInfo = function (field) {
|
1737
|
+
|
1738
|
+
let val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
|
1739
|
+
if(!val) {
|
1740
|
+
return false;
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
// WARNING: If field caching is disabled, it shouldn't load field info
|
1744
|
+
if(!this._fieldCaching) {
|
1745
|
+
return false;
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
val = FieldDefinition.hasFieldInfo(field);
|
1749
|
+
if(val) {
|
1750
|
+
return false;
|
1751
|
+
}
|
1752
|
+
|
1753
|
+
val = FieldDefinition.isAdc(field) || FieldDefinition.isRealTimeField(field);
|
1754
|
+
if(!val) {
|
1755
|
+
return false;
|
1756
|
+
}
|
1757
|
+
|
1758
|
+
return true;
|
1759
|
+
};
|
1760
|
+
/** Remove all existing columns and add new columns based on the given objects
|
1761
|
+
* @public
|
1762
|
+
* @param {Array.<Object>} columns Array of column options
|
1763
|
+
*/
|
1764
|
+
Grid.prototype.setColumns = function(columns) {
|
1765
|
+
let grid = this._grid;
|
1766
|
+
let colCount = (columns) ? columns.length : 0;
|
1767
|
+
|
1768
|
+
grid.startBatch("reset");
|
1769
|
+
this.removeAllColumns();
|
1770
|
+
if(colCount > 0) {
|
1771
|
+
let prevState = false;
|
1772
|
+
if(colCount > 1) {
|
1773
|
+
prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
1774
|
+
}
|
1775
|
+
for(let i = 0; i < colCount; ++i) {
|
1776
|
+
this.insertColumn(columns[i], i);
|
1777
|
+
}
|
1778
|
+
if(colCount > 1) {
|
1779
|
+
grid.freezeLayout(prevState);
|
1780
|
+
}
|
1781
|
+
}
|
1782
|
+
grid.stopBatch("reset");
|
1783
|
+
};
|
1784
|
+
|
1785
|
+
|
1786
|
+
/** Remove, add and keep column based on the given column data
|
1787
|
+
* @public
|
1788
|
+
* @param {Array.<Object>} columns Array of column options
|
1789
|
+
* @param {boolean=} byId=false, if enable it, this method will only check for differences in the 'id' property
|
1790
|
+
*/
|
1791
|
+
Grid.prototype.restoreColumns = function(columns, byId) {
|
1792
|
+
let grid = this._grid;
|
1793
|
+
grid.startBatch("reset");
|
1794
|
+
let configObj = this.getConfigObject();
|
1795
|
+
let previousColumns = configObj.columns;
|
1796
|
+
|
1797
|
+
let preColLen = previousColumns.length;
|
1798
|
+
let newColLen = columns.length;
|
1799
|
+
|
1800
|
+
let compareLogic = byId ? _hasMatchingId : deepEqual;
|
1801
|
+
let removingFields = [];
|
1802
|
+
let keepingColumns = [];
|
1803
|
+
let columnOrdering = [];
|
1804
|
+
|
1805
|
+
let i, j, found;
|
1806
|
+
// Slow, time complexity BigO(n ^ 2)
|
1807
|
+
for (i = 0; i < preColLen; i++) {
|
1808
|
+
found = false;
|
1809
|
+
for (j = 0; j < newColLen; j++) {
|
1810
|
+
if(compareLogic(previousColumns[i], columns[j])) {
|
1811
|
+
keepingColumns.push(previousColumns[i]);
|
1812
|
+
found = true;
|
1813
|
+
break;
|
1814
|
+
}
|
1815
|
+
}
|
1816
|
+
if (!found) {
|
1817
|
+
removingFields.push(i);
|
1818
|
+
}
|
1819
|
+
}
|
1820
|
+
|
1821
|
+
this.removeColumns(removingFields);
|
1822
|
+
|
1823
|
+
let keepingLen = keepingColumns.length;
|
1824
|
+
let prevState = false;
|
1825
|
+
if(newColLen > 1) {
|
1826
|
+
prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
1827
|
+
}
|
1828
|
+
for (i = 0; i < newColLen; i++) {
|
1829
|
+
found = false;
|
1830
|
+
for (j = 0; j < keepingLen; j++) { // loop only keeping column
|
1831
|
+
if(compareLogic(columns[i], keepingColumns[j])) {
|
1832
|
+
found = true;
|
1833
|
+
let colIndex = this.getColumnIndex(columns[i].id || columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
|
1834
|
+
columnOrdering.push(this.getColumnId(colIndex));
|
1835
|
+
break;
|
1836
|
+
}
|
1837
|
+
}
|
1838
|
+
if (!found) {
|
1839
|
+
this.insertColumn(columns[i], i);
|
1840
|
+
columnOrdering.push(this.getColumnId(i)); // Use new insertion column index
|
1841
|
+
}
|
1842
|
+
}
|
1843
|
+
|
1844
|
+
if(newColLen > 1) {
|
1845
|
+
this._grid.freezeLayout(prevState);
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
grid.reorderColumns(columnOrdering);
|
1849
|
+
grid.stopBatch("reset");
|
1850
|
+
};
|
1851
|
+
|
1852
|
+
/** Remove all existing columns and add new columns based on the given texts/fields
|
1853
|
+
* @public
|
1854
|
+
* @function
|
1855
|
+
* @param {Array.<string>} ary Array of fields (string)
|
1856
|
+
* @see {@link Grid#setColumns}
|
1857
|
+
*/
|
1858
|
+
Grid.prototype.setFields = Grid.prototype.setColumns;
|
1859
|
+
|
1860
|
+
/** @private
|
1861
|
+
* @param {Object} e
|
1862
|
+
*/
|
1863
|
+
Grid.prototype._onColumnAdded = function(e) {
|
1864
|
+
let colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
|
1865
|
+
delete e.context[COL_DEF];
|
1866
|
+
let idx = e.colIndex;
|
1867
|
+
|
1868
|
+
let coreColDef = this._grid._getColumnDef(idx);
|
1869
|
+
colDef._setCoreColumnDef(coreColDef); // For column id and field
|
1870
|
+
|
1871
|
+
let colData = this._grid.getColumnData(idx);
|
1872
|
+
if(!colData) { // Save column inside grid
|
1873
|
+
colData = this._grid.setColumnData(idx, {});
|
1874
|
+
}
|
1875
|
+
colData[COL_DEF] = colDef;
|
1876
|
+
let userModel = colDef.getUserModel();
|
1877
|
+
// binding
|
1878
|
+
this._grid.setColumnDataBindingHandler(idx, colDef.getRenderer());
|
1879
|
+
// width and scalable
|
1880
|
+
let value = userModel["width"];
|
1881
|
+
// eslint-disable-next-line no-undefined
|
1882
|
+
if(value !== undefined) {
|
1883
|
+
value = +value;
|
1884
|
+
let scalable;
|
1885
|
+
if(userModel["scalable"] != null) {
|
1886
|
+
scalable = userModel["scalable"] ? true : false;
|
1887
|
+
} else {
|
1888
|
+
scalable = value !== value; // NaN means scalable
|
1889
|
+
}
|
1890
|
+
this._grid.setColumnWidth(idx, value, scalable);
|
1891
|
+
} else {
|
1892
|
+
this._grid.setColumnWidth(idx, 1, true);
|
1893
|
+
}
|
1894
|
+
// minWidth
|
1895
|
+
value = userModel["minWidth"];
|
1896
|
+
if(value >= 0) {
|
1897
|
+
this._grid.setMinimumColumnWidth(idx, value);
|
1898
|
+
}
|
1899
|
+
// hidden
|
1900
|
+
value = userModel["hidden"];
|
1901
|
+
if(value) {
|
1902
|
+
this._grid.hideColumn(idx, true);
|
1903
|
+
}
|
1904
|
+
// textAlign
|
1905
|
+
value = userModel["textAlign"] || userModel["alignment"];
|
1906
|
+
if(typeof value === "string") {
|
1907
|
+
this._grid.setColumnAlignment(idx, value);
|
1908
|
+
}
|
1909
|
+
if(!userModel["keepModel"]) {
|
1910
|
+
colDef.clearUserModel();
|
1911
|
+
}
|
1912
|
+
|
1913
|
+
// text select flag per column
|
1914
|
+
// with this flag enabled user can select text in cell of this column
|
1915
|
+
if (colDef.isTextSelect()) {
|
1916
|
+
this._grid.enableColumnClass(idx, 'tr-text-select', true, "content");
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
// className
|
1920
|
+
let i, classes = colDef.getClasses();
|
1921
|
+
for(i = 0; i < classes.length; i++) {
|
1922
|
+
this._grid.enableColumnClass(idx, classes[i]);
|
1923
|
+
}
|
1924
|
+
let colField = colDef.getField();
|
1925
|
+
this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
|
1926
|
+
let fields = colDef.getAllFields();
|
1927
|
+
let referrer = colDef.getId();
|
1928
|
+
let len = fields.length;
|
1929
|
+
let field, dataType, prom, onLoaded;
|
1930
|
+
for(i = 0; i < len; i++) {
|
1931
|
+
field = fields[i];
|
1932
|
+
if(this._shouldLoadFieldInfo(field)) {
|
1933
|
+
if(field === colField) {
|
1934
|
+
dataType = colDef.getDataType(); // Data-type from user's column options
|
1935
|
+
} else { // Other required fields
|
1936
|
+
dataType = ColumnDefinition.getDataType(field); // Data-type evaluated from FieldDefinition
|
1937
|
+
}
|
1938
|
+
prom = FieldDefinition.loadFieldInfo(field)
|
1939
|
+
.then(this._onFieldLoadedSuccess.bind(this, field, colDef))
|
1940
|
+
.catch(this._onFieldLoadedError);
|
1941
|
+
|
1942
|
+
if(!dataType) {
|
1943
|
+
// wait field-info to be loaded before adding field
|
1944
|
+
onLoaded = this._onFieldLoaded.bind(this, field, referrer);
|
1945
|
+
prom = prom.then(onLoaded).catch(onLoaded);
|
1946
|
+
} else {
|
1947
|
+
if(colDef.isTimeSeries()) {
|
1948
|
+
this._populateTimeSeriesChildren(colDef);
|
1949
|
+
}
|
1950
|
+
this._connector.addFields(field, referrer);
|
1951
|
+
}
|
1952
|
+
} else {
|
1953
|
+
if(colDef.isTimeSeries()) {
|
1954
|
+
this._populateTimeSeriesChildren(colDef);
|
1955
|
+
}
|
1956
|
+
this._connector.addFields(field, referrer);
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
};
|
1960
|
+
|
1961
|
+
/** @public
|
1962
|
+
* @param {Grid~ColumnReference} colRef
|
1963
|
+
* @see {@link Grid#removeColumns}
|
1964
|
+
* @see {@link Grid#removeAllColumns}
|
1965
|
+
*/
|
1966
|
+
Grid.prototype.removeColumn = function(colRef) {
|
1967
|
+
let colIndex = this.getColumnIndex(colRef);
|
1968
|
+
if(colIndex < 0) {
|
1969
|
+
return;
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
let colDef = this.getColumnDefinition(colIndex);
|
1973
|
+
|
1974
|
+
this._grid.removeColumnAt(colIndex);
|
1975
|
+
this._connector.removeFields(colDef);
|
1976
|
+
|
1977
|
+
colDef.dispose(); // Dispose at the last line to avoid making properties inaccessible
|
1978
|
+
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
1979
|
+
};
|
1980
|
+
/** Remove multiple columns through array. To remove all columns, use removeAllColumns() instead of this method
|
1981
|
+
* @public
|
1982
|
+
* @param {Array.<Grid~ColumnReference>} colRefs
|
1983
|
+
* @see {@link Grid#removeColumn}
|
1984
|
+
* @see {@link Grid#removeAllColumns}
|
1985
|
+
*/
|
1986
|
+
Grid.prototype.removeColumns = function(colRefs) {
|
1987
|
+
let indices = this.getColumnIndices(colRefs);
|
1988
|
+
let len = indices.length;
|
1989
|
+
if(len <= 1) {
|
1990
|
+
if(len === 1) {
|
1991
|
+
this.removeColumn(indices[0]);
|
1992
|
+
}
|
1993
|
+
return;
|
1994
|
+
}
|
1995
|
+
indices.sort(Grid._descendingOrder); // Removal must be done from the back
|
1996
|
+
|
1997
|
+
let prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
|
1998
|
+
|
1999
|
+
for(let i = 0; i < len; ++i) {
|
2000
|
+
let colIndex = indices[i];
|
2001
|
+
let colDef = this.getColumnDefinition(colIndex);
|
2002
|
+
colDef.dispose();
|
2003
|
+
this._grid.removeColumnAt(colIndex);
|
2004
|
+
this._connector.removeFields(colDef);
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
this._grid.freezeLayout(prevState);
|
2008
|
+
};
|
2009
|
+
/** Sorting is also cleared.
|
2010
|
+
* @public
|
2011
|
+
* @see {@link Grid#removeColumn}
|
2012
|
+
* @see {@link Grid#removeColumns}
|
2013
|
+
*/
|
2014
|
+
Grid.prototype.removeAllColumns = function() {
|
2015
|
+
let colCount = this.getColumnCount();
|
2016
|
+
if(colCount <= 0) {
|
2017
|
+
return;
|
2018
|
+
}
|
2019
|
+
|
2020
|
+
if(!this._sharedSorter) {
|
2021
|
+
this.clearSort();
|
2022
|
+
}
|
2023
|
+
for(let i = colCount; --i >= 0;) {
|
2024
|
+
// WARNING: This may affect plugins event listeners
|
2025
|
+
this._grid.setColumnDataBindingHandler(i, null);
|
2026
|
+
let colDef = this.getColumnDefinition(i);
|
2027
|
+
colDef.dispose();
|
2028
|
+
}
|
2029
|
+
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
2030
|
+
|
2031
|
+
this._columnTitleConflator.reset();
|
2032
|
+
this._timeSeriesChildConflator.reset();
|
2033
|
+
|
2034
|
+
this._connector.removeAllFields();
|
2035
|
+
this._grid.setColumnCount(0);
|
2036
|
+
};
|
2037
|
+
|
2038
|
+
/** Move the column at the specified index to the target index. When moving multiple columns, the original order of the source columns will be sorted by their index and the position of the columns will not be guaranteed to be exactly at the destination index.
|
2039
|
+
* @public
|
2040
|
+
* @param {number|Array.<number>} fromColIndex index or array of indices of the column(s) to be moved.
|
2041
|
+
* @param {number} toColIndex target column index
|
2042
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
2043
|
+
* @see {@link Grid#moveColumnById}
|
2044
|
+
*/
|
2045
|
+
Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
|
2046
|
+
return this._grid.moveColumn(fromColIndex, toColIndex);
|
2047
|
+
};
|
2048
|
+
/** If source column is not found, no operation is performed. If destination column is not found, the source column will be moved to the last position.<br>
|
2049
|
+
* Note: this method behaves slightly different from moveColumn method in that it always put source column at the position before the specified destination column, while moveColumn method will put column at exactly at the destination index.
|
2050
|
+
* @public
|
2051
|
+
* @param {number|string} srcCol Column Id or index
|
2052
|
+
* @param {(number|string)=} destCol Column Id or index of the destination
|
2053
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
2054
|
+
* @see {@link Grid#moveColumn}
|
2055
|
+
* @example
|
2056
|
+
* grid.moveColumnById(3, 1); // Move column 3 to position before column 1
|
2057
|
+
* grid.moveColumnById(0, 2); // Move column 0 to position before column 2 (column index 1)
|
2058
|
+
* grid.moveColumnById(0, 1); // Nothing is moved
|
2059
|
+
* grid.moveColumnById("sourceColumnId", "anotherId");
|
2060
|
+
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
2061
|
+
*/
|
2062
|
+
Grid.prototype.moveColumnById = function (srcCol, destCol) {
|
2063
|
+
return this._grid.moveColumnById(srcCol, destCol);
|
2064
|
+
};
|
2065
|
+
|
2066
|
+
/** @public
|
2067
|
+
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
2068
|
+
* @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
2069
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
2070
|
+
*/
|
2071
|
+
Grid.prototype.reorderColumns = function (colRefs, destCol) {
|
2072
|
+
return this._grid.reorderColumns(colRefs, destCol);
|
2073
|
+
};
|
2074
|
+
|
2075
|
+
/** The hidden column still occupies the same index.
|
2076
|
+
* @public
|
2077
|
+
* @param {Grid~ColumnReference} colRef
|
2078
|
+
* @param {boolean=} hidden
|
2079
|
+
* @see {@link Grid#hideColumns}
|
2080
|
+
* @see {@link Grid#showAllColumns}
|
2081
|
+
*/
|
2082
|
+
Grid.prototype.hideColumn = function(colRef, hidden) {
|
2083
|
+
let colIndex = this.getColumnIndex(colRef);
|
2084
|
+
if(colIndex < 0) { // not found
|
2085
|
+
return;
|
2086
|
+
}
|
2087
|
+
this._grid.hideColumn(colIndex, hidden);
|
2088
|
+
|
2089
|
+
};
|
2090
|
+
/** Hide multiple columns at once. The hidden columns still occupy the same index.
|
2091
|
+
* @public
|
2092
|
+
* @param {Array.<Grid~ColumnReference>} colRefs
|
2093
|
+
* @param {boolean=} hidden
|
2094
|
+
* @see {@link Grid#hideColumn}
|
2095
|
+
* @see {@link Grid#showAllColumns}
|
2096
|
+
*/
|
2097
|
+
Grid.prototype.hideColumns = function(colRefs, hidden) {
|
2098
|
+
this._grid.hideColumns(this.getColumnIndices(colRefs), hidden);
|
2099
|
+
};
|
2100
|
+
/** @public
|
2101
|
+
* @see {@link Grid#hideColumn}
|
2102
|
+
* @see {@link Grid#hideColumns}
|
2103
|
+
*/
|
2104
|
+
Grid.prototype.showAllColumns = function() {
|
2105
|
+
this._grid.showAllColumns();
|
2106
|
+
};
|
2107
|
+
/** @private
|
2108
|
+
* @function
|
2109
|
+
* @param {number} a
|
2110
|
+
* @param {number} b
|
2111
|
+
* @return {number}
|
2112
|
+
*/
|
2113
|
+
Grid._descendingOrder = function(a, b) {
|
2114
|
+
return b - a;
|
2115
|
+
};
|
2116
|
+
|
2117
|
+
/** Add fields for real-time data without adding column nor UIs. No duplication is allowed
|
2118
|
+
* @public
|
2119
|
+
* @param {string|Array.<string>} fieldRef
|
2120
|
+
* @param {string=} referrer
|
2121
|
+
* @return {boolean}
|
2122
|
+
*/
|
2123
|
+
Grid.prototype.addDataFields = function(fieldRef, referrer) {
|
2124
|
+
if(!fieldRef) {
|
2125
|
+
return false;
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
let fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
|
2129
|
+
let len = fields.length;
|
2130
|
+
let i, field, dataType, prom, onLoaded;
|
2131
|
+
for(i = 0; i < len; i++) {
|
2132
|
+
field = fields[i];
|
2133
|
+
if(this._shouldLoadFieldInfo(field)) {
|
2134
|
+
dataType = ColumnDefinition.getDataType(field);
|
2135
|
+
prom = FieldDefinition.loadFieldInfo(field)
|
2136
|
+
.catch(this._onFieldLoadedError);
|
2137
|
+
|
2138
|
+
if(!dataType) {
|
2139
|
+
// wait field-info to be loaded before adding field
|
2140
|
+
onLoaded = this._onFieldLoaded.bind(this, field, referrer);
|
2141
|
+
prom = prom.then(onLoaded).catch(onLoaded);
|
2142
|
+
} else {
|
2143
|
+
this._connector.addFields(field, referrer || "grid");
|
2144
|
+
}
|
2145
|
+
} else {
|
2146
|
+
this._connector.addFields(field, referrer || "grid");
|
2147
|
+
}
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
return true;
|
2151
|
+
};
|
2152
|
+
/** Add fields for real-time data without adding column nor UIs. No duplication is allowed
|
2153
|
+
* @public
|
2154
|
+
* @param {string|Array.<string>} fieldRef
|
2155
|
+
* @param {string=} referrer
|
2156
|
+
* @return {boolean}
|
2157
|
+
*/
|
2158
|
+
Grid.prototype.removeDataFields = function(fieldRef, referrer) {
|
2159
|
+
if(!fieldRef) {
|
2160
|
+
return false;
|
2161
|
+
}
|
2162
|
+
|
2163
|
+
this._connector.removeFields(fieldRef, referrer || "grid");
|
2164
|
+
return true;
|
2165
|
+
};
|
2166
|
+
/** @public
|
2167
|
+
* @param {string} referrer
|
2168
|
+
*/
|
2169
|
+
Grid.prototype.removeFieldReferrer = function(referrer) {
|
2170
|
+
if(!referrer) {
|
2171
|
+
return;
|
2172
|
+
}
|
2173
|
+
|
2174
|
+
this._connector.removeFieldReferrer(referrer);
|
2175
|
+
};
|
2176
|
+
|
2177
|
+
/** @public
|
2178
|
+
* @param {Grid~ColumnReference} colRef
|
2179
|
+
* @param {string=} opt_order This can be "ascending", "descending", "none", "noOrder", or "originalOrder"
|
2180
|
+
*/
|
2181
|
+
Grid.prototype.sortColumn = function(colRef, opt_order) {
|
2182
|
+
if(typeof colRef === "string") {
|
2183
|
+
this._stp.sortColumn(colRef, opt_order); // Allow sorting by field
|
2184
|
+
return;
|
2185
|
+
}
|
2186
|
+
|
2187
|
+
let colIndex = this.getColumnIndex(colRef);
|
2188
|
+
if(colIndex < 0) {
|
2189
|
+
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
2190
|
+
} else {
|
2191
|
+
this._stp.sortColumn(colIndex, opt_order);
|
2192
|
+
}
|
2193
|
+
};
|
2194
|
+
/** @public
|
2195
|
+
* @param {number} colIndex
|
2196
|
+
* @param {string} str
|
2197
|
+
*/
|
2198
|
+
Grid.prototype.setColumnName = function(colIndex, str) {
|
2199
|
+
let colDef = this.getColumnDefinition(colIndex);
|
2200
|
+
if(colDef) {
|
2201
|
+
colDef.setName(str);
|
2202
|
+
this.updateColumnTitle();
|
2203
|
+
}
|
2204
|
+
};
|
2205
|
+
/** @public
|
2206
|
+
* @param {Grid~ColumnReference} colRef
|
2207
|
+
* @return {string}
|
2208
|
+
*/
|
2209
|
+
Grid.prototype.getColumnBackgroundColor = function(colRef) {
|
2210
|
+
let colDef = this.getColumnDefinition(colRef);
|
2211
|
+
if(colDef) {
|
2212
|
+
return colDef.getBackgroundColor();
|
2213
|
+
}
|
2214
|
+
return "";
|
2215
|
+
};
|
2216
|
+
/** @public
|
2217
|
+
* @param {Grid~ColumnReference} colRef
|
2218
|
+
* @param {string} color
|
2219
|
+
*/
|
2220
|
+
Grid.prototype.setColumnBackgroundColor = function(colRef, color) {
|
2221
|
+
let colDef = this.getColumnDefinition(colRef);
|
2222
|
+
if(colDef) {
|
2223
|
+
colDef.setBackgroundColor(color);
|
2224
|
+
}
|
2225
|
+
};
|
2226
|
+
/** @public
|
2227
|
+
* @param {Grid~ColumnReference} colRef
|
2228
|
+
* @param {Function=} func
|
2229
|
+
*/
|
2230
|
+
Grid.prototype.setColumnRenderer = function(colRef, func) {
|
2231
|
+
let colIndex = this.getColumnIndex(colRef);
|
2232
|
+
this.setColumnFormatter(colIndex, func);
|
2233
|
+
};
|
2234
|
+
|
2235
|
+
/** @public
|
2236
|
+
* @param {Grid~ColumnReference} colRef Column index or id
|
2237
|
+
* @param {string=} id ID for renderer mapping. If not specified the default renderer will be picked up
|
2238
|
+
* @param {Function=} func If not specified the renderer which corresponded id from mapping will be picked up
|
2239
|
+
*/
|
2240
|
+
Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
|
2241
|
+
let colIndex = this.getColumnIndex(colRef);
|
2242
|
+
if (colIndex == null) { return; }
|
2243
|
+
|
2244
|
+
let colDef = this.getColumnDefinition(colIndex);
|
2245
|
+
if(!colDef) { return; }
|
2246
|
+
|
2247
|
+
colDef.activateRenderer(id, func);
|
2248
|
+
|
2249
|
+
this._grid.setColumnDataBindingHandler(colIndex, colDef.getRenderer());
|
2250
|
+
this._grid.requestRowRefresh();
|
2251
|
+
};
|
2252
|
+
|
2253
|
+
/**
|
2254
|
+
* @public
|
2255
|
+
* @param {number} colIndex Column index of the position of the column to be updated
|
2256
|
+
* @param {Object|Function=} formatter Formatter object or bind function
|
2257
|
+
*/
|
2258
|
+
Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
2259
|
+
if (colIndex == null) { return; }
|
2260
|
+
|
2261
|
+
let colDef = this.getColumnDefinition(colIndex);
|
2262
|
+
if(!colDef) {
|
2263
|
+
return;
|
2264
|
+
}
|
2265
|
+
|
2266
|
+
let func = null;
|
2267
|
+
if (formatter) {
|
2268
|
+
if(typeof formatter === "object") {
|
2269
|
+
if(typeof formatter.init === "function") { // Initialize predefined formatter
|
2270
|
+
// WARNING: Column definition has not been updated
|
2271
|
+
formatter.init(colDef.getConfigObject(), this._grid);
|
2272
|
+
}
|
2273
|
+
func = formatter.binding;
|
2274
|
+
} else {
|
2275
|
+
func = formatter;
|
2276
|
+
}
|
2277
|
+
if(typeof func !== "function") {
|
2278
|
+
func = null;
|
2279
|
+
}
|
2280
|
+
}
|
2281
|
+
|
2282
|
+
if(func !== colDef.getRenderer()) {
|
2283
|
+
let section = this._grid.getSection("content");
|
2284
|
+
let col = /** @type {Column} */section.getColumn(colIndex);
|
2285
|
+
if (col) {
|
2286
|
+
col.clearContent();
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
this._grid.setColumnDataBindingHandler(colIndex, null);
|
2290
|
+
|
2291
|
+
colDef.setRenderer(func);
|
2292
|
+
|
2293
|
+
this._grid.setColumnDataBindingHandler(colIndex, colDef.getRenderer());
|
2294
|
+
this._grid.requestRowRefresh();
|
2295
|
+
}
|
2296
|
+
};
|
2297
|
+
|
2298
|
+
/** @public
|
2299
|
+
* @param {Grid~ColumnReference} colRef
|
2300
|
+
* @param {ColumnDefinition~SortLogic=} func
|
2301
|
+
*/
|
2302
|
+
Grid.prototype.setColumnSorter = function(colRef, func) {
|
2303
|
+
let colIndex = this.getColumnIndex(colRef);
|
2304
|
+
let colDef = this.getColumnDefinition(colIndex);
|
2305
|
+
if(colDef) {
|
2306
|
+
colDef.setSorter(func);
|
2307
|
+
|
2308
|
+
let sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
|
2309
|
+
if(sortedColumn === colIndex) {
|
2310
|
+
this._stp.refresh();
|
2311
|
+
}
|
2312
|
+
}
|
2313
|
+
};
|
2314
|
+
|
2315
|
+
|
2316
|
+
/** Initialize data for the given rowDef from another rowDef with the same RIC
|
2317
|
+
* @private
|
2318
|
+
* @param {!RowDefinition} rowDef
|
2319
|
+
*/
|
2320
|
+
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
2321
|
+
if(!rowDef) {
|
2322
|
+
return;
|
2323
|
+
}
|
2324
|
+
let rowDefs = this._connector.getRowDefByRic(rowDef.getSymbol());
|
2325
|
+
if(rowDefs && rowDefs.length > 0) { // Found at least 1 Duplicate chain/ric data
|
2326
|
+
let firstRowDef = rowDefs[0];
|
2327
|
+
rowDef.copyRowData(firstRowDef);
|
2328
|
+
if(rowDef.isChain()) {
|
2329
|
+
let children = firstRowDef.getChildren();
|
2330
|
+
if(children && children.length > 0) {
|
2331
|
+
setTimeout(this._cloneChain.bind(this, rowDef), 0); // Need to delay to wait row inserted
|
2332
|
+
}
|
2333
|
+
}
|
2334
|
+
}
|
2335
|
+
};
|
2336
|
+
|
2337
|
+
/** @private
|
2338
|
+
* @param {Object} newRowDef
|
2339
|
+
*/
|
2340
|
+
Grid.prototype._cloneChain = function(newRowDef) {
|
2341
|
+
let rowDefs = this._connector.getRowDefByRic(newRowDef.getSymbol());
|
2342
|
+
let firstRowDef = rowDefs ? rowDefs[0] : null;
|
2343
|
+
let constituents = firstRowDef ? firstRowDef.getChildren() : null;
|
2344
|
+
let count = constituents ? constituents.length : 0;
|
2345
|
+
if(count < 0) {
|
2346
|
+
return;
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
let subId = newRowDef.getSubId();
|
2350
|
+
if(!subId) {
|
2351
|
+
return; // A chain without subscription cannot have constituents
|
2352
|
+
}
|
2353
|
+
let evtArg = {
|
2354
|
+
"subId": subId
|
2355
|
+
};
|
2356
|
+
for (let i = 0; i < count; i++) {
|
2357
|
+
let childRowDef = constituents[i];
|
2358
|
+
evtArg["ric"] = childRowDef.getRic();
|
2359
|
+
evtArg["values"] = childRowDef.cloneRowData();
|
2360
|
+
evtArg["values"]["SUB_ID"] = subId; // Imitate real-time service responses
|
2361
|
+
|
2362
|
+
this._onQ2DataChanged(evtArg); // WARNING: evtArg is shared across multiple calls
|
2363
|
+
}
|
2364
|
+
};
|
2365
|
+
/** @public
|
2366
|
+
* @param {(RowDefinition~Options|string)=} rowOption
|
2367
|
+
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
2368
|
+
* @returns {RowDefinition}
|
2369
|
+
* @example
|
2370
|
+
* let grid = new rt.Grid(grid_div, options);
|
2371
|
+
* grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
|
2372
|
+
*/
|
2373
|
+
Grid.prototype.insertRow = function(rowOption, rowRef) {
|
2374
|
+
if(this._mainGrid) {
|
2375
|
+
return this._mainGrid.insertRow(rowOption, this._getRowId(rowRef));
|
2376
|
+
}
|
2377
|
+
|
2378
|
+
if(rowOption) {
|
2379
|
+
if(typeof rowOption === "string") {
|
2380
|
+
rowOption = { "ric": rowOption };
|
2381
|
+
} else if(Array.isArray(rowOption["values"])) {
|
2382
|
+
if(!rowOption["fields"]) { // Static values are defined but no fields
|
2383
|
+
rowOption["fields"] = this.getColumnFields(); // For initializing static value
|
2384
|
+
}
|
2385
|
+
}
|
2386
|
+
}
|
2387
|
+
let rowDef = new RowDefinition(rowOption);
|
2388
|
+
|
2389
|
+
if(rowDef.setDataSource(this._dc, this._subs)) { // This could also subscribe chain index/ric to JET/RTK
|
2390
|
+
this._hasNewUpdates = true; // Mark data table for cleaning it up later
|
2391
|
+
}
|
2392
|
+
rowDef.registerToView(this._dv, this._getRowId(rowRef));
|
2393
|
+
|
2394
|
+
this._initDuplicateRicData(rowDef);
|
2395
|
+
|
2396
|
+
if(rowOption && rowOption["hidden"]) {
|
2397
|
+
this._dv.hideRow(rowDef.getRowId()); // Try to obtain rowId in rowDef since rowId is not assigned when new rows are created.
|
2398
|
+
}
|
2399
|
+
this._connector.addRic(rowDef);
|
2400
|
+
return rowDef;
|
2401
|
+
};
|
2402
|
+
/** Insert a row as a segment separator
|
2403
|
+
* @public
|
2404
|
+
* @param {RowDefinition~Options=} rowOption
|
2405
|
+
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
2406
|
+
* @returns {RowDefinition}
|
2407
|
+
*/
|
2408
|
+
Grid.prototype.insertSegmentSeparator = function(rowOption, rowRef) {
|
2409
|
+
if(!rowOption) {
|
2410
|
+
rowOption = {};
|
2411
|
+
}
|
2412
|
+
if(typeof rowOption === "object") {
|
2413
|
+
rowOption.asSegment = true;
|
2414
|
+
return this.insertRow(rowOption, rowRef);
|
2415
|
+
}
|
2416
|
+
return null;
|
2417
|
+
};
|
2418
|
+
/** @public
|
2419
|
+
* @param {Array.<RowDefinition~Options|string>} rowOptions Array of row option object
|
2420
|
+
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
2421
|
+
* @param {Array.<string>=} opt_fields
|
2422
|
+
* @example
|
2423
|
+
* let grid = new rt.Grid(grid_div, options);
|
2424
|
+
* grid.insertRows([
|
2425
|
+
* {ric: "RIC"},
|
2426
|
+
* {values: {"field1": 0, "field2": 1}},
|
2427
|
+
* {ric: "RIC2", values: [1, 2, 3, 4]},
|
2428
|
+
* null
|
2429
|
+
* ]); // 4 rows are appended
|
2430
|
+
*/
|
2431
|
+
Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
2432
|
+
if(this._mainGrid) {
|
2433
|
+
this._mainGrid.insertRows(rowOptions, this._getRowId(rowRef));
|
2434
|
+
return;
|
2435
|
+
}
|
2436
|
+
if(!Array.isArray(rowOptions)) {
|
2437
|
+
return;
|
2438
|
+
}
|
2439
|
+
|
2440
|
+
let prevState = this._dt.freeze(); // Avoid sorting for each inserted row
|
2441
|
+
let fields = opt_fields || this.getColumnFields();
|
2442
|
+
let rowId = this._getRowId(rowRef);
|
2443
|
+
let len = rowOptions.length;
|
2444
|
+
for(let r = 0; r < len; ++r) {
|
2445
|
+
let rowOption = rowOptions[r];
|
2446
|
+
if(rowOption) {
|
2447
|
+
if(typeof rowOption === "string") {
|
2448
|
+
rowOption = { "ric": rowOption };
|
2449
|
+
}
|
2450
|
+
rowOption["fields"] = fields; // For initializing static value
|
2451
|
+
}
|
2452
|
+
this.insertRow(rowOption, rowId); // Note that data view is being frozen, so only using row id will work properly
|
2453
|
+
}
|
2454
|
+
this._dt.freeze(prevState);
|
2455
|
+
};
|
2456
|
+
/** Add multiple rows without `ric` property in {@link RowDefinition}
|
2457
|
+
* @public
|
2458
|
+
* @param {Array} dataRows 2D Array of data or Array of Field/Value pair object
|
2459
|
+
* @param {Array.<string>=} fields If no field is given, field defined in column definition will be used instead
|
2460
|
+
* @see {@link Grid#logDV}
|
2461
|
+
* @see {@link Grid#logDT}
|
2462
|
+
* @example
|
2463
|
+
* let grid = new rt.Grid(grid_div, options);
|
2464
|
+
* grid.addStaticDataRows([
|
2465
|
+
* [10, "a", true],
|
2466
|
+
* [20, "b", false],
|
2467
|
+
* [30, "c", true]
|
2468
|
+
* ], ["field1", "field2", "field3"]); // 3 rows are appended
|
2469
|
+
*
|
2470
|
+
* grid.addStaticDataRows([ // Object format can also be used
|
2471
|
+
* {"field1": 40, "field2": "a", "field3": true},
|
2472
|
+
* {"field1": 50, "field2": "b"}, // each row doesn't have to be the same
|
2473
|
+
* {"field1": 60, "field4": "some thing"}
|
2474
|
+
* ]); // 3 more rows are appended
|
2475
|
+
* grid.logDV({"colNames": ["field1", "field2", "field3", "field4"]}); // See results in console
|
2476
|
+
*/
|
2477
|
+
Grid.prototype.addStaticDataRows = function(dataRows, fields) {
|
2478
|
+
if(this._mainGrid) {
|
2479
|
+
this._mainGrid.addStaticDataRows(dataRows, fields);
|
2480
|
+
return;
|
2481
|
+
}
|
2482
|
+
|
2483
|
+
if(!Array.isArray(dataRows)) {
|
2484
|
+
let userObj = dataRows;
|
2485
|
+
dataRows = null;
|
2486
|
+
if(userObj) {
|
2487
|
+
if(userObj.fields && !fields) {
|
2488
|
+
fields = userObj.fields;
|
2489
|
+
}
|
2490
|
+
if(Array.isArray(userObj.data)) { // dataRows must has an array type
|
2491
|
+
dataRows = userObj.data;
|
2492
|
+
}
|
2493
|
+
}
|
2494
|
+
}
|
2495
|
+
if(dataRows) {
|
2496
|
+
this.insertRows(dataRows.map(Grid._dataToRowOptions), null, fields);
|
2497
|
+
}
|
2498
|
+
};
|
2499
|
+
/** Insert, update, remove and reorder data based on the given array of records
|
2500
|
+
* @public
|
2501
|
+
* @param {Array.<Object>} records Array of records for insert, remove, update, reorder in one operation
|
2502
|
+
* @param {string=} rowIdentifier Check difference data with the row identifier map property for operate record.
|
2503
|
+
* @example
|
2504
|
+
* // Grid data set will be updated to 3 records. All rows in the grid will be cleared and new rows will be inserted
|
2505
|
+
* grid.updateDataSet([
|
2506
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
2507
|
+
* { id: "B", field2: 1, field3: 2, field4: "Something B" },
|
2508
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
2509
|
+
* ], "id");
|
2510
|
+
* // Update record id "B" in "field2", "field3" value 100, 200
|
2511
|
+
* grid.updateDataSet([
|
2512
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
2513
|
+
* { id: "B", field2: 100, field3: 200, field4: "Something B" },
|
2514
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
2515
|
+
* ], "id");
|
2516
|
+
* // Delete record id "B"
|
2517
|
+
* grid.updateDataSet([
|
2518
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
2519
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
2520
|
+
* ], "id");
|
2521
|
+
* // Insert record id "D"
|
2522
|
+
* grid.updateDataSet([
|
2523
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
2524
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
2525
|
+
* { id: "D", field2: 1, field3: 2, field4: "Something D" },
|
2526
|
+
* ], "id");
|
2527
|
+
* // Reorder to "D", "C", "A"
|
2528
|
+
* grid.updateDataSet([
|
2529
|
+
* { id: "D", field2: 1, field3: 2, field4: "Something D" },
|
2530
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
2531
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
2532
|
+
* ], "id");
|
2533
|
+
* // Insert, Update, Delete And Reorder
|
2534
|
+
* grid.updateDataSet([
|
2535
|
+
* { id: "F", field2: 1, field3: 2, field4: "Something F" },
|
2536
|
+
* { id: "D", field2: 1, field3: 2, field4: "Something D" },
|
2537
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
2538
|
+
* { id: "E", field2: 1, field3: 2, field4: "Something E" },
|
2539
|
+
* ], "id");
|
2540
|
+
*/
|
2541
|
+
Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
2542
|
+
if(!Array.isArray(records) || records.length === 0 ) {
|
2543
|
+
this.removeAllRows();
|
2544
|
+
return;
|
2545
|
+
}
|
2546
|
+
|
2547
|
+
// Map new data index
|
2548
|
+
let recordCount = records.length;
|
2549
|
+
let fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
|
2550
|
+
let oldDataMap = {};
|
2551
|
+
let rowDef, id, record, i;
|
2552
|
+
let rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
|
2553
|
+
let rowDefCount = rowDefs.length;
|
2554
|
+
let prevState = false;
|
2555
|
+
if(rowIdentifier) {
|
2556
|
+
prevState = this._dt.freeze();
|
2557
|
+
for (i = 0; i < rowDefCount; i++) {
|
2558
|
+
rowDef = rowDefs[i];
|
2559
|
+
if(rowDef) {
|
2560
|
+
id = rowDef.getRowData()[rowIdentifier];
|
2561
|
+
if(id || id === 0) {
|
2562
|
+
oldDataMap[id] = rowDef;
|
2563
|
+
} else { // Any existing rowDef without row identifier should be removed
|
2564
|
+
this.removeRow(rowDef); // Slow
|
2565
|
+
}
|
2566
|
+
}
|
2567
|
+
}
|
2568
|
+
|
2569
|
+
let idMap = {};
|
2570
|
+
let newDataMap = {};
|
2571
|
+
for (i = recordCount - 1; i >= 0; i--) {
|
2572
|
+
record = records[i];
|
2573
|
+
id = record[rowIdentifier];
|
2574
|
+
rowDef = oldDataMap[id];
|
2575
|
+
newDataMap[id] = record; // Assign a new data map to compare to the previous data
|
2576
|
+
record[fieldSorting] = i;
|
2577
|
+
if(idMap[id]) { // Prevent assign data in duplicate row
|
2578
|
+
continue;
|
2579
|
+
}
|
2580
|
+
idMap[id] = true;
|
2581
|
+
if (!rowDef) {
|
2582
|
+
this.insertRow({ values: record}); // Insert last position
|
2583
|
+
} else {
|
2584
|
+
rowDef.setRowData(record);
|
2585
|
+
}
|
2586
|
+
}
|
2587
|
+
// Check Remove previous data
|
2588
|
+
for (let rowIdentifierName in oldDataMap) {
|
2589
|
+
if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
|
2590
|
+
this.removeRow(oldDataMap[rowIdentifierName]); // Slow
|
2591
|
+
}
|
2592
|
+
}
|
2593
|
+
this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
|
2594
|
+
this._dt.freeze(prevState);
|
2595
|
+
} else {
|
2596
|
+
if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
|
2597
|
+
prevState = this._dt.freeze();
|
2598
|
+
}
|
2599
|
+
for (i = 0; i < rowDefCount; i++) {
|
2600
|
+
record = records[i];
|
2601
|
+
if(record) {
|
2602
|
+
oldDataMap[i] = rowDefs[i]; // Use index instead of rowIdentifier
|
2603
|
+
} else {
|
2604
|
+
this.removeRow(rowDefs[i]); // Need to use rowRef, can't use index in view
|
2605
|
+
}
|
2606
|
+
}
|
2607
|
+
|
2608
|
+
for (i = 0; i < recordCount; i++) { // It will be sort by index when insert / update
|
2609
|
+
record = records[i];
|
2610
|
+
rowDef = oldDataMap[i];
|
2611
|
+
if (!rowDef) {
|
2612
|
+
this.insertRow({ values: record}); // Insert last position
|
2613
|
+
} else {
|
2614
|
+
rowDef.setRowData(record);
|
2615
|
+
}
|
2616
|
+
}
|
2617
|
+
if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
|
2618
|
+
this._dt.freeze(prevState);
|
2619
|
+
}
|
2620
|
+
}
|
2621
|
+
};
|
2622
|
+
/** @private
|
2623
|
+
* @param {Array|Object} item
|
2624
|
+
* @return {!Object}
|
2625
|
+
*/
|
2626
|
+
Grid._dataToRowOptions = function(item) {
|
2627
|
+
return {values: item};
|
2628
|
+
};
|
2629
|
+
/** @public
|
2630
|
+
* @param {Grid~RowReference} rowRef
|
2631
|
+
* @return {RowDefinition}
|
2632
|
+
* @see {@link Grid#removeRows}
|
2633
|
+
* @see {@link Grid#removeAllRows}
|
2634
|
+
*/
|
2635
|
+
Grid.prototype.removeRow = function(rowRef) {
|
2636
|
+
if(this._mainGrid) {
|
2637
|
+
return this._mainGrid.removeRow(this._getRowId(rowRef));
|
2638
|
+
}
|
2639
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
2640
|
+
if(rowDef) {
|
2641
|
+
if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
|
2642
|
+
this._removeRow(rowDef);
|
2643
|
+
}
|
2644
|
+
}
|
2645
|
+
return rowDef;
|
2646
|
+
};
|
2647
|
+
/** Remove multiple rows at once. This prevents duplicate operation and improve performance. To remove all rows, use removeAllRows() method instead of this method.
|
2648
|
+
* @public
|
2649
|
+
* @param {Array.<Grid~RowReference>} rowRefs
|
2650
|
+
* @return {Array.<RowDefinition>} Array of removed row definitions
|
2651
|
+
* @see {@link Grid#removeRow}
|
2652
|
+
* @see {@link Grid#removeAllRows}
|
2653
|
+
*/
|
2654
|
+
Grid.prototype.removeRows = function(rowRefs) {
|
2655
|
+
let rowDef;
|
2656
|
+
if(!Array.isArray(rowRefs)) {
|
2657
|
+
rowDef = this.removeRow(rowRefs);
|
2658
|
+
return rowDef ? [rowDef] : [];
|
2659
|
+
}
|
2660
|
+
if(this._mainGrid) {
|
2661
|
+
return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
|
2662
|
+
}
|
2663
|
+
|
2664
|
+
let i;
|
2665
|
+
let rowDefs = [];
|
2666
|
+
let len = rowRefs.length;
|
2667
|
+
|
2668
|
+
// Verify user input
|
2669
|
+
for(i = 0; i < len; ++i) {
|
2670
|
+
rowDef = this._getRowDefinitionByRef(rowRefs[i]);
|
2671
|
+
if(rowDef) {
|
2672
|
+
if(!rowDef.isAutoGenerated()) {
|
2673
|
+
rowDefs.push(rowDef);
|
2674
|
+
}
|
2675
|
+
}
|
2676
|
+
}
|
2677
|
+
len = rowDefs.length;
|
2678
|
+
|
2679
|
+
let prevState = false;
|
2680
|
+
if(len > 1) {
|
2681
|
+
prevState = this._dt.freeze(); // Prevent multiple changes that trigger sorting and filtering
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
for(i = 0; i < len; ++i) {
|
2685
|
+
this._removeRow(rowDefs[i]);
|
2686
|
+
}
|
2687
|
+
|
2688
|
+
if(len > 1) {
|
2689
|
+
this._dt.freeze(prevState);
|
2690
|
+
}
|
2691
|
+
return rowDefs;
|
2692
|
+
};
|
2693
|
+
/** @public
|
2694
|
+
* @see {@link Grid#removeRow}
|
2695
|
+
* @see {@link Grid#removeRows}
|
2696
|
+
*/
|
2697
|
+
Grid.prototype.removeAllRows = function() {
|
2698
|
+
if(this._sharedDataSource) {
|
2699
|
+
return;
|
2700
|
+
}
|
2701
|
+
if(!this._dt.getRowCount()) {
|
2702
|
+
return;
|
2703
|
+
}
|
2704
|
+
// Data source is not shared at this point
|
2705
|
+
let rowDefs = this._getAllRowDefinitions();
|
2706
|
+
|
2707
|
+
this._dc.clearAllData();
|
2708
|
+
this._dt.clearAllData();
|
2709
|
+
this._dt.setClassificationSource(this._dc);
|
2710
|
+
this._clearDataUpdates();
|
2711
|
+
|
2712
|
+
rowDefs.forEach(RowDefinition.dispose); // Each individual subscription is unsubscribed along with disposed rowDef
|
2713
|
+
|
2714
|
+
this._dcConflator.reset();
|
2715
|
+
this._formulaConflator.reset();
|
2716
|
+
this._chainConflator.reset();
|
2717
|
+
this._constituentMap = null;
|
2718
|
+
this._connector.removeAllRics();
|
2719
|
+
|
2720
|
+
// TODO: This logic should also be in the core grid
|
2721
|
+
this._grid.getVScrollbar().setScrollTop(0);
|
2722
|
+
};
|
2723
|
+
/** WARNING: This does not remove data stored in the data cache
|
2724
|
+
* @private
|
2725
|
+
* @param {!RowDefinition} rowDef
|
2726
|
+
*/
|
2727
|
+
Grid.prototype._removeRow = function(rowDef) {
|
2728
|
+
if(this._sharedDataSource) {
|
2729
|
+
return;
|
2730
|
+
}
|
2731
|
+
this._dispatch("beforeRowRemoved", {});
|
2732
|
+
|
2733
|
+
let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
|
2734
|
+
if(childRowDefs) {
|
2735
|
+
this._removeConstituentRows(childRowDefs);
|
2736
|
+
}
|
2737
|
+
this._connector.removeRic(rowDef);
|
2738
|
+
this._dt.removeRow(rowDef.getRowId()); // TODO: Merge this with the above removeRows() method
|
2739
|
+
rowDef.dispose(); // WARNING: This does not remove child reference from its parent
|
2740
|
+
};
|
2741
|
+
|
2742
|
+
/** @private
|
2743
|
+
* @param {Array.<RowDefinition>} rowDefs
|
2744
|
+
*/
|
2745
|
+
Grid.prototype._removeConstituentRows = function(rowDefs) {
|
2746
|
+
let connector = this._connector;
|
2747
|
+
let rowIds = [];
|
2748
|
+
for(let i = 0; i < rowDefs.length; i++) {
|
2749
|
+
let childRowDef = rowDefs[i];
|
2750
|
+
rowIds.push(childRowDef.getRowId());
|
2751
|
+
connector.removeRic(childRowDef);
|
2752
|
+
childRowDef.dispose();
|
2753
|
+
}
|
2754
|
+
|
2755
|
+
this._dt.removeRows(rowIds);
|
2756
|
+
};
|
2757
|
+
|
2758
|
+
/** @public
|
2759
|
+
* @param {Grid~RowReference} rowRef
|
2760
|
+
* @param {boolean=} hidden if false, show instead of hide
|
2761
|
+
*/
|
2762
|
+
Grid.prototype.hideRow = function(rowRef, hidden) {
|
2763
|
+
let rid = this._getRowId(rowRef);
|
2764
|
+
let grid = this._mainGrid || this._grid;
|
2765
|
+
grid.hideRow(rid, hidden);
|
2766
|
+
};
|
2767
|
+
|
2768
|
+
/** Hide row(s) in the Grid by specifying the rIds
|
2769
|
+
* @param {Grid~RowReference | Array.<Grid~RowReference>} rowRefs
|
2770
|
+
* @param {boolean=} hidden if false, show instead of hide
|
2771
|
+
* @public
|
2772
|
+
*/
|
2773
|
+
Grid.prototype.hideRows = function (rowRefs, hidden) {
|
2774
|
+
if (!Array.isArray(rowRefs)) {
|
2775
|
+
rowRefs = [rowRefs];
|
2776
|
+
}
|
2777
|
+
let rids = rowRefs.map(this._getRowId);
|
2778
|
+
let grid = this._mainGrid || this._grid;
|
2779
|
+
grid.hideRows(rids, hidden);
|
2780
|
+
};
|
2781
|
+
/**
|
2782
|
+
* Show row(s) in the Grid by specifying the rIds
|
2783
|
+
* @param {Grid~RowReference | Array.<Grid~RowReference>} rowRefs
|
2784
|
+
* @param {boolean=} shown if false, hide instead of show
|
2785
|
+
* @public
|
2786
|
+
*/
|
2787
|
+
Grid.prototype.showRows = function (rowRefs, shown) {
|
2788
|
+
this.hideRows(rowRefs, shown === false);
|
2789
|
+
};
|
2790
|
+
/**
|
2791
|
+
* Unhide all hidden rows in the Grid
|
2792
|
+
* @public
|
2793
|
+
*/
|
2794
|
+
Grid.prototype.unhideAllRows = function () {
|
2795
|
+
this._grid.unhideAllRows();
|
2796
|
+
};
|
2797
|
+
/**
|
2798
|
+
* @public
|
2799
|
+
* @returns {boolean}
|
2800
|
+
*/
|
2801
|
+
Grid.prototype.hasHiddenRow = function(){
|
2802
|
+
return this._grid.hasHiddenRow();
|
2803
|
+
};
|
2804
|
+
|
2805
|
+
/** Set RIC to the specified row
|
2806
|
+
* @public
|
2807
|
+
* @param {Grid~RowReference} rowRef
|
2808
|
+
* @param {string} str RIC to be set to a row
|
2809
|
+
* @param {RowDefinition~Options=} options
|
2810
|
+
* @returns {RowDefinition} Returns modified Row Definition instance
|
2811
|
+
*/
|
2812
|
+
Grid.prototype.setRic = function(rowRef, str, options) {
|
2813
|
+
if(this._mainGrid) {
|
2814
|
+
return this._mainGrid.setRic(this._toRowId(rowRef), str, options);
|
2815
|
+
}
|
2816
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
2817
|
+
if(rowDef) {
|
2818
|
+
let tempOpt = options || {};
|
2819
|
+
if(typeof str === "string") {
|
2820
|
+
tempOpt["ric"] = str;
|
2821
|
+
} else {
|
2822
|
+
if(str && !options) {
|
2823
|
+
tempOpt = str;
|
2824
|
+
}
|
2825
|
+
str = tempOpt["ric"] ? tempOpt["ric"] : "";
|
2826
|
+
}
|
2827
|
+
let extractedOptions = RowDefinition.extractRowOptions(tempOpt);
|
2828
|
+
let oldRic = rowDef.getSymbol();
|
2829
|
+
if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
|
2830
|
+
this._connector.removeRic(rowDef, oldRic);
|
2831
|
+
this._initDuplicateRicData(rowDef);
|
2832
|
+
this._connector.addRic(rowDef);
|
2833
|
+
}
|
2834
|
+
|
2835
|
+
let values = tempOpt["values"];
|
2836
|
+
if(values != null) {
|
2837
|
+
rowDef.setStaticRowData(values, tempOpt["fields"]);
|
2838
|
+
}
|
2839
|
+
}
|
2840
|
+
return rowDef;
|
2841
|
+
};
|
2842
|
+
/** Unlink the chain and its constituents. When the chain is expanded,
|
2843
|
+
* the chain row and its members are converted from autogenerated to
|
2844
|
+
* regular real-time rows. Only the chain row will be transformed to
|
2845
|
+
* a conventional real-time row if the chain is collapsed.
|
2846
|
+
* All converted rows will continue to have their data updated.
|
2847
|
+
*
|
2848
|
+
* @public
|
2849
|
+
* @param {Grid~RowReference} rowRef
|
2850
|
+
*/
|
2851
|
+
Grid.prototype.unlinkChain = function(rowRef) {
|
2852
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
2853
|
+
if(!rowDef) {
|
2854
|
+
return;
|
2855
|
+
}
|
2856
|
+
|
2857
|
+
if(!rowDef.isChain()) {
|
2858
|
+
return;
|
2859
|
+
}
|
2860
|
+
|
2861
|
+
let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
|
2862
|
+
if(childRowDefs) {
|
2863
|
+
let len = childRowDefs.length;
|
2864
|
+
let ridMap = {};
|
2865
|
+
for(let i = 0; i < len; i++) {
|
2866
|
+
ridMap[childRowDefs[i].getRic()] = "";
|
2867
|
+
}
|
2868
|
+
let collapsed = rowDef.isChainCollapsed();
|
2869
|
+
let args = {
|
2870
|
+
chain: rowDef,
|
2871
|
+
collapsed: collapsed,
|
2872
|
+
ridMap: ridMap
|
2873
|
+
};
|
2874
|
+
this._dispatch("beforeUnlinked", args);
|
2875
|
+
|
2876
|
+
if(!collapsed) {
|
2877
|
+
let rowIdChanged = false;
|
2878
|
+
let ridPair = {};
|
2879
|
+
for(let i = 0; i < len; i++) {
|
2880
|
+
let childRowDef = childRowDefs[i];
|
2881
|
+
let mappedRowId = ridMap[childRowDef.getRic()];
|
2882
|
+
if(mappedRowId) {
|
2883
|
+
if(mappedRowId.match(RowDefinition.ROW_ID_PATTERN)) {
|
2884
|
+
console.warn("Please change the rowId format to avoid duplicated rows' id causing unexpected behavior.");
|
2885
|
+
mappedRowId = "";
|
2886
|
+
} else {
|
2887
|
+
rowIdChanged = true;
|
2888
|
+
ridPair[childRowDef.getRowId()] = mappedRowId;
|
2889
|
+
}
|
2890
|
+
}
|
2891
|
+
childRowDef.toRealTimeRow(mappedRowId);
|
2892
|
+
}
|
2893
|
+
if(rowIdChanged) {
|
2894
|
+
this._dc.replaceRowIds(ridPair);
|
2895
|
+
this._dt.replaceRowIds(ridPair);
|
2896
|
+
}
|
2897
|
+
} else {
|
2898
|
+
this._removeConstituentRows(childRowDefs);
|
2899
|
+
}
|
2900
|
+
}
|
2901
|
+
|
2902
|
+
rowDef.unlinkChain();
|
2903
|
+
};
|
2904
|
+
|
2905
|
+
/** Alias to setRic
|
2906
|
+
* @public
|
2907
|
+
* @function
|
2908
|
+
* @param {Grid~RowReference} rowRef
|
2909
|
+
* @param {string} str
|
2910
|
+
* @see {@link Grid.setRic}
|
2911
|
+
*/
|
2912
|
+
Grid.prototype.setRowContent = Grid.prototype.setRic;
|
2913
|
+
|
2914
|
+
/**
|
2915
|
+
* @public
|
2916
|
+
* @param {string|number} rid Row Id or index
|
2917
|
+
* @param {boolean=} force
|
2918
|
+
*/
|
2919
|
+
Grid.prototype.toggleRowExpansion = function(rid, force) {
|
2920
|
+
this._dv.toggleRowExpansion(rid, force);
|
2921
|
+
};
|
2922
|
+
/**
|
2923
|
+
* @private
|
2924
|
+
* @param {object} e
|
2925
|
+
*/
|
2926
|
+
Grid.prototype._onRowExpansionBinding = function(e) {
|
2927
|
+
if(!this.hasListener("rowExpansionBinding")) {
|
2928
|
+
return;
|
2929
|
+
}
|
2930
|
+
|
2931
|
+
if(e["originalRowId"]) {
|
2932
|
+
let rowIndex = this._dv.getRowIndex(e["originalRowId"]);
|
2933
|
+
e["originalRowDef"] = this._getRowDefinitionByIndex(rowIndex);
|
2934
|
+
e["originalRowData"] = e["originalRowDef"].getRowData();
|
2935
|
+
} else {
|
2936
|
+
e["rowDef"] = this._getRowDefinitionByIndex(e["rowIndex"]);
|
2937
|
+
e["rowData"] = e["rowDef"].getRowData();
|
2938
|
+
}
|
2939
|
+
|
2940
|
+
this._dispatch("rowExpansionBinding", e);
|
2941
|
+
};
|
2942
|
+
|
2943
|
+
/** Reset existing rows. It is a combination of insertRows and removeAllRows.
|
2944
|
+
* @public
|
2945
|
+
* @param {Array.<string>} ary
|
2946
|
+
*/
|
2947
|
+
Grid.prototype.setRics = function(ary) {
|
2948
|
+
this.removeAllRows();
|
2949
|
+
if(ary && ary.length) {
|
2950
|
+
this.insertRows(ary);
|
2951
|
+
}
|
2952
|
+
};
|
2953
|
+
|
2954
|
+
/** WARNING: This represents number of visible rows in a single grid
|
2955
|
+
* @public
|
2956
|
+
* @return {number}
|
2957
|
+
*/
|
2958
|
+
Grid.prototype.getRowCount = function() {
|
2959
|
+
return this._dv.getRowCount();
|
2960
|
+
};
|
2961
|
+
/** Get all rows without paging
|
2962
|
+
* @public
|
2963
|
+
* @return {number}
|
2964
|
+
*/
|
2965
|
+
Grid.prototype.getPageItemCount = function() {
|
2966
|
+
return this._dv.getRowCount(false, true);
|
2967
|
+
};
|
2968
|
+
/** WARNING: This represents number of rows in the DataTable which includes all invisible rows and rows in multiple wrapped grids
|
2969
|
+
* @public
|
2970
|
+
* @return {number}
|
2971
|
+
*/
|
2972
|
+
Grid.prototype.getDataRowCount = function() {
|
2973
|
+
return this._dt.getRowCount();
|
2974
|
+
};
|
2975
|
+
/** @public
|
2976
|
+
* @return {number}
|
2977
|
+
*/
|
2978
|
+
Grid.prototype.getColumnCount = function() {
|
2979
|
+
return this._grid.getColumnCount();
|
2980
|
+
};
|
2981
|
+
/** @public
|
2982
|
+
* @param {number} colIndex
|
2983
|
+
* @return {string}
|
2984
|
+
*/
|
2985
|
+
Grid.prototype.getColumnDataType = function(colIndex) {
|
2986
|
+
let colDef = this.getColumnDefinition(colIndex);
|
2987
|
+
if (colDef) {
|
2988
|
+
return colDef.getDataType();
|
2989
|
+
}
|
2990
|
+
return '';
|
2991
|
+
};
|
2992
|
+
/** @public
|
2993
|
+
* @param {number} colIndex
|
2994
|
+
* @return {ColumnDefinition}
|
2995
|
+
*/
|
2996
|
+
Grid.prototype.getColumnDefinition = function(colIndex) {
|
2997
|
+
let colData = this._grid.getColumnData(colIndex);
|
2998
|
+
if(colData) {
|
2999
|
+
return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
|
3000
|
+
}
|
3001
|
+
return null;
|
3002
|
+
};
|
3003
|
+
/** @public
|
3004
|
+
* @return {!Array.<ColumnDefinition>}
|
3005
|
+
*/
|
3006
|
+
Grid.prototype.getColumnDefinitions = function() {
|
3007
|
+
let colCount = this.getColumnCount();
|
3008
|
+
let colDefs = new Array(colCount);
|
3009
|
+
for(let i = 0; i < colCount; i++) {
|
3010
|
+
colDefs[i] = this.getColumnDefinition(i);
|
3011
|
+
}
|
3012
|
+
return colDefs;
|
3013
|
+
};
|
3014
|
+
|
3015
|
+
/** @public
|
3016
|
+
* @param {string} colId
|
3017
|
+
* @return {ColumnDefinition}
|
3018
|
+
*/
|
3019
|
+
Grid.prototype.getColumnDefinitionById = function(colId) {
|
3020
|
+
if(typeof colId === "string") {
|
3021
|
+
return this.getColumnDefinition(this.getColumnIndex(colId));
|
3022
|
+
}
|
3023
|
+
return null;
|
3024
|
+
};
|
3025
|
+
|
3026
|
+
/** @public
|
3027
|
+
* @param {Array.<string>} colIds
|
3028
|
+
* @return {ColumnDefinition}
|
3029
|
+
*/
|
3030
|
+
Grid.prototype.getColumnDefinitionsById = function(colIds) {
|
3031
|
+
let colCount = Array.isArray(colIds) ? colIds.length : 0;
|
3032
|
+
if(colCount > 0) {
|
3033
|
+
let i, colId;
|
3034
|
+
let colDefs = new Array(colCount);
|
3035
|
+
for(i = 0; i < colCount; i++) {
|
3036
|
+
colId = colIds[i];
|
3037
|
+
colDefs[i] = this.getColumnDefinitionById(colId);
|
3038
|
+
}
|
3039
|
+
return colDefs;
|
3040
|
+
}
|
3041
|
+
return null;
|
3042
|
+
|
3043
|
+
};
|
3044
|
+
/** @private
|
3045
|
+
* @param {Grid~ColumnReference} colRef
|
3046
|
+
* @return {ColumnDefinition}
|
3047
|
+
*/
|
3048
|
+
Grid.prototype._getColumnDefinition = function(colRef) {
|
3049
|
+
if(colRef instanceof ColumnDefinition) {
|
3050
|
+
return /** @type{!ColumnDefinition} */(colRef);
|
3051
|
+
} else if(typeof colRef === "number") {
|
3052
|
+
return this.getColumnDefinition(colRef);
|
3053
|
+
} else if(typeof colRef === "string") {
|
3054
|
+
let colCount = this.getColumnCount();
|
3055
|
+
for(let i = 0; i < colCount; ++i) {
|
3056
|
+
let colDef = this.getColumnDefinition(i);
|
3057
|
+
if(_hasFieldOrId(colDef, colRef)) {
|
3058
|
+
return colDef; // Return the first found column
|
3059
|
+
}
|
3060
|
+
}
|
3061
|
+
}
|
3062
|
+
return null;
|
3063
|
+
};
|
3064
|
+
/** @public
|
3065
|
+
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
3066
|
+
* @return {string}
|
3067
|
+
*/
|
3068
|
+
Grid.prototype.getRowType = function(rowRef) {
|
3069
|
+
let rowDef = this.getRowDefinition(rowRef);
|
3070
|
+
return rowDef ? rowDef.getType() : "";
|
3071
|
+
};
|
3072
|
+
/** Get RowDefinition object by either number or row id
|
3073
|
+
* @public
|
3074
|
+
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
3075
|
+
* @return {RowDefinition}
|
3076
|
+
*/
|
3077
|
+
Grid.prototype.getRowDefinition = function(rowRef) {
|
3078
|
+
if(typeof rowRef === "number") {
|
3079
|
+
return this._getRowDefinitionByIndex(rowRef);
|
3080
|
+
} else if(typeof rowRef === "string") {
|
3081
|
+
return this._getRowDefinitionById(rowRef);
|
3082
|
+
}
|
3083
|
+
return null;
|
3084
|
+
};
|
3085
|
+
/** @private
|
3086
|
+
* @param {number} rowIndex
|
3087
|
+
* @return {RowDefinition}
|
3088
|
+
*/
|
3089
|
+
Grid.prototype._getRowDefinitionByIndex = function(rowIndex) {
|
3090
|
+
return this._dv.getDataAt(rowIndex, ROW_DEF) || null;
|
3091
|
+
};
|
3092
|
+
/** @private
|
3093
|
+
* @param {string} rowId
|
3094
|
+
* @return {RowDefinition}
|
3095
|
+
*/
|
3096
|
+
Grid.prototype._getRowDefinitionById = function(rowId) {
|
3097
|
+
return this._dt.getData(rowId, ROW_DEF) || null;
|
3098
|
+
};
|
3099
|
+
/** @private
|
3100
|
+
* @param {Grid~RowReference} rowRef
|
3101
|
+
* @return {RowDefinition}
|
3102
|
+
*/
|
3103
|
+
Grid.prototype._getRowDefinitionByRef = function(rowRef) {
|
3104
|
+
if(rowRef instanceof RowDefinition) {
|
3105
|
+
if(rowRef.getRowId()) { // The row may have been removed from the grid
|
3106
|
+
return /** @type{!RowDefinition} */(rowRef);
|
3107
|
+
}
|
3108
|
+
}
|
3109
|
+
return this.getRowDefinition(rowRef);
|
3110
|
+
};
|
3111
|
+
/** Get all row definitions shown in the view, excluding rows that are hidden by filtering or pagination. <br>
|
3112
|
+
* A new array object is created every time. Do not call this method repeatedly.<br>
|
3113
|
+
* Group header row will return null for its rowDefinition since the row is auto generated and has no data nor definition.
|
3114
|
+
* @public
|
3115
|
+
* @return {!Array.<RowDefinition>}
|
3116
|
+
*/
|
3117
|
+
Grid.prototype.getRowDefinitions = function() {
|
3118
|
+
return this._dv.getColumnData(ROW_DEF, true); // Include group header rows
|
3119
|
+
};
|
3120
|
+
/** Get all row definitions, including filtered and hidden rows, but without group header rows.
|
3121
|
+
* @private
|
3122
|
+
* @return {!Array.<RowDefinition>}
|
3123
|
+
*/
|
3124
|
+
Grid.prototype._getAllRowDefinitions = function() {
|
3125
|
+
return this._dt.getColumnData(ROW_DEF); // no group header rows
|
3126
|
+
};
|
3127
|
+
|
3128
|
+
/** Get all row definitions, including filtered and hidden rows, but without auto generated rows (i.e., group header and chain constituent).
|
3129
|
+
* @public
|
3130
|
+
* @param {boolean=} inclAutoGenerated=false Set to true to include auto generated rows. Default value is false (exclude auto generated rows)
|
3131
|
+
* @return {!Array.<RowDefinition>}
|
3132
|
+
*/
|
3133
|
+
Grid.prototype.getAllRowDefinitions = function(inclAutoGenerated) {
|
3134
|
+
if(inclAutoGenerated) {
|
3135
|
+
return this._getAllRowDefinitions();
|
3136
|
+
}
|
3137
|
+
return this._dt.getColumnData(ROW_DEF).filter(excludeAutoGenerated);
|
3138
|
+
};
|
3139
|
+
/** A shorthand to retrieve row data based on index of the specified row.
|
3140
|
+
* @public
|
3141
|
+
* @param {number} rowIndex Row index as shown in the view
|
3142
|
+
* @return {Object} "FIELD1": value1, "FIELD2": value2, ...
|
3143
|
+
*/
|
3144
|
+
Grid.prototype.getRowData = function(rowIndex) {
|
3145
|
+
return toRowData(this._getRowDefinitionByIndex(rowIndex));
|
3146
|
+
};
|
3147
|
+
/** Get data from multiple rows. If null or undefined value is given, data from all rows are returned.
|
3148
|
+
* @public
|
3149
|
+
* @param {*=} obj The value can be rowIndex, array of row indices, array of row definitions, DataView instance, null or undefined
|
3150
|
+
* @return {!Array.<Object>}
|
3151
|
+
* @example
|
3152
|
+
* grid.getMultipleRowData(); // All row data are returned
|
3153
|
+
* grid.getMultipleRowData([0, 2, 4]); // Three row data are returned
|
3154
|
+
* grid.getMultipleRowData(1); // One row data from the specified row index is returned
|
3155
|
+
* grid.getMultipleRowData(DataView); // All row data from the specified DataView instance are returned
|
3156
|
+
*/
|
3157
|
+
Grid.prototype.getMultipleRowData = function(obj) {
|
3158
|
+
if(typeof obj === "number") {
|
3159
|
+
return [this.getRowData(obj)];
|
3160
|
+
}
|
3161
|
+
let rowDefs = null;
|
3162
|
+
if(Array.isArray(obj)) {
|
3163
|
+
let rowRefs = obj;
|
3164
|
+
let rowCount = rowRefs.length;
|
3165
|
+
let rows = new Array(rowCount);
|
3166
|
+
rowDefs = this.getRowDefinitions();
|
3167
|
+
|
3168
|
+
for(let r = 0; r < rowCount; ++r) {
|
3169
|
+
let rowRef = rowRefs[r];
|
3170
|
+
if(typeof rowRef === "number") {
|
3171
|
+
rows[r] = toRowData(rowDefs[rowRef]);
|
3172
|
+
} else if(rowRef && rowRef.getRowData) {
|
3173
|
+
rows[r] = toRowData(rowRef);
|
3174
|
+
}
|
3175
|
+
}
|
3176
|
+
return rows;
|
3177
|
+
}
|
3178
|
+
|
3179
|
+
if(obj && obj.getColumnData) { // Check if the given reference is DataView or DataTable
|
3180
|
+
rowDefs = obj.getColumnData(ROW_DEF, false); // Get all row data WITHOUT group header rows
|
3181
|
+
} else {
|
3182
|
+
rowDefs = this.getRowDefinitions(); // Get all row definition from current view INCLUDING group header rows
|
3183
|
+
}
|
3184
|
+
return rowDefs.map(toRowData);
|
3185
|
+
};
|
3186
|
+
/** Set row data base on RIC.
|
3187
|
+
* @public
|
3188
|
+
* @param {string} ric
|
3189
|
+
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
3190
|
+
*/
|
3191
|
+
Grid.prototype.setRicData = function(ric, values) {
|
3192
|
+
let rowDefs = this._connector.getRowDefByRic(ric);
|
3193
|
+
let rowCount = rowDefs ? rowDefs.length : 0;
|
3194
|
+
for (let i = 0; i < rowCount; ++i) {
|
3195
|
+
let rowDef = rowDefs[i];
|
3196
|
+
if (rowDef && rowDef.getSymbol() === ric) {
|
3197
|
+
rowDef.setRowData(values); // TODO: Need conflator to improve performance
|
3198
|
+
}
|
3199
|
+
}
|
3200
|
+
};
|
3201
|
+
/** Retrieve all RIC subscriptions. This method is not dependent on the number of rows, the RIC can vary from the current row in the grid.
|
3202
|
+
* @public
|
3203
|
+
* @return {Array.<string>}
|
3204
|
+
*/
|
3205
|
+
Grid.prototype.getAllRics = function() {
|
3206
|
+
return this._connector.getAllRics();
|
3207
|
+
};
|
3208
|
+
|
3209
|
+
/** Returns true if there is at least 1 RIC in the grid. This method includes RICs not in the row.
|
3210
|
+
* @public
|
3211
|
+
* @return {boolean}
|
3212
|
+
*/
|
3213
|
+
Grid.prototype.hasRic = function() {
|
3214
|
+
return this._connector.hasRic();
|
3215
|
+
};
|
3216
|
+
/** Returns RIC of given row reference.
|
3217
|
+
* @public
|
3218
|
+
* @param {(string|number)=} rowRef
|
3219
|
+
* @return {string}
|
3220
|
+
*/
|
3221
|
+
Grid.prototype.getRic = function(rowRef) {
|
3222
|
+
let rowDef = this.getRowDefinition(rowRef);
|
3223
|
+
return rowDef.getRic();
|
3224
|
+
};
|
3225
|
+
/** A shorthand to set row data based on index of the specified row. It is better to keep rowDefinition object for updating data directly as row index can be changed by sorting and filtering.
|
3226
|
+
* @public
|
3227
|
+
* @param {Grid~RowReference} rowRef
|
3228
|
+
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
3229
|
+
*/
|
3230
|
+
Grid.prototype.setRowData = function(rowRef, values) {
|
3231
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
3232
|
+
if(rowDef) {
|
3233
|
+
rowDef.setRowData(values);
|
3234
|
+
}
|
3235
|
+
};
|
3236
|
+
|
3237
|
+
/**
|
3238
|
+
* @public
|
3239
|
+
* @param {Grid~RowReference} rowRef
|
3240
|
+
* @param {Object} values
|
3241
|
+
*/
|
3242
|
+
Grid.prototype.setStaticRowData = function(rowRef, values) {
|
3243
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
3244
|
+
if(rowDef) {
|
3245
|
+
rowDef.setStaticRowData(values);
|
3246
|
+
}
|
3247
|
+
};
|
3248
|
+
|
3249
|
+
/**
|
3250
|
+
* @public
|
3251
|
+
* @param {Grid~RowReference} rowRef
|
3252
|
+
* @param {string} field
|
3253
|
+
* @param {*} value
|
3254
|
+
*/
|
3255
|
+
Grid.prototype.setStaticData = function(rowRef, field, value) {
|
3256
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
3257
|
+
if(rowDef) {
|
3258
|
+
rowDef.setStaticData(field, value);
|
3259
|
+
}
|
3260
|
+
};
|
3261
|
+
|
3262
|
+
/** @private
|
3263
|
+
* @param {Grid~RowReference=} rowRef
|
3264
|
+
* @return {string}
|
3265
|
+
*/
|
3266
|
+
Grid.prototype._getRowId = function(rowRef) {
|
3267
|
+
if(typeof rowRef === "string") {
|
3268
|
+
return rowRef;
|
3269
|
+
} else if(typeof rowRef === "number") { // WARNING: This is view index, excluding hidden row
|
3270
|
+
return this._dv.getRowId(rowRef);
|
3271
|
+
} else if(rowRef instanceof RowDefinition) {
|
3272
|
+
return rowRef.getRowId();
|
3273
|
+
}
|
3274
|
+
return "";
|
3275
|
+
};
|
3276
|
+
|
3277
|
+
/** Clear all existing data from the specified column(s).
|
3278
|
+
* @public
|
3279
|
+
* @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRefs
|
3280
|
+
*/
|
3281
|
+
Grid.prototype.clearColumnData = function(colRefs) {
|
3282
|
+
let colIndices = this.getColumnIndices(colRefs);
|
3283
|
+
let colCount = colIndices.length;
|
3284
|
+
if(!colCount) {
|
3285
|
+
return;
|
3286
|
+
}
|
3287
|
+
let emptyData = {};
|
3288
|
+
for(let c = 0; c < colCount; ++c) {
|
3289
|
+
let colIndex = colIndices[c];
|
3290
|
+
let field = this.getColumnField(colIndex);
|
3291
|
+
if(field) {
|
3292
|
+
emptyData[field] = null;
|
3293
|
+
}
|
3294
|
+
}
|
3295
|
+
|
3296
|
+
let rowDefs = this.getAllRowDefinitions();
|
3297
|
+
let rowCount = rowDefs.length;
|
3298
|
+
for(let r = 0; r < rowCount; ++r) {
|
3299
|
+
rowDefs[r].setRowData(emptyData); // There is a conflator caching the data change in DataCache
|
3300
|
+
}
|
3301
|
+
};
|
3302
|
+
|
3303
|
+
/** @public
|
3304
|
+
* @param {Grid~ColumnReference} colRef
|
3305
|
+
* @return {number}
|
3306
|
+
*/
|
3307
|
+
Grid.prototype.getColumnIndex = function(colRef) {
|
3308
|
+
if(colRef instanceof ColumnDefinition) {
|
3309
|
+
let colCount = this.getColumnCount();
|
3310
|
+
for(let i = 0; i < colCount; ++i) {
|
3311
|
+
let colDef = this.getColumnDefinition(i);
|
3312
|
+
if(colDef === colRef) {
|
3313
|
+
return i;
|
3314
|
+
}
|
3315
|
+
}
|
3316
|
+
return -1;
|
3317
|
+
}
|
3318
|
+
return this._grid.getColumnIndex(colRef);
|
3319
|
+
};
|
3320
|
+
/** Any invalid column reference will be excluded from the output array
|
3321
|
+
* @public
|
3322
|
+
* @param {Array.<Grid~ColumnReference>} colRefs
|
3323
|
+
* @return {!Array.<number>}
|
3324
|
+
*/
|
3325
|
+
Grid.prototype.getColumnIndices = function(colRefs) {
|
3326
|
+
let ary = [];
|
3327
|
+
if(colRefs || colRefs === 0) {
|
3328
|
+
let colCount = this.getColumnCount();
|
3329
|
+
let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
3330
|
+
let len = inputAry.length;
|
3331
|
+
// Verify user input
|
3332
|
+
for(let i = 0; i < len; ++i) {
|
3333
|
+
let colIndex = this.getColumnIndex(inputAry[i]);
|
3334
|
+
if(colIndex >= 0 && colIndex < colCount) {
|
3335
|
+
ary.push(colIndex); // WARNING: We have not checked for duplication
|
3336
|
+
}
|
3337
|
+
}
|
3338
|
+
}
|
3339
|
+
return ary;
|
3340
|
+
};
|
3341
|
+
/** Return column id that is set through configuration object
|
3342
|
+
* @public
|
3343
|
+
* @param {number} colIndex
|
3344
|
+
* @return {string} Return empty string if no existing id or column
|
3345
|
+
* @see {@link Grid#getColumnDefinition}
|
3346
|
+
*/
|
3347
|
+
Grid.prototype.getColumnId = function(colIndex) {
|
3348
|
+
return this._grid.getColumnId(colIndex);
|
3349
|
+
};
|
3350
|
+
/** Get ids from each column definition.
|
3351
|
+
* @public
|
3352
|
+
* @return {!Array.<string>} New array is created
|
3353
|
+
*/
|
3354
|
+
Grid.prototype.getColumnIds = function() {
|
3355
|
+
return this._grid.getColumnIds();
|
3356
|
+
};
|
3357
|
+
/** Return field defined in the column definition
|
3358
|
+
* @public
|
3359
|
+
* @param {number} colIndex
|
3360
|
+
* @return {string}
|
3361
|
+
* @see {@link Grid#getColumnDefinition}
|
3362
|
+
*/
|
3363
|
+
Grid.prototype.getColumnField = function(colIndex) {
|
3364
|
+
return this._grid.getColumnField(colIndex);
|
3365
|
+
};
|
3366
|
+
/** Get fields from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
3367
|
+
* @public
|
3368
|
+
* @return {!Array.<string>} New array is created
|
3369
|
+
*/
|
3370
|
+
Grid.prototype.getColumnFields = function() {
|
3371
|
+
return this._grid.getColumnFields();
|
3372
|
+
};
|
3373
|
+
/** Get column name from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
3374
|
+
* @public
|
3375
|
+
* @return {!Array.<string>} New array is created
|
3376
|
+
*/
|
3377
|
+
Grid.prototype.getColumnNames = function() {
|
3378
|
+
return this.getColumnDefinitions().map(_getName);
|
3379
|
+
};
|
3380
|
+
/** Get all fields, including required fields and data fields, with no duplicate
|
3381
|
+
* @public
|
3382
|
+
* @return {!Array.<string>} New array is created
|
3383
|
+
*/
|
3384
|
+
Grid.prototype.getAllFields = function() {
|
3385
|
+
return this._connector.getAllFields();
|
3386
|
+
};
|
3387
|
+
/** Freeze the column at the left side of the table starting from index 0 to the specified colIndex
|
3388
|
+
* If no index is specified (null or undefined index), unfreeze all columns.
|
3389
|
+
* @public
|
3390
|
+
* @param {number=} colIndex Negative index is equivalent to null value
|
3391
|
+
* @param {number=} pinnedRightColumns Number of columns to be pinned/snapped on the right side
|
3392
|
+
*/
|
3393
|
+
Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
|
3394
|
+
if(colIndex == null) {
|
3395
|
+
colIndex = -1;
|
3396
|
+
}
|
3397
|
+
this._grid.freezeColumn(colIndex, pinnedRightColumns);
|
3398
|
+
};
|
3399
|
+
|
3400
|
+
/** Pin column to the left side by moving the specified column to the rightmost of the frozen columns. <br>
|
3401
|
+
* The method will do nothing if the specified column is already pinned to the left side
|
3402
|
+
* @public
|
3403
|
+
* @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRef
|
3404
|
+
* @param {string=} side Available values are: left|right. If no value is supplied, the column will be pinned to the left.
|
3405
|
+
* @return {boolean}
|
3406
|
+
*/
|
3407
|
+
Grid.prototype.pinColumn = function(colRef, side) {
|
3408
|
+
if(Array.isArray(colRef)) {
|
3409
|
+
let ary = colRef;
|
3410
|
+
let len = ary.length;
|
3411
|
+
|
3412
|
+
let dirty = 0;
|
3413
|
+
for(let i = 0; i < len; ++i) {
|
3414
|
+
dirty |= this._pinColumn(ary[i], side);
|
3415
|
+
}
|
3416
|
+
return dirty ? true : false;
|
3417
|
+
}
|
3418
|
+
return this._pinColumn(colRef, side);
|
3419
|
+
};
|
3420
|
+
/** @private
|
3421
|
+
* @param {Grid~ColumnReference} colRef
|
3422
|
+
* @param {string=} side Available values are: left|right. If no value is supplied, the column will be pinned to the left.
|
3423
|
+
* @return {boolean}
|
3424
|
+
*/
|
3425
|
+
Grid.prototype._pinColumn = function(colRef, side) {
|
3426
|
+
let colIndex = this.getColumnIndex(colRef);
|
3427
|
+
let colCount = this.getColumnCount();
|
3428
|
+
if(colIndex < 0 || colIndex > colCount) {
|
3429
|
+
return false;
|
3430
|
+
}
|
3431
|
+
|
3432
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
3433
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
3434
|
+
let stationaryIdx = this._grid.getStationaryColumnIndex();
|
3435
|
+
|
3436
|
+
if(side && side.toLowerCase() === "right") {
|
3437
|
+
let rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
|
3438
|
+
if(colIndex >= rightPinnedIndex) {
|
3439
|
+
return false; // The column is already pinned area
|
3440
|
+
}
|
3441
|
+
|
3442
|
+
if(stationaryIdx >= 0 && colIndex <= stationaryIdx) {
|
3443
|
+
return false;
|
3444
|
+
}
|
3445
|
+
|
3446
|
+
this.moveColumnById(colIndex, rightPinnedIndex);
|
3447
|
+
rightPinnedCount += 1;
|
3448
|
+
leftPinnedCount -= 1;
|
3449
|
+
} else {
|
3450
|
+
if(colIndex < leftPinnedCount) {
|
3451
|
+
return false; // The column is already pinned area
|
3452
|
+
}
|
3453
|
+
if(!leftPinnedCount) {
|
3454
|
+
if(stationaryIdx >= 0) {
|
3455
|
+
leftPinnedCount = stationaryIdx;
|
3456
|
+
if(colIndex > stationaryIdx) {
|
3457
|
+
leftPinnedCount++;
|
3458
|
+
}
|
3459
|
+
}
|
3460
|
+
}
|
3461
|
+
this.moveColumnById(colIndex, leftPinnedCount);
|
3462
|
+
}
|
3463
|
+
|
3464
|
+
this._grid.freezeColumn(leftPinnedCount, rightPinnedCount);
|
3465
|
+
return true;
|
3466
|
+
};
|
3467
|
+
/** Unpin column from the left side by moving the specified column to the end of the frozen columns. <br>
|
3468
|
+
* The method will do nothing if the specified column is not pinned on the left side.
|
3469
|
+
* @public
|
3470
|
+
* @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRef
|
3471
|
+
* @param {Grid~ColumnReference=} dest The unpinned column will be placed before the destination position after the operation
|
3472
|
+
* @return {boolean}
|
3473
|
+
*/
|
3474
|
+
Grid.prototype.unpinColumn = function(colRef, dest) {
|
3475
|
+
if(Array.isArray(colRef)) {
|
3476
|
+
let ary = colRef;
|
3477
|
+
let len = ary.length;
|
3478
|
+
|
3479
|
+
let dirty = 0;
|
3480
|
+
for(let i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
|
3481
|
+
dirty |= this._unpinColumn(ary[i], dest);
|
3482
|
+
}
|
3483
|
+
return dirty ? true : false;
|
3484
|
+
}
|
3485
|
+
return this._unpinColumn(colRef, dest);
|
3486
|
+
};
|
3487
|
+
/** @private
|
3488
|
+
* @param {Grid~ColumnReference} colRef
|
3489
|
+
* @param {Grid~ColumnReference=} dest The unpinned column will be placed before the destination position after the operation
|
3490
|
+
* @return {boolean}
|
3491
|
+
*/
|
3492
|
+
Grid.prototype._unpinColumn = function(colRef, dest) {
|
3493
|
+
let colIndex = this.getColumnIndex(colRef);
|
3494
|
+
if(colIndex < 0) {
|
3495
|
+
return false;
|
3496
|
+
}
|
3497
|
+
|
3498
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
3499
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
3500
|
+
let colCount = this.getColumnCount();
|
3501
|
+
let firstRightPinnedIndex = colCount - rightPinnedCount;
|
3502
|
+
|
3503
|
+
if(colIndex >= leftPinnedCount && colIndex < firstRightPinnedIndex) {
|
3504
|
+
return false;
|
3505
|
+
}
|
3506
|
+
|
3507
|
+
let srcId = null;
|
3508
|
+
let destId = null;
|
3509
|
+
if(dest != null) {
|
3510
|
+
let destIdx = this.getColumnIndex(dest);
|
3511
|
+
destId = this.getColumnId(destIdx);
|
3512
|
+
srcId = this.getColumnId(colIndex);
|
3513
|
+
}
|
3514
|
+
|
3515
|
+
let stationaryIdx = this._grid.getStationaryColumnIndex();
|
3516
|
+
|
3517
|
+
if(colIndex < leftPinnedCount) {
|
3518
|
+
if(colIndex > stationaryIdx) {
|
3519
|
+
this.moveColumnById(colIndex, leftPinnedCount);
|
3520
|
+
}
|
3521
|
+
|
3522
|
+
this._grid.freezeColumn(leftPinnedCount - 2, rightPinnedCount); // Column index is used for freezing
|
3523
|
+
} else if(colIndex >= firstRightPinnedIndex) {
|
3524
|
+
if(colIndex > stationaryIdx) {
|
3525
|
+
this.moveColumnById(colIndex, firstRightPinnedIndex);
|
3526
|
+
}
|
3527
|
+
|
3528
|
+
this._grid.freezeColumn(leftPinnedCount - 1, rightPinnedCount - 1); // Column index is used for freezing
|
3529
|
+
}
|
3530
|
+
|
3531
|
+
if(colIndex > stationaryIdx) {
|
3532
|
+
if(destId != null) {
|
3533
|
+
this.moveColumnById(srcId, destId);
|
3534
|
+
}
|
3535
|
+
}
|
3536
|
+
|
3537
|
+
return true;
|
3538
|
+
};
|
3539
|
+
/** A shorthand to unpin all columns from the left hand side
|
3540
|
+
* @public
|
3541
|
+
* @return {boolean}
|
3542
|
+
*/
|
3543
|
+
Grid.prototype.unpinAllColumns = function() {
|
3544
|
+
let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
|
3545
|
+
let rightPinnedCount = this._grid.getPinnedRightColumnCount();
|
3546
|
+
if(!leftPinnedCount && !rightPinnedCount) {
|
3547
|
+
return false;
|
3548
|
+
}
|
3549
|
+
this._grid.freezeColumn(-1, 0); // Column index is used for left freezing and column count is used for right freezing
|
3550
|
+
return true;
|
3551
|
+
};
|
3552
|
+
|
3553
|
+
/** @private
|
3554
|
+
* @param {Object} e
|
3555
|
+
*/
|
3556
|
+
Grid.prototype._onColumnHeaderBinding = function(e) {
|
3557
|
+
if(e["sectionType"] !== "title" || e["sectionIndex"] > 0) {
|
3558
|
+
return; // WARNING: Assume that only the first title section is owned by the grid. Anything else is assumed to be generated by plugins
|
3559
|
+
}
|
3560
|
+
|
3561
|
+
let c = e["fromColIndex"];
|
3562
|
+
let toC = e["toColIndex"];
|
3563
|
+
while(c < toC) {
|
3564
|
+
this._renderColumnHeader(c++, e);
|
3565
|
+
}
|
3566
|
+
};
|
3567
|
+
/** @private
|
3568
|
+
* @param {number=} colIndex
|
3569
|
+
* @param {Object} arg
|
3570
|
+
*/
|
3571
|
+
Grid.prototype._renderColumnHeader = function(colIndex, arg) {
|
3572
|
+
let colDef = this.getColumnDefinition(colIndex);
|
3573
|
+
if(!colDef) {
|
3574
|
+
return;
|
3575
|
+
}
|
3576
|
+
let customRenderer = colDef.getHeaderRenderer();
|
3577
|
+
let tSection = arg.section;
|
3578
|
+
let rowCount = tSection.getRowCount();
|
3579
|
+
arg["colIndex"] = colIndex;
|
3580
|
+
arg["columnDef"] = colDef;
|
3581
|
+
|
3582
|
+
let colName = colDef.getName();
|
3583
|
+
let colTooltip = colDef.getTooltip();
|
3584
|
+
let headerAlignment = colDef.getHeaderAlignment();
|
3585
|
+
let tooltipValue = colDef.getTooltipValue();
|
3586
|
+
|
3587
|
+
for(let r = 0; r < rowCount; ++r) {
|
3588
|
+
let tCell = tSection.getCell(colIndex, r, false);
|
3589
|
+
// Default behaviors
|
3590
|
+
tCell.setContent(colName);
|
3591
|
+
tCell.setTooltipInfo("columnDefault", tooltipValue);
|
3592
|
+
tCell.setTooltipInfo("columnTooltip", colTooltip);
|
3593
|
+
tCell.updateTooltip();
|
3594
|
+
tCell.setStyle("textAlign", headerAlignment);
|
3595
|
+
|
3596
|
+
if(customRenderer) {
|
3597
|
+
arg["rowIndex"] = r;
|
3598
|
+
arg["cell"] = tCell;
|
3599
|
+
customRenderer(arg);
|
3600
|
+
}
|
3601
|
+
}
|
3602
|
+
};
|
3603
|
+
/** @public
|
3604
|
+
*/
|
3605
|
+
Grid.prototype.updateColumnTitle = function() {
|
3606
|
+
if(this._columnTitleConflator.conflate()) {
|
3607
|
+
return;
|
3608
|
+
}
|
3609
|
+
let tss = this._grid.getSectionSettings("title"); // WARNING: Assume that only the first title section is owned by the grid
|
3610
|
+
if(tss) {
|
3611
|
+
tss.rerender();
|
3612
|
+
}
|
3613
|
+
};
|
3614
|
+
/** @public
|
3615
|
+
* @return {boolean}
|
3616
|
+
*/
|
3617
|
+
Grid.prototype.isSorting = function() {
|
3618
|
+
return this._stp.isSorting();
|
3619
|
+
};
|
3620
|
+
/** @public
|
3621
|
+
* @return {number}
|
3622
|
+
*/
|
3623
|
+
Grid.prototype.getSortedColumnIndex = function() {
|
3624
|
+
return this._stp.getSortedColumnIndex();
|
3625
|
+
};
|
3626
|
+
/** @public
|
3627
|
+
* @return {string} "a" for "ascending, "d" for descending, and "n" for none/noOrder
|
3628
|
+
*/
|
3629
|
+
Grid.prototype.getSortOrder = function() {
|
3630
|
+
return this._stp.getSortOrder();
|
3631
|
+
};
|
3632
|
+
/** @public
|
3633
|
+
*/
|
3634
|
+
Grid.prototype.clearSort = function() {
|
3635
|
+
this._stp.clearSortState(); // WARNING: No event is dispatched
|
3636
|
+
};
|
3637
|
+
/** Get sorting states from sorting columns
|
3638
|
+
* @public
|
3639
|
+
* @return {!Array.<Object>} Array of sorting states ordered by priority. If there is no sorting column, an empty array is returned
|
3640
|
+
*/
|
3641
|
+
Grid.prototype.getSortingStates = function () { // This method is mainly for backward compatability
|
3642
|
+
let ary = [];
|
3643
|
+
let states = this._stp.getSortingStates();
|
3644
|
+
let stateCount = states.length;
|
3645
|
+
|
3646
|
+
for (let i = 0; i < stateCount; i++) {
|
3647
|
+
let state = states[i];
|
3648
|
+
let colIndex = this._stp.getSortedColumnIndex(i);
|
3649
|
+
|
3650
|
+
ary.push({
|
3651
|
+
"colId": this.getColumnId(colIndex),
|
3652
|
+
"colIndex": colIndex,
|
3653
|
+
"order": state["sortOrder"]
|
3654
|
+
});
|
3655
|
+
}
|
3656
|
+
|
3657
|
+
return ary;
|
3658
|
+
};
|
3659
|
+
|
3660
|
+
/**
|
3661
|
+
* @private
|
3662
|
+
* @param {Object} e Event object from quote2
|
3663
|
+
*/
|
3664
|
+
Grid.prototype._onQuote2PostUpdate = function (e) {
|
3665
|
+
if(e.childOrderChange) { // For dynamic chain when CHILD_ORDER from the server change, it will be call sort children
|
3666
|
+
if(!this.isSorting()) {
|
3667
|
+
// Use rowDef for get CHILD_ORDER to sort
|
3668
|
+
this._dt.sortOnce("ROW_DEF", "a", _sortChildrenOfChain);
|
3669
|
+
}
|
3670
|
+
}
|
3671
|
+
};
|
3672
|
+
|
3673
|
+
/**
|
3674
|
+
* @private
|
3675
|
+
* @param {Object} e
|
3676
|
+
*/
|
3677
|
+
Grid.prototype._onQ2DataChanged = function (e) {
|
3678
|
+
let rowDef = this._getRowDefinitionById(e["subId"]);
|
3679
|
+
if(!rowDef) {
|
3680
|
+
return; // WARNING: This should not be happened because row has been removed but the data is still received
|
3681
|
+
}
|
3682
|
+
|
3683
|
+
let ric = e["ric"];
|
3684
|
+
let values = e["values"];
|
3685
|
+
if (values) {
|
3686
|
+
let duplicateRics = null;
|
3687
|
+
if(rowDef.verifyConstituent(ric)) {
|
3688
|
+
let parentDef = rowDef;
|
3689
|
+
let childDef = parentDef.getConstituent(ric);
|
3690
|
+
if(childDef) { // The constituent will share the same sub id as its parent
|
3691
|
+
rowDef = childDef;
|
3692
|
+
} else {
|
3693
|
+
rowDef = childDef = parentDef.addConstituent(ric);
|
3694
|
+
if(!childDef) {
|
3695
|
+
return; // Parent chain is not alive
|
3696
|
+
}
|
3697
|
+
duplicateRics = this._connector.getRowDefByRic(ric);
|
3698
|
+
this._connector.addRic(childDef); // TODO: JET/RTK should not re-subscribe this
|
3699
|
+
if(!this._constituentMap) {
|
3700
|
+
this._constituentMap = {};
|
3701
|
+
}
|
3702
|
+
this._constituentMap[childDef.getRowId()] = childDef;
|
3703
|
+
this._registerConstituents(childDef);
|
3704
|
+
}
|
3705
|
+
}
|
3706
|
+
|
3707
|
+
if(duplicateRics && duplicateRics.length) {
|
3708
|
+
let duplicateRic = duplicateRics[0];
|
3709
|
+
duplicateRic.cloneRowData(values, values);
|
3710
|
+
}
|
3711
|
+
|
3712
|
+
rowDef.setRowData(values); // Trigger data changes
|
3713
|
+
} else { // The constituent is requested to be removed by the real-time data provider
|
3714
|
+
let childDef = rowDef.getConstituent(ric); // WARNING: normal ric and its delayed version must match with the one first given
|
3715
|
+
if(childDef) {
|
3716
|
+
childDef.setParent(null); // Manually remove child reference from its parent
|
3717
|
+
this._removeRow(childDef);
|
3718
|
+
}
|
3719
|
+
}
|
3720
|
+
};
|
3721
|
+
|
3722
|
+
/** @private
|
3723
|
+
* @param {RowDefinition} rowDef
|
3724
|
+
*/
|
3725
|
+
Grid.prototype._registerConstituents = function(rowDef) {
|
3726
|
+
if(this._chainConflator.conflate(rowDef)) {
|
3727
|
+
return;
|
3728
|
+
}
|
3729
|
+
|
3730
|
+
this._constituentMap = null;
|
3731
|
+
|
3732
|
+
let view = this._dv;
|
3733
|
+
let dt = view ? view.getDataSource() : null;
|
3734
|
+
if(!dt) {
|
3735
|
+
return;
|
3736
|
+
}
|
3737
|
+
|
3738
|
+
let childDefs = this._chainConflator.popAllData(); // This must have no duplication
|
3739
|
+
let childCount = childDefs ? childDefs.length : 0;
|
3740
|
+
|
3741
|
+
// Validate row definition and collect its info
|
3742
|
+
let i;
|
3743
|
+
let validDefs = [];
|
3744
|
+
let maxCountMap = {};
|
3745
|
+
for(i = 0; i < childCount; ++i) {
|
3746
|
+
let childDef = childDefs[i];
|
3747
|
+
let parentDef = childDef.getParent();
|
3748
|
+
if(!parentDef) {
|
3749
|
+
break; // A constituent without parent cannot be added to the view
|
3750
|
+
}
|
3751
|
+
let parentRowId = parentDef.getRowId();
|
3752
|
+
let maxCount = maxCountMap[parentRowId];
|
3753
|
+
if(maxCount == null) {
|
3754
|
+
maxCount = maxCountMap[parentRowId] = parentDef.countChildInView();
|
3755
|
+
}
|
3756
|
+
validDefs.push(childDef);
|
3757
|
+
}
|
3758
|
+
|
3759
|
+
childCount = validDefs.length;
|
3760
|
+
if(!childCount) {
|
3761
|
+
return;
|
3762
|
+
}
|
3763
|
+
|
3764
|
+
let prevState = false;
|
3765
|
+
if(childCount > 1) {
|
3766
|
+
prevState = this._dt.freeze(); // Avoid sorting for each insertion
|
3767
|
+
}
|
3768
|
+
|
3769
|
+
for(i = 0; i < childCount; ++i) {
|
3770
|
+
let childDef = validDefs[i];
|
3771
|
+
let parentDef = childDef.getParent();
|
3772
|
+
let parentRowId = parentDef.getRowId();
|
3773
|
+
let maxCount = maxCountMap[parentRowId];
|
3774
|
+
|
3775
|
+
// TODO: Handle nested children
|
3776
|
+
view.addSegmentChild(parentRowId, childDef.getRowId());
|
3777
|
+
|
3778
|
+
// Added order and child order can be different
|
3779
|
+
// CHILD_ORDER value from real-time service indicates the order of constituents.
|
3780
|
+
let destIndex = dt.getRowIndex(parentRowId) + 1; // WARNING: Not checking for negative index
|
3781
|
+
let childOrder = childDef.getData("CHILD_ORDER"); // CHILD_ORDER starts from 0
|
3782
|
+
if(childOrder != null && childOrder < maxCount) {
|
3783
|
+
destIndex += childOrder;
|
3784
|
+
} else {
|
3785
|
+
destIndex += maxCount;
|
3786
|
+
}
|
3787
|
+
let destRowId = dt.getRowId(destIndex);
|
3788
|
+
childDef.registerToView(view, destRowId);
|
3789
|
+
maxCountMap[parentRowId] = maxCount + 1; // Since new child has been added to the view, maxCount has to be updated
|
3790
|
+
}
|
3791
|
+
if(childCount > 1) {
|
3792
|
+
this._dt.freeze(prevState);
|
3793
|
+
}
|
3794
|
+
};
|
3795
|
+
|
3796
|
+
/** @private
|
3797
|
+
* @param {Object} e
|
3798
|
+
*/
|
3799
|
+
Grid.prototype._onDataChanged = function(e) {
|
3800
|
+
if(!this._dt) {
|
3801
|
+
return;
|
3802
|
+
}
|
3803
|
+
if(e) {
|
3804
|
+
if(e["initialChanges"] && !this._dt.hasSegmentClassification()) {
|
3805
|
+
return;
|
3806
|
+
}
|
3807
|
+
|
3808
|
+
// TODO: Insertion should also be addressed here.
|
3809
|
+
if(e["rid"] && e["changes"]) {
|
3810
|
+
let rowDef = this._getRowDefinitionById(e["rid"]);
|
3811
|
+
if(rowDef) {
|
3812
|
+
if(rowDef.addUpdate(e["changes"])) { // This is the only place that update array can grow. It is used for blinking data.
|
3813
|
+
this._hasNewUpdates = true; // Mark data table for cleaning it up later
|
3814
|
+
}
|
3815
|
+
}
|
3816
|
+
}
|
3817
|
+
}
|
3818
|
+
|
3819
|
+
if(this._dcConflator.conflate()) {
|
3820
|
+
return;
|
3821
|
+
}
|
3822
|
+
|
3823
|
+
this._dt.classifySegments();
|
3824
|
+
this._dt.dispatchGlobalChange();
|
3825
|
+
};
|
3826
|
+
|
3827
|
+
/** @private
|
3828
|
+
* @param {Object} e
|
3829
|
+
*/
|
3830
|
+
Grid.prototype._onPreDataSorting = function (e) {
|
3831
|
+
let objs = this._stp.getSortedColumns();
|
3832
|
+
|
3833
|
+
this._sorter.reset();
|
3834
|
+
if(Array.isArray(objs)) {
|
3835
|
+
let sortCount = objs.length;
|
3836
|
+
for(let i = 0; i < sortCount; ++i) {
|
3837
|
+
let obj = objs[i];
|
3838
|
+
let field = obj["field"] || ""; // This supports "sortBy" option (sort by another column)
|
3839
|
+
let colIndex = obj["colIndex"];
|
3840
|
+
let colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
3841
|
+
|
3842
|
+
let rowSorting = false;
|
3843
|
+
let sortLogic = null;
|
3844
|
+
if(colDef) {
|
3845
|
+
if(!field) {
|
3846
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
3847
|
+
}
|
3848
|
+
rowSorting = colDef.isRowSorting();
|
3849
|
+
sortLogic = colDef.getSorter();
|
3850
|
+
}
|
3851
|
+
// TODO: get sortLogic from DataView
|
3852
|
+
// if(!sortLogic && field) {
|
3853
|
+
// sortLogic = state["sortLogic"];
|
3854
|
+
// }
|
3855
|
+
|
3856
|
+
this._sorter.addColumnContext(field, sortLogic, rowSorting, obj["sortOrder"], colIndex, colDef);
|
3857
|
+
}
|
3858
|
+
}
|
3859
|
+
|
3860
|
+
this._columnSorter = this._sorter.getSorter();
|
3861
|
+
};
|
3862
|
+
/** @private
|
3863
|
+
* @param {RowDefinition} rowDefA
|
3864
|
+
* @param {RowDefinition} rowDefB
|
3865
|
+
* @param {number} order
|
3866
|
+
* @return {number}
|
3867
|
+
*/
|
3868
|
+
Grid.prototype._mainSorter = function (rowDefA, rowDefB, order) {
|
3869
|
+
return this._columnSorter(rowDefA, rowDefB, order);
|
3870
|
+
};
|
3871
|
+
|
3872
|
+
/** @private
|
3873
|
+
* @param {Object} e
|
3874
|
+
*/
|
3875
|
+
Grid.prototype._onPostSectionDataBinding = function(e) {
|
3876
|
+
if(e["actualUpdate"]) {
|
3877
|
+
this._asyncClearDataUpdates();
|
3878
|
+
}
|
3879
|
+
};
|
3880
|
+
/** @private
|
3881
|
+
*/
|
3882
|
+
Grid.prototype._asyncClearDataUpdates = function() {
|
3883
|
+
setTimeout(this._clearDataUpdates, 0);
|
3884
|
+
};
|
3885
|
+
/** @private
|
3886
|
+
*/
|
3887
|
+
Grid.prototype._clearDataUpdates = function() {
|
3888
|
+
if(!this._dt || !this._hasNewUpdates) {
|
3889
|
+
return;
|
3890
|
+
}
|
3891
|
+
this._hasNewUpdates = false;
|
3892
|
+
let rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
|
3893
|
+
for(let i = rowIds.length; --i >= 0;) {
|
3894
|
+
let rowData = this._dt.getRowData(rowIds[i]);
|
3895
|
+
let rowDef = rowData[ROW_DEF];
|
3896
|
+
rowDef.resetUpdates();
|
3897
|
+
}
|
3898
|
+
};
|
3899
|
+
|
3900
|
+
/** @public
|
3901
|
+
* @return {DataView}
|
3902
|
+
*/
|
3903
|
+
Grid.prototype.getDataView = function() {
|
3904
|
+
return this._dv;
|
3905
|
+
};
|
3906
|
+
/** @public
|
3907
|
+
* @param {number} pageIndex
|
3908
|
+
* @return {boolean}
|
3909
|
+
*/
|
3910
|
+
Grid.prototype.setPage = function(pageIndex) {
|
3911
|
+
return this._dv.setPage(pageIndex);
|
3912
|
+
};
|
3913
|
+
/** @public
|
3914
|
+
* @param {number} size
|
3915
|
+
*/
|
3916
|
+
Grid.prototype.setPageSize = function(size) {
|
3917
|
+
this._dv.setPageSize(size);
|
3918
|
+
};
|
3919
|
+
/** @public
|
3920
|
+
* @return {number}
|
3921
|
+
*/
|
3922
|
+
Grid.prototype.getPageIndex = function() {
|
3923
|
+
return this._dv.getPageIndex();
|
3924
|
+
};
|
3925
|
+
/** @public
|
3926
|
+
* @return {number}
|
3927
|
+
*/
|
3928
|
+
Grid.prototype.getPageSize = function() {
|
3929
|
+
return this._dv.getPageSize();
|
3930
|
+
};
|
3931
|
+
/** @public
|
3932
|
+
* @return {number}
|
3933
|
+
*/
|
3934
|
+
Grid.prototype.getPageCount = function() {
|
3935
|
+
return this._dv.getPageCount();
|
3936
|
+
};
|
3937
|
+
|
3938
|
+
/** @description Toggle between expanded and collapsed chain index
|
3939
|
+
* @public
|
3940
|
+
* @param {Grid~RowReference} rowRef
|
3941
|
+
*/
|
3942
|
+
Grid.prototype.toggleChain = function(rowRef) {
|
3943
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
3944
|
+
if(rowDef) {
|
3945
|
+
rowDef.toggleChain();
|
3946
|
+
}
|
3947
|
+
};
|
3948
|
+
/**
|
3949
|
+
* @public
|
3950
|
+
* @param {Grid~RowReference} rowRef
|
3951
|
+
* @param {Array.<string>} fields
|
3952
|
+
* @return {boolean}
|
3953
|
+
*/
|
3954
|
+
Grid.prototype.setClassification = function(rowRef, fields) {
|
3955
|
+
let rowDef = this._getRowDefinitionByRef(rowRef);
|
3956
|
+
if(rowDef) {
|
3957
|
+
return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
|
3958
|
+
}
|
3959
|
+
return false;
|
3960
|
+
};
|
3961
|
+
|
3962
|
+
/** Check element in the grid element
|
3963
|
+
* @public
|
3964
|
+
* @param {Element} elem
|
3965
|
+
* @return {boolean}=true if an element from the parameter is inside a grid element
|
3966
|
+
*/
|
3967
|
+
Grid.prototype.contains = function(elem) {
|
3968
|
+
if(elem) {
|
3969
|
+
// This will impact the contents within the rt-grid element, but not those outside of it, such as the wrapper elements atlas-blotter and ef-grid.
|
3970
|
+
return this._topNode.contains(elem);
|
3971
|
+
}
|
3972
|
+
return false;
|
3973
|
+
};
|
3974
|
+
|
3975
|
+
/** Check grid element is focused
|
3976
|
+
* @public
|
3977
|
+
* @return {boolean}
|
3978
|
+
*/
|
3979
|
+
Grid.prototype.isFocused = function() {
|
3980
|
+
let activeElement = document.activeElement;
|
3981
|
+
if(!activeElement || !activeElement.shadowRoot) {
|
3982
|
+
// active element is not in the shadow DOM. try using contains method to check
|
3983
|
+
return this.contains(activeElement);
|
3984
|
+
}
|
3985
|
+
// For wrapper scenarios, such as atlas-blotter or efx-grid
|
3986
|
+
return activeElement.shadowRoot === this._topNode.parentNode;
|
3987
|
+
};
|
3988
|
+
/** @description Focus grid element without moving window scrollbar
|
3989
|
+
* @public
|
3990
|
+
*/
|
3991
|
+
Grid.prototype.focus = function() {
|
3992
|
+
this._grid.focus();
|
3993
|
+
};
|
3994
|
+
/** Request re-rendering of content row by triggering data binding event without any change in data model
|
3995
|
+
* @public
|
3996
|
+
*/
|
3997
|
+
Grid.prototype.requestRowRefresh = function() {
|
3998
|
+
this._grid.requestRowRefresh();
|
3999
|
+
};
|
4000
|
+
/** Force recalculation of grid's layout
|
4001
|
+
* @public
|
4002
|
+
*/
|
4003
|
+
Grid.prototype.updateLayout = function() {
|
4004
|
+
this._grid.updateLayout();
|
4005
|
+
};
|
4006
|
+
/** Get extension instance
|
4007
|
+
* @public
|
4008
|
+
* @param {string} str Extension name
|
4009
|
+
* @return {*} Returns null, if the specified extension does not exist
|
4010
|
+
*/
|
4011
|
+
Grid.prototype.getExtension = function(str) {
|
4012
|
+
if(str) {
|
4013
|
+
return this._grid.getPlugin(str.replace(/Extension/ig, ""));
|
4014
|
+
}
|
4015
|
+
return null;
|
4016
|
+
};
|
4017
|
+
|
4018
|
+
/** @private
|
4019
|
+
* @param {Object} e
|
4020
|
+
*/
|
4021
|
+
Grid.prototype._onFormulaDataChanged = function(e) {
|
4022
|
+
if (this._formulaConflator.conflate()) {
|
4023
|
+
return;
|
4024
|
+
}
|
4025
|
+
|
4026
|
+
// TODO: Check if we need to recompose the data in the data composed method
|
4027
|
+
this._recalculateFormulas(); // Force recalculation of user formula
|
4028
|
+
this._updateRowData(); // Re-render the data
|
4029
|
+
};
|
4030
|
+
/** @private
|
4031
|
+
* @param {Object} e
|
4032
|
+
*/
|
4033
|
+
Grid.prototype._onFormulaDataRequired = function(e) {
|
4034
|
+
// if(obj["field"]) {
|
4035
|
+
// this._registerFieldToDataProvider(obj); TODO
|
4036
|
+
// if(this._dataRequiredTimerId) {
|
4037
|
+
// window.clearTimeout(this._dataRequiredTimerId);
|
4038
|
+
// }
|
4039
|
+
// this._dataRequiredTimerId = window.setTimeout( this._recalculateFormulas, 0); // Force recalculation of all rows
|
4040
|
+
// }
|
4041
|
+
};
|
4042
|
+
|
4043
|
+
/** @private
|
4044
|
+
* @param {Object} e
|
4045
|
+
*/
|
4046
|
+
Grid.prototype._onDataComposed = function(e) {
|
4047
|
+
let changes = e["changes"];
|
4048
|
+
if(!changes) {
|
4049
|
+
if(e["initialChanges"]) {
|
4050
|
+
changes = e["changes"] = e["initialChanges"]; // Need to keep e["changes"] for backward compatibility.
|
4051
|
+
} else {
|
4052
|
+
return; // Cannot do data composition if there is no change in data
|
4053
|
+
}
|
4054
|
+
}
|
4055
|
+
|
4056
|
+
let rowData = e["rowData"];
|
4057
|
+
if(!rowData) {
|
4058
|
+
return; // Row could already be removed or global change event is sent
|
4059
|
+
}
|
4060
|
+
|
4061
|
+
let rowId = e["rid"];
|
4062
|
+
let rowDef = e["rowDef"] || this._getRowDefinitionById(rowId);
|
4063
|
+
if(!rowDef) {
|
4064
|
+
rowDef = this._constituentMap ? this._constituentMap[rowId] : null; // Row def could be in pending for adding to view
|
4065
|
+
if(!rowDef) {
|
4066
|
+
return; // Somehow the given row id is invalid
|
4067
|
+
}
|
4068
|
+
if(rowDef.isDisposed()) {
|
4069
|
+
this._constituentMap[rowId] = null;
|
4070
|
+
return;
|
4071
|
+
}
|
4072
|
+
}
|
4073
|
+
|
4074
|
+
if(this._autoDateConversion) { // auto data conversion
|
4075
|
+
let dataType;
|
4076
|
+
for(let field in changes) {
|
4077
|
+
let colDef = this._getColumnDefinition(field);
|
4078
|
+
if(colDef) {
|
4079
|
+
dataType = colDef.getDataType();
|
4080
|
+
} else {
|
4081
|
+
dataType = ColumnDefinition.getDataType(field);
|
4082
|
+
}
|
4083
|
+
|
4084
|
+
if(dataType === "datetime") {
|
4085
|
+
let value = rowData[field];
|
4086
|
+
rowDef.setData(field + "_RAW", value);
|
4087
|
+
value = DateTime.toDateObject(value);
|
4088
|
+
rowDef.setData(field, value); // TODO: Check if this trigger data change multiple times
|
4089
|
+
}
|
4090
|
+
}
|
4091
|
+
}
|
4092
|
+
|
4093
|
+
if(this.hasListener("dataComposed")) {
|
4094
|
+
e["grid"] = this;
|
4095
|
+
e["rowDef"] = rowDef;
|
4096
|
+
this._dispatch("dataComposed", e);
|
4097
|
+
}
|
4098
|
+
|
4099
|
+
this._recalculateFormulas(e);
|
4100
|
+
};
|
4101
|
+
/** @private
|
4102
|
+
* @param {Object} e
|
4103
|
+
*/
|
4104
|
+
Grid.prototype._onSubSegmentChanged = function(e) {
|
4105
|
+
let insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
|
4106
|
+
let removalList = /** @type{Array.<string>} */(e["removalList"]);
|
4107
|
+
let removedRows = /** @type{Object} */(e["removedRows"]);
|
4108
|
+
|
4109
|
+
let i;
|
4110
|
+
let removalCount = removalList.length;
|
4111
|
+
let rowDef = null;
|
4112
|
+
for(i = 0; i < removalCount; i++) {
|
4113
|
+
let rid = removalList[i];
|
4114
|
+
let removedRow = removedRows[rid];
|
4115
|
+
if(removedRow) {
|
4116
|
+
rowDef = removedRow[ROW_DEF];
|
4117
|
+
if(rowDef) {
|
4118
|
+
rowDef.dispose();
|
4119
|
+
removedRow[ROW_DEF] = null;
|
4120
|
+
}
|
4121
|
+
}
|
4122
|
+
}
|
4123
|
+
|
4124
|
+
let insertionCount = insertionList.length;
|
4125
|
+
for(i = 0; i < insertionCount; i++) {
|
4126
|
+
let segment = insertionList[i];
|
4127
|
+
// let parentId = segment.getParentId();
|
4128
|
+
let segmentId = segment.getId();
|
4129
|
+
rowDef = new RowDefinition({
|
4130
|
+
"segmentId": segmentId // WARNING: This could cause row id duplication
|
4131
|
+
});
|
4132
|
+
if(rowDef.setDataSource(this._dc)) { // auto generated row does not require a subscription
|
4133
|
+
this._hasNewUpdates = true; // Mark data table for cleaning it up later
|
4134
|
+
}
|
4135
|
+
rowDef.registerToView(this._dv);
|
4136
|
+
}
|
4137
|
+
};
|
4138
|
+
|
4139
|
+
/** @private
|
4140
|
+
* @param {Object=} e
|
4141
|
+
*/
|
4142
|
+
Grid.prototype._recalculateFormulas = function(e) {
|
4143
|
+
if(!this._fnEngine || this._fnEngine.getFormulaCount() <= 0) {
|
4144
|
+
return;
|
4145
|
+
}
|
4146
|
+
|
4147
|
+
if(e && e["rid"]) {
|
4148
|
+
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
4149
|
+
} else {
|
4150
|
+
let rows = this._dc ? this._dc.getAllRowData() : null; // Slow
|
4151
|
+
|
4152
|
+
let rowCount = rows ? rows.length : 0;
|
4153
|
+
for(let r = 0; r < rowCount; ++r) { // WARNING: This is very slow
|
4154
|
+
this._fnEngine.calculate(rows[r]);
|
4155
|
+
}
|
4156
|
+
}
|
4157
|
+
};
|
4158
|
+
|
4159
|
+
/** @private
|
4160
|
+
* @param {Object} e The updated data from snapshot filler when it request data from JET/RTK
|
4161
|
+
*/
|
4162
|
+
Grid.prototype._snapshotFillerDataChanged = function (e) {
|
4163
|
+
if (!this._dt) return;
|
4164
|
+
|
4165
|
+
let data = e.data;
|
4166
|
+
if(e.timeSeries) {
|
4167
|
+
this._updateTimeSeriesFields(e); // Increase or decrease time series field
|
4168
|
+
} else {
|
4169
|
+
for (let ric in data) {
|
4170
|
+
this.setRicData(ric, data[ric]);
|
4171
|
+
}
|
4172
|
+
}
|
4173
|
+
|
4174
|
+
if(!this._lastPollingRequest) { // This is the first time we receive successful ADC response
|
4175
|
+
this._lastPollingRequest = 1; // Allow polling to be started
|
4176
|
+
}
|
4177
|
+
this._startPolling();
|
4178
|
+
};
|
4179
|
+
/** @private
|
4180
|
+
*/
|
4181
|
+
Grid.prototype._startPolling = function () {
|
4182
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
4183
|
+
if(this._lastPollingRequest && !this._pollingTimerId) {
|
4184
|
+
let now = new Date();
|
4185
|
+
this._lastPollingRequest = now.getTime();
|
4186
|
+
this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
|
4187
|
+
}
|
4188
|
+
}
|
4189
|
+
};
|
4190
|
+
/** @private
|
4191
|
+
*/
|
4192
|
+
Grid.prototype._onPollingInterval = function () {
|
4193
|
+
this._pollingTimerId = 0;
|
4194
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
4195
|
+
this.refreshADCData();
|
4196
|
+
this._startPolling();
|
4197
|
+
}
|
4198
|
+
};
|
4199
|
+
/** @public
|
4200
|
+
* @param {boolean=} activated=true
|
4201
|
+
*/
|
4202
|
+
Grid.prototype.activateADCPolling = function (activated) {
|
4203
|
+
if(activated !== false) {
|
4204
|
+
this._pollingEnabled = true;
|
4205
|
+
// Make immediate request after re-activation if it has been a long time
|
4206
|
+
let now = new Date();
|
4207
|
+
if(this._lastPollingRequest) {
|
4208
|
+
let diff = now.getTime() - this._lastPollingRequest;
|
4209
|
+
if(diff > this._pollingInterval) {
|
4210
|
+
this.refreshADCData();
|
4211
|
+
}
|
4212
|
+
}
|
4213
|
+
this._startPolling();
|
4214
|
+
} else {
|
4215
|
+
this._pollingEnabled = false;
|
4216
|
+
}
|
4217
|
+
};
|
4218
|
+
/** Force re-requesting ADC data to immediately update the data
|
4219
|
+
* @public
|
4220
|
+
* @return {boolean} Return true, if a request has been made
|
4221
|
+
*/
|
4222
|
+
Grid.prototype.refreshADCData = function () {
|
4223
|
+
let dirty = this._snapshot.addFields(this._connector.getAllFields());
|
4224
|
+
if(dirty) {
|
4225
|
+
dirty = this._snapshot.addRics(this._connector.getAllRics());
|
4226
|
+
if(dirty) {
|
4227
|
+
return true;
|
4228
|
+
}
|
4229
|
+
}
|
4230
|
+
this._lastPollingRequest = 0; // No ADC field or RIC detected. Prevent polling from continuing
|
4231
|
+
return false;
|
4232
|
+
};
|
4233
|
+
|
4234
|
+
/** @private
|
4235
|
+
*/
|
4236
|
+
Grid.prototype._onAutoLayoutUpdate = function() {
|
4237
|
+
let elem = this._topNode;
|
4238
|
+
|
4239
|
+
let cw = elem.clientWidth;
|
4240
|
+
if(cw !== this._clientWidth) {
|
4241
|
+
this._clientWidth = cw;
|
4242
|
+
this.updateLayout();
|
4243
|
+
}
|
4244
|
+
};
|
4245
|
+
|
4246
|
+
/** @description Log DataTable to console. By default, this will log only fields specified in the column definition. To see other column data use "colNames" options
|
4247
|
+
* @public
|
4248
|
+
* @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
|
4249
|
+
*/
|
4250
|
+
Grid.prototype.logDT = function(opt_options) {
|
4251
|
+
let rowDefs = this._getAllRowDefinitions();
|
4252
|
+
this._logData(rowDefs, opt_options);
|
4253
|
+
};
|
4254
|
+
/** @description Log DataView to console. By default, this will log only fields specified in the column definition. To see other column data use "colNames" options
|
4255
|
+
* @public
|
4256
|
+
* @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
|
4257
|
+
* @example
|
4258
|
+
// Options have the following format:
|
4259
|
+
// {
|
4260
|
+
// "colNames": Array.<string>,
|
4261
|
+
// "rowCount": number,
|
4262
|
+
// "startIndex": number,
|
4263
|
+
// "getter": function(rowData:Object, colName:string):*,
|
4264
|
+
// "withRowIds": boolean
|
4265
|
+
// }
|
4266
|
+
grid.logDV({"rowCount": 10}); // Showing 10 records
|
4267
|
+
*/
|
4268
|
+
Grid.prototype.logDV = function(opt_options) {
|
4269
|
+
let rowDefs = this.getRowDefinitions();
|
4270
|
+
this._logData(rowDefs, opt_options);
|
4271
|
+
};
|
4272
|
+
/** Log the collection of data to console
|
4273
|
+
* @private
|
4274
|
+
* @param {!Array.<RowDefinition>} rowDefs
|
4275
|
+
* @param {Object=} options
|
4276
|
+
*/
|
4277
|
+
Grid.prototype._logData = function(rowDefs, options) {
|
4278
|
+
if(!options) {
|
4279
|
+
options = {};
|
4280
|
+
}
|
4281
|
+
if(!options["colNames"]) {
|
4282
|
+
// TODO: Get all required fields and eliminate duplicate fields
|
4283
|
+
options["colNames"] = this.getColumnFields();
|
4284
|
+
}
|
4285
|
+
let tbl = DataCache.constructTable(rowDefs.map(toRowData), options);
|
4286
|
+
|
4287
|
+
console.table(tbl); // eslint-disable-line
|
4288
|
+
};
|
4289
|
+
|
4290
|
+
/** @public
|
4291
|
+
* @description Replace existing row by a new row. Row Id is always changed, after the row is replaced.
|
4292
|
+
* If the rowId of the new row is identical to that of the replacing row. Grid will do nothing because
|
4293
|
+
* similar rowIds indicate that they are the same row.
|
4294
|
+
* @param {Grid~RowReference} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
4295
|
+
* @param {(RowDefinition~Options|string)=} rowOption
|
4296
|
+
* @returns {RowDefinition} Returns null, if the row is not replaced. Otherwise, a newly created row is returned
|
4297
|
+
*/
|
4298
|
+
Grid.prototype.replaceRow = function(rowRef, rowOption) {
|
4299
|
+
let insertPos = this._getRowId(rowRef);
|
4300
|
+
let rowDef = this._getRowDefinitionById(insertPos);
|
4301
|
+
|
4302
|
+
if(rowDef) {
|
4303
|
+
if(rowDef.isAutoGenerated()) {
|
4304
|
+
return null; // Users cannot replace an auto-generated row
|
4305
|
+
}
|
4306
|
+
|
4307
|
+
let configObj = rowDef.getConfigObject();
|
4308
|
+
if(rowDef.getRowId() === rowOption["rowId"]) {
|
4309
|
+
return null; // Cannot replace a row with the same row id
|
4310
|
+
}
|
4311
|
+
|
4312
|
+
if(deepEqual(configObj, rowOption)){
|
4313
|
+
return null;
|
4314
|
+
}
|
4315
|
+
}
|
4316
|
+
|
4317
|
+
let newRow = this.insertRow(rowOption, insertPos);
|
4318
|
+
if(rowDef) {
|
4319
|
+
this.removeRow(insertPos);
|
4320
|
+
}
|
4321
|
+
return newRow;
|
4322
|
+
};
|
4323
|
+
|
4324
|
+
/** Scroll the view to the specified column. If the column is already in the view, nothing happens. If the column is outside of the view, the view will be moved to the column with some additional offsets
|
4325
|
+
* @public
|
4326
|
+
* @param {number} colIndex
|
4327
|
+
* @param {boolean=} leftOfView Default is false. If true, the specified column will be put at the leftmost of the view (no offset)
|
4328
|
+
* @returns {boolean} Return true, if there is any change
|
4329
|
+
*/
|
4330
|
+
Grid.prototype.scrollToColumn = function (colIndex, leftOfView) {
|
4331
|
+
return this._grid.scrollToColumn(colIndex, leftOfView);
|
4332
|
+
};
|
4333
|
+
/** Scroll the view to the specified row. If the row is already in the view, nothing happens. If the row is outside of the view, the view will be moved to the row with some additional offsets
|
4334
|
+
* @public
|
4335
|
+
* @param {number} rowIndex
|
4336
|
+
* @param {boolean=} topOfView=false If true, the specified row will be put at the top of the view (no offset)
|
4337
|
+
*/
|
4338
|
+
Grid.prototype.scrollToRow = function (rowIndex, topOfView) {
|
4339
|
+
this._grid.scrollToRow("content", rowIndex, topOfView);
|
4340
|
+
};
|
4341
|
+
|
4342
|
+
/** Get scroll value in pixel from the horizontal scrollbar
|
4343
|
+
* @public
|
4344
|
+
* @returns {number} pixels
|
4345
|
+
*/
|
4346
|
+
Grid.prototype.getScrollLeft = function () {
|
4347
|
+
return this._grid.getScrollLeft();
|
4348
|
+
};
|
4349
|
+
/** Get scroll value in pixel from the vertical scrollbar
|
4350
|
+
* @public
|
4351
|
+
* @returns {number} pixels
|
4352
|
+
*/
|
4353
|
+
Grid.prototype.getScrollTop = function () {
|
4354
|
+
return this._grid.getScrollTop();
|
4355
|
+
};
|
4356
|
+
|
4357
|
+
/** Set scroll value to the horizontal scrollbar. This will move the scrollbar to specific position
|
4358
|
+
* @public
|
4359
|
+
* @param {number} pixels
|
4360
|
+
* @see {@link Grid.scrollRight}
|
4361
|
+
*/
|
4362
|
+
Grid.prototype.setScrollLeft = function (pixels) {
|
4363
|
+
this._grid.setScrollLeft(pixels);
|
4364
|
+
};
|
4365
|
+
/** Set scroll value to the vertical scrollbar. This will move the scrollbar to specific position
|
4366
|
+
* @public
|
4367
|
+
* @param {number} pixels
|
4368
|
+
* @see {@link Grid.scrollDown}
|
4369
|
+
*/
|
4370
|
+
Grid.prototype.setScrollTop = function (pixels) {
|
4371
|
+
this._grid.setScrollTop(pixels);
|
4372
|
+
};
|
4373
|
+
|
4374
|
+
/** Scroll the view to the right by the specified value. Use negative value to scroll the view to the left
|
4375
|
+
* @public
|
4376
|
+
* @param {number} pixels
|
4377
|
+
* @see {@link Grid.setScrollLeft}
|
4378
|
+
*/
|
4379
|
+
Grid.prototype.scrollRight = function (pixels) {
|
4380
|
+
this._grid.scrollRight(pixels);
|
4381
|
+
};
|
4382
|
+
/** Scroll the view down by the specified value. Use negative value to scroll the view to the top
|
4383
|
+
* @public
|
4384
|
+
* @param {number} pixels
|
4385
|
+
* @see {@link Grid.setScrollTop}
|
4386
|
+
*/
|
4387
|
+
Grid.prototype.scrollDown = function (pixels) {
|
4388
|
+
this._grid.scrollDown(pixels);
|
4389
|
+
};
|
4390
|
+
|
4391
|
+
/** Get width of scrollable area from the horizontal scrollbar. This is useful for determining the end of scrollbar
|
4392
|
+
* @public
|
4393
|
+
* @returns {number}
|
4394
|
+
*/
|
4395
|
+
Grid.prototype.getScrollWidth = function () {
|
4396
|
+
return this._grid.getScrollWidth();
|
4397
|
+
};
|
4398
|
+
/** Get height of scrollable area from the vertical scrollbar. This is useful for determining the end of scrollbar
|
4399
|
+
* @public
|
4400
|
+
* @returns {number}
|
4401
|
+
*/
|
4402
|
+
Grid.prototype.getScrollHeight = function () {
|
4403
|
+
return this._grid.getScrollHeight();
|
4404
|
+
};
|
4405
|
+
|
4406
|
+
/** Get information about current grid's view and the vertical scrollbar
|
4407
|
+
* @public
|
4408
|
+
* @returns {Object} Returns null, if vertical scrollbar does not exists
|
4409
|
+
*/
|
4410
|
+
Grid.prototype.getVScrollView = function () {
|
4411
|
+
return this._grid.getVScrollView();
|
4412
|
+
};
|
4413
|
+
|
4414
|
+
/** @private
|
4415
|
+
* @param {Object} cell
|
4416
|
+
* @param {Object} args
|
4417
|
+
* @return {boolean}
|
4418
|
+
*/
|
4419
|
+
Grid.prototype._focusCell = function(cell, args) {
|
4420
|
+
if(cell) {
|
4421
|
+
let cellContent = cell.getContent();
|
4422
|
+
if(cellContent) {
|
4423
|
+
let nfe = null;
|
4424
|
+
if(this.hasListener("tabNavigation")) {
|
4425
|
+
let tabNavArg = {
|
4426
|
+
"shiftKey": args.shiftKey,
|
4427
|
+
"activeElement": args.activeElement,
|
4428
|
+
"cellContent": cellContent,
|
4429
|
+
"cell": cell,
|
4430
|
+
"colIndex": args.colIndex,
|
4431
|
+
"rowIndex": args.rowIndex,
|
4432
|
+
"field": args.fields ? args.fields[args.colIndex] : ""
|
4433
|
+
};
|
4434
|
+
this._dispatch("tabNavigation", tabNavArg);
|
4435
|
+
nfe = tabNavArg.nextFocusableElement;
|
4436
|
+
} else if(cellContent.tagName !== "SPAN") {
|
4437
|
+
nfe = cellContent;
|
4438
|
+
}
|
4439
|
+
|
4440
|
+
if(nfe && nfe !== args.activeElement && !nfe.disabled) {
|
4441
|
+
nfe.focus();
|
4442
|
+
return true;
|
4443
|
+
}
|
4444
|
+
}
|
4445
|
+
}
|
4446
|
+
return false;
|
4447
|
+
};
|
4448
|
+
/** @private
|
4449
|
+
*/
|
4450
|
+
Grid.prototype._onVScroll = function() {
|
4451
|
+
let args = this._focusingArgs;
|
4452
|
+
if(args) {
|
4453
|
+
args.timeoutId = _clearTimeout(args.timeoutId);
|
4454
|
+
this._focusingArgs = null;
|
4455
|
+
let cell = this._grid.getCell("content", args.colIndex, args.rowIndex);
|
4456
|
+
if(!this._focusCell(cell, args)) {
|
4457
|
+
if(args.shiftKey) {
|
4458
|
+
this._focusPrevCellContent(args);
|
4459
|
+
} else {
|
4460
|
+
this._focusNextCellContent(args);
|
4461
|
+
}
|
4462
|
+
}
|
4463
|
+
}
|
4464
|
+
};
|
4465
|
+
/** @private
|
4466
|
+
*/
|
4467
|
+
Grid.prototype._onScrollTimeout = function() {
|
4468
|
+
this._focusingArgs = null;
|
4469
|
+
};
|
4470
|
+
/** @private
|
4471
|
+
*/
|
4472
|
+
Grid.prototype._selfScrollToRow = function() {
|
4473
|
+
let args = this._focusingArgs;
|
4474
|
+
if(args) {
|
4475
|
+
args.id = 0;
|
4476
|
+
this.scrollToRow(args.rowIndex);
|
4477
|
+
}
|
4478
|
+
};
|
4479
|
+
/** @private
|
4480
|
+
* @param {Object} args
|
4481
|
+
*/
|
4482
|
+
Grid.prototype._requestScroll = function(args) {
|
4483
|
+
if(!this._focusingArgs) {
|
4484
|
+
this._focusingArgs = args;
|
4485
|
+
args.event = null; // The event is invalid after the scroll
|
4486
|
+
args.id = setTimeout(this._selfScrollToRow, 0); // Avoid event loop protection
|
4487
|
+
args.timeoutId = setTimeout(this._onScrollTimeout, 100); // To avoid a fail case where scroll cannot be performed
|
4488
|
+
}
|
4489
|
+
};
|
4490
|
+
/** @private
|
4491
|
+
* @param {Object} args
|
4492
|
+
*/
|
4493
|
+
Grid.prototype._focusNextCellContent = function(args) {
|
4494
|
+
let colIndex = args.colIndex;
|
4495
|
+
let rowIndex = args.rowIndex;
|
4496
|
+
if(rowIndex < 0 || rowIndex == null) {
|
4497
|
+
return;
|
4498
|
+
}
|
4499
|
+
|
4500
|
+
let focusableColIndices = args.focusableColIndices;
|
4501
|
+
let len = focusableColIndices.length;
|
4502
|
+
let startIdx = 0;
|
4503
|
+
let i;
|
4504
|
+
if(colIndex >= 0) {
|
4505
|
+
for(i = 1; i < len; i++) {
|
4506
|
+
if(colIndex < focusableColIndices[i]) {
|
4507
|
+
break;
|
4508
|
+
}
|
4509
|
+
startIdx = i;
|
4510
|
+
}
|
4511
|
+
}
|
4512
|
+
|
4513
|
+
let grid = this._grid;
|
4514
|
+
let section = grid.getSection("content");
|
4515
|
+
let viewInfo = grid.getVerticalViewInfo();
|
4516
|
+
let lastFullRow = viewInfo.lastFullRow;
|
4517
|
+
let rowCount = this.getRowCount();
|
4518
|
+
|
4519
|
+
args.fields = grid.getColumnFields();
|
4520
|
+
for(let r = rowIndex; r < rowCount; r++) {
|
4521
|
+
args.rowIndex = r;
|
4522
|
+
for(i = startIdx; i < len; i++) {
|
4523
|
+
let c = focusableColIndices[i];
|
4524
|
+
args.colIndex = c;
|
4525
|
+
if(r > lastFullRow) {
|
4526
|
+
_preventDefault(args.event);
|
4527
|
+
this._requestScroll(args);
|
4528
|
+
return;
|
4529
|
+
} else {
|
4530
|
+
let cell = section.getCell(c, r);
|
4531
|
+
if(this._focusCell(cell, args)) {
|
4532
|
+
_preventDefault(args.event);
|
4533
|
+
return;
|
4534
|
+
}
|
4535
|
+
}
|
4536
|
+
}
|
4537
|
+
startIdx = 0;
|
4538
|
+
}
|
4539
|
+
|
4540
|
+
// The current focus on the last focusable content
|
4541
|
+
this._grid.getHiddenInput().focus();
|
4542
|
+
};
|
4543
|
+
/** @private
|
4544
|
+
* @param {Object} args
|
4545
|
+
*/
|
4546
|
+
Grid.prototype._focusPrevCellContent = function(args) {
|
4547
|
+
let colIndex = args.colIndex;
|
4548
|
+
let rowIndex = args.rowIndex;
|
4549
|
+
if(rowIndex < 0 || rowIndex == null) {
|
4550
|
+
return;
|
4551
|
+
}
|
4552
|
+
|
4553
|
+
let focusableColIndices = args.focusableColIndices;
|
4554
|
+
let len = focusableColIndices.length;
|
4555
|
+
let startIdx = len - 1;
|
4556
|
+
let i;
|
4557
|
+
if(colIndex >= 0) {
|
4558
|
+
for(i = len - 1; --i >= 0;) {
|
4559
|
+
if(colIndex > focusableColIndices[i]) {
|
4560
|
+
break;
|
4561
|
+
}
|
4562
|
+
startIdx = i;
|
4563
|
+
}
|
4564
|
+
}
|
4565
|
+
|
4566
|
+
let grid = this._grid;
|
4567
|
+
let section = grid.getSection("content");
|
4568
|
+
let viewInfo = grid.getVerticalViewInfo();
|
4569
|
+
let firstFullRow = viewInfo.firstFullRow;
|
4570
|
+
|
4571
|
+
args.fields = this.getColumnFields();
|
4572
|
+
for(let r = rowIndex; r >= 0; r--) {
|
4573
|
+
args.rowIndex = r;
|
4574
|
+
for(i = startIdx; i >= 0; i--) {
|
4575
|
+
let c = focusableColIndices[i];
|
4576
|
+
args.colIndex = c;
|
4577
|
+
if(r < firstFullRow) {
|
4578
|
+
_preventDefault(args.event);
|
4579
|
+
this._requestScroll(args);
|
4580
|
+
return;
|
4581
|
+
} else {
|
4582
|
+
let cell = section.getCell(c, r);
|
4583
|
+
if(this._focusCell(cell, args)) {
|
4584
|
+
_preventDefault(args.event);
|
4585
|
+
return;
|
4586
|
+
}
|
4587
|
+
}
|
4588
|
+
}
|
4589
|
+
startIdx = len - 1;
|
4590
|
+
}
|
4591
|
+
|
4592
|
+
// The current focus on the last focusable content
|
4593
|
+
this._grid.getHiddenInput(true).focus();
|
4594
|
+
};
|
4595
|
+
|
4596
|
+
/** @private
|
4597
|
+
* @param {Object} e
|
4598
|
+
*/
|
4599
|
+
Grid.prototype._onTabNavigation = function(e) {
|
4600
|
+
if(this._focusingArgs) {
|
4601
|
+
return; // Cannot do another tab navigation while waiting for scrolling
|
4602
|
+
}
|
4603
|
+
|
4604
|
+
let colDefs = this.getColumnDefinitions();
|
4605
|
+
let colCount = colDefs.length;
|
4606
|
+
|
4607
|
+
let focusableColIndices = [];
|
4608
|
+
for(let c = 0; c < colCount; c++) {
|
4609
|
+
if(colDefs[c].isFocusable()) {
|
4610
|
+
focusableColIndices.push(c);
|
4611
|
+
}
|
4612
|
+
}
|
4613
|
+
|
4614
|
+
if(!focusableColIndices.length) {
|
4615
|
+
return;
|
4616
|
+
}
|
4617
|
+
|
4618
|
+
let keyEvt = e.event;
|
4619
|
+
let pos = this.getRelativePosition(keyEvt);
|
4620
|
+
let startingRowIndex = pos["rowIndex"];
|
4621
|
+
if(e.onTheEdge) {
|
4622
|
+
let viewInfo = this._grid.getVerticalViewInfo();
|
4623
|
+
startingRowIndex = keyEvt.shiftKey ? viewInfo.lastFullRow : viewInfo.firstFullRow;
|
4624
|
+
}
|
4625
|
+
let args = {
|
4626
|
+
event: keyEvt,
|
4627
|
+
shiftKey: keyEvt.shiftKey,
|
4628
|
+
colIndex: pos["colIndex"],
|
4629
|
+
rowIndex: startingRowIndex,
|
4630
|
+
focusableColIndices: focusableColIndices,
|
4631
|
+
activeElement: e.activeElement
|
4632
|
+
};
|
4633
|
+
|
4634
|
+
if(keyEvt.shiftKey) {
|
4635
|
+
this._focusPrevCellContent(args);
|
4636
|
+
} else {
|
4637
|
+
this._focusNextCellContent(args);
|
4638
|
+
}
|
4639
|
+
};
|
4640
|
+
|
4641
|
+
/** @public
|
4642
|
+
* @ignore
|
4643
|
+
* @return {!Object}
|
4644
|
+
*/
|
4645
|
+
Grid.prototype._getEventHandlers = function() {
|
4646
|
+
return {
|
4647
|
+
"tabNavigation": this._onTabNavigation,
|
4648
|
+
"q2DataChanged": this._onQ2DataChanged
|
4649
|
+
};
|
4650
|
+
};
|
4651
|
+
|
4652
|
+
export { Grid };
|
4653
|
+
export default Grid;
|