@refinitiv-ui/efx-grid 6.0.0-next.0
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-format-dialog/index.d.ts +1 -0
- package/lib/column-format-dialog/index.js +1 -0
- package/lib/column-format-dialog/lib/column-format-dialog.d.ts +64 -0
- package/lib/column-format-dialog/lib/column-format-dialog.js +2713 -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 +995 -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 +1 -0
- package/lib/column-selection-dialog/index.js +1 -0
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +41 -0
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +1410 -0
- package/lib/column-selection-dialog/lib/locale/translation-de.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-de.js +19 -0
- package/lib/column-selection-dialog/lib/locale/translation-en.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-en.js +19 -0
- package/lib/column-selection-dialog/lib/locale/translation-ja.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-ja.js +19 -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 +19 -0
- package/lib/column-selection-dialog/lib/locale/translation-zh.d.ts +7 -0
- package/lib/column-selection-dialog/lib/locale/translation-zh.js +19 -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 +189 -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 +6 -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 +6 -0
- package/lib/column-selection-dialog/themes/halo/column-selection-dialog.less +22 -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 +6 -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 +6 -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 +6 -0
- package/lib/column-selection-dialog/themes/solar/column-selection-dialog.less +1 -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 +6 -0
- package/lib/core/dist/core.css +1 -0
- package/lib/core/dist/core.js +28075 -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 +81 -0
- package/lib/core/es6/data/DataCache.js +1317 -0
- package/lib/core/es6/data/DataTable.d.ts +125 -0
- package/lib/core/es6/data/DataTable.js +1655 -0
- package/lib/core/es6/data/DataView.d.ts +280 -0
- package/lib/core/es6/data/DataView.js +3654 -0
- package/lib/core/es6/data/Segment.d.ts +38 -0
- package/lib/core/es6/data/Segment.js +193 -0
- package/lib/core/es6/data/SegmentCollection.d.ts +58 -0
- package/lib/core/es6/data/SegmentCollection.js +431 -0
- package/lib/core/es6/grid/Core.d.ts +387 -0
- package/lib/core/es6/grid/Core.js +4939 -0
- package/lib/core/es6/grid/ILayoutGrid.d.ts +204 -0
- package/lib/core/es6/grid/ILayoutGrid.js +658 -0
- package/lib/core/es6/grid/LayoutGrid.d.ts +23 -0
- package/lib/core/es6/grid/LayoutGrid.js +2602 -0
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +18 -0
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +907 -0
- package/lib/core/es6/grid/components/Cell.d.ts +50 -0
- package/lib/core/es6/grid/components/Cell.js +740 -0
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +19 -0
- package/lib/core/es6/grid/components/CellFloatingPanel.js +123 -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 +38 -0
- package/lib/core/es6/grid/components/CellSpans.js +341 -0
- package/lib/core/es6/grid/components/Column.d.ts +22 -0
- package/lib/core/es6/grid/components/Column.js +612 -0
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +125 -0
- package/lib/core/es6/grid/components/ElementWrapper.js +714 -0
- package/lib/core/es6/grid/components/HScrollbar.d.ts +24 -0
- package/lib/core/es6/grid/components/HScrollbar.js +222 -0
- package/lib/core/es6/grid/components/Scrollbar.d.ts +61 -0
- package/lib/core/es6/grid/components/Scrollbar.js +1374 -0
- package/lib/core/es6/grid/components/StretchedCells.d.ts +17 -0
- package/lib/core/es6/grid/components/StretchedCells.js +328 -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 +163 -0
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +24 -0
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +615 -0
- package/lib/core/es6/grid/plugins/Plugin.d.ts +28 -0
- package/lib/core/es6/grid/plugins/Plugin.js +272 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +127 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +1707 -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/ElementFrameWork.d.ts +18 -0
- package/lib/core/es6/grid/util/ElementFrameWork.js +227 -0
- package/lib/core/es6/grid/util/HttpRequest.d.ts +53 -0
- package/lib/core/es6/grid/util/HttpRequest.js +371 -0
- package/lib/core/es6/grid/util/PercentBar.d.ts +43 -0
- package/lib/core/es6/grid/util/PercentBar.js +390 -0
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +41 -0
- package/lib/core/es6/grid/util/PercentBarRenderer.js +316 -0
- package/lib/core/es6/grid/util/RangeBar.d.ts +25 -0
- package/lib/core/es6/grid/util/RangeBar.js +255 -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 +674 -0
- package/lib/core/es6/grid/util/SelectionList.d.ts +50 -0
- package/lib/core/es6/grid/util/SelectionList.js +422 -0
- package/lib/core/es6/grid/util/TrackLayout.d.ts +84 -0
- package/lib/core/es6/grid/util/TrackLayout.js +850 -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 +18 -0
- package/lib/core/es6/grid/util/util.js +450 -0
- package/lib/core/es6/index.d.ts +84 -0
- package/lib/core/es6/index.js +132 -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 +1 -0
- package/lib/filter-dialog/index.js +1 -0
- package/lib/filter-dialog/lib/checkbox-list.d.ts +27 -0
- package/lib/filter-dialog/lib/checkbox-list.js +336 -0
- package/lib/filter-dialog/lib/filter-dialog.d.ts +53 -0
- package/lib/filter-dialog/lib/filter-dialog.js +860 -0
- package/lib/filter-dialog/lib/locale/translation-de.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-de.js +37 -0
- package/lib/filter-dialog/lib/locale/translation-en.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-en.js +37 -0
- package/lib/filter-dialog/lib/locale/translation-ja.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-ja.js +37 -0
- package/lib/filter-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-zh-hant.js +37 -0
- package/lib/filter-dialog/lib/locale/translation-zh.d.ts +7 -0
- package/lib/filter-dialog/lib/locale/translation-zh.js +37 -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 +37 -0
- package/lib/filter-dialog/themes/base.less +102 -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 +9 -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 +22 -0
- package/lib/formatters/es6/CoralButtonFormatter.js +40 -0
- package/lib/formatters/es6/CoralCheckboxFormatter.d.ts +12 -0
- package/lib/formatters/es6/CoralCheckboxFormatter.js +45 -0
- package/lib/formatters/es6/CoralComboBoxFormatter.d.ts +23 -0
- package/lib/formatters/es6/CoralComboBoxFormatter.js +102 -0
- package/lib/formatters/es6/CoralIconFormatter.d.ts +23 -0
- package/lib/formatters/es6/CoralIconFormatter.js +45 -0
- package/lib/formatters/es6/CoralInputFormatter.d.ts +12 -0
- package/lib/formatters/es6/CoralInputFormatter.js +40 -0
- package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +22 -0
- package/lib/formatters/es6/CoralRadioButtonFormatter.js +80 -0
- package/lib/formatters/es6/CoralSelectFormatter.d.ts +23 -0
- package/lib/formatters/es6/CoralSelectFormatter.js +66 -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 +22 -0
- package/lib/formatters/es6/EFButtonFormatter.js +40 -0
- package/lib/formatters/es6/EFCheckboxFormatter.d.ts +12 -0
- package/lib/formatters/es6/EFCheckboxFormatter.js +45 -0
- package/lib/formatters/es6/EFComboBoxFormatter.d.ts +23 -0
- package/lib/formatters/es6/EFComboBoxFormatter.js +68 -0
- package/lib/formatters/es6/EFDateTimePickerFormatter.d.ts +13 -0
- package/lib/formatters/es6/EFDateTimePickerFormatter.js +55 -0
- package/lib/formatters/es6/EFIconFormatter.d.ts +23 -0
- package/lib/formatters/es6/EFIconFormatter.js +45 -0
- package/lib/formatters/es6/EFNumberFieldFormatter.d.ts +12 -0
- package/lib/formatters/es6/EFNumberFieldFormatter.js +40 -0
- package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +22 -0
- package/lib/formatters/es6/EFRadioButtonFormatter.js +80 -0
- package/lib/formatters/es6/EFSelectFormatter.d.ts +23 -0
- package/lib/formatters/es6/EFSelectFormatter.js +66 -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 +22 -0
- package/lib/formatters/es6/FormatterBuilder.js +334 -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 +25 -0
- package/lib/formatters/es6/SimpleTickerFormatter.js +65 -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 +30 -0
- package/lib/formatters/es6/index.d.ts +43 -0
- package/lib/formatters/es6/index.js +67 -0
- package/lib/grid/index.d.ts +1 -0
- package/lib/grid/index.js +2 -0
- package/lib/grid/lib/efx-grid.d.ts +32 -0
- package/lib/grid/lib/efx-grid.js +469 -0
- package/lib/grid/themes/base.less +134 -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 +92 -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 +102 -0
- package/lib/index.js +102 -0
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +83 -0
- package/lib/row-segmenting/es6/RowSegmenting.js +592 -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 +44672 -0
- package/lib/rt-grid/dist/rt-grid.min.js +1 -0
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +141 -0
- package/lib/rt-grid/es6/ColumnDefinition.js +1074 -0
- package/lib/rt-grid/es6/DataConnector.d.ts +37 -0
- package/lib/rt-grid/es6/DataConnector.js +266 -0
- package/lib/rt-grid/es6/FieldDefinition.d.ts +20 -0
- package/lib/rt-grid/es6/FieldDefinition.js +418 -0
- package/lib/rt-grid/es6/Grid.d.ts +261 -0
- package/lib/rt-grid/es6/Grid.js +2893 -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 +38 -0
- package/lib/rt-grid/es6/ReferenceCounter.js +230 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +120 -0
- package/lib/rt-grid/es6/RowDefinition.js +873 -0
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +21 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +252 -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 +67 -0
- package/lib/statistics-row/es6/StatisticsRow.js +786 -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 +45 -0
- package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.js +431 -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 +67 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +1777 -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 +69 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.js +1476 -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 +1000 -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 +89 -0
- package/lib/tr-grid-column-formatting/es6/ColumnFormatting.js +615 -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 +60 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +913 -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 +1013 -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 +70 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +928 -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 +76 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +1227 -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 +70 -0
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +947 -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 +478 -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 +471 -0
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +22 -0
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +133 -0
- package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +39 -0
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +245 -0
- package/lib/tr-grid-contextmenu/es6/PopupMenu.d.ts +29 -0
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +292 -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 +57 -0
- package/lib/tr-grid-filter-input/es6/FilterInput.js +928 -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 +44 -0
- package/lib/tr-grid-heat-map/es6/HeatMap.js +394 -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 +129 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +1977 -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 +57 -0
- package/lib/tr-grid-pagination/es6/Pagination.js +427 -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 +801 -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 +49 -0
- package/lib/tr-grid-printer/es6/CellWriter.js +226 -0
- package/lib/tr-grid-printer/es6/ColumnWriter.d.ts +12 -0
- package/lib/tr-grid-printer/es6/ColumnWriter.js +21 -0
- package/lib/tr-grid-printer/es6/GridPrinter.d.ts +32 -0
- package/lib/tr-grid-printer/es6/GridPrinter.js +761 -0
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +38 -0
- package/lib/tr-grid-printer/es6/PrintTrait.js +481 -0
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +54 -0
- package/lib/tr-grid-printer/es6/SectionWriter.js +205 -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/RangeBar.d.ts +39 -0
- package/lib/tr-grid-range-bar/es6/RangeBar.js +353 -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 +53 -0
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +794 -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 +118 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +1884 -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 +109 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +1541 -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 +74 -0
- package/lib/tr-grid-row-selection/es6/RowSelection.js +1202 -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 +60 -0
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +611 -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 +77 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +574 -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 +29 -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 +136 -0
- package/lib/tr-grid-util/es6/CellPainter.js +1128 -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 +14 -0
- package/lib/tr-grid-util/es6/Deferred.js +98 -0
- package/lib/tr-grid-util/es6/Delay.d.ts +20 -0
- package/lib/tr-grid-util/es6/Delay.js +85 -0
- package/lib/tr-grid-util/es6/Dom.d.ts +32 -0
- package/lib/tr-grid-util/es6/Dom.js +346 -0
- package/lib/tr-grid-util/es6/ElementObserver.d.ts +10 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +101 -0
- package/lib/tr-grid-util/es6/ElementWrapper.d.ts +23 -0
- package/lib/tr-grid-util/es6/ElementWrapper.js +83 -0
- package/lib/tr-grid-util/es6/ElfDate.d.ts +26 -0
- package/lib/tr-grid-util/es6/ElfDate.js +163 -0
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +33 -0
- package/lib/tr-grid-util/es6/ElfUtil.js +458 -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 +27 -0
- package/lib/tr-grid-util/es6/ExpanderIcon.js +169 -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 +432 -0
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +48 -0
- package/lib/tr-grid-util/es6/FilterBuilder.js +521 -0
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +41 -0
- package/lib/tr-grid-util/es6/FilterOperators.js +181 -0
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +72 -0
- package/lib/tr-grid-util/es6/GridPlugin.js +747 -0
- package/lib/tr-grid-util/es6/Icon.d.ts +14 -0
- package/lib/tr-grid-util/es6/Icon.js +61 -0
- package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +42 -0
- package/lib/tr-grid-util/es6/MouseDownTrait.js +237 -0
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +32 -0
- package/lib/tr-grid-util/es6/MultiTableManager.js +506 -0
- package/lib/tr-grid-util/es6/NumberFormatter.d.ts +83 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +471 -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 +162 -0
- package/lib/tr-grid-util/es6/Popup.d.ts +84 -0
- package/lib/tr-grid-util/es6/Popup.js +818 -0
- package/lib/tr-grid-util/es6/RangeBar.d.ts +33 -0
- package/lib/tr-grid-util/es6/RangeBar.js +259 -0
- package/lib/tr-grid-util/es6/RequestQueue.d.ts +30 -0
- package/lib/tr-grid-util/es6/RequestQueue.js +239 -0
- package/lib/tr-grid-util/es6/RowPainter.d.ts +23 -0
- package/lib/tr-grid-util/es6/RowPainter.js +188 -0
- package/lib/tr-grid-util/es6/SubTable.d.ts +74 -0
- package/lib/tr-grid-util/es6/SubTable.js +558 -0
- package/lib/tr-grid-util/es6/Table.d.ts +125 -0
- package/lib/tr-grid-util/es6/Table.js +790 -0
- package/lib/tr-grid-util/es6/TextHighlighter.d.ts +18 -0
- package/lib/tr-grid-util/es6/TextHighlighter.js +273 -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 +65 -0
- package/lib/tr-grid-util/es6/Util.js +528 -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 +882 -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 +63 -0
- package/lib/tr-grid-util/es6/index.js +99 -0
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +28 -0
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +141 -0
- package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +114 -0
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +827 -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 +63 -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 +72 -0
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +564 -0
- package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +8 -0
- package/lib/tr-grid-util/es6/jet/MockRTK.js +43 -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 +131 -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 +45 -0
- package/lib/types/es6/CellSelection.d.ts +67 -0
- package/lib/types/es6/Checkbox.d.ts +69 -0
- package/lib/types/es6/ColumnFitter.d.ts +56 -0
- package/lib/types/es6/ColumnFormatting.d.ts +90 -0
- package/lib/types/es6/ColumnGrouping.d.ts +60 -0
- package/lib/types/es6/ColumnResizing.d.ts +68 -0
- package/lib/types/es6/ColumnSelection.d.ts +70 -0
- package/lib/types/es6/ColumnStack.d.ts +76 -0
- package/lib/types/es6/CompositeGrid/CollapsibleHeaderPlugin.d.ts +11 -0
- package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +38 -0
- package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +45 -0
- package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +287 -0
- package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +22 -0
- package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +44 -0
- package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +30 -0
- package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +42 -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 +70 -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 +22 -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 +23 -0
- package/lib/types/es6/CoralInputFormatter.d.ts +12 -0
- package/lib/types/es6/CoralRadioButtonFormatter.d.ts +22 -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 +81 -0
- package/lib/types/es6/Core/data/DataTable.d.ts +125 -0
- package/lib/types/es6/Core/data/DataView.d.ts +280 -0
- package/lib/types/es6/Core/data/Segment.d.ts +38 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +58 -0
- package/lib/types/es6/Core/grid/Core.d.ts +387 -0
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +204 -0
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +23 -0
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +18 -0
- package/lib/types/es6/Core/grid/components/Cell.d.ts +50 -0
- package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +19 -0
- package/lib/types/es6/Core/grid/components/CellSpan.d.ts +18 -0
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +38 -0
- package/lib/types/es6/Core/grid/components/Column.d.ts +22 -0
- package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +125 -0
- package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +24 -0
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +61 -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/DragAndDropTitlePlugin.d.ts +24 -0
- package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +28 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +127 -0
- package/lib/types/es6/Core/grid/util/Conflator.d.ts +32 -0
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +18 -0
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +53 -0
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +43 -0
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +41 -0
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +25 -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 +50 -0
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +84 -0
- package/lib/types/es6/Core/grid/util/Virtualizer.d.ts +40 -0
- package/lib/types/es6/Core/grid/util/util.d.ts +18 -0
- package/lib/types/es6/Core/index.d.ts +84 -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 +22 -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 +23 -0
- package/lib/types/es6/EFNumberFieldFormatter.d.ts +12 -0
- package/lib/types/es6/EFRadioButtonFormatter.d.ts +22 -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 +52 -0
- package/lib/types/es6/Extensions.d.ts +61 -0
- package/lib/types/es6/FilterInput.d.ts +57 -0
- package/lib/types/es6/FormatterBuilder.d.ts +22 -0
- package/lib/types/es6/GridFormatter.d.ts +63 -0
- package/lib/types/es6/HeatMap.d.ts +44 -0
- package/lib/types/es6/InCellEditing.d.ts +129 -0
- package/lib/types/es6/MenuEventAPI.d.ts +22 -0
- package/lib/types/es6/MenuItem.d.ts +39 -0
- package/lib/types/es6/NumericInputFormatter.d.ts +13 -0
- package/lib/types/es6/Pagination.d.ts +57 -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 +29 -0
- package/lib/types/es6/RangeBar.d.ts +39 -0
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +143 -0
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +37 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +20 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +263 -0
- package/lib/types/es6/RealtimeGrid/PredefinedFormula.d.ts +16 -0
- package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +38 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +120 -0
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +21 -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 +60 -0
- package/lib/types/es6/RowDragging.d.ts +53 -0
- package/lib/types/es6/RowFiltering.d.ts +118 -0
- package/lib/types/es6/RowGrouping.d.ts +109 -0
- package/lib/types/es6/RowSegmenting.d.ts +83 -0
- package/lib/types/es6/RowSelection.d.ts +74 -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 +25 -0
- package/lib/types/es6/SimpleToggleFormatter.d.ts +22 -0
- package/lib/types/es6/StatisticsRow.d.ts +67 -0
- package/lib/types/es6/TextFormatter.d.ts +12 -0
- package/lib/types/es6/TextFormatting.d.ts +77 -0
- package/lib/types/es6/TitleWrap.d.ts +29 -0
- package/lib/types/es6/Zoom.d.ts +51 -0
- package/lib/types/es6/index.d.ts +76 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/versions.json +36 -0
- package/lib/window-exporter.js +13 -0
- package/lib/zoom/es6/Zoom.d.ts +51 -0
- package/lib/zoom/es6/Zoom.js +419 -0
- package/lib/zoom/es6/index.d.ts +1 -0
- package/lib/zoom/es6/index.js +1 -0
- package/package.json +42 -0
@@ -0,0 +1,2893 @@
|
|
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 } 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
|
+
|
17
|
+
import { Core } from "../../core/es6/grid/Core.js";
|
18
|
+
import { SortableTitlePlugin } from "../../core/es6/grid/plugins/SortableTitlePlugin.js";
|
19
|
+
import { DragAndDropTitlePlugin } from "../../core/es6/grid/plugins/DragAndDropTitlePlugin.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~GridOptions
|
35
|
+
* @description Configuration object that can be provided directly at the initialization phase
|
36
|
+
* @property {Array.<ColumnDefinition~Options|string>=} columns Collection of the column definitions
|
37
|
+
* @property {ColumnDefinition~Options=} defaultColumnOptions All Columns will inherit from this default object
|
38
|
+
* @property {Array.<RowDefinition~Options>=} rows Collection of the row definitions
|
39
|
+
* @property {Array.<string>=} fields Shorthand for setting fields
|
40
|
+
* @property {Array.<string>=} rics Shorthand for creating row definition
|
41
|
+
* @property {Array=} plugins Additional plugins for core grid (from getBlotter()/getCoreGrid())
|
42
|
+
* @property {Array=} extensions Alias to `plugins`
|
43
|
+
* @property {boolean=} scrollbar=true Enable both vertical and horizontal scrollbar in grid
|
44
|
+
* @property {boolean=} linearWheelScrolling=false If enabled, wheel scrolling will move the content linearly regardless of how long the content is (i.e. no skipping).
|
45
|
+
* @property {boolean=} stepScroll=false If enabled, a full row will be scrolled at a time instead of actual scroll value.
|
46
|
+
* @property {boolean=} autoHideScrollbar=true Fading in/out Scrollbar on hover.
|
47
|
+
* @property {string=} pageSize=0 Make grid show specified number of row
|
48
|
+
* @property {number=} rowHeight=32 Set default row height for body (content) section
|
49
|
+
* @property {number=} headerRowHeight=32 Set default row height for header section
|
50
|
+
* @property {boolean=} noColumnDragging=false All columns can be moved by dragging. If this option is true, the feature is disabled
|
51
|
+
* @property {boolean=} columnReorder=true Alias with noColumnDragging but in opposite value. This property deprecated in favor of noColumnDragging.
|
52
|
+
* @property {boolean=} rowHighlighting=true Highlight a row when hovering mouse over grid
|
53
|
+
* @property {(boolean|number)=} autoLayoutUpdate=false Grid will check for layout change periodically.
|
54
|
+
* @property {number=} columnFreezing Enable horizontal scrollbar after `columnFreezing` index
|
55
|
+
* @property {number=} freezeColumn An alias to columnFreezing
|
56
|
+
* @property {number=} pinnedRightColumns=0 Number of columns to be frozen/pinned on the right side.
|
57
|
+
* @property {Array=} staticDataRows Shorthand for calling {@link Grid#addStaticDataRows}
|
58
|
+
* @property {Array.<string>=} dataFields Shorthand for calling {@link Grid#addDataFields}
|
59
|
+
* @property {boolean=} rowVirtualization=true If disabled, all data rows will be rendered. This will greatly impact grid's performance if the data set is huge.
|
60
|
+
* @property {boolean=} columnVirtualization=false If enabled, all columns will be rendered. This will greatly impact grid's performance if the column set is huge.
|
61
|
+
* @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.
|
62
|
+
* @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.
|
63
|
+
* @property {boolean=} borders=true Lines around grid element
|
64
|
+
* @property {boolean=} gridlines=true Horizontal and Vertical lines for ONLY content sections
|
65
|
+
* @property {boolean=} verticalLines=true Vertical lines for all sections
|
66
|
+
* @property {boolean=} horizontalLines=true Horizontal lines for all sections
|
67
|
+
* @property {*=} RTK=null rtk toolkit instance
|
68
|
+
* @property {Grid~SynapseConfig=} synapse=null synapse config object
|
69
|
+
* @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
|
70
|
+
* @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
|
71
|
+
* @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
|
72
|
+
* @property {Function=} dataComposed Handler for dataComposed event
|
73
|
+
* @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
|
74
|
+
* @property {boolean=} textSelect=false If enabled, user can select text
|
75
|
+
* @property {string=} lang laguage for config localization date time, if null the default language is "en"
|
76
|
+
*/
|
77
|
+
|
78
|
+
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
79
|
+
* @description A row in Grid can be referred by the following values: <br>
|
80
|
+
* <b>number</b> : Row index of a visible rows, excluding invisible (hidden) rows<br>
|
81
|
+
* <b>RowDefinition</b> : Row definition object<br>
|
82
|
+
* <b>string</b> : Unique row Id existing in current data table, including invisible rows<br>
|
83
|
+
*/
|
84
|
+
|
85
|
+
/** @typedef {number|string|ColumnDefinition} Grid~ColumnReference
|
86
|
+
* @description A column in Grid can be referred by the following values:<br>
|
87
|
+
* <b>number</b> : Column index including all invisible (hidden) columns<br>
|
88
|
+
* <b>string</b> : Field name of the column<br>
|
89
|
+
* <b>ColumnDefinition</b> : Column definition object<br>
|
90
|
+
*/
|
91
|
+
|
92
|
+
/** @event Grid#fieldAdded
|
93
|
+
* @description Fired after the field has been added to the data table.
|
94
|
+
* @property {string} type "fieldAdded"
|
95
|
+
* @property {Array.<string>} addedFields An array of newly added fields
|
96
|
+
* @property {Array.<string>} fields All fields
|
97
|
+
* @property {Array.<string>} rics All rics
|
98
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
99
|
+
*/
|
100
|
+
/** @event Grid#fieldRemoved
|
101
|
+
* @description Fired after the field has been removed from the data table.
|
102
|
+
* @property {string} type "fieldRemoved"
|
103
|
+
* @property {Array.<string>} removedFields An array of recently removed fields
|
104
|
+
* @property {Array.<string>} fields All fields
|
105
|
+
* @property {Array.<string>} rics All rics
|
106
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
107
|
+
*/
|
108
|
+
/** @event Grid#ricAdded
|
109
|
+
* @description Fired after the ric has been added to the data table.
|
110
|
+
* @property {string} type "ricAdded"
|
111
|
+
* @property {Array.<string>} addedRics An array of newly added rics
|
112
|
+
* @property {Array.<string>} fields All fields
|
113
|
+
* @property {Array.<string>} rics All rics
|
114
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
115
|
+
*/
|
116
|
+
/** @event Grid#ricRemoved
|
117
|
+
* @description Fired after the ric has been removed from the data table.
|
118
|
+
* @property {string} type "ricRemoved"
|
119
|
+
* @property {Array.<string>} removedRics An array of recently removed rics
|
120
|
+
* @property {Array.<string>} fields All fields
|
121
|
+
* @property {Array.<string>} rics All rics
|
122
|
+
* @property {Array.<RowDefinition>} rowDefs All row definitions
|
123
|
+
*/
|
124
|
+
|
125
|
+
/** @event Grid#adcDataReceived
|
126
|
+
* @description Fired after ADC data or response received from the server
|
127
|
+
* @property {Array.<Array>} data Data part of the server response
|
128
|
+
*/
|
129
|
+
|
130
|
+
/** @event Grid#pageIndexChanged
|
131
|
+
* @description Fired after page index in the data view is changed during the active pagination mode
|
132
|
+
*/
|
133
|
+
|
134
|
+
/** @event Grid#pageCountChanged
|
135
|
+
* @description Fired after page count in the data view is changed during the active pagination mode
|
136
|
+
*/
|
137
|
+
|
138
|
+
/** @event Grid#dataComposed
|
139
|
+
* @description Trigger before dataChanged. Perform any data update during the event will NOT cause more dataChanged events
|
140
|
+
* @property {Grid} grid
|
141
|
+
* @property {RowDefinition} rowDef
|
142
|
+
*/
|
143
|
+
|
144
|
+
/** @event Grid#beforeRowRemoved
|
145
|
+
* @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
|
146
|
+
*/
|
147
|
+
|
148
|
+
/** @type {string}
|
149
|
+
* @private
|
150
|
+
* @const
|
151
|
+
*/
|
152
|
+
var SUB_ID = "SUB_ID";
|
153
|
+
|
154
|
+
/** @private
|
155
|
+
* @param {*} rowDef
|
156
|
+
* @return {Object}
|
157
|
+
*/
|
158
|
+
var toRowData = function(rowDef) {
|
159
|
+
return rowDef ? rowDef.getRowData() : null;
|
160
|
+
};
|
161
|
+
|
162
|
+
/** @private
|
163
|
+
* @const
|
164
|
+
* @type {Object.<string, number>}
|
165
|
+
*/
|
166
|
+
var _unclonableFields = {
|
167
|
+
"ROW_DEF": 1,
|
168
|
+
"SUB_ID": 1
|
169
|
+
};
|
170
|
+
/** @private
|
171
|
+
* @param {RowDefinition} fromRowDef
|
172
|
+
* @param {RowDefinition} toRowDef
|
173
|
+
*/
|
174
|
+
var cloneRowData = function(fromRowDef, toRowDef) {
|
175
|
+
var from = toRowData(fromRowDef);
|
176
|
+
var to = toRowData(toRowDef);
|
177
|
+
for(var key in from) {
|
178
|
+
if(!_unclonableFields[key]) {
|
179
|
+
to[key] = from[key];
|
180
|
+
}
|
181
|
+
}
|
182
|
+
};
|
183
|
+
|
184
|
+
/** @private
|
185
|
+
* @param {number} a
|
186
|
+
* @param {number} b
|
187
|
+
* @return {number}
|
188
|
+
*/
|
189
|
+
var ascNumberSorter = function (a, b) {
|
190
|
+
return a - b;
|
191
|
+
};
|
192
|
+
|
193
|
+
/** @private
|
194
|
+
* @param {number} min
|
195
|
+
* @param {number} max
|
196
|
+
* @param {number} elem
|
197
|
+
* @return {boolean}
|
198
|
+
*/
|
199
|
+
var inRangeFilter = function (min, max, elem) {
|
200
|
+
return elem >= min && elem <= max;
|
201
|
+
};
|
202
|
+
|
203
|
+
/** @private
|
204
|
+
* @param {string} sortField
|
205
|
+
* @param {Object} elemData
|
206
|
+
* @param {number} index
|
207
|
+
*/
|
208
|
+
var mapRowOrder = function (sortField, elemData, index) { // edit name
|
209
|
+
elemData[sortField] = index; // Make column for sort with user data array
|
210
|
+
};
|
211
|
+
|
212
|
+
/** @private
|
213
|
+
* @param {string} rowDefA
|
214
|
+
* @param {string} rowDefB
|
215
|
+
* @param {string} sortOrder
|
216
|
+
* @param {string} fieldName
|
217
|
+
* @return {number} The outcome of the value comparison
|
218
|
+
*/
|
219
|
+
var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit name
|
220
|
+
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
221
|
+
};
|
222
|
+
|
223
|
+
/** @constructor
|
224
|
+
* @extends {EventDispatcher}
|
225
|
+
* @param {(Element|null)=} placeholder
|
226
|
+
* @param {Grid~GridOptions=} config
|
227
|
+
*/
|
228
|
+
var Grid = function(placeholder, config) {
|
229
|
+
var t = this; // This is to primarily reduce file size
|
230
|
+
|
231
|
+
t._onDataChanged = t._onDataChanged.bind(t);
|
232
|
+
t._onDataComposed = t._onDataComposed.bind(t);
|
233
|
+
t._recalculateFormulas = t._recalculateFormulas.bind(t);
|
234
|
+
t._updateStreamingData = t._updateStreamingData.bind(t);
|
235
|
+
t.updateColumnTitle = t.updateColumnTitle.bind(t);
|
236
|
+
|
237
|
+
t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
|
238
|
+
t._asyncClearDataUpdates = t._asyncClearDataUpdates.bind(t);
|
239
|
+
t._clearDataUpdates = t._clearDataUpdates.bind(t);
|
240
|
+
t._onPreDataSorting = t._onPreDataSorting.bind(t);
|
241
|
+
t._mainSorter = t._mainSorter.bind(t);
|
242
|
+
t._updateRowData = t._updateRowData.bind(t);
|
243
|
+
t._onFormulaDataChanged = t._onFormulaDataChanged.bind(t);
|
244
|
+
t._onFormulaDataRequired = t._onFormulaDataRequired.bind(t);
|
245
|
+
t._addMemberOfChain = t._addMemberOfChain.bind(t);
|
246
|
+
t._onColumnAdded = t._onColumnAdded.bind(t);
|
247
|
+
t._onRowExpansionBinding = t._onRowExpansionBinding.bind(t);
|
248
|
+
t._onColumnHeaderBinding = t._onColumnHeaderBinding.bind(t);
|
249
|
+
t._getRowId = t._getRowId.bind(t);
|
250
|
+
t._onFieldLoadedError = t._onFieldLoadedError.bind(t);
|
251
|
+
|
252
|
+
t._snapshotFillerDataChanged = t._snapshotFillerDataChanged.bind(t);
|
253
|
+
|
254
|
+
t._streamingConflator = new Conflator(50, t._updateStreamingData);
|
255
|
+
t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
|
256
|
+
t._chainConflator = new Conflator(100, t._addMemberOfChain);
|
257
|
+
t._columnTitleConflator = new Conflator(0, t.updateColumnTitle);
|
258
|
+
|
259
|
+
t._defaultColumnOptions = {};
|
260
|
+
|
261
|
+
t._topNode = placeholder || Dom.div();
|
262
|
+
t._topNode.classList.add("rt-grid");
|
263
|
+
t._grid = new Core();
|
264
|
+
t._grid._wrapper = this; // For back referencing
|
265
|
+
|
266
|
+
t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
|
267
|
+
|
268
|
+
t._stp = new SortableTitlePlugin({
|
269
|
+
"userManagedLogic": true,
|
270
|
+
"sortableColumns": true,
|
271
|
+
"disableDoubleClickToSort": true,
|
272
|
+
"ROW_DEF": true // Enable Row Definition Mode
|
273
|
+
});
|
274
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
275
|
+
|
276
|
+
t._dtp = new DragAndDropTitlePlugin();
|
277
|
+
|
278
|
+
// WARNING: These two plugins don't have normal workflow unlike other extensions. defaultColumnOptions property does not work with these two.
|
279
|
+
// beforeInit does not get called.
|
280
|
+
t._grid.loadPlugin(t._stp, config);
|
281
|
+
t._grid.loadPlugin(t._dtp);
|
282
|
+
|
283
|
+
t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
|
284
|
+
t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
|
285
|
+
|
286
|
+
t._grid.enableRowHighlighting(true);
|
287
|
+
|
288
|
+
t._dc = new DataCache();
|
289
|
+
t._dc.listen("dataChanged", t._onDataChanged);
|
290
|
+
t._dc.listen("dataComposed", t._onDataComposed);
|
291
|
+
t._dc.listen("dataComposed", t._recalculateFormulas); // This will be called after _onDataComposed
|
292
|
+
|
293
|
+
t._dt = new DataTable();
|
294
|
+
t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
|
295
|
+
t._dv = new DataView(t._dt);
|
296
|
+
t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
|
297
|
+
t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
|
298
|
+
|
299
|
+
t._addGridSections();
|
300
|
+
t._grid.setDataSource(t._dv);
|
301
|
+
t._grid.setParent(t._topNode);
|
302
|
+
|
303
|
+
t._snapshot = new SnapshotFiller();
|
304
|
+
t._snapshot.addEventListener("adcDataReceived", t._dispatch.bind(t, "adcDataReceived"));
|
305
|
+
t._snapshot.addEventListener("dataChanged", this._snapshotFillerDataChanged);
|
306
|
+
|
307
|
+
t._connector = new DataConnector();
|
308
|
+
t._connector.addEventListener("ricAdded", t._onRicAdded.bind(t));
|
309
|
+
t._connector.addEventListener("ricRemoved", t._onRicRemoved.bind(t));
|
310
|
+
t._connector.addEventListener("fieldAdded", t._onFieldAdded.bind(t));
|
311
|
+
t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
|
312
|
+
|
313
|
+
t._fnEngine = new Engine();
|
314
|
+
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
315
|
+
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
316
|
+
|
317
|
+
t.initialize(config);
|
318
|
+
t.initSubscription();
|
319
|
+
|
320
|
+
StyleLoader.applyStyle(t._grid);
|
321
|
+
};
|
322
|
+
Ext.inherits(Grid, EventDispatcher);
|
323
|
+
|
324
|
+
/** @private
|
325
|
+
* @type {Element}
|
326
|
+
*/
|
327
|
+
Grid.prototype._topNode = null;
|
328
|
+
/** @private
|
329
|
+
* @type {Core}
|
330
|
+
*/
|
331
|
+
Grid.prototype._grid = null;
|
332
|
+
/** Store all actual data including streaming data, ADC data, snapshot data, user input data.
|
333
|
+
* @type {DataCache}
|
334
|
+
* @private
|
335
|
+
*/
|
336
|
+
Grid.prototype._dc = null;
|
337
|
+
/** Used for hiding and filtering out rows. Always have greater or equal number of rows than that in grid
|
338
|
+
* @type {DataTable}
|
339
|
+
* @private
|
340
|
+
*/
|
341
|
+
Grid.prototype._dt = null;
|
342
|
+
/** Used for sorting. Number of rows is always the same as that in grid
|
343
|
+
* @type {DataView}
|
344
|
+
* @private
|
345
|
+
*/
|
346
|
+
Grid.prototype._dv = null;
|
347
|
+
/** JET.Quotes2 Subscription
|
348
|
+
* @type {Object}
|
349
|
+
* @private
|
350
|
+
*/
|
351
|
+
Grid.prototype._subs = null;
|
352
|
+
|
353
|
+
/** @type {SortableTitlePlugin}
|
354
|
+
* @private
|
355
|
+
*/
|
356
|
+
Grid.prototype._stp = null;
|
357
|
+
/** @type {DragAndDropTitlePlugin}
|
358
|
+
* @private
|
359
|
+
*/
|
360
|
+
Grid.prototype._dtp = null;
|
361
|
+
/** @type {Function}
|
362
|
+
* @private
|
363
|
+
*/
|
364
|
+
Grid.prototype._columnSorter = null;
|
365
|
+
|
366
|
+
/** @private
|
367
|
+
* @type {Conflator}
|
368
|
+
*/
|
369
|
+
Grid.prototype._streamingConflator = null;
|
370
|
+
/** @private
|
371
|
+
* @type {SnapshotFiller}
|
372
|
+
*/
|
373
|
+
Grid.prototype._snapshot = null;
|
374
|
+
/** @private
|
375
|
+
* @type {DataConnector}
|
376
|
+
*/
|
377
|
+
Grid.prototype._connector = null;
|
378
|
+
|
379
|
+
/** @private
|
380
|
+
* @type {Engine}
|
381
|
+
*/
|
382
|
+
Grid.prototype._fnEngine = null;
|
383
|
+
/** @private
|
384
|
+
* @type {Conflator}
|
385
|
+
*/
|
386
|
+
Grid.prototype._formulaConflator = null;
|
387
|
+
|
388
|
+
/** @private
|
389
|
+
* @type {Object.<string, Object>}
|
390
|
+
*/
|
391
|
+
Grid.prototype._chainMembers = null;
|
392
|
+
/** @private
|
393
|
+
* @type {Conflator}
|
394
|
+
*/
|
395
|
+
Grid.prototype._chainConflator = null;
|
396
|
+
/** @private
|
397
|
+
* @type {boolean}
|
398
|
+
*/
|
399
|
+
Grid.prototype._hasGroup = false;
|
400
|
+
/** @private
|
401
|
+
* @type {number}
|
402
|
+
*/
|
403
|
+
Grid.prototype._clientWidth = NaN;
|
404
|
+
/** @private
|
405
|
+
* @type {number}
|
406
|
+
*/
|
407
|
+
Grid.prototype._autoLayoutTimer = 0;
|
408
|
+
/** @private
|
409
|
+
* @type {ColumnDefinition~Options}
|
410
|
+
*/
|
411
|
+
Grid.prototype._defaultColumnOptions = null;
|
412
|
+
/** @private
|
413
|
+
* @type {*}
|
414
|
+
*/
|
415
|
+
Grid.prototype._RTK = null;
|
416
|
+
/** use for synapse service
|
417
|
+
* @private
|
418
|
+
* @type {string}
|
419
|
+
*/
|
420
|
+
Grid.prototype._synapse = null;
|
421
|
+
/** @private
|
422
|
+
* @type {boolean}
|
423
|
+
*/
|
424
|
+
Grid.prototype._autoDateConversion = false;
|
425
|
+
/** @private
|
426
|
+
* @type {boolean}
|
427
|
+
*/
|
428
|
+
Grid.prototype._textSelect = false;
|
429
|
+
/** @private
|
430
|
+
* @type {string}
|
431
|
+
*/
|
432
|
+
Grid.prototype._lang = null;
|
433
|
+
/**
|
434
|
+
* @private
|
435
|
+
* @type {boolean}
|
436
|
+
*/
|
437
|
+
Grid.prototype._initializing = false;
|
438
|
+
|
439
|
+
|
440
|
+
/** @public
|
441
|
+
*/
|
442
|
+
Grid.prototype.dispose = function() {
|
443
|
+
this.removeAllEventListeners();
|
444
|
+
if(this._autoLayoutTimer) {
|
445
|
+
clearInterval(this._autoLayoutTimer);
|
446
|
+
this._autoLayoutTimer = 0;
|
447
|
+
}
|
448
|
+
this.removeAllColumns(); // Some conflators are reset
|
449
|
+
this.removeAllRows(); // Some conflators are reset
|
450
|
+
this._grid.dispose();
|
451
|
+
this._connector.reset();
|
452
|
+
|
453
|
+
if(this._subs) {
|
454
|
+
this._subs["dispose"]();
|
455
|
+
this._subs = null;
|
456
|
+
}
|
457
|
+
};
|
458
|
+
/** @public
|
459
|
+
* @return {Element}
|
460
|
+
*/
|
461
|
+
Grid.prototype.getElement = function() {
|
462
|
+
return this._topNode;
|
463
|
+
};
|
464
|
+
/** Alias to {@link EventDispatcher#removeAllEventListeners}
|
465
|
+
* @public
|
466
|
+
* @function
|
467
|
+
*/
|
468
|
+
Grid.prototype.removeEventListeners = Grid.prototype.removeAllEventListeners;
|
469
|
+
/** Alias to {@link EventDispatcher#addEventListener}
|
470
|
+
* @public
|
471
|
+
* @function
|
472
|
+
* @param {string} type Event name
|
473
|
+
* @param {Function} handler Event handler
|
474
|
+
*/
|
475
|
+
Grid.prototype.listen = Grid.prototype.addEventListener;
|
476
|
+
/** @public
|
477
|
+
*/
|
478
|
+
Grid.prototype.initSubscription = function() {
|
479
|
+
if(this._dc.getSubscriptions()) { // Subscription is already initialized
|
480
|
+
return;
|
481
|
+
}
|
482
|
+
|
483
|
+
var jet, q, s;
|
484
|
+
jet = window["JET"]; // Assume that JET is already exist.
|
485
|
+
if (this._RTK) {
|
486
|
+
q = this._RTK.Quotes;
|
487
|
+
} else if(jet) {
|
488
|
+
q = jet["Quotes2"];
|
489
|
+
}
|
490
|
+
if(q) {
|
491
|
+
s = q["create"]();
|
492
|
+
}
|
493
|
+
if(!s) {
|
494
|
+
return;
|
495
|
+
}
|
496
|
+
if(s["filter"]) {
|
497
|
+
s["filter"](-2, -1); // Enable skip header for chains
|
498
|
+
}
|
499
|
+
|
500
|
+
this._subs = s;
|
501
|
+
this._subs["start"]();
|
502
|
+
this._dc.setSubscriptions(s);
|
503
|
+
|
504
|
+
// TODO: Subscriptions should be registered per row.
|
505
|
+
// However, chain subscription cannot be integrated with DataConnector in this current implementation.
|
506
|
+
var rowDefs = this._getAllRowDefinitions();
|
507
|
+
var len = rowDefs.length;
|
508
|
+
for(var i = 0; i < len; ++i) {
|
509
|
+
var rowDef = rowDefs[i];
|
510
|
+
if(rowDef) {
|
511
|
+
rowDef.subscribeForUpdates();
|
512
|
+
}
|
513
|
+
}
|
514
|
+
};
|
515
|
+
|
516
|
+
/** @public
|
517
|
+
*/
|
518
|
+
Grid.prototype.updateLayout = function() {
|
519
|
+
this._grid.updateLayout();
|
520
|
+
this._stp.updateSortSymbols(); // HACK: There is a chance that grid may not yet be in the document
|
521
|
+
};
|
522
|
+
/** Force rerender of grid row. TODO: Check this could be deprecated in favor of Core's requestRowRefresh method
|
523
|
+
* @private
|
524
|
+
* @param {number=} rowIndex
|
525
|
+
*/
|
526
|
+
Grid.prototype._updateRowData = function(rowIndex) {
|
527
|
+
if(rowIndex >= 0) {
|
528
|
+
var rowId = this._dv.getRowId(rowIndex);
|
529
|
+
if(rowId) {
|
530
|
+
this._dt.setRowData(rowId, {});
|
531
|
+
}
|
532
|
+
} else {
|
533
|
+
this._dt.dispatchGlobalChange(); // Trigger sorting too
|
534
|
+
}
|
535
|
+
};
|
536
|
+
/** @public
|
537
|
+
* @function
|
538
|
+
* @param {number=} opt_rowIndex
|
539
|
+
*/
|
540
|
+
Grid.prototype.updateRowData = Grid.prototype._updateRowData;
|
541
|
+
|
542
|
+
/** @private
|
543
|
+
*/
|
544
|
+
Grid.prototype._addGridSections = function () {
|
545
|
+
var title = this._grid.addSection("title");
|
546
|
+
title.setRowCount(1);
|
547
|
+
this._grid.addSection("content");
|
548
|
+
|
549
|
+
var titleSettings = this._grid.getSectionSettings("title");
|
550
|
+
titleSettings.disableDataBinding();
|
551
|
+
|
552
|
+
var contentSettings = this._grid.getSectionSettings("content");
|
553
|
+
contentSettings.setAutoSyncRowCount(true);
|
554
|
+
contentSettings.setParent(titleSettings);
|
555
|
+
};
|
556
|
+
/** @public
|
557
|
+
* @param {string=} sectionName
|
558
|
+
* @return {*} Return Section instance
|
559
|
+
*/
|
560
|
+
Grid.prototype.addHeaderSection = function (sectionName) {
|
561
|
+
var titleSects = this._grid.getAllSections("title");
|
562
|
+
|
563
|
+
var headerSect = this._grid.addSectionAt(titleSects.length, "title", sectionName);
|
564
|
+
if(headerSect) {
|
565
|
+
headerSect.setRowCount(1);
|
566
|
+
|
567
|
+
var headerSettings = this._grid.getSectionSettings(headerSect);
|
568
|
+
headerSettings.disableDataBinding();
|
569
|
+
}
|
570
|
+
|
571
|
+
return headerSect;
|
572
|
+
};
|
573
|
+
/** @public
|
574
|
+
* @param {string=} sectionName
|
575
|
+
* @return {*} Return Section instance
|
576
|
+
*/
|
577
|
+
Grid.prototype.addFooterSection = function (sectionName) {
|
578
|
+
var footerSect = this._grid.addSection("footer", sectionName);
|
579
|
+
if(footerSect) {
|
580
|
+
footerSect.setRowCount(1);
|
581
|
+
|
582
|
+
var footerSettings = this._grid.getSectionSettings(footerSect);
|
583
|
+
footerSettings.disableDataBinding();
|
584
|
+
}
|
585
|
+
|
586
|
+
return footerSect;
|
587
|
+
};
|
588
|
+
|
589
|
+
/** @public
|
590
|
+
* @param {Element} elem Parent element
|
591
|
+
*/
|
592
|
+
Grid.prototype.setParent = function (elem) {
|
593
|
+
Dom.appendChild(elem, this._topNode);
|
594
|
+
this.updateLayout();
|
595
|
+
};
|
596
|
+
/** @public
|
597
|
+
* @param {Element} elem Sibling element
|
598
|
+
*/
|
599
|
+
Grid.prototype.insertBefore = function (elem) {
|
600
|
+
if(elem) {
|
601
|
+
var pn = elem.parentNode;
|
602
|
+
if(pn) {
|
603
|
+
pn.insertBefore(this._topNode, elem);
|
604
|
+
this.updateLayout();
|
605
|
+
}
|
606
|
+
}
|
607
|
+
};
|
608
|
+
/** The returned object contains <br>
|
609
|
+
* `boolean` hit : Indicates whether the given position is on the grid <br>
|
610
|
+
* `number` x : Horizontal coordinate that is relative to the top-left of the grid (Zero means left-most) <br>
|
611
|
+
* `number` y : Vertical coordinate that is relative to the top-left of the grid (Zero means top-most) <br>
|
612
|
+
* `number` colIndex <br>
|
613
|
+
* `number` sectionIndex <br>
|
614
|
+
* `number` rowIndex <br>
|
615
|
+
* and other related property to the given position.
|
616
|
+
* @public
|
617
|
+
* @param {!ElementWrapper|Element|Event|MouseEvent} obj Element, Browser's Event object, Browser's Mouse Event object are all valid
|
618
|
+
* @return {!Object}
|
619
|
+
*/
|
620
|
+
Grid.prototype.getRelativePosition = function (obj) {
|
621
|
+
return this._grid.getRelativePosition(obj);
|
622
|
+
};
|
623
|
+
/** The returned core grid
|
624
|
+
* @public
|
625
|
+
* @return {Core}
|
626
|
+
*/
|
627
|
+
Grid.prototype.getCoreGrid = function () {
|
628
|
+
return this._grid;
|
629
|
+
};
|
630
|
+
|
631
|
+
/** @public
|
632
|
+
* @param {Grid~GridOptions=} gridOption
|
633
|
+
*/
|
634
|
+
Grid.prototype.initialize = function(gridOption) {
|
635
|
+
if (!gridOption) { return; }
|
636
|
+
// TODO: clear all data before re-initialization
|
637
|
+
var t = this; // For minimizing file size
|
638
|
+
t._initializing = true;
|
639
|
+
var grid = t._grid; // core grid
|
640
|
+
var exts = gridOption["plugins"] || gridOption["extensions"];
|
641
|
+
|
642
|
+
var cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
|
643
|
+
if (gridOption["defaultColumnOptions"]) {
|
644
|
+
t._defaultColumnOptions = gridOption["defaultColumnOptions"];
|
645
|
+
t._defaultColumnSetup(t._defaultColumnOptions, cols);
|
646
|
+
}
|
647
|
+
|
648
|
+
// Tell all plugins that the initialization phase has started
|
649
|
+
t._processExtension(exts, "beforeInit", [grid.getElement(), gridOption]);
|
650
|
+
|
651
|
+
// option flag text-select
|
652
|
+
// allow user to select text for copy or so something
|
653
|
+
if (gridOption['textSelect']) {
|
654
|
+
t._textSelect = true;
|
655
|
+
grid.addClass('tr-text-select');
|
656
|
+
}
|
657
|
+
|
658
|
+
if (gridOption["RTK"]) {
|
659
|
+
t._RTK = gridOption["RTK"];
|
660
|
+
t._snapshot.setRTK(t._RTK);
|
661
|
+
}
|
662
|
+
if (gridOption["synapse"]) {
|
663
|
+
t._synapse = gridOption["synapse"];
|
664
|
+
FieldDefinition.setSynapseConfig(t._synapse);
|
665
|
+
}
|
666
|
+
|
667
|
+
if (gridOption["icons"] && gridOption["icons"]["rowGrouping"] && gridOption["icons"]["rowGrouping"]["expander"]) {
|
668
|
+
StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
|
669
|
+
}
|
670
|
+
|
671
|
+
var borders = gridOption["borders"];
|
672
|
+
if (borders != null) {
|
673
|
+
grid.toggleBorders(borders);
|
674
|
+
}
|
675
|
+
var gridlines = gridOption["gridlines"];
|
676
|
+
if (gridlines != null) {
|
677
|
+
grid.toggleGridlines(gridlines);
|
678
|
+
}
|
679
|
+
var vLines = gridOption["verticalLines"];
|
680
|
+
if (vLines != null) {
|
681
|
+
grid.toggleVerticalLines(vLines);
|
682
|
+
}
|
683
|
+
var hLines = gridOption["horizontalLines"];
|
684
|
+
if (hLines != null) {
|
685
|
+
grid.toggleHorizontalLines(hLines);
|
686
|
+
}
|
687
|
+
|
688
|
+
if(gridOption["pageSize"]) {
|
689
|
+
t._dv.setPageSize(+gridOption["pageSize"]);
|
690
|
+
}
|
691
|
+
|
692
|
+
var rowHeight = +gridOption["rowHeight"];
|
693
|
+
if(rowHeight) { // Non empty or zero
|
694
|
+
grid.setDefaultRowHeight(rowHeight);
|
695
|
+
}
|
696
|
+
var hRowHeight = +gridOption["headerRowHeight"];
|
697
|
+
if(hRowHeight) { // Non empty or zero
|
698
|
+
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
699
|
+
}
|
700
|
+
|
701
|
+
var noColumnDragging = gridOption["noColumnDragging"];
|
702
|
+
if (noColumnDragging == null && gridOption["columnReorder"] != null) {
|
703
|
+
noColumnDragging = !gridOption["columnReorder"];
|
704
|
+
}
|
705
|
+
if (noColumnDragging) {
|
706
|
+
t._dtp.disable();
|
707
|
+
}
|
708
|
+
|
709
|
+
var val = gridOption["autoLayoutUpdate"];
|
710
|
+
if(!t._autoLayoutTimer && val) {
|
711
|
+
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
712
|
+
t._autoLayoutTimer = setInterval(t._onAutoLayoutUpdate.bind(t), 2000);
|
713
|
+
}
|
714
|
+
}
|
715
|
+
|
716
|
+
var bool = gridOption["rowHighlighting"];
|
717
|
+
if(bool != null) {
|
718
|
+
grid.enableRowHighlighting(!!bool);
|
719
|
+
}
|
720
|
+
|
721
|
+
var rowExpansionBinding = gridOption["rowExpansionBinding"];
|
722
|
+
if(typeof rowExpansionBinding === "function") {
|
723
|
+
grid.listen("rowExpansionBinding", t._onRowExpansionBinding); // TODO: Support multi-table feature
|
724
|
+
t.listen("rowExpansionBinding", rowExpansionBinding);
|
725
|
+
}
|
726
|
+
|
727
|
+
var dataComposedHandler = gridOption["dataComposed"];
|
728
|
+
if(typeof dataComposedHandler === "function") {
|
729
|
+
t.listen("dataComposed", dataComposedHandler);
|
730
|
+
}
|
731
|
+
|
732
|
+
if(gridOption["autoDateConversion"]) {
|
733
|
+
t._autoDateConversion = true;
|
734
|
+
}
|
735
|
+
|
736
|
+
if(gridOption["stepScroll"]) {
|
737
|
+
grid.setRowScrollingStep(1);
|
738
|
+
}
|
739
|
+
if(gridOption["linearWheelScrolling"]) {
|
740
|
+
grid.getVScrollbar().setMouseWheelSpeed("linear");
|
741
|
+
}
|
742
|
+
if(gridOption["autoHideScrollbar"] != null) {
|
743
|
+
grid.autoHideScrollbars(gridOption["autoHideScrollbar"] ? true : false);
|
744
|
+
}
|
745
|
+
|
746
|
+
// Column operations
|
747
|
+
t.setColumns(cols);
|
748
|
+
|
749
|
+
var columnFreezing = gridOption["columnFreezing"] || gridOption["freezeColumn"];
|
750
|
+
if(columnFreezing == null) {
|
751
|
+
columnFreezing = -1; // Prevent disable scroll when passing null
|
752
|
+
}
|
753
|
+
|
754
|
+
var pinnedRightColumns = gridOption["pinnedRightColumns"];
|
755
|
+
|
756
|
+
var rowVir = true;
|
757
|
+
if (gridOption["rowVirtualRendering"] != null) {
|
758
|
+
rowVir = gridOption["rowVirtualRendering"];
|
759
|
+
}
|
760
|
+
if (gridOption["rowVirtualization"] != null) {
|
761
|
+
rowVir = gridOption["rowVirtualization"];
|
762
|
+
}
|
763
|
+
grid.enableRowVirtualization(!!rowVir);
|
764
|
+
|
765
|
+
if (!pinnedRightColumns) {
|
766
|
+
var colVir = false;
|
767
|
+
if (gridOption["columnVirtualRendering"] != null) {
|
768
|
+
colVir = gridOption["columnVirtualRendering"];
|
769
|
+
}
|
770
|
+
if (gridOption["columnVirtualization"] != null) {
|
771
|
+
colVir = gridOption["columnVirtualization"];
|
772
|
+
}
|
773
|
+
grid.enableColumnVirtualization(!!colVir);
|
774
|
+
}
|
775
|
+
|
776
|
+
var scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
|
777
|
+
if (scrollbar) {
|
778
|
+
t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
|
779
|
+
grid.freezeColumn(columnFreezing, pinnedRightColumns); // Enable horizontal scrollbar
|
780
|
+
} else {
|
781
|
+
grid.freezeSection(null); // Disable vertical scrollbar
|
782
|
+
t._topNode.style.overflow = "";
|
783
|
+
}
|
784
|
+
|
785
|
+
var topFreezingCount = gridOption["topFreezingCount"];
|
786
|
+
if (typeof topFreezingCount === "number") {
|
787
|
+
topFreezingCount = (topFreezingCount > 0) ? topFreezingCount : 0;
|
788
|
+
var sectionIndex = topFreezingCount - 1;
|
789
|
+
grid.freezeSection(sectionIndex);
|
790
|
+
} else if (topFreezingCount === false) {
|
791
|
+
grid.freezeSection(null);
|
792
|
+
}
|
793
|
+
|
794
|
+
var bottomFreezingCount = gridOption["bottomFreezingCount"];
|
795
|
+
if (typeof bottomFreezingCount === "number") {
|
796
|
+
bottomFreezingCount = (bottomFreezingCount > 0) ? bottomFreezingCount : 0;
|
797
|
+
grid.freezeFooter(bottomFreezingCount);
|
798
|
+
}
|
799
|
+
|
800
|
+
t.addDataFields(gridOption["dataFields"]);
|
801
|
+
|
802
|
+
// Plugins
|
803
|
+
gridOption[ROW_DEF] = true; // Enable ROW_DEF mode
|
804
|
+
if (Array.isArray(exts)) {
|
805
|
+
for (var i = 0; i < exts.length; ++i) {
|
806
|
+
var ext = exts[i];
|
807
|
+
var extInstance = null;
|
808
|
+
if (ext) {
|
809
|
+
var extName = ext["name"];
|
810
|
+
if(extName) {
|
811
|
+
extInstance = grid.loadPlugin(extName, ext); // pass plugin object as an argument for initialization
|
812
|
+
} else {
|
813
|
+
extInstance = grid.loadPlugin(ext, gridOption);
|
814
|
+
}
|
815
|
+
}
|
816
|
+
if (extInstance && extInstance["setGridWrapper"]) {
|
817
|
+
var hasApi = (typeof extInstance["getGridApi"] === "function") ? extInstance["getGridApi"]() : false;
|
818
|
+
if(!hasApi) {
|
819
|
+
extInstance["setGridWrapper"]("realTimeGrid", t);
|
820
|
+
}
|
821
|
+
}
|
822
|
+
}
|
823
|
+
t._initializing = false;
|
824
|
+
}
|
825
|
+
|
826
|
+
var lang = gridOption["lang"];
|
827
|
+
if(lang != null) {
|
828
|
+
t._lang = lang;
|
829
|
+
DateTime.setLocale(lang);
|
830
|
+
}
|
831
|
+
|
832
|
+
// Row operations
|
833
|
+
var rows = gridOption["rows"];
|
834
|
+
if(!rows) {
|
835
|
+
rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
|
836
|
+
}
|
837
|
+
var bodies = /** @type{Array} */(gridOption["bodies"]);
|
838
|
+
if(!bodies) {
|
839
|
+
bodies = [];
|
840
|
+
if(gridOption["body"]) {
|
841
|
+
bodies.push(gridOption["body"]);
|
842
|
+
}
|
843
|
+
if(rows) {
|
844
|
+
for(var m = 0; m < rows.length; m++) {
|
845
|
+
if(typeof rows[m] === "string") {
|
846
|
+
rows[m] = { "ric": rows[m] };
|
847
|
+
}
|
848
|
+
}
|
849
|
+
bodies.push({ "rows": rows });
|
850
|
+
}
|
851
|
+
}
|
852
|
+
|
853
|
+
// Merge rows with static data rows
|
854
|
+
var staticRows = gridOption["staticDataRows"] || gridOption["dataModel"];
|
855
|
+
if(rows && staticRows) {
|
856
|
+
var ary = staticRows["data"] ? staticRows["data"] : staticRows;
|
857
|
+
var fields = staticRows["fields"] || t.getColumnFields();
|
858
|
+
var values, data;
|
859
|
+
var len = rows.length;
|
860
|
+
for(var n = 0; n < len; n++) {
|
861
|
+
if(rows[n]["values"]) { // merge row's values, values can be object or array
|
862
|
+
values = arrayToObject(rows[n]["values"], fields);
|
863
|
+
data = arrayToObject(ary[n], fields);
|
864
|
+
rows[n]["values"] = extendObject(values, data);
|
865
|
+
} else {
|
866
|
+
rows[n]["values"] = ary[n];
|
867
|
+
}
|
868
|
+
}
|
869
|
+
ary = ary.slice(len, ary.length);
|
870
|
+
if(staticRows["data"]) {
|
871
|
+
staticRows["data"] = ary;
|
872
|
+
} else {
|
873
|
+
staticRows = ary;
|
874
|
+
}
|
875
|
+
}
|
876
|
+
|
877
|
+
for(var j = 0; j < bodies.length; ++j) {
|
878
|
+
t.insertRows(bodies[j]["rows"]);
|
879
|
+
// break; // TODO: The first version supports only 1 grid
|
880
|
+
}
|
881
|
+
|
882
|
+
t.addStaticDataRows(staticRows);
|
883
|
+
|
884
|
+
if(gridOption.contentBottomPadding) {
|
885
|
+
grid.setBottomPaddingSection(gridOption.contentBottomPadding);
|
886
|
+
}
|
887
|
+
|
888
|
+
var contentRightPadding = gridOption.contentRightPadding;
|
889
|
+
if(contentRightPadding) {
|
890
|
+
if (typeof contentRightPadding !== "number") {
|
891
|
+
contentRightPadding = 6;
|
892
|
+
}
|
893
|
+
|
894
|
+
grid.reserveRightSpace(contentRightPadding);
|
895
|
+
}
|
896
|
+
|
897
|
+
// Let everything init first
|
898
|
+
// then set conflationRate to grid for better perfomance on rapidly updating
|
899
|
+
var dataConflationRate = gridOption['dataConflationRate'];
|
900
|
+
if (dataConflationRate != null) {
|
901
|
+
grid.setDataConflationRate(dataConflationRate);
|
902
|
+
}
|
903
|
+
|
904
|
+
// Tell all plugins that the initialization phase has ended
|
905
|
+
var extObjects = grid.getPluginList().map(grid.getPlugin.bind(grid));
|
906
|
+
t._processExtension(extObjects, "afterInit");
|
907
|
+
};
|
908
|
+
|
909
|
+
/** @public
|
910
|
+
* @param {Object=} gridOptions
|
911
|
+
* @return {!Object}
|
912
|
+
*/
|
913
|
+
Grid.prototype.getConfigObject = function (gridOptions) {
|
914
|
+
var obj = gridOptions || {};
|
915
|
+
|
916
|
+
var columns = obj.columns;
|
917
|
+
if(!columns) {
|
918
|
+
columns = obj.columns = [];
|
919
|
+
}
|
920
|
+
|
921
|
+
var grid = this._grid;
|
922
|
+
if(grid.getConfigObject) {
|
923
|
+
grid.getConfigObject(obj);
|
924
|
+
}
|
925
|
+
|
926
|
+
var len = this.getColumnCount();
|
927
|
+
for (var i = 0; i < len; ++i) {
|
928
|
+
var column = columns[i];
|
929
|
+
if(!column) {
|
930
|
+
column = columns[i] = {};
|
931
|
+
}
|
932
|
+
var colDef = this.getColumnDefinition(i);
|
933
|
+
// TODO: Update width and scalability changed by the extensions
|
934
|
+
colDef.getConfigObject(column);
|
935
|
+
}
|
936
|
+
|
937
|
+
if(this._topNode.style.overflow === "") {
|
938
|
+
obj["scrollbar"] = false;
|
939
|
+
}
|
940
|
+
|
941
|
+
var val = this._dv.getPageSize();
|
942
|
+
if(val > 0) {
|
943
|
+
obj["pageSize"] = val;
|
944
|
+
}
|
945
|
+
|
946
|
+
val = grid.getDefaultRowHeight();
|
947
|
+
if(val !== 32) {
|
948
|
+
obj["rowHeight"] = val;
|
949
|
+
}
|
950
|
+
|
951
|
+
val = grid.getSection("title").getDefaultRowHeight();
|
952
|
+
if(val !== 32) {
|
953
|
+
obj["headerRowHeight"] = val;
|
954
|
+
}
|
955
|
+
|
956
|
+
if(this._autoLayoutTimer) {
|
957
|
+
obj["autoLayoutUpdate"] = true;
|
958
|
+
}
|
959
|
+
|
960
|
+
val = grid.getHScrollStartIndex();
|
961
|
+
if(val > 0) {
|
962
|
+
obj["columnFreezing"] = val - 1;
|
963
|
+
}
|
964
|
+
|
965
|
+
if (this._defaultColumnOptions) {
|
966
|
+
obj["defaultColumnOptions"] = this._defaultColumnOptions;
|
967
|
+
}
|
968
|
+
|
969
|
+
if(this._autoDateConversion) {
|
970
|
+
obj["autoDateConversion"] = true;
|
971
|
+
}
|
972
|
+
|
973
|
+
if (this._textSelect) {
|
974
|
+
obj["textSelect"] = true;
|
975
|
+
}
|
976
|
+
|
977
|
+
if (this._lang) {
|
978
|
+
obj["lang"] = this._lang;
|
979
|
+
}
|
980
|
+
|
981
|
+
// TODO: The following states need to be retrieved
|
982
|
+
// noColumnDragging
|
983
|
+
// rowHighlighting
|
984
|
+
// pinnedRightColumns
|
985
|
+
// columnVirtualization
|
986
|
+
// topFreezingCount, bottomFreezingCount
|
987
|
+
|
988
|
+
// NOTE: no need to export synapseApiKey and RTK
|
989
|
+
|
990
|
+
return obj;
|
991
|
+
};
|
992
|
+
|
993
|
+
/** @private
|
994
|
+
* @param {Object} defaultCol
|
995
|
+
* @param {Array.<Object>} userColumns
|
996
|
+
*/
|
997
|
+
Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
|
998
|
+
var c = userColumns.length;
|
999
|
+
for (var i = 0; i < c; i++) {
|
1000
|
+
var column = userColumns[i];
|
1001
|
+
if (typeof column === 'object') {
|
1002
|
+
for (var key in defaultCol) {
|
1003
|
+
if (column[key] == null) {
|
1004
|
+
column[key] = defaultCol[key];
|
1005
|
+
}
|
1006
|
+
}
|
1007
|
+
}
|
1008
|
+
// TODO: Handle columnOption type string
|
1009
|
+
// else if (typeof column === 'string') { }
|
1010
|
+
}
|
1011
|
+
};
|
1012
|
+
|
1013
|
+
/** @private
|
1014
|
+
* @param {Array.<Object>} exts List of plugin instance
|
1015
|
+
* @param {string} field A function name of plugin instance
|
1016
|
+
* @param {Array.<*>} params Inputs that will pass to a function call
|
1017
|
+
*/
|
1018
|
+
Grid.prototype._processExtension = function (exts, field, params) {
|
1019
|
+
if(Array.isArray(exts)) {
|
1020
|
+
for (var i = 0; i < exts.length; i++) {
|
1021
|
+
if (exts[i][field]) {
|
1022
|
+
exts[i][field].apply(exts[i], params);
|
1023
|
+
}
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
};
|
1027
|
+
|
1028
|
+
/** @private
|
1029
|
+
* @param {Object} e
|
1030
|
+
*/
|
1031
|
+
Grid.prototype._onRicAdded = function(e) {
|
1032
|
+
var addedRics = e.addedRics;
|
1033
|
+
this._snapshot.addFields(e.fields);
|
1034
|
+
var len = addedRics.length;
|
1035
|
+
for (var i = 0; i < len; ++i) {
|
1036
|
+
var ric = addedRics[i];
|
1037
|
+
var rowDefs = this._connector.getRowDefByRic(ric);
|
1038
|
+
var jLen = rowDefs ? rowDefs.length : 0;
|
1039
|
+
for (var j = 0; j < jLen; ++j) {
|
1040
|
+
var rowDef = rowDefs[j];
|
1041
|
+
if (rowDef.getRic() === ric) {
|
1042
|
+
this._snapshot.addRic(ric); // ADC
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
this._dispatch(e.type, e);
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
/** @private
|
1051
|
+
* @param {Object} e
|
1052
|
+
*/
|
1053
|
+
Grid.prototype._onRicRemoved = function(e) {
|
1054
|
+
this._dispatch(e.type, e);
|
1055
|
+
};
|
1056
|
+
|
1057
|
+
/** @private
|
1058
|
+
* @param {Object} e
|
1059
|
+
*/
|
1060
|
+
Grid.prototype._onFieldAdded = function(e) {
|
1061
|
+
var rowDefs = e.rowDefs;
|
1062
|
+
var addedFields = e.addedFields;
|
1063
|
+
|
1064
|
+
// ADC
|
1065
|
+
for (var i in rowDefs) {
|
1066
|
+
this._snapshot.addRic(rowDefs[i].getRic());
|
1067
|
+
}
|
1068
|
+
this._snapshot.addFields(addedFields);
|
1069
|
+
|
1070
|
+
// JET
|
1071
|
+
if (this._subs) {
|
1072
|
+
var colDefs = this._getAllColumnDefinitions();
|
1073
|
+
var fields = colDefs.reduce(ColumnDefinition.getRealTimeFields, []);
|
1074
|
+
this._subs["addFields"](fields);
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
this._dispatch(e.type, e);
|
1078
|
+
};
|
1079
|
+
/** @private
|
1080
|
+
* @param {Object} e
|
1081
|
+
*/
|
1082
|
+
Grid.prototype._onFieldRemoved = function(e) {
|
1083
|
+
var removedFields = e.removedFields;
|
1084
|
+
|
1085
|
+
// JET
|
1086
|
+
if(this._subs) {
|
1087
|
+
this._subs["removeFields"](removedFields);
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
this._dispatch(e.type, e);
|
1091
|
+
};
|
1092
|
+
|
1093
|
+
/** @public
|
1094
|
+
* @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
|
1095
|
+
* @param {number=} idx
|
1096
|
+
*/
|
1097
|
+
Grid.prototype.insertColumn = function (columnOption, idx) {
|
1098
|
+
if (typeof columnOption === "string") {
|
1099
|
+
columnOption = { field: columnOption };
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
var colCount = this.getColumnCount();
|
1103
|
+
if(idx == null || idx > colCount) {
|
1104
|
+
idx = colCount;
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
// no need to merge defaultColumn during initialize process
|
1108
|
+
// because columnOption already mutate by initialize function
|
1109
|
+
var userOptions = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
1110
|
+
Grid._objectAssign(userOptions, columnOption);
|
1111
|
+
userOptions["formulaEngine"] = this._fnEngine; // Adding extra option
|
1112
|
+
|
1113
|
+
var colDef = new ColumnDefinition(userOptions, this);
|
1114
|
+
userOptions[COL_DEF] = colDef;
|
1115
|
+
|
1116
|
+
// WARNING: width is processed twice by tr-grid and rt-grid
|
1117
|
+
// Inserting column also initializes prefined formatter
|
1118
|
+
this._grid.insertColumn(idx, userOptions); // columnAdded is fired
|
1119
|
+
};
|
1120
|
+
|
1121
|
+
|
1122
|
+
/** to update column name when field info is loaded
|
1123
|
+
* @private
|
1124
|
+
* @param {string} field
|
1125
|
+
* @param {ColumnDefinition} colDef
|
1126
|
+
* @param {Object} response
|
1127
|
+
*/
|
1128
|
+
Grid.prototype._onFieldLoadedSuccess = function (field, colDef, response) {
|
1129
|
+
if (response && response.fieldDefinition) {
|
1130
|
+
var fieldDef = response.fieldDefinition;
|
1131
|
+
if (colDef && colDef.getField() === field) {
|
1132
|
+
if (colDef.isDefaultName() && fieldDef.name) {
|
1133
|
+
colDef.setName(fieldDef.name);
|
1134
|
+
this.updateColumnTitle(); // has conflator -> async operation
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
}
|
1138
|
+
};
|
1139
|
+
|
1140
|
+
/**
|
1141
|
+
* @private
|
1142
|
+
* @param {Object} err
|
1143
|
+
*/
|
1144
|
+
Grid.prototype._onFieldLoadedError = function (err) {
|
1145
|
+
// TODO: May implement retry mechanism here, if need
|
1146
|
+
};
|
1147
|
+
|
1148
|
+
/**
|
1149
|
+
* @private
|
1150
|
+
* @param {string} field
|
1151
|
+
* @param {string} referrer
|
1152
|
+
*/
|
1153
|
+
Grid.prototype._onFieldLoaded = function (field, referrer) {
|
1154
|
+
this._connector.addFields(field, referrer);
|
1155
|
+
};
|
1156
|
+
|
1157
|
+
/**
|
1158
|
+
* @private
|
1159
|
+
* @param {string} field
|
1160
|
+
* @param {boolean} isRealTime
|
1161
|
+
* @returns {boolean}
|
1162
|
+
*/
|
1163
|
+
Grid.prototype._shouldLoadFieldInfo = function (field, isRealTime) {
|
1164
|
+
var fieldDef = FieldDefinition.get(field);
|
1165
|
+
if (!fieldDef &&
|
1166
|
+
field !== 'X_RIC_NAME' && // ignore X_RIC_NAME
|
1167
|
+
(isRealTime || ColumnDefinition.isAdcField(field)) &&
|
1168
|
+
(this._RTK || window["JET"])
|
1169
|
+
) {
|
1170
|
+
return true;
|
1171
|
+
}
|
1172
|
+
return false;
|
1173
|
+
};
|
1174
|
+
/** Remove all existing columns and add new columns based on the given objects
|
1175
|
+
* @public
|
1176
|
+
* @param {Array.<Object>} columns Array of column options
|
1177
|
+
*/
|
1178
|
+
Grid.prototype.setColumns = function(columns) {
|
1179
|
+
var colCount = (columns) ? columns.length : 0;
|
1180
|
+
|
1181
|
+
this.removeAllColumns();
|
1182
|
+
if(colCount > 0) {
|
1183
|
+
var prevState = false;
|
1184
|
+
if(colCount > 1) {
|
1185
|
+
prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
1186
|
+
}
|
1187
|
+
for(var i = 0; i < colCount; ++i) {
|
1188
|
+
this.insertColumn(columns[i], i);
|
1189
|
+
}
|
1190
|
+
if(colCount > 1) {
|
1191
|
+
this._grid.freezeLayout(prevState);
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
};
|
1195
|
+
/** Remove all existing columns and add new columns based on the given texts/fields
|
1196
|
+
* @public
|
1197
|
+
* @function
|
1198
|
+
* @param {Array.<string>} ary Array of fields (string)
|
1199
|
+
* @see {@link Grid#setColumns}
|
1200
|
+
*/
|
1201
|
+
Grid.prototype.setFields = Grid.prototype.setColumns;
|
1202
|
+
|
1203
|
+
/** @private
|
1204
|
+
* @param {Object} e
|
1205
|
+
*/
|
1206
|
+
Grid.prototype._onColumnAdded = function(e) {
|
1207
|
+
var colDef = e.context[COL_DEF];
|
1208
|
+
delete e.context[COL_DEF];
|
1209
|
+
var idx = e.colIndex;
|
1210
|
+
|
1211
|
+
var colData = this._grid.getColumnData(idx);
|
1212
|
+
if(!colData) { // Save column inside grid
|
1213
|
+
colData = this._grid.setColumnData(idx, {});
|
1214
|
+
}
|
1215
|
+
colData[COL_DEF] = colDef;
|
1216
|
+
var userModel = colDef.getUserModel();
|
1217
|
+
// binding
|
1218
|
+
this._grid.setColumnDataBindingHandler(idx, colDef.getRenderer());
|
1219
|
+
// width and scalable
|
1220
|
+
var value = userModel["width"];
|
1221
|
+
// eslint-disable-next-line no-undefined
|
1222
|
+
if(value !== undefined) {
|
1223
|
+
value = +value;
|
1224
|
+
var scalable;
|
1225
|
+
if(userModel["scalable"] != null) {
|
1226
|
+
scalable = userModel["scalable"] ? true : false;
|
1227
|
+
} else {
|
1228
|
+
scalable = value !== value; // NaN means scalable
|
1229
|
+
}
|
1230
|
+
this._grid.setColumnWidth(idx, value, scalable);
|
1231
|
+
} else {
|
1232
|
+
this._grid.setColumnWidth(idx, 1, true);
|
1233
|
+
}
|
1234
|
+
// minWidth
|
1235
|
+
value = userModel["minWidth"];
|
1236
|
+
if(value >= 0) {
|
1237
|
+
this._grid.setMinimumColumnWidth(idx, value);
|
1238
|
+
}
|
1239
|
+
// hidden
|
1240
|
+
value = userModel["hidden"];
|
1241
|
+
if(value) {
|
1242
|
+
this._grid.hideColumn(idx, true);
|
1243
|
+
}
|
1244
|
+
// textAlign
|
1245
|
+
value = userModel["textAlign"] || userModel["alignment"];
|
1246
|
+
if(typeof value === "string") {
|
1247
|
+
this._grid.setColumnAlignment(idx, value);
|
1248
|
+
}
|
1249
|
+
if(!userModel["keepModel"]) {
|
1250
|
+
colDef.clearUserModel();
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
// text select flag per column
|
1254
|
+
// with this flag enabled user can select text in cell of this column
|
1255
|
+
if (colDef.isTextSelect()) {
|
1256
|
+
this._grid.enableColumnClass(idx, 'tr-text-select', true, "content");
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
// className
|
1260
|
+
var i, classes = colDef.getClasses();
|
1261
|
+
for(i = 0; i < classes.length; i++) {
|
1262
|
+
this._grid.enableColumnClass(idx, classes[i]);
|
1263
|
+
}
|
1264
|
+
var colField = colDef.getField();
|
1265
|
+
if (!colDef.isRealTimeField()) {
|
1266
|
+
// not realtime filed
|
1267
|
+
this._dc.addStaticFields([colField]);
|
1268
|
+
}
|
1269
|
+
this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
|
1270
|
+
|
1271
|
+
var fields = colDef.getAllFields();
|
1272
|
+
var referrer = colDef.getId();
|
1273
|
+
var len = fields.length;
|
1274
|
+
var field, dataType, prom, isRealTimeField, onLoaded;
|
1275
|
+
for(i = 0; i < len; i++) {
|
1276
|
+
field = fields[i];
|
1277
|
+
isRealTimeField = ColumnDefinition.isRealTimeField(field);
|
1278
|
+
if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
|
1279
|
+
if(field === colField) {
|
1280
|
+
dataType = colDef.getDataType(); // Data-type from user's column options
|
1281
|
+
} else { // Other required fields
|
1282
|
+
dataType = ColumnDefinition.getDataType(field); // Data-type evaluated from FieldDefinition
|
1283
|
+
}
|
1284
|
+
prom = FieldDefinition.loadFieldInfo(field)
|
1285
|
+
.then(this._onFieldLoadedSuccess.bind(this, field, colDef))
|
1286
|
+
.catch(this._onFieldLoadedError);
|
1287
|
+
|
1288
|
+
if(!dataType) {
|
1289
|
+
// wait field-info to be loaded before adding field
|
1290
|
+
onLoaded = this._onFieldLoaded.bind(this, field, referrer);
|
1291
|
+
prom = prom.then(onLoaded).catch(onLoaded);
|
1292
|
+
} else {
|
1293
|
+
this._connector.addFields(field, referrer);
|
1294
|
+
}
|
1295
|
+
} else {
|
1296
|
+
this._connector.addFields(field, referrer);
|
1297
|
+
}
|
1298
|
+
}
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
/** @public
|
1302
|
+
* @param {Grid~ColumnReference} colRef
|
1303
|
+
* @see {@link Grid#removeColumns}
|
1304
|
+
* @see {@link Grid#removeAllColumns}
|
1305
|
+
*/
|
1306
|
+
Grid.prototype.removeColumn = function(colRef) {
|
1307
|
+
var colIndex = this.getColumnIndex(colRef);
|
1308
|
+
if(colIndex < 0) {
|
1309
|
+
return;
|
1310
|
+
}
|
1311
|
+
|
1312
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1313
|
+
if(!colDef.isRealTimeField()) {
|
1314
|
+
this._dc.removeStaticFields([colDef.getField()]);
|
1315
|
+
}
|
1316
|
+
colDef.dispose();
|
1317
|
+
this._grid.removeColumnAt(colIndex);
|
1318
|
+
|
1319
|
+
this._connector.removeFields(colDef);
|
1320
|
+
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
1321
|
+
};
|
1322
|
+
/** Remove multiple columns through array. To remove all columns, use removeAllColumns() instead of this method
|
1323
|
+
* @public
|
1324
|
+
* @param {Array.<Grid~ColumnReference>} colRefs
|
1325
|
+
* @see {@link Grid#removeColumn}
|
1326
|
+
* @see {@link Grid#removeAllColumns}
|
1327
|
+
*/
|
1328
|
+
Grid.prototype.removeColumns = function(colRefs) {
|
1329
|
+
var indices = this.getColumnIndices(colRefs);
|
1330
|
+
var len = indices.length;
|
1331
|
+
if(len <= 1) {
|
1332
|
+
if(len === 1) {
|
1333
|
+
this.removeColumn(indices[0]);
|
1334
|
+
}
|
1335
|
+
return;
|
1336
|
+
}
|
1337
|
+
indices.sort(Grid._descendingOrder); // Removal must be done from the back
|
1338
|
+
|
1339
|
+
var staticFields = []; // For clearing any data stored in our cache
|
1340
|
+
var prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
|
1341
|
+
|
1342
|
+
for(var i = 0; i < len; ++i) {
|
1343
|
+
var colIndex = indices[i];
|
1344
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1345
|
+
if(!colDef.isRealTimeField()) {
|
1346
|
+
staticFields.push(colDef.getField());
|
1347
|
+
}
|
1348
|
+
colDef.dispose();
|
1349
|
+
this._grid.removeColumnAt(colIndex);
|
1350
|
+
this._connector.removeFields(colDef);
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
if(staticFields.length) {
|
1354
|
+
this._dc.removeStaticFields(staticFields);
|
1355
|
+
}
|
1356
|
+
this._grid.freezeLayout(prevState);
|
1357
|
+
};
|
1358
|
+
/** Sorting is also cleared.
|
1359
|
+
* @public
|
1360
|
+
* @see {@link Grid#removeColumn}
|
1361
|
+
* @see {@link Grid#removeColumns}
|
1362
|
+
*/
|
1363
|
+
Grid.prototype.removeAllColumns = function() {
|
1364
|
+
var colCount = this.getColumnCount();
|
1365
|
+
if(colCount <= 0) {
|
1366
|
+
return;
|
1367
|
+
}
|
1368
|
+
|
1369
|
+
this.clearSort();
|
1370
|
+
for(var i = colCount; --i >= 0;) {
|
1371
|
+
// WARNING: This may affect plugins event listeners
|
1372
|
+
this._grid.setColumnDataBindingHandler(i, null);
|
1373
|
+
var colDef = this.getColumnDefinition(i);
|
1374
|
+
colDef.dispose();
|
1375
|
+
}
|
1376
|
+
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
1377
|
+
|
1378
|
+
this._columnTitleConflator.reset();
|
1379
|
+
|
1380
|
+
this._connector.removeAllFields();
|
1381
|
+
this._grid.setColumnCount(0);
|
1382
|
+
this._dc.resetStaticFields();
|
1383
|
+
};
|
1384
|
+
|
1385
|
+
/**
|
1386
|
+
* Move the column at the specified index to the target index.
|
1387
|
+
* @public
|
1388
|
+
* @param {number|Array.<number>} fromColIndex index or array of indices of the column(s) to be moved.
|
1389
|
+
* @param {number} toColIndex target column index
|
1390
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
1391
|
+
*/
|
1392
|
+
Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
|
1393
|
+
//Wrap single index to array
|
1394
|
+
if (!Array.isArray(fromColIndex)) {
|
1395
|
+
fromColIndex = [fromColIndex];
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
var columnCount = this._grid.getColumnCount();
|
1399
|
+
var lastColIndex = columnCount - 1;
|
1400
|
+
fromColIndex.sort(ascNumberSorter);
|
1401
|
+
fromColIndex = fromColIndex.filter(inRangeFilter.bind(null, 0, lastColIndex));
|
1402
|
+
|
1403
|
+
if (!this._grid.isColumnMoveAllowed(fromColIndex, toColIndex)) {
|
1404
|
+
return false;
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
var frozen = this._grid.isLayoutFrozen();
|
1408
|
+
this._grid.freezeLayout(true);
|
1409
|
+
|
1410
|
+
var marker = [];
|
1411
|
+
var runner = 0;
|
1412
|
+
var i;
|
1413
|
+
for (i = 0; i < columnCount; i++) {
|
1414
|
+
if (i == fromColIndex[runner]) {
|
1415
|
+
marker.push(true);
|
1416
|
+
runner++;
|
1417
|
+
} else {
|
1418
|
+
marker.push(false);
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
//Find the index to be moved to
|
1422
|
+
var counter = -1;
|
1423
|
+
var toMoveTo = -1;
|
1424
|
+
|
1425
|
+
for (i = 0; i < columnCount; i++) {
|
1426
|
+
if (marker[i] === false) {
|
1427
|
+
counter++;
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
if (counter === toColIndex) {
|
1431
|
+
toMoveTo = i;
|
1432
|
+
break;
|
1433
|
+
}
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
//If toMoveTo == -1, it means the target column index is beyond the last colmn so just move the columns
|
1437
|
+
//to the end of the table
|
1438
|
+
if (toMoveTo === -1) {
|
1439
|
+
toMoveTo = columnCount;
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
//Perform moving
|
1443
|
+
var leftList = [], rightList = [];
|
1444
|
+
|
1445
|
+
for (i = 0; i < fromColIndex.length; i++) {
|
1446
|
+
if (fromColIndex[i] < toMoveTo) {
|
1447
|
+
leftList.push(fromColIndex[i]);
|
1448
|
+
} else if (fromColIndex[i] > toMoveTo) {
|
1449
|
+
rightList.push(fromColIndex[i]);
|
1450
|
+
}
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
for (i = 0; i < rightList.length; i++) {
|
1454
|
+
this._grid.moveColumn(rightList[i], toMoveTo + i);
|
1455
|
+
}
|
1456
|
+
|
1457
|
+
for (i = leftList.length - 1; i >= 0; i--) {
|
1458
|
+
toMoveTo--;
|
1459
|
+
|
1460
|
+
this._grid.moveColumn(leftList[i], toMoveTo);
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
this._grid.freezeLayout(frozen);
|
1464
|
+
return true;
|
1465
|
+
};
|
1466
|
+
|
1467
|
+
/** The hidden column still occupies the same index.
|
1468
|
+
* @public
|
1469
|
+
* @param {Grid~ColumnReference} colRef
|
1470
|
+
* @param {boolean=} hidden
|
1471
|
+
* @see {@link Grid#hideColumns}
|
1472
|
+
* @see {@link Grid#showAllColumns}
|
1473
|
+
*/
|
1474
|
+
Grid.prototype.hideColumn = function(colRef, hidden) {
|
1475
|
+
var colIndex = this.getColumnIndex(colRef);
|
1476
|
+
this._grid.hideColumn(colIndex, hidden);
|
1477
|
+
};
|
1478
|
+
/** Hide multiple columns at once. The hidden columns still occupy the same index.
|
1479
|
+
* @public
|
1480
|
+
* @param {Array.<Grid~ColumnReference>} colRefs
|
1481
|
+
* @param {boolean=} hidden
|
1482
|
+
* @see {@link Grid#hideColumn}
|
1483
|
+
* @see {@link Grid#showAllColumns}
|
1484
|
+
*/
|
1485
|
+
Grid.prototype.hideColumns = function(colRefs, hidden) {
|
1486
|
+
this._grid.hideColumns(this.getColumnIndices(colRefs), hidden);
|
1487
|
+
};
|
1488
|
+
/** @public
|
1489
|
+
* @see {@link Grid#hideColumn}
|
1490
|
+
* @see {@link Grid#hideColumns}
|
1491
|
+
*/
|
1492
|
+
Grid.prototype.showAllColumns = function() {
|
1493
|
+
this._grid.showAllColumns();
|
1494
|
+
};
|
1495
|
+
/** @private
|
1496
|
+
* @function
|
1497
|
+
* @param {number} a
|
1498
|
+
* @param {number} b
|
1499
|
+
* @return {number}
|
1500
|
+
*/
|
1501
|
+
Grid._descendingOrder = function(a, b) {
|
1502
|
+
return b - a;
|
1503
|
+
};
|
1504
|
+
|
1505
|
+
/** Add fields for real-time data without adding column nor UIs. No duplication is allowed
|
1506
|
+
* @public
|
1507
|
+
* @param {string|Array.<string>} fieldRef
|
1508
|
+
* @param {string=} referrer
|
1509
|
+
* @return {boolean}
|
1510
|
+
*/
|
1511
|
+
Grid.prototype.addDataFields = function(fieldRef, referrer) {
|
1512
|
+
if(!fieldRef) {
|
1513
|
+
return false;
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
var fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
|
1517
|
+
var len = fields.length;
|
1518
|
+
var i, field, dataType, prom, isRealTimeField, onLoaded;
|
1519
|
+
for(i = 0; i < len; i++) {
|
1520
|
+
field = fields[i];
|
1521
|
+
isRealTimeField = ColumnDefinition.isRealTimeField(field);
|
1522
|
+
if(this._shouldLoadFieldInfo(field, isRealTimeField)) {
|
1523
|
+
dataType = ColumnDefinition.getDataType(field);
|
1524
|
+
prom = FieldDefinition.loadFieldInfo(field)
|
1525
|
+
.catch(this._onFieldLoadedError);
|
1526
|
+
|
1527
|
+
if(!dataType) {
|
1528
|
+
// wait field-info to be loaded before adding field
|
1529
|
+
onLoaded = this._onFieldLoaded.bind(this, field);
|
1530
|
+
prom = prom.then(onLoaded).catch(onLoaded);
|
1531
|
+
} else {
|
1532
|
+
this._connector.addFields(field, referrer || "grid");
|
1533
|
+
}
|
1534
|
+
} else {
|
1535
|
+
this._connector.addFields(field, referrer || "grid");
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
return true;
|
1540
|
+
};
|
1541
|
+
/** Add fields for real-time data without adding column nor UIs. No duplication is allowed
|
1542
|
+
* @public
|
1543
|
+
* @param {string|Array.<string>} fieldRef
|
1544
|
+
* @param {string=} referrer
|
1545
|
+
* @return {boolean}
|
1546
|
+
*/
|
1547
|
+
Grid.prototype.removeDataFields = function(fieldRef, referrer) {
|
1548
|
+
if(!fieldRef) {
|
1549
|
+
return false;
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
this._connector.removeFields(fieldRef, referrer || "grid");
|
1553
|
+
return true;
|
1554
|
+
};
|
1555
|
+
|
1556
|
+
/** @public
|
1557
|
+
* @param {Grid~ColumnReference} colRef
|
1558
|
+
* @param {string=} opt_order This can be "ascending", "descending", "none", "noOrder", or "originalOrder"
|
1559
|
+
*/
|
1560
|
+
Grid.prototype.sortColumn = function(colRef, opt_order) {
|
1561
|
+
var colIndex = this.getColumnIndex(colRef);
|
1562
|
+
if(colIndex < 0) {
|
1563
|
+
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
1564
|
+
} else {
|
1565
|
+
this._stp.sortColumn(colIndex, opt_order);
|
1566
|
+
}
|
1567
|
+
};
|
1568
|
+
/** @public
|
1569
|
+
* @param {number} colIndex
|
1570
|
+
* @param {string} str
|
1571
|
+
*/
|
1572
|
+
Grid.prototype.setColumnName = function(colIndex, str) {
|
1573
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1574
|
+
if(colDef) {
|
1575
|
+
colDef.setName(str);
|
1576
|
+
this.updateColumnTitle();
|
1577
|
+
}
|
1578
|
+
};
|
1579
|
+
/** @public
|
1580
|
+
* @param {Grid~ColumnReference} colRef
|
1581
|
+
* @param {Function=} func
|
1582
|
+
*/
|
1583
|
+
Grid.prototype.setColumnRenderer = function(colRef, func) {
|
1584
|
+
var colIndex = this.getColumnIndex(colRef);
|
1585
|
+
this.setColumnFormatter(colIndex, func);
|
1586
|
+
};
|
1587
|
+
|
1588
|
+
/** @public
|
1589
|
+
* @param {Grid~ColumnReference} colRef Column index or id
|
1590
|
+
* @param {string=} id ID for renderer mapping. If not specified the default renderer will be picked up
|
1591
|
+
* @param {Function=} func If not specified the renderer which corresponded id from mapping will be picked up
|
1592
|
+
*/
|
1593
|
+
Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
|
1594
|
+
var colIndex = this.getColumnIndex(colRef);
|
1595
|
+
if (colIndex == null) { return; }
|
1596
|
+
|
1597
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1598
|
+
if(!colDef) { return; }
|
1599
|
+
|
1600
|
+
colDef.activateRenderer(id, func);
|
1601
|
+
|
1602
|
+
this._grid.setColumnDataBindingHandler(colIndex, colDef.getRenderer());
|
1603
|
+
this._grid.requestRowRefresh();
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
/**
|
1607
|
+
* @public
|
1608
|
+
* @param {number} colIndex Column index of the position of the column to be updated
|
1609
|
+
* @param {Object|Function=} formatter Formatter object or bind function
|
1610
|
+
*/
|
1611
|
+
Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
|
1612
|
+
if (colIndex == null) { return; }
|
1613
|
+
|
1614
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1615
|
+
if(!colDef) {
|
1616
|
+
return;
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
var func = null;
|
1620
|
+
if (formatter) {
|
1621
|
+
if(typeof formatter === "object") {
|
1622
|
+
if(typeof formatter.init === "function") { // Initialize predefined formatter
|
1623
|
+
// WARNING: Column definition has not been updated
|
1624
|
+
formatter.init(colDef.getConfigObject(), this._grid);
|
1625
|
+
}
|
1626
|
+
func = formatter.binding;
|
1627
|
+
} else {
|
1628
|
+
func = formatter;
|
1629
|
+
}
|
1630
|
+
if(typeof func !== "function") {
|
1631
|
+
func = null;
|
1632
|
+
}
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
if(func !== colDef.getRenderer()) {
|
1636
|
+
var section = this._grid.getSection("content");
|
1637
|
+
var col = /** @type {Column} */section.getColumn(colIndex);
|
1638
|
+
if (col) {
|
1639
|
+
col.clearContent();
|
1640
|
+
}
|
1641
|
+
|
1642
|
+
this._grid.setColumnDataBindingHandler(colIndex, null);
|
1643
|
+
|
1644
|
+
colDef.setRenderer(func);
|
1645
|
+
|
1646
|
+
this._grid.setColumnDataBindingHandler(colIndex, colDef.getRenderer());
|
1647
|
+
this._grid.requestRowRefresh();
|
1648
|
+
}
|
1649
|
+
};
|
1650
|
+
|
1651
|
+
/** @public
|
1652
|
+
* @param {Grid~ColumnReference} colRef
|
1653
|
+
* @param {ColumnDefinition~SortLogic=} func
|
1654
|
+
*/
|
1655
|
+
Grid.prototype.setColumnSorter = function(colRef, func) {
|
1656
|
+
var colIndex = this.getColumnIndex(colRef);
|
1657
|
+
var colDef = this.getColumnDefinition(colIndex);
|
1658
|
+
if(colDef) {
|
1659
|
+
colDef.setSorter(func);
|
1660
|
+
|
1661
|
+
var sortedColumn = this.getSortedColumnIndex();
|
1662
|
+
if(sortedColumn === colIndex) {
|
1663
|
+
this._columnSorter = colDef.getSorter();
|
1664
|
+
}
|
1665
|
+
}
|
1666
|
+
};
|
1667
|
+
|
1668
|
+
|
1669
|
+
/** Initialize data for the given rowDef from another rowDef with the same RIC
|
1670
|
+
* @public
|
1671
|
+
* @param {RowDefinition} rowDef
|
1672
|
+
*/
|
1673
|
+
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
1674
|
+
var ric = rowDef.getRic();
|
1675
|
+
var rowDefs = this._connector.getRowDefByRic(ric);
|
1676
|
+
if(rowDefs && rowDefs.length) {
|
1677
|
+
cloneRowData(rowDefs[0], rowDef);
|
1678
|
+
}
|
1679
|
+
};
|
1680
|
+
/** @public
|
1681
|
+
* @param {Object=} rowOption
|
1682
|
+
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
1683
|
+
* @returns {Object}
|
1684
|
+
* @example
|
1685
|
+
* var grid = new rt.Grid(grid_div, options);
|
1686
|
+
* grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
|
1687
|
+
*/
|
1688
|
+
Grid.prototype.insertRow = function(rowOption, rowRef) {
|
1689
|
+
if(rowOption) {
|
1690
|
+
if(typeof rowOption === "string") {
|
1691
|
+
rowOption = { "ric": rowOption };
|
1692
|
+
} else if(Array.isArray(rowOption["values"])) {
|
1693
|
+
if(!rowOption["fields"]) { // Static values are defined but no fields
|
1694
|
+
rowOption["fields"] = this.getColumnFields(); // For initializing static value
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
}
|
1698
|
+
var rowDef = new RowDefinition(rowOption);
|
1699
|
+
rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
|
1700
|
+
this._initDuplicateRicData(rowDef);
|
1701
|
+
if(rowDef.isFixedPosition()) {
|
1702
|
+
this._hasGroup = true; // HACK: This is temporary solution
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
rowDef.registerToView(this._dv, this._getRowId(rowRef));
|
1706
|
+
this._connector.addRic(rowDef);
|
1707
|
+
return rowDef;
|
1708
|
+
};
|
1709
|
+
/** @public
|
1710
|
+
* @param {Array.<Object>} rowOptions Array of row option object
|
1711
|
+
* @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
|
1712
|
+
* @param {Array.<string>=} opt_fields
|
1713
|
+
* @example
|
1714
|
+
* var grid = new rt.Grid(grid_div, options);
|
1715
|
+
* grid.insertRows([
|
1716
|
+
* {ric: "RIC"},
|
1717
|
+
* {values: {"field1": 0, "field2": 1}},
|
1718
|
+
* {ric: "RIC2", values: [1, 2, 3, 4]},
|
1719
|
+
* null
|
1720
|
+
* ]); // 4 rows are appended
|
1721
|
+
*/
|
1722
|
+
Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
1723
|
+
if(!Array.isArray(rowOptions)) {
|
1724
|
+
return;
|
1725
|
+
}
|
1726
|
+
|
1727
|
+
var prevState = this._dt.freeze(); // Avoid sorting for each inserted row
|
1728
|
+
var fields = opt_fields || this.getColumnFields();
|
1729
|
+
var rowId = this._getRowId(rowRef);
|
1730
|
+
var len = rowOptions.length;
|
1731
|
+
for(var r = 0; r < len; ++r) {
|
1732
|
+
var rowOption = rowOptions[r];
|
1733
|
+
if(rowOption) {
|
1734
|
+
if(typeof rowOption === "string") {
|
1735
|
+
rowOption = { "ric": rowOption };
|
1736
|
+
}
|
1737
|
+
rowOption["fields"] = fields; // For initializing static value
|
1738
|
+
}
|
1739
|
+
this.insertRow(rowOption, rowId); // Note that data view is being frozen, so only using row id will work properly
|
1740
|
+
}
|
1741
|
+
this._updateGroupOrder(); // TODO: Update group order for all scenarios
|
1742
|
+
this._dt.freeze(prevState);
|
1743
|
+
};
|
1744
|
+
/** Add multiple rows without `ric` property in {@link RowDefinition}
|
1745
|
+
* @public
|
1746
|
+
* @param {Array} dataRows 2D Array of data or Array of Field/Value pair object
|
1747
|
+
* @param {Array.<string>=} fields If no field is given, field defined in column definition will be used instead
|
1748
|
+
* @see {@link Grid#logDV}
|
1749
|
+
* @see {@link Grid#logDT}
|
1750
|
+
* @example
|
1751
|
+
* var grid = new rt.Grid(grid_div, options);
|
1752
|
+
* grid.addStaticDataRows([
|
1753
|
+
* [10, "a", true],
|
1754
|
+
* [20, "b", false],
|
1755
|
+
* [30, "c", true]
|
1756
|
+
* ], ["field1", "field2", "field3"]); // 3 rows are appended
|
1757
|
+
*
|
1758
|
+
* grid.addStaticDataRows([ // Object format can also be used
|
1759
|
+
* {"field1": 40, "field2": "a", "field3": true},
|
1760
|
+
* {"field1": 50, "field2": "b"}, // each row doesn't have to be the same
|
1761
|
+
* {"field1": 60, "field4": "some thing"}
|
1762
|
+
* ]); // 3 more rows are appended
|
1763
|
+
* grid.logDV({"colNames": ["field1", "field2", "field3", "field4"]}); // See results in console
|
1764
|
+
*/
|
1765
|
+
Grid.prototype.addStaticDataRows = function(dataRows, fields) {
|
1766
|
+
if(!Array.isArray(dataRows)) {
|
1767
|
+
var userObj = dataRows;
|
1768
|
+
dataRows = null;
|
1769
|
+
if(userObj) {
|
1770
|
+
if(userObj.fields && !fields) {
|
1771
|
+
fields = userObj.fields;
|
1772
|
+
}
|
1773
|
+
if(Array.isArray(userObj.data)) { // dataRows must has an array type
|
1774
|
+
dataRows = userObj.data;
|
1775
|
+
}
|
1776
|
+
}
|
1777
|
+
}
|
1778
|
+
if(dataRows) {
|
1779
|
+
this.insertRows(dataRows.map(Grid._dataToRowOptions), null, fields);
|
1780
|
+
}
|
1781
|
+
};
|
1782
|
+
/** Insert, update, remove and reorder data based on the given array of records
|
1783
|
+
* @public
|
1784
|
+
* @param {Array.<Object>} records Array of records for insert, remove, update, reorder in one operation
|
1785
|
+
* @param {string} rowIdentifier Check difference data with the row identifier map property for operate record.
|
1786
|
+
* @example
|
1787
|
+
* // Grid data set will be updated to 3 records. All rows in the grid will be cleared and new rows will be inserted
|
1788
|
+
* grid.updateDataSet([
|
1789
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
1790
|
+
* { id: "B", field2: 1, field3: 2, field4: "Something B" },
|
1791
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
1792
|
+
* ], "id");
|
1793
|
+
* // Update record id "B" in "field2", "field3" value 100, 200
|
1794
|
+
* grid.updateDataSet([
|
1795
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
1796
|
+
* { id: "B", field2: 100, field3: 200, field4: "Something B" },
|
1797
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
1798
|
+
* ], "id");
|
1799
|
+
* // Delete record id "B"
|
1800
|
+
* grid.updateDataSet([
|
1801
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
1802
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
1803
|
+
* ], "id");
|
1804
|
+
* // Insert record id "D"
|
1805
|
+
* grid.updateDataSet([
|
1806
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
1807
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
1808
|
+
* { id: "D", field2: 1, field3: 2, field4: "Something D" },
|
1809
|
+
* ], "id");
|
1810
|
+
* // Reorder to "D", "C", "A"
|
1811
|
+
* grid.updateDataSet([
|
1812
|
+
* { id: "D", field2: 1, field3: 2, field4: "Something D" },
|
1813
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
1814
|
+
* { id: "A", field2: 1, field3: 2, field4: "Something A" },
|
1815
|
+
* ], "id");
|
1816
|
+
* // Insert, Update, Delete And Reorder
|
1817
|
+
* grid.updateDataSet([
|
1818
|
+
* { id: "F", field2: 1, field3: 2, field4: "Something F" },
|
1819
|
+
* { id: "D", field2: 1, field3: 2, field4: "Something D" },
|
1820
|
+
* { id: "C", field2: 1, field3: 2, field4: "Something C" },
|
1821
|
+
* { id: "E", field2: 1, field3: 2, field4: "Something E" },
|
1822
|
+
* ], "id");
|
1823
|
+
*/
|
1824
|
+
Grid.prototype.updateDataSet = function(records, rowIdentifier) {
|
1825
|
+
if(!Array.isArray(records) || records.length === 0 ) {
|
1826
|
+
this.removeAllRows();
|
1827
|
+
return;
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
// Map new data index
|
1831
|
+
var newDataMap = {};
|
1832
|
+
var recordCount = records.length;
|
1833
|
+
var record, i;
|
1834
|
+
for (i = 0; i < recordCount; i++) {
|
1835
|
+
record = records[i];
|
1836
|
+
newDataMap[record[rowIdentifier]] = record; // Assign a new data map to compare to the previous data
|
1837
|
+
}
|
1838
|
+
|
1839
|
+
var fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
|
1840
|
+
records.forEach(mapRowOrder.bind(null, fieldSorting));
|
1841
|
+
|
1842
|
+
var oldDataMap = {};
|
1843
|
+
var rowDef, id;
|
1844
|
+
var rowDefs = this.getRowDefinitions(); // WARNING: Filtered and hidden rows are not included
|
1845
|
+
var rowDefCount = rowDefs.length;
|
1846
|
+
for (i = 0; i < rowDefCount; i++) {
|
1847
|
+
rowDef = rowDefs[i];
|
1848
|
+
if(rowDef) {
|
1849
|
+
id = rowDef.getRowData()[rowIdentifier];
|
1850
|
+
if(id || id === 0) {
|
1851
|
+
oldDataMap[id] = rowDef;
|
1852
|
+
} else { // Any existing rowDef without row identifier should be removed
|
1853
|
+
this.removeRow(rowDef); // Slow
|
1854
|
+
}
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
|
1858
|
+
// Check Remove previous data
|
1859
|
+
for (var rowIdentifierName in oldDataMap) {
|
1860
|
+
if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
|
1861
|
+
this.removeRow(oldDataMap[rowIdentifierName]); // Slow
|
1862
|
+
}
|
1863
|
+
}
|
1864
|
+
|
1865
|
+
// Check Update and Insert
|
1866
|
+
for (i = 0; i < recordCount; i++) {
|
1867
|
+
record = records[i];
|
1868
|
+
id = record[rowIdentifier];
|
1869
|
+
rowDef = oldDataMap[id];
|
1870
|
+
if (!rowDef) {
|
1871
|
+
this.insertRow({ values: newDataMap[id]}); // Insert last position
|
1872
|
+
} else {
|
1873
|
+
rowDef.setRowData(record);
|
1874
|
+
}
|
1875
|
+
}
|
1876
|
+
// Sorting
|
1877
|
+
this._dt.sortOnce("ROW_DEF", "a", compareNumber, fieldSorting);
|
1878
|
+
};
|
1879
|
+
/** @private
|
1880
|
+
* @param {Array|Object} item
|
1881
|
+
* @return {!Object}
|
1882
|
+
*/
|
1883
|
+
Grid._dataToRowOptions = function(item) {
|
1884
|
+
return {values: item};
|
1885
|
+
};
|
1886
|
+
/** @public
|
1887
|
+
* @param {Grid~RowReference} rowRef
|
1888
|
+
* @return {RowDefinition}
|
1889
|
+
* @see {@link Grid#removeRows}
|
1890
|
+
* @see {@link Grid#removeAllRows}
|
1891
|
+
*/
|
1892
|
+
Grid.prototype.removeRow = function(rowRef) {
|
1893
|
+
var rowDef = this._getRowDefinition(rowRef);
|
1894
|
+
if(rowDef) {
|
1895
|
+
if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
|
1896
|
+
this._removeRow(rowDef);
|
1897
|
+
}
|
1898
|
+
}
|
1899
|
+
return rowDef;
|
1900
|
+
};
|
1901
|
+
/** Remove multiple rows at once. This prevents duplicate operation and improve performance. To remove all rows, use removeAllRows() method instead of this method.
|
1902
|
+
* @public
|
1903
|
+
* @param {Array.<Grid~RowReference>} rowRefs
|
1904
|
+
* @return {Array.<RowDefinition>} Array of removed row definitions
|
1905
|
+
* @see {@link Grid#removeRow}
|
1906
|
+
* @see {@link Grid#removeAllRows}
|
1907
|
+
*/
|
1908
|
+
Grid.prototype.removeRows = function(rowRefs) {
|
1909
|
+
var rowDef;
|
1910
|
+
if(!Array.isArray(rowRefs)) {
|
1911
|
+
rowDef = this.removeRow(rowRefs);
|
1912
|
+
return rowDef ? [rowDef] : [];
|
1913
|
+
}
|
1914
|
+
|
1915
|
+
var i;
|
1916
|
+
var rowDefs = [];
|
1917
|
+
var len = rowRefs.length;
|
1918
|
+
|
1919
|
+
// Verify user input
|
1920
|
+
for(i = 0; i < len; ++i) {
|
1921
|
+
rowDef = this._getRowDefinition(rowRefs[i]);
|
1922
|
+
if(rowDef) {
|
1923
|
+
if(!rowDef.isAutoGenerated()) {
|
1924
|
+
rowDefs.push(rowDef);
|
1925
|
+
}
|
1926
|
+
}
|
1927
|
+
}
|
1928
|
+
len = rowDefs.length;
|
1929
|
+
|
1930
|
+
var prevState = false;
|
1931
|
+
if(len > 1) {
|
1932
|
+
prevState = this._dt.freeze(); // Prevent multiple changes that trigger sorting and filtering
|
1933
|
+
}
|
1934
|
+
|
1935
|
+
for(i = 0; i < len; ++i) {
|
1936
|
+
this._removeRow(rowDefs[i]);
|
1937
|
+
}
|
1938
|
+
|
1939
|
+
if(len > 1) {
|
1940
|
+
this._dt.freeze(prevState);
|
1941
|
+
}
|
1942
|
+
return rowDefs;
|
1943
|
+
};
|
1944
|
+
/** @public
|
1945
|
+
* @see {@link Grid#removeRow}
|
1946
|
+
* @see {@link Grid#removeRows}
|
1947
|
+
*/
|
1948
|
+
Grid.prototype.removeAllRows = function() {
|
1949
|
+
if(!this._dt.getRowCount()) {
|
1950
|
+
return;
|
1951
|
+
}
|
1952
|
+
var rowDefs = this._getAllRowDefinitions();
|
1953
|
+
|
1954
|
+
this._dc.clearAllData();
|
1955
|
+
this._dt.clearAllData();
|
1956
|
+
this._clearDataUpdates();
|
1957
|
+
|
1958
|
+
rowDefs.forEach(RowDefinition.dispose);
|
1959
|
+
|
1960
|
+
this._streamingConflator.reset();
|
1961
|
+
this._formulaConflator.reset();
|
1962
|
+
this._chainConflator.reset();
|
1963
|
+
this._connector.removeAllRics();
|
1964
|
+
|
1965
|
+
// TODO: This logic should also be in the core grid
|
1966
|
+
this._grid.getVScrollbar().setScrollTop(0);
|
1967
|
+
this._grid.getHScrollbar().setScrollLeft(0);
|
1968
|
+
};
|
1969
|
+
/** WARNING: This does not remove data stored in the data cache
|
1970
|
+
* @private
|
1971
|
+
* @param {!RowDefinition} rowDef
|
1972
|
+
*/
|
1973
|
+
Grid.prototype._removeRow = function(rowDef) {
|
1974
|
+
this._dispatch("beforeRowRemoved", {});
|
1975
|
+
|
1976
|
+
var rowIds = rowDef.getAllDescendantIds(); // TODO: Support nested child
|
1977
|
+
if(rowIds) { // Remove all children first
|
1978
|
+
this._dt.removeRows(rowIds);
|
1979
|
+
}
|
1980
|
+
this._connector.removeRic(rowDef);
|
1981
|
+
this._dt.removeRow(rowDef.getRowId()); // TODO: Merge this with the above removeRows() method
|
1982
|
+
rowDef.dispose(); // WARNING: This does not remove child reference from its parent
|
1983
|
+
};
|
1984
|
+
|
1985
|
+
/** @public
|
1986
|
+
* @param {Grid~RowReference} rowRef
|
1987
|
+
* @param {boolean=} hidden if false, show instead of hide
|
1988
|
+
*/
|
1989
|
+
Grid.prototype.hideRow = function(rowRef, hidden) {
|
1990
|
+
this._grid.hideRow(this._getRowId(rowRef), hidden);
|
1991
|
+
};
|
1992
|
+
|
1993
|
+
/** Hide row(s) in the Grid by specifying the rIds
|
1994
|
+
* @param {Grid~RowReference | Array.<Grid~RowReference>} rowRefs
|
1995
|
+
* @param {boolean=} hidden if false, show instead of hide
|
1996
|
+
* @public
|
1997
|
+
*/
|
1998
|
+
Grid.prototype.hideRows = function (rowRefs, hidden) {
|
1999
|
+
if (!Array.isArray(rowRefs)) {
|
2000
|
+
rowRefs = [rowRefs];
|
2001
|
+
}
|
2002
|
+
var rids = rowRefs.map(this._getRowId);
|
2003
|
+
this._grid.hideRows(rids, hidden );
|
2004
|
+
};
|
2005
|
+
/**
|
2006
|
+
* Show row(s) in the Grid by specifying the rIds
|
2007
|
+
* @param {Grid~RowReference | Array.<Grid~RowReference>} rowRefs
|
2008
|
+
* @param {boolean=} shown if false, hide instead of show
|
2009
|
+
* @public
|
2010
|
+
*/
|
2011
|
+
Grid.prototype.showRows = function (rowRefs, shown) {
|
2012
|
+
this.hideRows(rowRefs, shown === false);
|
2013
|
+
};
|
2014
|
+
/**
|
2015
|
+
* Unhide all hidden rows in the Grid
|
2016
|
+
* @public
|
2017
|
+
*/
|
2018
|
+
Grid.prototype.unhideAllRows = function () {
|
2019
|
+
this._grid.unhideAllRows();
|
2020
|
+
};
|
2021
|
+
/**
|
2022
|
+
* @public
|
2023
|
+
* @returns {boolean}
|
2024
|
+
*/
|
2025
|
+
Grid.prototype.hasHiddenRow = function(){
|
2026
|
+
return this._grid.hasHiddenRow();
|
2027
|
+
};
|
2028
|
+
|
2029
|
+
/** Set RIC to the specified row
|
2030
|
+
* @public
|
2031
|
+
* @param {Grid~RowReference} rowRef
|
2032
|
+
* @param {string} str
|
2033
|
+
*/
|
2034
|
+
Grid.prototype.setRic = function(rowRef, str) {
|
2035
|
+
var rowDef = this._getRowDefinition(rowRef);
|
2036
|
+
if(rowDef) {
|
2037
|
+
var oldRic = rowDef.getRic();
|
2038
|
+
if(rowDef.setContent(str)) { // The given string may not be a RIC
|
2039
|
+
this._connector.removeRic(rowDef, oldRic);
|
2040
|
+
this._initDuplicateRicData(rowDef);
|
2041
|
+
this._connector.addRic(rowDef);
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
};
|
2045
|
+
/** Alias to setRic
|
2046
|
+
* @public
|
2047
|
+
* @function
|
2048
|
+
* @param {Grid~RowReference} rowRef
|
2049
|
+
* @param {string} str
|
2050
|
+
* @see {@link Grid.setRic}
|
2051
|
+
*/
|
2052
|
+
Grid.prototype.setRowContent = Grid.prototype.setRic;
|
2053
|
+
|
2054
|
+
/**
|
2055
|
+
* @public
|
2056
|
+
* @param {string|number} rid Row Id or index
|
2057
|
+
* @param {boolean=} force
|
2058
|
+
*/
|
2059
|
+
Grid.prototype.toggleRowExpansion = function(rid, force) {
|
2060
|
+
this._dv.toggleRowExpansion(rid, force);
|
2061
|
+
};
|
2062
|
+
/**
|
2063
|
+
* @private
|
2064
|
+
* @param {object} e
|
2065
|
+
*/
|
2066
|
+
Grid.prototype._onRowExpansionBinding = function(e) {
|
2067
|
+
if(!this.hasListener("rowExpansionBinding")) {
|
2068
|
+
return;
|
2069
|
+
}
|
2070
|
+
|
2071
|
+
if(e["originalRowId"]) {
|
2072
|
+
var rowIndex = this._dv.getRowIndex(e["originalRowId"]);
|
2073
|
+
e["originalRowDef"] = this._getRowDefinitionByIndex(rowIndex);
|
2074
|
+
e["originalRowData"] = e["originalRowDef"].getRowData();
|
2075
|
+
} else {
|
2076
|
+
e["rowDef"] = this._getRowDefinitionByIndex(e["rowIndex"]);
|
2077
|
+
e["rowData"] = e["rowDef"].getRowData();
|
2078
|
+
}
|
2079
|
+
|
2080
|
+
this._dispatch("rowExpansionBinding", e);
|
2081
|
+
};
|
2082
|
+
|
2083
|
+
/** Reset existing rows. It is a combination of insertRows and removeAllRows.
|
2084
|
+
* @public
|
2085
|
+
* @param {Array.<string>} ary
|
2086
|
+
*/
|
2087
|
+
Grid.prototype.setRics = function(ary) {
|
2088
|
+
this.removeAllRows();
|
2089
|
+
if(ary && ary.length) {
|
2090
|
+
this.insertRows(ary);
|
2091
|
+
}
|
2092
|
+
};
|
2093
|
+
|
2094
|
+
/** WARNING: This represents number of visible rows in a single grid
|
2095
|
+
* @public
|
2096
|
+
* @return {number}
|
2097
|
+
*/
|
2098
|
+
Grid.prototype.getRowCount = function() {
|
2099
|
+
return this._dv.getRowCount();
|
2100
|
+
};
|
2101
|
+
/** Get all rows without paging
|
2102
|
+
* @public
|
2103
|
+
* @return {number}
|
2104
|
+
*/
|
2105
|
+
Grid.prototype.getPageItemCount = function() {
|
2106
|
+
return this._dv.getRowCount(false, true);
|
2107
|
+
};
|
2108
|
+
/** WARNING: This represents number of rows in the DataTable which includes all invisible rows and rows in multiple wrapped grids
|
2109
|
+
* @public
|
2110
|
+
* @return {number}
|
2111
|
+
*/
|
2112
|
+
Grid.prototype.getDataRowCount = function() {
|
2113
|
+
return this._dt.getRowCount();
|
2114
|
+
};
|
2115
|
+
/** @public
|
2116
|
+
* @return {number}
|
2117
|
+
*/
|
2118
|
+
Grid.prototype.getColumnCount = function() {
|
2119
|
+
return this._grid.getColumnCount();
|
2120
|
+
};
|
2121
|
+
/** @public
|
2122
|
+
* @param {number} colIndex
|
2123
|
+
* @return {string}
|
2124
|
+
*/
|
2125
|
+
Grid.prototype.getColumnDataType = function(colIndex) {
|
2126
|
+
var colDef = this.getColumnDefinition(colIndex);
|
2127
|
+
if (colDef) {
|
2128
|
+
return colDef.getDataType();
|
2129
|
+
}
|
2130
|
+
return '';
|
2131
|
+
};
|
2132
|
+
/** @public
|
2133
|
+
* @param {number} colIndex
|
2134
|
+
* @return {ColumnDefinition}
|
2135
|
+
*/
|
2136
|
+
Grid.prototype.getColumnDefinition = function(colIndex) {
|
2137
|
+
var colData = this._grid.getColumnData(colIndex);
|
2138
|
+
if(colData) {
|
2139
|
+
return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
|
2140
|
+
}
|
2141
|
+
return null;
|
2142
|
+
};
|
2143
|
+
/** @private
|
2144
|
+
* @param {Grid~ColumnReference} colRef
|
2145
|
+
* @return {ColumnDefinition}
|
2146
|
+
*/
|
2147
|
+
Grid.prototype._getColumnDefinition = function(colRef) {
|
2148
|
+
if(colRef instanceof ColumnDefinition) {
|
2149
|
+
return /** @type{!ColumnDefinition} */(colRef);
|
2150
|
+
} else if(typeof colRef === "number") {
|
2151
|
+
return this.getColumnDefinition(colRef);
|
2152
|
+
} else if(typeof colRef === "string") {
|
2153
|
+
var colCount = this.getColumnCount();
|
2154
|
+
for(var i = 0; i < colCount; ++i) {
|
2155
|
+
var colDef = this.getColumnDefinition(i);
|
2156
|
+
if(colDef.getField() === colRef) {
|
2157
|
+
return colDef; // Return the first found field
|
2158
|
+
}
|
2159
|
+
}
|
2160
|
+
}
|
2161
|
+
return null;
|
2162
|
+
};
|
2163
|
+
/** @private
|
2164
|
+
* @return {Array.<ColumnDefinition>}
|
2165
|
+
*/
|
2166
|
+
Grid.prototype._getAllColumnDefinitions = function() {
|
2167
|
+
var colCount = this.getColumnCount();
|
2168
|
+
var colDefs = new Array(colCount);
|
2169
|
+
for(var i = 0; i < colCount; i++) {
|
2170
|
+
colDefs[i] = this.getColumnDefinition(i);
|
2171
|
+
}
|
2172
|
+
return colDefs;
|
2173
|
+
};
|
2174
|
+
/** @public
|
2175
|
+
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
2176
|
+
* @return {RowDefinition}
|
2177
|
+
*/
|
2178
|
+
Grid.prototype.getRowDefinition = function(rowRef) {
|
2179
|
+
if(typeof rowRef === "number") {
|
2180
|
+
return this._getRowDefinitionByIndex(rowRef);
|
2181
|
+
} else if(typeof rowRef === "string") {
|
2182
|
+
return this._getRowDefinitionById(rowRef);
|
2183
|
+
}
|
2184
|
+
return null;
|
2185
|
+
};
|
2186
|
+
/** @private
|
2187
|
+
* @param {number} rowIndex
|
2188
|
+
* @return {RowDefinition}
|
2189
|
+
*/
|
2190
|
+
Grid.prototype._getRowDefinitionByIndex = function(rowIndex) {
|
2191
|
+
return this._dv.getDataAt(rowIndex, ROW_DEF) || null;
|
2192
|
+
};
|
2193
|
+
/** @private
|
2194
|
+
* @param {string} rowId
|
2195
|
+
* @return {RowDefinition}
|
2196
|
+
*/
|
2197
|
+
Grid.prototype._getRowDefinitionById = function(rowId) {
|
2198
|
+
return this._dt.getData(rowId, ROW_DEF) || null;
|
2199
|
+
};
|
2200
|
+
/** @private
|
2201
|
+
* @param {Grid~RowReference} rowRef
|
2202
|
+
* @return {RowDefinition}
|
2203
|
+
*/
|
2204
|
+
Grid.prototype._getRowDefinition = function(rowRef) {
|
2205
|
+
if(rowRef instanceof RowDefinition) {
|
2206
|
+
if(rowRef.getRowId()) { // The row may have been removed from the grid
|
2207
|
+
return /** @type{!RowDefinition} */(rowRef);
|
2208
|
+
}
|
2209
|
+
}
|
2210
|
+
return this.getRowDefinition(rowRef);
|
2211
|
+
};
|
2212
|
+
/** Get all row definitions shown in the view, excluding rows that are hidden by filtering or pagination. <br>
|
2213
|
+
* A new array object is created every time. Do not call this method repeatedly.<br>
|
2214
|
+
* Group header row will return null for its rowDefinition since the row is auto generated and has no data nor definition.
|
2215
|
+
* @public
|
2216
|
+
* @return {!Array.<RowDefinition>}
|
2217
|
+
*/
|
2218
|
+
Grid.prototype.getRowDefinitions = function() {
|
2219
|
+
return this._dv.getColumnData(ROW_DEF, true); // Include group header rows
|
2220
|
+
};
|
2221
|
+
/** Get all row definitions, including filtered and hidden rows, but without group header rows.
|
2222
|
+
* @private
|
2223
|
+
* @return {!Array.<RowDefinition>}
|
2224
|
+
*/
|
2225
|
+
Grid.prototype._getAllRowDefinitions = function() {
|
2226
|
+
return this._dt.getColumnData(ROW_DEF); // no group header rows
|
2227
|
+
};
|
2228
|
+
/** A shorthand to retrieve row data based on index of the specified row.
|
2229
|
+
* @public
|
2230
|
+
* @param {number} rowIndex Row index as shown in the view
|
2231
|
+
* @return {Object} "FIELD1": value1, "FIELD2": value2, ...
|
2232
|
+
*/
|
2233
|
+
Grid.prototype.getRowData = function(rowIndex) {
|
2234
|
+
return toRowData(this._getRowDefinitionByIndex(rowIndex));
|
2235
|
+
};
|
2236
|
+
/** Get data from multiple rows. If null or undefined value is given, data from all rows are returned.
|
2237
|
+
* @public
|
2238
|
+
* @param {*=} obj The value can be rowIndex, array of row indices, array of row definitions, DataView instance, null or undefined
|
2239
|
+
* @return {!Array.<Object>}
|
2240
|
+
* @example
|
2241
|
+
* grid.getMultipleRowData(); // All row data are returned
|
2242
|
+
* grid.getMultipleRowData([0, 2, 4]); // Three row data are returned
|
2243
|
+
* grid.getMultipleRowData(1); // One row data from the specified row index is returned
|
2244
|
+
* grid.getMultipleRowData(DataView); // All row data from the specified DataView instance are returned
|
2245
|
+
*/
|
2246
|
+
Grid.prototype.getMultipleRowData = function(obj) {
|
2247
|
+
if(typeof obj === "number") {
|
2248
|
+
return [this.getRowData(obj)];
|
2249
|
+
}
|
2250
|
+
var rowDefs = null;
|
2251
|
+
if(Array.isArray(obj)) {
|
2252
|
+
var rowRefs = obj;
|
2253
|
+
var rowCount = rowRefs.length;
|
2254
|
+
var rows = new Array(rowCount);
|
2255
|
+
rowDefs = this.getRowDefinitions();
|
2256
|
+
|
2257
|
+
for(var r = 0; r < rowCount; ++r) {
|
2258
|
+
var rowRef = rowRefs[r];
|
2259
|
+
if(typeof rowRef === "number") {
|
2260
|
+
rows[r] = toRowData(rowDefs[rowRef]);
|
2261
|
+
} else if(rowRef && rowRef.getRowData) {
|
2262
|
+
rows[r] = toRowData(rowRef);
|
2263
|
+
}
|
2264
|
+
}
|
2265
|
+
return rows;
|
2266
|
+
}
|
2267
|
+
|
2268
|
+
if(obj && obj.getColumnData) { // Check if the given reference is DataView or DataTable
|
2269
|
+
rowDefs = obj.getColumnData(ROW_DEF, false); // Get all row data WITHOUT group header rows
|
2270
|
+
} else {
|
2271
|
+
rowDefs = this.getRowDefinitions(); // Get all row definition from current view INCLUDING group header rows
|
2272
|
+
}
|
2273
|
+
return rowDefs.map(toRowData);
|
2274
|
+
};
|
2275
|
+
/** Set row data base on RIC.
|
2276
|
+
* @public
|
2277
|
+
* @param {string} ric
|
2278
|
+
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
2279
|
+
*/
|
2280
|
+
Grid.prototype.setRicData = function(ric, values) {
|
2281
|
+
var rowDefs = this._connector.getRowDefByRic(ric);
|
2282
|
+
var rowCount = rowDefs ? rowDefs.length : 0;
|
2283
|
+
for (var i = 0; i < rowCount; ++i) {
|
2284
|
+
var rowDef = rowDefs[i];
|
2285
|
+
if (rowDef && rowDef.getRic() === ric) {
|
2286
|
+
rowDef.setRowData(values); // TODO: Need conflator to improve performance
|
2287
|
+
}
|
2288
|
+
}
|
2289
|
+
};
|
2290
|
+
/** 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.
|
2291
|
+
* @public
|
2292
|
+
* @param {Grid~RowReference} rowRef
|
2293
|
+
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
2294
|
+
*/
|
2295
|
+
Grid.prototype.setRowData = function(rowRef, values) {
|
2296
|
+
var rowDef = this._getRowDefinition(rowRef);
|
2297
|
+
if(rowDef) {
|
2298
|
+
rowDef.setRowData(values);
|
2299
|
+
}
|
2300
|
+
};
|
2301
|
+
/** @private
|
2302
|
+
* @param {Grid~RowReference=} rowRef
|
2303
|
+
* @return {string}
|
2304
|
+
*/
|
2305
|
+
Grid.prototype._getRowId = function(rowRef) {
|
2306
|
+
if(typeof rowRef === "string") {
|
2307
|
+
return rowRef;
|
2308
|
+
} else if(typeof rowRef === "number") { // WARNING: This is view index, excluding hidden row
|
2309
|
+
return this._dv.getRowId(rowRef);
|
2310
|
+
} else if(rowRef instanceof RowDefinition) {
|
2311
|
+
return rowRef.getRowId();
|
2312
|
+
}
|
2313
|
+
return "";
|
2314
|
+
};
|
2315
|
+
|
2316
|
+
/** @public
|
2317
|
+
* @param {Grid~ColumnReference} colRef
|
2318
|
+
* @return {number}
|
2319
|
+
*/
|
2320
|
+
Grid.prototype.getColumnIndex = function(colRef) {
|
2321
|
+
if(typeof colRef === "number") {
|
2322
|
+
return colRef;
|
2323
|
+
}
|
2324
|
+
|
2325
|
+
var colCount = this.getColumnCount();
|
2326
|
+
var i, colDef;
|
2327
|
+
if(colRef instanceof ColumnDefinition) {
|
2328
|
+
for(i = 0; i < colCount; ++i) {
|
2329
|
+
colDef = this.getColumnDefinition(i);
|
2330
|
+
if(colDef === colRef) {
|
2331
|
+
return i;
|
2332
|
+
}
|
2333
|
+
}
|
2334
|
+
} else if(typeof colRef === "string") {
|
2335
|
+
for(i = 0; i < colCount; ++i) {
|
2336
|
+
colDef = this.getColumnDefinition(i);
|
2337
|
+
if(colDef.getField() === colRef) {
|
2338
|
+
return i; // Return the first found field
|
2339
|
+
}
|
2340
|
+
}
|
2341
|
+
}
|
2342
|
+
return -1;
|
2343
|
+
};
|
2344
|
+
/** Any invalid column reference will be excluded from the output array
|
2345
|
+
* @public
|
2346
|
+
* @param {Array.<Grid~ColumnReference>} colRefs
|
2347
|
+
* @return {!Array.<number>}
|
2348
|
+
*/
|
2349
|
+
Grid.prototype.getColumnIndices = function(colRefs) {
|
2350
|
+
var ary = [];
|
2351
|
+
var colCount = this.getColumnCount();
|
2352
|
+
var inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
2353
|
+
var len = inputAry.length;
|
2354
|
+
// Verify user input
|
2355
|
+
for(var i = 0; i < len; ++i) {
|
2356
|
+
var colIndex = this.getColumnIndex(inputAry[i]);
|
2357
|
+
if(colIndex >= 0 && colIndex < colCount) {
|
2358
|
+
ary.push(colIndex); // WARNING: We have not check for duplication
|
2359
|
+
}
|
2360
|
+
}
|
2361
|
+
return ary;
|
2362
|
+
};
|
2363
|
+
/** Return column id that is set through configuration object
|
2364
|
+
* @public
|
2365
|
+
* @param {number} colIndex
|
2366
|
+
* @return {string} Return empty string if no existing id or column
|
2367
|
+
* @see {@link Grid#getColumnDefinition}
|
2368
|
+
*/
|
2369
|
+
Grid.prototype.getColumnId = function(colIndex) {
|
2370
|
+
var colDef = this.getColumnDefinition(colIndex);
|
2371
|
+
return (colDef) ? colDef.getId() : "";
|
2372
|
+
};
|
2373
|
+
/** Return field defined in the column definition
|
2374
|
+
* @public
|
2375
|
+
* @param {number} colIndex
|
2376
|
+
* @return {string}
|
2377
|
+
* @see {@link Grid#getColumnDefinition}
|
2378
|
+
*/
|
2379
|
+
Grid.prototype.getColumnField = function(colIndex) {
|
2380
|
+
var colDef = this.getColumnDefinition(colIndex);
|
2381
|
+
return (colDef) ? colDef.getField() : "";
|
2382
|
+
};
|
2383
|
+
/** Get fields from each column definition. Note that this does not include any required field or data fields. Duplicates may exist.
|
2384
|
+
* @public
|
2385
|
+
* @return {!Array.<string>} New array is created
|
2386
|
+
*/
|
2387
|
+
Grid.prototype.getColumnFields = function() {
|
2388
|
+
var colCount = this.getColumnCount();
|
2389
|
+
var ary = new Array(colCount);
|
2390
|
+
for(var i = 0; i < colCount; ++i) {
|
2391
|
+
ary[i] = this.getColumnField(i);
|
2392
|
+
}
|
2393
|
+
return ary;
|
2394
|
+
};
|
2395
|
+
/** Get all fields, including required fields and data fields, with no duplicate
|
2396
|
+
* @public
|
2397
|
+
* @return {!Array.<string>} New array is created
|
2398
|
+
*/
|
2399
|
+
Grid.prototype.getAllFields = function() {
|
2400
|
+
return this._connector.getAllFields();
|
2401
|
+
};
|
2402
|
+
/** Freeze the column at the left side of the table starting from index 0 to the specified colIndex
|
2403
|
+
* If no index is specified (null or undefined index), unfreeze all columns.
|
2404
|
+
* @public
|
2405
|
+
* @param {number=} opt_colIndex
|
2406
|
+
* @param {number=} pinnedRightColumns Number of columns to be pinned/snapped on the right side
|
2407
|
+
*/
|
2408
|
+
Grid.prototype.freezeColumn = function(opt_colIndex, pinnedRightColumns) {
|
2409
|
+
this._grid.freezeColumn(opt_colIndex, pinnedRightColumns);
|
2410
|
+
};
|
2411
|
+
|
2412
|
+
/** @private
|
2413
|
+
* @param {Object} e
|
2414
|
+
*/
|
2415
|
+
Grid.prototype._onColumnHeaderBinding = function(e) {
|
2416
|
+
if(e["sectionType"] !== "title" || e["sectionIndex"] > 0) {
|
2417
|
+
return; // WARNING: Assume that only the first title section is owned by the grid. Anything else is assumed to be generated by plugins
|
2418
|
+
}
|
2419
|
+
|
2420
|
+
var c = e["fromColIndex"];
|
2421
|
+
var toC = e["toColIndex"];
|
2422
|
+
while(c < toC) {
|
2423
|
+
this._renderColumnHeader(c++, e);
|
2424
|
+
}
|
2425
|
+
};
|
2426
|
+
/** @private
|
2427
|
+
* @param {number=} colIndex
|
2428
|
+
* @param {Object} arg
|
2429
|
+
*/
|
2430
|
+
Grid.prototype._renderColumnHeader = function(colIndex, arg) {
|
2431
|
+
var colDef = this.getColumnDefinition(colIndex);
|
2432
|
+
if(!colDef) {
|
2433
|
+
return;
|
2434
|
+
}
|
2435
|
+
var customRenderer = colDef.getHeaderRenderer();
|
2436
|
+
var tSection = arg.section;
|
2437
|
+
var rowCount = tSection.getRowCount();
|
2438
|
+
arg["colIndex"] = colIndex;
|
2439
|
+
arg["columnDef"] = colDef;
|
2440
|
+
|
2441
|
+
var colName = colDef.getName();
|
2442
|
+
var colTooltip = colDef.getTooltip();
|
2443
|
+
var headerAlignment = colDef.getHeaderAlignment();
|
2444
|
+
|
2445
|
+
for(var r = 0; r < rowCount; ++r) {
|
2446
|
+
var tCell = tSection.getCell(colIndex, r, false);
|
2447
|
+
// Default behaviors
|
2448
|
+
tCell.setContent(colName);
|
2449
|
+
tCell.setTooltip(colTooltip);
|
2450
|
+
tCell.setStyle("textAlign", headerAlignment);
|
2451
|
+
|
2452
|
+
if(customRenderer) {
|
2453
|
+
arg["rowIndex"] = r;
|
2454
|
+
arg["cell"] = tCell;
|
2455
|
+
customRenderer(arg);
|
2456
|
+
}
|
2457
|
+
}
|
2458
|
+
};
|
2459
|
+
/** @public
|
2460
|
+
*/
|
2461
|
+
Grid.prototype.updateColumnTitle = function() {
|
2462
|
+
if(this._columnTitleConflator.conflate()) {
|
2463
|
+
return;
|
2464
|
+
}
|
2465
|
+
var tss = this._grid.getSectionSettings("title"); // WARNING: Assume that only the first title section is owned by the grid
|
2466
|
+
if(tss) {
|
2467
|
+
tss.rerender();
|
2468
|
+
}
|
2469
|
+
};
|
2470
|
+
/** @public
|
2471
|
+
* @return {boolean}
|
2472
|
+
*/
|
2473
|
+
Grid.prototype.isSorting = function() {
|
2474
|
+
return this.getSortedColumnIndex() >= 0;
|
2475
|
+
};
|
2476
|
+
/** @public
|
2477
|
+
* @return {number}
|
2478
|
+
*/
|
2479
|
+
Grid.prototype.getSortedColumnIndex = function() {
|
2480
|
+
return this._stp.getSortedColumnIndex();
|
2481
|
+
};
|
2482
|
+
/** @public
|
2483
|
+
* @return {string} "a" for "ascending, "d" for descending, and "n" for none/noOrder
|
2484
|
+
*/
|
2485
|
+
Grid.prototype.getSortOrder = function() {
|
2486
|
+
return this._stp.getSortOrder();
|
2487
|
+
};
|
2488
|
+
/** @public
|
2489
|
+
*/
|
2490
|
+
Grid.prototype.clearSort = function() {
|
2491
|
+
this._stp.clearSortState();
|
2492
|
+
};
|
2493
|
+
|
2494
|
+
/** @private
|
2495
|
+
* @param {!Object} e
|
2496
|
+
*/
|
2497
|
+
Grid.prototype._onDataChanged = function(e) {
|
2498
|
+
var rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
|
2499
|
+
if (!rowData) {
|
2500
|
+
return; // This must be a global change
|
2501
|
+
}
|
2502
|
+
var rowDef = rowData[ROW_DEF];
|
2503
|
+
|
2504
|
+
if(rowDef) {
|
2505
|
+
var rowId = rowDef.getRowId();
|
2506
|
+
if(rowId) {
|
2507
|
+
// e["rid"] could be from JET/RTK (rowId + ric) or static data update (rowId)
|
2508
|
+
var curRowData = this._dc.getRowData(e["rid"]);
|
2509
|
+
if (curRowData) {
|
2510
|
+
if(rowDef.addUpdate(e)) { // This is the only place that update array can grow. It is used for blinking data.
|
2511
|
+
this._dt._hasNewUpdates = true; // Mark data table for cleaning it up later
|
2512
|
+
}
|
2513
|
+
this._updateStreamingData();
|
2514
|
+
} else if(rowDef.isAutoGenerated()) { // Subscription and its parent has been removed by Real-time provider
|
2515
|
+
rowDef.setParent(null); // Manually remove child reference from its parent
|
2516
|
+
this._removeRow(rowDef);
|
2517
|
+
}
|
2518
|
+
}
|
2519
|
+
return;
|
2520
|
+
}
|
2521
|
+
|
2522
|
+
// The new data update has no row definition, meaning that we have found a new constituent from a chain.
|
2523
|
+
var subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
|
2524
|
+
if(subId) {
|
2525
|
+
var parentDef = this._getRowDefinition(subId);
|
2526
|
+
if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
|
2527
|
+
if(!this._chainMembers) {
|
2528
|
+
this._chainMembers = {};
|
2529
|
+
}
|
2530
|
+
if(!this._chainMembers[e["rid"]]) { // Prevent duplication
|
2531
|
+
this._chainMembers[e["rid"]] = rowData;
|
2532
|
+
this._addMemberOfChain(rowData);
|
2533
|
+
}
|
2534
|
+
}
|
2535
|
+
}
|
2536
|
+
};
|
2537
|
+
/** @private
|
2538
|
+
* @param {!Object} rowData
|
2539
|
+
*/
|
2540
|
+
Grid.prototype._addMemberOfChain = function(rowData) {
|
2541
|
+
if(this._chainConflator.conflate(rowData)) {
|
2542
|
+
return;
|
2543
|
+
}
|
2544
|
+
|
2545
|
+
var rows = this._chainConflator.popAllData(); // This must have no duplication
|
2546
|
+
var len = rows ? rows.length : 0;
|
2547
|
+
var i;
|
2548
|
+
|
2549
|
+
var prevState = false;
|
2550
|
+
if(len > 1) {
|
2551
|
+
prevState = this._dt.freeze(); // Avoid sorting for each insertion
|
2552
|
+
}
|
2553
|
+
var childDefs = [];
|
2554
|
+
for(i = 0; i < len; ++i) {
|
2555
|
+
rowData = /** @type{!Object} */(rows[i]);
|
2556
|
+
var subId = rowData[SUB_ID];
|
2557
|
+
var parentDef = this._getRowDefinition(subId);
|
2558
|
+
if(parentDef) {
|
2559
|
+
var childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
|
2560
|
+
if(childDef) {
|
2561
|
+
childDefs.push(childDef);
|
2562
|
+
} // else { // childDef has already been added
|
2563
|
+
}
|
2564
|
+
}
|
2565
|
+
this._chainMembers = null; // Clear all waiting chain members
|
2566
|
+
|
2567
|
+
var childCount = childDefs.length;
|
2568
|
+
if(childCount) {
|
2569
|
+
for(i = childCount; --i >= 0;) {
|
2570
|
+
this._connector.addRic(childDefs[i]); // TODO: JET/RTK should not re-subscribe this
|
2571
|
+
}
|
2572
|
+
}
|
2573
|
+
if(len > 1) {
|
2574
|
+
this._dt.freeze(prevState);
|
2575
|
+
}
|
2576
|
+
};
|
2577
|
+
|
2578
|
+
/** @private
|
2579
|
+
*/
|
2580
|
+
Grid.prototype._updateStreamingData = function() {
|
2581
|
+
if(this._streamingConflator.conflate()) {
|
2582
|
+
return;
|
2583
|
+
}
|
2584
|
+
|
2585
|
+
if(this._dt) {
|
2586
|
+
this._dt.dispatchGlobalChange();
|
2587
|
+
}
|
2588
|
+
};
|
2589
|
+
/** @private
|
2590
|
+
*/
|
2591
|
+
Grid.prototype._updateGroupOrder = function() {
|
2592
|
+
if(!this._hasGroup) { return; }
|
2593
|
+
// TODO: Perform re-indexing of the data table, so that both data table and data view has the same index
|
2594
|
+
// if(this.isSorting()) {
|
2595
|
+
// this._dt.sortOnce(ROW_DEF, this.getSortOrder());
|
2596
|
+
// }
|
2597
|
+
var rowCount = this._dt.getRowCount();
|
2598
|
+
var groupOrder = 0;
|
2599
|
+
var dirty = 0;
|
2600
|
+
var prevParent = null;
|
2601
|
+
var prevFixedState = false;
|
2602
|
+
for(var i = 0; i < rowCount; ++i) {
|
2603
|
+
var rowDef = this._dt.getDataAt(i, ROW_DEF);
|
2604
|
+
var curParent = rowDef.getParent();
|
2605
|
+
var curFixedState = rowDef.isFixedPosition();
|
2606
|
+
if(curFixedState || curFixedState !== prevFixedState || curParent !== prevParent) {
|
2607
|
+
++groupOrder;
|
2608
|
+
}
|
2609
|
+
prevParent = curParent;
|
2610
|
+
prevFixedState = curFixedState;
|
2611
|
+
dirty |= rowDef.setGroupOrder(groupOrder);
|
2612
|
+
}
|
2613
|
+
if(dirty && this.isSorting()){
|
2614
|
+
this._stp.refresh();
|
2615
|
+
}
|
2616
|
+
};
|
2617
|
+
|
2618
|
+
/** @private
|
2619
|
+
* @param {Object} e
|
2620
|
+
*/
|
2621
|
+
Grid.prototype._onPreDataSorting = function (e) {
|
2622
|
+
// TODO: Support multi-column sorting
|
2623
|
+
var colIndex = this._stp.getSortedColumnIndex();
|
2624
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
2625
|
+
this._columnSorter = (colDef) ? colDef._prepareSortContext(colIndex) : null;
|
2626
|
+
};
|
2627
|
+
/** @private
|
2628
|
+
* @param {RowDefinition} rowDefA
|
2629
|
+
* @param {RowDefinition} rowDefB
|
2630
|
+
* @param {number} order
|
2631
|
+
* @return {number}
|
2632
|
+
*/
|
2633
|
+
Grid.prototype._mainSorter = function (rowDefA, rowDefB, order) {
|
2634
|
+
return this._columnSorter(rowDefA, rowDefB, order);
|
2635
|
+
};
|
2636
|
+
|
2637
|
+
/** @private
|
2638
|
+
* @param {Object} e
|
2639
|
+
*/
|
2640
|
+
Grid.prototype._onPostSectionDataBinding = function(e) {
|
2641
|
+
if(e["actualUpdate"]) {
|
2642
|
+
this._asyncClearDataUpdates();
|
2643
|
+
}
|
2644
|
+
};
|
2645
|
+
/** @private
|
2646
|
+
*/
|
2647
|
+
Grid.prototype._asyncClearDataUpdates = function() {
|
2648
|
+
setTimeout(this._clearDataUpdates, 0);
|
2649
|
+
};
|
2650
|
+
/** @private
|
2651
|
+
*/
|
2652
|
+
Grid.prototype._clearDataUpdates = function() {
|
2653
|
+
if(!this._dt || !this._dt._hasNewUpdates) {
|
2654
|
+
return;
|
2655
|
+
}
|
2656
|
+
var rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
|
2657
|
+
for(var i = rowIds.length; --i >= 0;) {
|
2658
|
+
var rowData = this._dt.getRowData(rowIds[i]);
|
2659
|
+
var rowDef = rowData[ROW_DEF];
|
2660
|
+
rowDef.resetUpdates();
|
2661
|
+
}
|
2662
|
+
};
|
2663
|
+
|
2664
|
+
/** @public
|
2665
|
+
* @return {DataView}
|
2666
|
+
*/
|
2667
|
+
Grid.prototype.getDataView = function() {
|
2668
|
+
return this._dv;
|
2669
|
+
};
|
2670
|
+
/** @public
|
2671
|
+
* @param {number} pageIndex
|
2672
|
+
* @return {boolean}
|
2673
|
+
*/
|
2674
|
+
Grid.prototype.setPage = function(pageIndex) {
|
2675
|
+
return this._dv.setPage(pageIndex);
|
2676
|
+
};
|
2677
|
+
/** @public
|
2678
|
+
* @param {number} size
|
2679
|
+
*/
|
2680
|
+
Grid.prototype.setPageSize = function(size) {
|
2681
|
+
this._dv.setPageSize(size);
|
2682
|
+
};
|
2683
|
+
/** @public
|
2684
|
+
* @return {number}
|
2685
|
+
*/
|
2686
|
+
Grid.prototype.getPageIndex = function() {
|
2687
|
+
return this._dv.getPageIndex();
|
2688
|
+
};
|
2689
|
+
/** @public
|
2690
|
+
* @return {number}
|
2691
|
+
*/
|
2692
|
+
Grid.prototype.getPageSize = function() {
|
2693
|
+
return this._dv.getPageSize();
|
2694
|
+
};
|
2695
|
+
/** @public
|
2696
|
+
* @return {number}
|
2697
|
+
*/
|
2698
|
+
Grid.prototype.getPageCount = function() {
|
2699
|
+
return this._dv.getPageCount();
|
2700
|
+
};
|
2701
|
+
|
2702
|
+
/** @description Toggle between expanded and collapsed chain index
|
2703
|
+
* @public
|
2704
|
+
* @param {Grid~RowReference} rowRef
|
2705
|
+
*/
|
2706
|
+
Grid.prototype.toggleChain = function(rowRef) {
|
2707
|
+
var rowDef = this._getRowDefinition(rowRef);
|
2708
|
+
if(rowDef) {
|
2709
|
+
rowDef.toggleChain();
|
2710
|
+
}
|
2711
|
+
};
|
2712
|
+
/** @description Focus grid element without moving window scrollbar
|
2713
|
+
* @public
|
2714
|
+
*/
|
2715
|
+
Grid.prototype.focus = function() {
|
2716
|
+
this._grid.focus();
|
2717
|
+
};
|
2718
|
+
/** Request re-rendering of content row by triggering data binding event without any change in data model
|
2719
|
+
* @public
|
2720
|
+
*/
|
2721
|
+
Grid.prototype.requestRowRefresh = function() {
|
2722
|
+
this._grid.requestRowRefresh();
|
2723
|
+
};
|
2724
|
+
|
2725
|
+
/** @private
|
2726
|
+
* @param {Object} e
|
2727
|
+
*/
|
2728
|
+
Grid.prototype._onFormulaDataChanged = function(e) {
|
2729
|
+
if (this._formulaConflator.conflate()) {
|
2730
|
+
return;
|
2731
|
+
}
|
2732
|
+
|
2733
|
+
// TODO: Check if we need to recompose the data in the data composed method
|
2734
|
+
this._recalculateFormulas(); // Force recalculation of user formula
|
2735
|
+
this._updateRowData(); // Re-render the data
|
2736
|
+
};
|
2737
|
+
/** @private
|
2738
|
+
* @param {Object} e
|
2739
|
+
*/
|
2740
|
+
Grid.prototype._onFormulaDataRequired = function(e) {
|
2741
|
+
// if(obj["field"]) {
|
2742
|
+
// this._registerFieldToDataProvider(obj); TODO
|
2743
|
+
// if(this._dataRequiredTimerId) {
|
2744
|
+
// window.clearTimeout(this._dataRequiredTimerId);
|
2745
|
+
// }
|
2746
|
+
// this._dataRequiredTimerId = window.setTimeout( this._recalculateFormulas, 0); // Force recalculation of all rows
|
2747
|
+
// }
|
2748
|
+
};
|
2749
|
+
|
2750
|
+
/** @private
|
2751
|
+
* @param {Object} e
|
2752
|
+
*/
|
2753
|
+
Grid.prototype._onDataComposed = function(e) {
|
2754
|
+
var values = e["changes"];
|
2755
|
+
if(!values) {
|
2756
|
+
return; // Cannot do data composition if there is no change in data
|
2757
|
+
}
|
2758
|
+
|
2759
|
+
var rowData = e["rowData"];
|
2760
|
+
if(!rowData) {
|
2761
|
+
return; // Row could already be removed or global change event is sent
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
var rowDef = rowData[ROW_DEF];
|
2765
|
+
if(!rowDef) {
|
2766
|
+
return;
|
2767
|
+
}
|
2768
|
+
|
2769
|
+
if(this._autoDateConversion) { // auto data conversion
|
2770
|
+
var field, value, dataType, colDef;
|
2771
|
+
for(field in values) {
|
2772
|
+
colDef = this._getColumnDefinition(field);
|
2773
|
+
if(colDef) {
|
2774
|
+
dataType = colDef.getDataType();
|
2775
|
+
} else {
|
2776
|
+
dataType = ColumnDefinition.getDataType(field);
|
2777
|
+
}
|
2778
|
+
|
2779
|
+
if(dataType === "datetime") {
|
2780
|
+
value = values[field];
|
2781
|
+
rowDef.setData(field + "_RAW", value);
|
2782
|
+
value = DateTime.toDateObject(value);
|
2783
|
+
rowDef.setData(field, value); // TODO: Check if this trigger data change multiple times
|
2784
|
+
}
|
2785
|
+
}
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
if(this.hasListener("dataComposed")) {
|
2789
|
+
e["grid"] = this;
|
2790
|
+
e["rowDef"] = rowDef;
|
2791
|
+
this._dispatch("dataComposed", e);
|
2792
|
+
}
|
2793
|
+
};
|
2794
|
+
|
2795
|
+
/** @private
|
2796
|
+
* @param {Object=} e
|
2797
|
+
*/
|
2798
|
+
Grid.prototype._recalculateFormulas = function(e) {
|
2799
|
+
if(this._fnEngine.getFormulaCount() <= 0) { return; }
|
2800
|
+
|
2801
|
+
if(e && e["rid"]) {
|
2802
|
+
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
2803
|
+
} else {
|
2804
|
+
var rows = this._dc.getAllRowData(); // Slow
|
2805
|
+
|
2806
|
+
var rowCount = rows.length;
|
2807
|
+
for(var r = 0; r < rowCount; ++r) { // WARNING: This is very slow
|
2808
|
+
this._fnEngine.calculate(rows[r]);
|
2809
|
+
}
|
2810
|
+
}
|
2811
|
+
};
|
2812
|
+
|
2813
|
+
/** @private
|
2814
|
+
* @param {Object} e The updated data from snapshot filler when it request data from JET/RTK
|
2815
|
+
*/
|
2816
|
+
Grid.prototype._snapshotFillerDataChanged = function (e) {
|
2817
|
+
if (!this._dt) return;
|
2818
|
+
|
2819
|
+
var data = e.data;
|
2820
|
+
for (var ric in data) {
|
2821
|
+
this.setRicData(ric, data[ric]);
|
2822
|
+
}
|
2823
|
+
};
|
2824
|
+
|
2825
|
+
/** @private
|
2826
|
+
*/
|
2827
|
+
Grid.prototype._onAutoLayoutUpdate = function() {
|
2828
|
+
var elem = this._topNode;
|
2829
|
+
|
2830
|
+
var cw = elem.clientWidth;
|
2831
|
+
if(cw !== this._clientWidth) {
|
2832
|
+
this._clientWidth = cw;
|
2833
|
+
this.updateLayout();
|
2834
|
+
}
|
2835
|
+
};
|
2836
|
+
|
2837
|
+
/** @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
|
2838
|
+
* @public
|
2839
|
+
* @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
|
2840
|
+
*/
|
2841
|
+
Grid.prototype.logDT = function(opt_options) {
|
2842
|
+
var rowDefs = this._getAllRowDefinitions();
|
2843
|
+
this._logData(rowDefs, opt_options);
|
2844
|
+
};
|
2845
|
+
/** @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
|
2846
|
+
* @public
|
2847
|
+
* @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
|
2848
|
+
* @example
|
2849
|
+
// Options have the following format:
|
2850
|
+
// {
|
2851
|
+
// "colNames": Array.<string>,
|
2852
|
+
// "rowCount": number,
|
2853
|
+
// "startIndex": number,
|
2854
|
+
// "getter": function(rowData:Object, colName:string):*,
|
2855
|
+
// "withRowIds": boolean
|
2856
|
+
// }
|
2857
|
+
grid.logDV({"rowCount": 10}); // Showing 10 records
|
2858
|
+
*/
|
2859
|
+
Grid.prototype.logDV = function(opt_options) {
|
2860
|
+
var rowDefs = this.getRowDefinitions();
|
2861
|
+
this._logData(rowDefs, opt_options);
|
2862
|
+
};
|
2863
|
+
/** Log the collection of data to console
|
2864
|
+
* @private
|
2865
|
+
* @param {!Array.<RowDefinition>} rowDefs
|
2866
|
+
* @param {Object=} options
|
2867
|
+
*/
|
2868
|
+
Grid.prototype._logData = function(rowDefs, options) {
|
2869
|
+
if(!options) {
|
2870
|
+
options = {};
|
2871
|
+
}
|
2872
|
+
if(!options["colNames"]) {
|
2873
|
+
// TODO: Get all required fields and eliminate duplicate fields
|
2874
|
+
options["colNames"] = this.getColumnFields();
|
2875
|
+
}
|
2876
|
+
var tbl = DataCache.constructTable(rowDefs.map(toRowData), options);
|
2877
|
+
|
2878
|
+
console.table(tbl); // eslint-disable-line
|
2879
|
+
};
|
2880
|
+
|
2881
|
+
/** @private
|
2882
|
+
* @function
|
2883
|
+
* @param {Object} to
|
2884
|
+
* @param {Object} from
|
2885
|
+
*/
|
2886
|
+
Grid._objectAssign = function (to, from) {
|
2887
|
+
for (var key in from) {
|
2888
|
+
to[key] = from[key];
|
2889
|
+
}
|
2890
|
+
};
|
2891
|
+
|
2892
|
+
export { Grid };
|
2893
|
+
export default Grid;
|