@revolist/revogrid 4.9.41 → 4.9.42
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/dist/cjs/app-globals-c0b20747.js.map +1 -1
- package/dist/cjs/{column.drag.plugin-fcd892ec.js → column.drag.plugin-a6ef25bf.js} +1034 -149
- package/dist/cjs/column.drag.plugin-a6ef25bf.js.map +1 -0
- package/dist/cjs/column.service-831e1c92.js +1321 -0
- package/dist/cjs/column.service-831e1c92.js.map +1 -0
- package/dist/cjs/{column.service-26c61ed6.js → dimension.helpers-1927ad24.js} +490 -1273
- package/dist/cjs/dimension.helpers-1927ad24.js.map +1 -0
- package/dist/cjs/{edit.utils-179c0800.js → edit.utils-e51411f6.js} +3 -3
- package/dist/cjs/{edit.utils-179c0800.js.map → edit.utils-e51411f6.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-d879d95e.js → header-cell-renderer-53ecdcdb.js} +2 -2
- package/dist/cjs/{header-cell-renderer-d879d95e.js.map → header-cell-renderer-53ecdcdb.js.map} +1 -1
- package/dist/cjs/index.cjs.js +127 -69
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/key.utils-96d0bc42.js +101 -0
- package/dist/cjs/key.utils-96d0bc42.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +310 -941
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +100 -70
- package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +11 -10
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +88 -78
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +33 -13
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{text-editor-b756d6b3.js → text-editor-1afffaf1.js} +6 -6
- package/dist/cjs/text-editor-1afffaf1.js.map +1 -0
- package/dist/cjs/{throttle-a57f51f9.js → throttle-bb713c73.js} +4 -4
- package/dist/cjs/{throttle-a57f51f9.js.map → throttle-bb713c73.js.map} +1 -1
- package/dist/cjs/{row-header-utils-c37f76e4.js → viewport.store-69b45f22.js} +15 -14
- package/dist/cjs/viewport.store-69b45f22.js.map +1 -0
- package/dist/collection/components/attribution/revogr-attribution.js +1 -1
- package/dist/collection/components/attribution/revogr-attribution.js.map +1 -1
- package/dist/collection/components/data/cell-renderer.js +11 -9
- package/dist/collection/components/data/cell-renderer.js.map +1 -1
- package/dist/collection/components/data/column.service.js +7 -19
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/data/revogr-data-style.css +10 -5
- package/dist/collection/components/data/revogr-data.js +50 -28
- package/dist/collection/components/data/revogr-data.js.map +1 -1
- package/dist/collection/components/data/row-highlight.plugin.js.map +1 -1
- package/dist/collection/components/data/row-renderer.js.map +1 -1
- package/dist/collection/components/editors/revogr-edit-style.css +8 -5
- package/dist/collection/components/editors/revogr-edit.js +2 -2
- package/dist/collection/components/editors/revogr-edit.js.map +1 -1
- package/dist/collection/components/editors/text-editor.js +2 -2
- package/dist/collection/components/editors/text-editor.js.map +1 -1
- package/dist/collection/components/extra/revogr-extra.js +44 -6
- package/dist/collection/components/extra/revogr-extra.js.map +1 -1
- package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
- package/dist/collection/components/header/header-renderer.js.map +1 -1
- package/dist/collection/components/header/resizable.element.js.map +1 -1
- package/dist/collection/components/header/revogr-header-style.css +8 -5
- package/dist/collection/components/header/revogr-header.js +9 -9
- package/dist/collection/components/header/revogr-header.js.map +1 -1
- package/dist/collection/components/order/order-renderer.js.map +1 -1
- package/dist/collection/components/order/revogr-order-editor.js +12 -24
- package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
- package/dist/collection/components/overlay/autofill.service.js +7 -5
- package/dist/collection/components/overlay/autofill.service.js.map +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +1 -4
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-selection.js +88 -72
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-style.css +8 -5
- package/dist/collection/components/overlay/selection.utils.js.map +1 -1
- package/dist/collection/components/revoGrid/plugin.service.js +81 -0
- package/dist/collection/components/revoGrid/plugin.service.js.map +1 -0
- package/dist/collection/components/revoGrid/revo-grid-style.css +18 -11
- package/dist/collection/components/revoGrid/revo-grid.js +289 -140
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.service.js +9 -9
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +1 -1
- package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -1
- package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +8 -5
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +26 -20
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
- package/dist/collection/components/scrollable/revogr-scroll-style.css +10 -7
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +10 -8
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
- package/dist/collection/components/selectionFocus/revogr-focus-style.css +8 -5
- package/dist/collection/components/selectionFocus/revogr-focus.js +10 -10
- package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -1
- package/dist/collection/components/selectionTempRange/revogr-temp-range-style.css +8 -5
- package/dist/collection/components/selectionTempRange/revogr-temp-range.js +6 -6
- package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -1
- package/dist/collection/components/vnode/vnode-converter.js +1 -1
- package/dist/collection/components/vnode/vnode-converter.js.map +1 -1
- package/dist/collection/components/vnode/vnode.utils.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/plugins/add-rows-on-paste.plugin.js +40 -0
- package/dist/collection/plugins/add-rows-on-paste.plugin.js.map +1 -0
- package/dist/collection/plugins/base.plugin.js.map +1 -1
- package/dist/collection/plugins/column.auto-size.plugin.js +1 -1
- package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -1
- package/dist/collection/plugins/column.stretch.plugin.js +1 -1
- package/dist/collection/plugins/column.stretch.plugin.js.map +1 -1
- package/dist/collection/plugins/export/csv.js +1 -1
- package/dist/collection/plugins/export/csv.js.map +1 -1
- package/dist/collection/plugins/export/export.plugin.js +4 -2
- package/dist/collection/plugins/export/export.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.indexed.js +1 -0
- package/dist/collection/plugins/filter/filter.indexed.js.map +1 -1
- package/dist/collection/plugins/filter/filter.panel.js +35 -35
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +117 -77
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.style.css +19 -5
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js.map +1 -1
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.const.js +1 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +64 -79
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +3 -3
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js +40 -6
- package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -1
- package/dist/collection/plugins/index.js +2 -0
- package/dist/collection/plugins/index.js.map +1 -1
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +12 -6
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
- package/dist/collection/plugins/sorting/sorting.func.js +42 -0
- package/dist/collection/plugins/sorting/sorting.func.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +71 -69
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
- package/dist/collection/plugins/sorting/sorting.types.js +2 -0
- package/dist/collection/plugins/sorting/sorting.types.js.map +1 -0
- package/dist/collection/serve/controller.js +32 -15
- package/dist/collection/serve/data.js +18 -11
- package/dist/collection/services/column.data.provider.js +5 -2
- package/dist/collection/services/column.data.provider.js.map +1 -1
- package/dist/collection/services/data.provider.js +18 -7
- package/dist/collection/services/data.provider.js.map +1 -1
- package/dist/collection/services/dimension.provider.js +32 -33
- package/dist/collection/services/dimension.provider.js.map +1 -1
- package/dist/collection/services/selection.store.connector.js +1 -1
- package/dist/collection/services/selection.store.connector.js.map +1 -1
- package/dist/collection/store/dataSource/data.proxy.js +9 -15
- package/dist/collection/store/dataSource/data.proxy.js.map +1 -1
- package/dist/collection/store/dataSource/data.store.js +1 -1
- package/dist/collection/store/dataSource/data.store.js.map +1 -1
- package/dist/collection/store/dataSource/trimmed.plugin.js +5 -8
- package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
- package/dist/collection/store/dimension/dimension.helpers.js +7 -9
- package/dist/collection/store/dimension/dimension.helpers.js.map +1 -1
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
- package/dist/collection/store/dimension/dimension.store.js +47 -67
- package/dist/collection/store/dimension/dimension.store.js.map +1 -1
- package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
- package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
- package/dist/collection/store/selection/selection.store.js +1 -1
- package/dist/collection/store/selection/selection.store.js.map +1 -1
- package/dist/collection/store/vp/viewport.store.js +4 -2
- package/dist/collection/store/vp/viewport.store.js.map +1 -1
- package/dist/collection/types/events.js +6 -2
- package/dist/collection/types/events.js.map +1 -1
- package/dist/collection/types/interfaces.js +4 -0
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/types/plugin.types.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/types/viewport.interfaces.js.map +1 -1
- package/dist/collection/utils/column.utils.js +13 -3
- package/dist/collection/utils/column.utils.js.map +1 -1
- package/dist/esm/app-globals-3a760941.js.map +1 -1
- package/dist/esm/{column.drag.plugin-3cc77986.js → column.drag.plugin-50f49fa9.js} +1012 -130
- package/dist/esm/column.drag.plugin-50f49fa9.js.map +1 -0
- package/dist/esm/column.service-a6a7c415.js +1281 -0
- package/dist/esm/column.service-a6a7c415.js.map +1 -0
- package/dist/esm/{debounce-72878ced.js → debounce-b3166f78.js} +2 -2
- package/dist/esm/{debounce-72878ced.js.map → debounce-b3166f78.js.map} +1 -1
- package/dist/esm/{column.service-751345b2.js → dimension.helpers-d0d709c4.js} +450 -1234
- package/dist/esm/dimension.helpers-d0d709c4.js.map +1 -0
- package/dist/esm/{edit.utils-6fc686b9.js → edit.utils-0ae0db50.js} +2 -2
- package/dist/esm/{edit.utils-6fc686b9.js.map → edit.utils-0ae0db50.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-32d2ed96.js → header-cell-renderer-36ecbdef.js} +2 -2
- package/dist/esm/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-36ecbdef.js.map} +1 -1
- package/dist/esm/index.js +52 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{key.utils-17273f42.js → key.utils-7c3218d4.js} +2 -2
- package/dist/esm/{key.utils-17273f42.js.map → key.utils-7c3218d4.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +246 -877
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +63 -33
- package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js +7 -6
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +60 -50
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +34 -14
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{text-editor-901c3eb8.js → text-editor-148a17c1.js} +5 -5
- package/dist/esm/text-editor-148a17c1.js.map +1 -0
- package/dist/esm/{throttle-138d69c3.js → throttle-394e489c.js} +3 -3
- package/dist/esm/{throttle-138d69c3.js.map → throttle-394e489c.js.map} +1 -1
- package/dist/esm/{row-header-utils-3dfbb81f.js → viewport.store-afa8c4fe.js} +11 -10
- package/dist/esm/viewport.store-afa8c4fe.js.map +1 -0
- package/dist/revo-grid/app-globals-3a760941.js +8 -1
- package/dist/revo-grid/app-globals-3a760941.js.map +1 -1
- package/dist/revo-grid/column.drag.plugin-50f49fa9.js +2541 -0
- package/dist/revo-grid/column.drag.plugin-50f49fa9.js.map +1 -0
- package/dist/revo-grid/column.service-a6a7c415.js +1281 -0
- package/dist/revo-grid/column.service-a6a7c415.js.map +1 -0
- package/dist/revo-grid/debounce-b3166f78.js +495 -0
- package/dist/revo-grid/debounce-b3166f78.js.map +1 -0
- package/dist/revo-grid/dimension.helpers-d0d709c4.js +3611 -0
- package/dist/revo-grid/dimension.helpers-d0d709c4.js.map +1 -0
- package/dist/revo-grid/edit.utils-0ae0db50.js +17 -0
- package/dist/revo-grid/edit.utils-0ae0db50.js.map +1 -0
- package/dist/revo-grid/events-cf0893a3.js +38 -1
- package/dist/revo-grid/events-cf0893a3.js.map +1 -1
- package/dist/revo-grid/filter.button-d40ab17b.js +34 -1
- package/dist/revo-grid/filter.button-d40ab17b.js.map +1 -1
- package/dist/revo-grid/header-cell-renderer-36ecbdef.js +339 -0
- package/dist/revo-grid/header-cell-renderer-36ecbdef.js.map +1 -0
- package/dist/revo-grid/index-a61f225b.js +1845 -2
- package/dist/revo-grid/index-a61f225b.js.map +1 -1
- package/dist/revo-grid/index.esm.js +160 -1
- package/dist/revo-grid/index.esm.js.map +1 -1
- package/dist/revo-grid/key.utils-7c3218d4.js +89 -0
- package/dist/revo-grid/key.utils-7c3218d4.js.map +1 -0
- package/dist/revo-grid/resize-observer-83c9e167.js +501 -1
- package/dist/revo-grid/resize-observer-83c9e167.js.map +1 -1
- package/dist/revo-grid/revo-grid.entry.js +1934 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revo-grid.esm.js +21 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +1431 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +455 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +974 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +340 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/sorting.sign-1a675bf7.js +9 -1
- package/dist/revo-grid/sorting.sign-1a675bf7.js.map +1 -1
- package/dist/revo-grid/text-editor-148a17c1.js +80 -0
- package/dist/revo-grid/text-editor-148a17c1.js.map +1 -0
- package/dist/revo-grid/throttle-394e489c.js +230 -0
- package/dist/revo-grid/throttle-394e489c.js.map +1 -0
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js +48 -1
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -1
- package/dist/revo-grid/viewport.store-afa8c4fe.js +406 -0
- package/dist/revo-grid/viewport.store-afa8c4fe.js.map +1 -0
- package/dist/types/components/data/cell-renderer.d.ts +3 -5
- package/dist/types/components/data/column.service.d.ts +2 -3
- package/dist/types/components/data/revogr-data.d.ts +10 -6
- package/dist/types/components/data/row-highlight.plugin.d.ts +1 -1
- package/dist/types/components/data/row-renderer.d.ts +1 -1
- package/dist/types/components/editors/revogr-edit.d.ts +2 -2
- package/dist/types/components/editors/text-editor.d.ts +5 -6
- package/dist/types/components/extra/revogr-extra.d.ts +17 -3
- package/dist/types/components/header/header-cell-renderer.d.ts +1 -1
- package/dist/types/components/header/header-renderer.d.ts +2 -2
- package/dist/types/components/header/resizable.element.d.ts +1 -1
- package/dist/types/components/header/revogr-header.d.ts +2 -3
- package/dist/types/components/order/order-renderer.d.ts +1 -1
- package/dist/types/components/order/revogr-order-editor.d.ts +4 -10
- package/dist/types/components/overlay/autofill.service.d.ts +2 -2
- package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +16 -13
- package/dist/types/components/overlay/selection.utils.d.ts +1 -1
- package/dist/types/components/revoGrid/plugin.service.d.ts +37 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +105 -61
- package/dist/types/components/revoGrid/viewport.service.d.ts +2 -2
- package/dist/types/components/rowHeaders/row-header-render.d.ts +2 -2
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +2 -5
- package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +2 -3
- package/dist/types/components/selectionFocus/revogr-focus.d.ts +2 -2
- package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +2 -3
- package/dist/types/components/vnode/vnode-converter.d.ts +1 -1
- package/dist/types/components/vnode/vnode.utils.d.ts +2 -2
- package/dist/types/components.d.ts +191 -108
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/add-rows-on-paste.plugin.d.ts +14 -0
- package/dist/types/plugins/base.plugin.d.ts +3 -4
- package/dist/types/plugins/column.auto-size.plugin.d.ts +1 -1
- package/dist/types/plugins/column.stretch.plugin.d.ts +1 -1
- package/dist/types/plugins/export/csv.d.ts +1 -1
- package/dist/types/plugins/export/export.plugin.d.ts +4 -3
- package/dist/types/plugins/filter/filter.panel.d.ts +2 -2
- package/dist/types/plugins/filter/filter.plugin.d.ts +25 -7
- package/dist/types/plugins/filter/filter.types.d.ts +32 -10
- package/dist/types/plugins/groupingColumn/columnGroupsRenderer.d.ts +2 -2
- package/dist/types/plugins/groupingColumn/headerGroupRenderer.d.ts +3 -4
- package/dist/types/plugins/groupingRow/grouping.const.d.ts +3 -1
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +15 -10
- package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +38 -4
- package/dist/types/plugins/groupingRow/grouping.service.d.ts +9 -12
- package/dist/types/plugins/index.d.ts +2 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +2 -2
- package/dist/types/plugins/sorting/sorting.func.d.ts +3 -0
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +14 -13
- package/dist/types/plugins/sorting/sorting.types.d.ts +13 -0
- package/dist/types/services/column.data.provider.d.ts +5 -2
- package/dist/types/services/data.provider.d.ts +3 -1
- package/dist/types/services/dimension.provider.d.ts +9 -4
- package/dist/types/services/selection.store.connector.d.ts +4 -4
- package/dist/types/store/dataSource/data.proxy.d.ts +7 -9
- package/dist/types/store/dataSource/data.store.d.ts +2 -3
- package/dist/types/store/dataSource/trimmed.plugin.d.ts +1 -1
- package/dist/types/store/dimension/dimension.helpers.d.ts +1 -4
- package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
- package/dist/types/store/dimension/dimension.store.d.ts +3 -2
- package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
- package/dist/types/store/selection/selection.store.d.ts +1 -1
- package/dist/types/store/vp/viewport.store.d.ts +1 -1
- package/dist/types/types/events.d.ts +1 -1
- package/dist/types/types/interfaces.d.ts +36 -12
- package/dist/types/types/plugin.types.d.ts +17 -1
- package/dist/types/types/selection.d.ts +23 -17
- package/dist/types/types/viewport.interfaces.d.ts +1 -3
- package/dist/types/utils/column.utils.d.ts +1 -0
- package/hydrate/index.js +2490 -2135
- package/hydrate/index.mjs +2490 -2135
- package/package.json +20 -19
- package/readme.md +15 -17
- package/standalone/column.service.js +192 -160
- package/standalone/column.service.js.map +1 -1
- package/standalone/data.store.js +36 -25
- package/standalone/data.store.js.map +1 -1
- package/standalone/dimension.helpers.js +8 -10
- package/standalone/dimension.helpers.js.map +1 -1
- package/standalone/index.js +46 -6
- package/standalone/index.js.map +1 -1
- package/standalone/revo-grid.js +1275 -1022
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-attribution2.js +1 -1
- package/standalone/revogr-attribution2.js.map +1 -1
- package/standalone/revogr-data2.js +26 -22
- package/standalone/revogr-data2.js.map +1 -1
- package/standalone/revogr-edit2.js +3 -3
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-extra2.js +25 -4
- package/standalone/revogr-extra2.js.map +1 -1
- package/standalone/revogr-filter-panel.js +34 -14
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-focus2.js +2 -1
- package/standalone/revogr-focus2.js.map +1 -1
- package/standalone/revogr-header2.js +6 -5
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-order-editor2.js +3 -0
- package/standalone/revogr-order-editor2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +29 -17
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +12 -9
- package/standalone/revogr-row-headers2.js.map +1 -1
- package/standalone/revogr-scroll-virtual2.js +6 -4
- package/standalone/revogr-scroll-virtual2.js.map +1 -1
- package/standalone/revogr-temp-range2.js +1 -1
- package/standalone/revogr-temp-range2.js.map +1 -1
- package/standalone/revogr-viewport-scroll2.js +27 -21
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/standalone/selection.utils.js +1 -0
- package/standalone/selection.utils.js.map +1 -1
- package/standalone/vnode-converter.js +1 -1
- package/standalone/vnode-converter.js.map +1 -1
- package/dist/cjs/column.drag.plugin-fcd892ec.js.map +0 -1
- package/dist/cjs/column.service-26c61ed6.js.map +0 -1
- package/dist/cjs/index-3ab26ab9.js +0 -513
- package/dist/cjs/index-3ab26ab9.js.map +0 -1
- package/dist/cjs/key.utils-f49d7bee.js +0 -101
- package/dist/cjs/key.utils-f49d7bee.js.map +0 -1
- package/dist/cjs/row-header-utils-c37f76e4.js.map +0 -1
- package/dist/cjs/text-editor-b756d6b3.js.map +0 -1
- package/dist/esm/column.drag.plugin-3cc77986.js.map +0 -1
- package/dist/esm/column.service-751345b2.js.map +0 -1
- package/dist/esm/index-1dcad6ef.js +0 -476
- package/dist/esm/index-1dcad6ef.js.map +0 -1
- package/dist/esm/row-header-utils-3dfbb81f.js.map +0 -1
- package/dist/esm/text-editor-901c3eb8.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-3cc77986.js +0 -5
- package/dist/revo-grid/column.drag.plugin-3cc77986.js.map +0 -1
- package/dist/revo-grid/column.service-751345b2.js +0 -5
- package/dist/revo-grid/column.service-751345b2.js.map +0 -1
- package/dist/revo-grid/debounce-72878ced.js +0 -5
- package/dist/revo-grid/debounce-72878ced.js.map +0 -1
- package/dist/revo-grid/edit.utils-6fc686b9.js +0 -5
- package/dist/revo-grid/edit.utils-6fc686b9.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-32d2ed96.js +0 -5
- package/dist/revo-grid/header-cell-renderer-32d2ed96.js.map +0 -1
- package/dist/revo-grid/index-1dcad6ef.js +0 -5
- package/dist/revo-grid/index-1dcad6ef.js.map +0 -1
- package/dist/revo-grid/key.utils-17273f42.js +0 -5
- package/dist/revo-grid/key.utils-17273f42.js.map +0 -1
- package/dist/revo-grid/row-header-utils-3dfbb81f.js +0 -5
- package/dist/revo-grid/row-header-utils-3dfbb81f.js.map +0 -1
- package/dist/revo-grid/text-editor-901c3eb8.js +0 -5
- package/dist/revo-grid/text-editor-901c3eb8.js.map +0 -1
- package/dist/revo-grid/throttle-138d69c3.js +0 -5
- package/dist/revo-grid/throttle-138d69c3.js.map +0 -1
- package/standalone/identity.js +0 -26
- package/standalone/identity.js.map +0 -1
|
@@ -1,45 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { f as calculateRowHeaderSize } from './
|
|
4
|
+
import { x as reduce, y as baseEach, r as getColumnType, h as isGrouping, f as getGroupingName, q as getCellDataParsed, G as GROUP_EXPANDED, k as getParsedGroup, P as PSEUDO_GROUP_ITEM_ID, l as isSameGroup, z as GROUP_DEPTH, A as PSEUDO_GROUP_ITEM_VALUE, w as getColumnByProp, p as getCellRaw, B as GROUPING_ROW_TYPE, b as getSource, C as PSEUDO_GROUP_COLUMN, e as gatherGrouping, j as isGroupingColumn, d as getExpanded, t as isColGrouping } from './column.service-a6a7c415.js';
|
|
5
|
+
import { W as createStore, w as setStore, i as calculateDimensionData, X as identity, Y as isArray, b as getSourceItem, o as getScrollbarSize, Z as toInteger, _ as isIterateeCall, u as timeout, $ as baseProperty, a0 as isArrayLike, a1 as getTag, a2 as baseKeys, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-d0d709c4.js';
|
|
6
|
+
import { f as calculateRowHeaderSize } from './viewport.store-afa8c4fe.js';
|
|
7
7
|
import { h } from './index-a61f225b.js';
|
|
8
8
|
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-d40ab17b.js';
|
|
9
|
-
import { d as debounce } from './debounce-
|
|
10
|
-
import { d as dispatch, O as ON_COLUMN_CLICK } from './header-cell-renderer-
|
|
9
|
+
import { i as isObjectLike, b as baseGetTag, d as debounce } from './debounce-b3166f78.js';
|
|
10
|
+
import { d as dispatch, O as ON_COLUMN_CLICK } from './header-cell-renderer-36ecbdef.js';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Storing pre-calculated
|
|
14
|
-
* Dimension information and sizes
|
|
15
|
-
*/
|
|
16
|
-
const trimmedPlugin = (store) => {
|
|
17
|
-
let trimmedSize = {};
|
|
18
|
-
const setTrimmed = (sizes, trimmed) => {
|
|
19
|
-
const newSize = Object.assign({}, sizes);
|
|
20
|
-
trimmedSize = {};
|
|
21
|
-
for (const [index, v] of Object.entries(trimmed)) {
|
|
22
|
-
const i = index;
|
|
23
|
-
if (v && newSize[i]) {
|
|
24
|
-
trimmedSize[i] = newSize[i];
|
|
25
|
-
delete newSize[i];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
store.setDimensionSize(newSize);
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
set(key, val) {
|
|
32
|
-
switch (key) {
|
|
33
|
-
case 'trimmed':
|
|
34
|
-
const trim = val;
|
|
35
|
-
const sizes = store.store.get('sizes');
|
|
36
|
-
// recover trimmed, apply new trim
|
|
37
|
-
setTrimmed(Object.assign(Object.assign({}, sizes), trimmedSize), trim);
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
12
|
/**
|
|
44
13
|
* Plugin which recalculates realSize on changes of sizes, originItemSize and count
|
|
45
14
|
*/
|
|
@@ -55,7 +24,7 @@ const recalculateRealSizePlugin = (storeService) => {
|
|
|
55
24
|
switch (k) {
|
|
56
25
|
case 'count':
|
|
57
26
|
case 'sizes':
|
|
58
|
-
case 'originItemSize':
|
|
27
|
+
case 'originItemSize': {
|
|
59
28
|
// recalculate realSize
|
|
60
29
|
let realSize = 0;
|
|
61
30
|
const count = storeService.store.get('count');
|
|
@@ -66,19 +35,81 @@ const recalculateRealSizePlugin = (storeService) => {
|
|
|
66
35
|
}
|
|
67
36
|
storeService.setStore({ realSize });
|
|
68
37
|
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Plugin for trimming
|
|
46
|
+
*
|
|
47
|
+
* 1.a. Retrieves the previous sizes value. Saves the resulting trimmed data as a new sizes value.
|
|
48
|
+
* 1.b. Stores a reference to the trimmed data to prevent further changes.
|
|
49
|
+
* 2. Removes multiple and shifts the data based on the trimmed value.
|
|
50
|
+
*/
|
|
51
|
+
const trimmedPlugin = (storeService) => {
|
|
52
|
+
let trimmingObject = null;
|
|
53
|
+
let trimmedPreviousSizes = null;
|
|
54
|
+
return {
|
|
55
|
+
set(key, val) {
|
|
56
|
+
switch (key) {
|
|
57
|
+
case 'sizes': {
|
|
58
|
+
// prevent changes after trimming
|
|
59
|
+
if (trimmingObject && trimmingObject === val) {
|
|
60
|
+
trimmingObject = null;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
trimmedPreviousSizes = null;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case 'trimmed': {
|
|
67
|
+
const trim = val;
|
|
68
|
+
if (!trimmedPreviousSizes) {
|
|
69
|
+
trimmedPreviousSizes = storeService.store.get('sizes');
|
|
70
|
+
}
|
|
71
|
+
trimmingObject = removeMultipleAndShift(trimmedPreviousSizes, trim || {});
|
|
72
|
+
// save a reference to the trimmed object to prevent changes after trimming
|
|
73
|
+
storeService.setSizes(trimmingObject);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
},
|
|
71
78
|
};
|
|
72
79
|
};
|
|
80
|
+
function removeMultipleAndShift(items, toRemove) {
|
|
81
|
+
const newItems = {};
|
|
82
|
+
const sortedIndexes = Object.keys(items || {})
|
|
83
|
+
.map(Number)
|
|
84
|
+
.sort((a, b) => a - b);
|
|
85
|
+
const lastIndex = sortedIndexes[sortedIndexes.length - 1];
|
|
86
|
+
let shift = 0;
|
|
87
|
+
for (let i = 0; i <= lastIndex; i++) {
|
|
88
|
+
if (toRemove[i] !== undefined) {
|
|
89
|
+
shift++;
|
|
90
|
+
// skip already removed
|
|
91
|
+
if (items[i] !== undefined) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (items[i] !== undefined) {
|
|
96
|
+
newItems[i - shift] = items[i];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return newItems;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Storing pre-calculated
|
|
104
|
+
* Dimension information and sizes
|
|
105
|
+
*/
|
|
73
106
|
function initialBase() {
|
|
74
107
|
return {
|
|
75
108
|
indexes: [],
|
|
76
109
|
count: 0,
|
|
77
|
-
//
|
|
78
|
-
trimmed:
|
|
79
|
-
//
|
|
80
|
-
// same as indexes but for sizes and positions
|
|
81
|
-
// item index to size
|
|
110
|
+
// hidden items
|
|
111
|
+
trimmed: null,
|
|
112
|
+
// virtual item index to size
|
|
82
113
|
sizes: {},
|
|
83
114
|
// order in indexes[] to coordinate
|
|
84
115
|
positionIndexToItem: {},
|
|
@@ -98,8 +129,14 @@ class DimensionStore {
|
|
|
98
129
|
constructor(type) {
|
|
99
130
|
this.type = type;
|
|
100
131
|
this.store = createStore(initialState());
|
|
101
|
-
this.store.use(trimmedPlugin(
|
|
102
|
-
|
|
132
|
+
this.store.use(trimmedPlugin({
|
|
133
|
+
store: this.store,
|
|
134
|
+
setSizes: this.setDimensionSize.bind(this),
|
|
135
|
+
}));
|
|
136
|
+
this.store.use(recalculateRealSizePlugin({
|
|
137
|
+
store: this.store,
|
|
138
|
+
setStore: this.setStore.bind(this),
|
|
139
|
+
}));
|
|
103
140
|
}
|
|
104
141
|
getCurrentState() {
|
|
105
142
|
const state = initialState();
|
|
@@ -124,9 +161,40 @@ class DimensionStore {
|
|
|
124
161
|
* Generates new indexes based on sizes
|
|
125
162
|
* @param sizes - sizes to set
|
|
126
163
|
*/
|
|
127
|
-
setDimensionSize(sizes) {
|
|
164
|
+
setDimensionSize(sizes = {}) {
|
|
128
165
|
const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
|
|
129
|
-
setStore(this.store, dimensionData);
|
|
166
|
+
setStore(this.store, Object.assign(Object.assign({}, dimensionData), { sizes }));
|
|
167
|
+
}
|
|
168
|
+
updateSizesPositionByIndexes(newItemsOrder, prevItemsOrder = []) {
|
|
169
|
+
// Move custom sizes to new order
|
|
170
|
+
const customSizes = Object.assign({}, this.store.get('sizes'));
|
|
171
|
+
if (!Object.keys(customSizes).length) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// Step 1: Create a map of original indices, but allow duplicates by storing arrays of indices
|
|
175
|
+
const originalIndices = {};
|
|
176
|
+
prevItemsOrder.forEach((physIndex, virtIndex) => {
|
|
177
|
+
if (!originalIndices[physIndex]) {
|
|
178
|
+
originalIndices[physIndex] = [];
|
|
179
|
+
}
|
|
180
|
+
originalIndices[physIndex].push(virtIndex); // Store all indices for each value
|
|
181
|
+
});
|
|
182
|
+
// Step 2: Create new sizes based on new item order
|
|
183
|
+
const newSizes = {};
|
|
184
|
+
newItemsOrder.forEach((physIndex, virtIndex) => {
|
|
185
|
+
const indices = originalIndices[physIndex]; // Get all original indices for this value
|
|
186
|
+
if (indices && indices.length > 0) {
|
|
187
|
+
const originalIndex = indices.shift(); // Get the first available original index
|
|
188
|
+
if (originalIndex !== undefined && originalIndex !== virtIndex && customSizes[originalIndex]) {
|
|
189
|
+
newSizes[virtIndex] = customSizes[originalIndex];
|
|
190
|
+
delete customSizes[originalIndex];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
// Step 3: Set new sizes if there are changes
|
|
195
|
+
if (Object.keys(newSizes).length) {
|
|
196
|
+
this.setDimensionSize(Object.assign(Object.assign({}, customSizes), newSizes));
|
|
197
|
+
}
|
|
130
198
|
}
|
|
131
199
|
}
|
|
132
200
|
|
|
@@ -1053,6 +1121,7 @@ const notContains = (value, extra) => {
|
|
|
1053
1121
|
notContains.extra = 'input';
|
|
1054
1122
|
contains.extra = 'input';
|
|
1055
1123
|
|
|
1124
|
+
// filter.indexed.ts
|
|
1056
1125
|
const filterCoreFunctionsIndexedByType = {
|
|
1057
1126
|
none: () => true,
|
|
1058
1127
|
empty: notSet,
|
|
@@ -1090,19 +1159,25 @@ const filterNames = {
|
|
|
1090
1159
|
lte: '<=',
|
|
1091
1160
|
};
|
|
1092
1161
|
|
|
1162
|
+
// filter.plugin.tsx
|
|
1093
1163
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
1094
1164
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
1095
1165
|
const FILTE_PANEL = 'revogr-filter-panel';
|
|
1096
1166
|
/**
|
|
1097
1167
|
* @typedef ColumnFilterConfig
|
|
1098
1168
|
* @type {object}
|
|
1099
|
-
*
|
|
1169
|
+
*
|
|
1170
|
+
* @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering with relation
|
|
1171
|
+
*
|
|
1172
|
+
* @property {Record<ColumnProp, FilterCollectionItem>|undefined} collection - preserved filter data, relation for filters will be applied as 'and'
|
|
1173
|
+
*
|
|
1100
1174
|
* @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
|
|
1175
|
+
*
|
|
1101
1176
|
* @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
|
|
1177
|
+
*
|
|
1102
1178
|
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
1103
|
-
*
|
|
1179
|
+
*
|
|
1104
1180
|
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
|
|
1105
|
-
* A way to define your own filter types per column
|
|
1106
1181
|
*/
|
|
1107
1182
|
/**
|
|
1108
1183
|
* @internal
|
|
@@ -1112,8 +1187,17 @@ class FilterPlugin extends BasePlugin {
|
|
|
1112
1187
|
var _a;
|
|
1113
1188
|
super(revogrid, providers);
|
|
1114
1189
|
this.revogrid = revogrid;
|
|
1190
|
+
this.config = config;
|
|
1115
1191
|
this.filterCollection = {};
|
|
1116
1192
|
this.multiFilterItems = {};
|
|
1193
|
+
/**
|
|
1194
|
+
* Filter types
|
|
1195
|
+
* @example
|
|
1196
|
+
* {
|
|
1197
|
+
* string: ['contains', 'beginswith'],
|
|
1198
|
+
* number: ['eqN', 'neqN', 'gt']
|
|
1199
|
+
* }
|
|
1200
|
+
*/
|
|
1117
1201
|
this.filterByType = Object.assign({}, filterTypes);
|
|
1118
1202
|
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
1119
1203
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
@@ -1124,8 +1208,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
1124
1208
|
const existingNodes = this.revogrid.registerVNode.filter(n => typeof n === 'object' && n.$tag$ !== FILTE_PANEL);
|
|
1125
1209
|
this.revogrid.registerVNode = [
|
|
1126
1210
|
...existingNodes,
|
|
1127
|
-
h("revogr-filter-panel", {
|
|
1128
|
-
|
|
1211
|
+
h("revogr-filter-panel", { filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) },
|
|
1212
|
+
' ',
|
|
1129
1213
|
this.extraContent()),
|
|
1130
1214
|
];
|
|
1131
1215
|
const aftersourceset = async () => {
|
|
@@ -1145,11 +1229,17 @@ class FilterPlugin extends BasePlugin {
|
|
|
1145
1229
|
}
|
|
1146
1230
|
});
|
|
1147
1231
|
}
|
|
1232
|
+
if (Object.keys(this.multiFilterItems).length === 0) {
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1148
1235
|
await this.runFiltering(this.multiFilterItems);
|
|
1149
1236
|
};
|
|
1150
|
-
this.addEventListener('headerclick',
|
|
1237
|
+
this.addEventListener('headerclick', e => this.headerclick(e));
|
|
1151
1238
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
1152
|
-
if (!detail
|
|
1239
|
+
if (!detail ||
|
|
1240
|
+
(typeof detail === 'object' &&
|
|
1241
|
+
(!detail.multiFilterItems ||
|
|
1242
|
+
!Object.keys(detail.multiFilterItems).length))) {
|
|
1153
1243
|
this.clearFiltering();
|
|
1154
1244
|
return;
|
|
1155
1245
|
}
|
|
@@ -1161,6 +1251,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
1161
1251
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
1162
1252
|
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
1163
1253
|
}
|
|
1254
|
+
beforeshow(_) {
|
|
1255
|
+
// used as hook for filter panel
|
|
1256
|
+
}
|
|
1164
1257
|
extraContent() {
|
|
1165
1258
|
return null;
|
|
1166
1259
|
}
|
|
@@ -1168,6 +1261,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
1168
1261
|
if (config.multiFilterItems) {
|
|
1169
1262
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
1170
1263
|
}
|
|
1264
|
+
else {
|
|
1265
|
+
this.multiFilterItems = {};
|
|
1266
|
+
}
|
|
1171
1267
|
// Add custom filters
|
|
1172
1268
|
if (config.customFilters) {
|
|
1173
1269
|
for (let customFilterType in config.customFilters) {
|
|
@@ -1175,8 +1271,11 @@ class FilterPlugin extends BasePlugin {
|
|
|
1175
1271
|
if (!this.filterByType[cFilter.columnFilterType]) {
|
|
1176
1272
|
this.filterByType[cFilter.columnFilterType] = [];
|
|
1177
1273
|
}
|
|
1274
|
+
// add custom filter type
|
|
1178
1275
|
this.filterByType[cFilter.columnFilterType].push(customFilterType);
|
|
1276
|
+
// add custom filter function
|
|
1179
1277
|
this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
|
|
1278
|
+
// add custom filter name
|
|
1180
1279
|
this.filterNameIndexByType[customFilterType] = cFilter.name;
|
|
1181
1280
|
}
|
|
1182
1281
|
}
|
|
@@ -1186,7 +1285,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1186
1285
|
}
|
|
1187
1286
|
/**
|
|
1188
1287
|
* which filters has to be included/excluded
|
|
1189
|
-
*
|
|
1288
|
+
* convenient way to exclude system filters
|
|
1190
1289
|
*/
|
|
1191
1290
|
const cfgInlcude = config.include;
|
|
1192
1291
|
if (cfgInlcude) {
|
|
@@ -1204,15 +1303,11 @@ class FilterPlugin extends BasePlugin {
|
|
|
1204
1303
|
}
|
|
1205
1304
|
}
|
|
1206
1305
|
if (config.collection) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
console.warn(`${item.type} type is not found.`);
|
|
1213
|
-
}
|
|
1214
|
-
return result;
|
|
1215
|
-
}, {});
|
|
1306
|
+
const filtersWithFilterFunctionPresent = Object.entries(config.collection).filter(([, item]) => this.filterFunctionsIndexedByType[item.type]);
|
|
1307
|
+
this.filterCollection = Object.fromEntries(filtersWithFilterFunctionPresent);
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
this.filterCollection = {};
|
|
1216
1311
|
}
|
|
1217
1312
|
if (config.localization) {
|
|
1218
1313
|
if (config.localization.filterNames) {
|
|
@@ -1225,18 +1320,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
1225
1320
|
}
|
|
1226
1321
|
}
|
|
1227
1322
|
async headerclick(e) {
|
|
1228
|
-
var _a, _b
|
|
1323
|
+
var _a, _b;
|
|
1229
1324
|
const el = (_a = e.detail.originalEvent) === null || _a === void 0 ? void 0 : _a.target;
|
|
1230
1325
|
if (!isFilterBtn(el)) {
|
|
1231
1326
|
return;
|
|
1232
1327
|
}
|
|
1233
1328
|
e.preventDefault();
|
|
1234
|
-
// close if same
|
|
1235
|
-
const changes = await ((_b = this.pop) === null || _b === void 0 ? void 0 : _b.getChanges());
|
|
1236
|
-
if (changes && (changes === null || changes === void 0 ? void 0 : changes.prop) === e.detail.prop) {
|
|
1237
|
-
(_c = this.pop) === null || _c === void 0 ? void 0 : _c.show();
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
1329
|
if (!this.pop) {
|
|
1241
1330
|
return;
|
|
1242
1331
|
}
|
|
@@ -1244,7 +1333,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
1244
1333
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
1245
1334
|
const buttonPos = el.getBoundingClientRect();
|
|
1246
1335
|
const prop = e.detail.prop;
|
|
1247
|
-
|
|
1336
|
+
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent });
|
|
1337
|
+
(_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
|
|
1338
|
+
this.pop.show(data);
|
|
1248
1339
|
}
|
|
1249
1340
|
getColumnFilter(type) {
|
|
1250
1341
|
let filterType = 'string';
|
|
@@ -1328,7 +1419,11 @@ class FilterPlugin extends BasePlugin {
|
|
|
1328
1419
|
}
|
|
1329
1420
|
// applies the hasFilter to the columns to show filter icon
|
|
1330
1421
|
this.providers.column.updateColumns(columnsToUpdate);
|
|
1331
|
-
this.emit('afterfilterapply'
|
|
1422
|
+
this.emit('afterfilterapply', {
|
|
1423
|
+
multiFilterItems: filterItems,
|
|
1424
|
+
source,
|
|
1425
|
+
collection,
|
|
1426
|
+
});
|
|
1332
1427
|
}
|
|
1333
1428
|
async clearFiltering() {
|
|
1334
1429
|
this.multiFilterItems = {};
|
|
@@ -1343,7 +1438,6 @@ class FilterPlugin extends BasePlugin {
|
|
|
1343
1438
|
if (multiFilterItems[prop].length > 0) {
|
|
1344
1439
|
const firstFilterItem = multiFilterItems[prop][0];
|
|
1345
1440
|
collection[prop] = {
|
|
1346
|
-
filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
|
|
1347
1441
|
type: firstFilterItem.type,
|
|
1348
1442
|
value: firstFilterItem.value,
|
|
1349
1443
|
};
|
|
@@ -1370,65 +1464,847 @@ class FilterPlugin extends BasePlugin {
|
|
|
1370
1464
|
getRowFilter(rows, filterItems, columnByProp) {
|
|
1371
1465
|
const propKeys = Object.keys(filterItems);
|
|
1372
1466
|
const trimmed = {};
|
|
1373
|
-
let propFilterSatisfiedCount = 0;
|
|
1374
|
-
let lastFilterResults = [];
|
|
1375
1467
|
// each rows
|
|
1376
|
-
rows.
|
|
1468
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
1377
1469
|
// check filter by column properties
|
|
1378
1470
|
for (const prop of propKeys) {
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1471
|
+
// add to the list of removed/trimmed rows of filter condition is satisfied
|
|
1472
|
+
if (this.shouldTrimRow(filterItems[prop], prop, columnByProp[prop], rows[rowIndex])) {
|
|
1473
|
+
trimmed[rowIndex] = true;
|
|
1474
|
+
}
|
|
1475
|
+
} // end of for-of propKeys
|
|
1476
|
+
}
|
|
1477
|
+
return trimmed;
|
|
1478
|
+
}
|
|
1479
|
+
shouldTrimRow(propFilters, prop, column, model = {}) {
|
|
1480
|
+
// reset the count of satisfied filters
|
|
1481
|
+
let propFilterSatisfiedCount = 0;
|
|
1482
|
+
// reset the array of last filter results
|
|
1483
|
+
let lastFilterResults = [];
|
|
1484
|
+
// testing each filter for a prop
|
|
1485
|
+
for (const [filterIndex, filterData] of propFilters.entries()) {
|
|
1486
|
+
// the filter LogicFunction based on the type
|
|
1487
|
+
const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
|
|
1488
|
+
// THE MAGIC OF FILTERING IS HERE
|
|
1489
|
+
// If there is no column but user wants to filter by a property
|
|
1490
|
+
const value = column ? getCellDataParsed(model, column) : model[prop];
|
|
1491
|
+
// OR relation
|
|
1492
|
+
if (filterData.relation === 'or') {
|
|
1382
1493
|
// reset the array of last filter results
|
|
1383
1494
|
lastFilterResults = [];
|
|
1384
|
-
//
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1495
|
+
// if the filter is satisfied, continue to the next filter
|
|
1496
|
+
if (filterFunc(value, filterData.value)) {
|
|
1497
|
+
continue;
|
|
1498
|
+
}
|
|
1499
|
+
// if the filter is not satisfied, count it
|
|
1500
|
+
propFilterSatisfiedCount++;
|
|
1501
|
+
// AND relation
|
|
1502
|
+
}
|
|
1503
|
+
else {
|
|
1504
|
+
// 'and' relation will need to know the next filter
|
|
1505
|
+
// so we save this current filter to include it in the next filter
|
|
1506
|
+
lastFilterResults.push(!filterFunc(value, filterData.value));
|
|
1507
|
+
if (isFinalAndFilter(filterIndex, propFilters)) {
|
|
1508
|
+
// let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
|
|
1509
|
+
if (allAndConditionsSatisfied(lastFilterResults)) {
|
|
1394
1510
|
// reset the array of last filter results
|
|
1395
1511
|
lastFilterResults = [];
|
|
1396
|
-
|
|
1397
|
-
if (filterFunc(value, filterData.value)) {
|
|
1398
|
-
continue;
|
|
1399
|
-
}
|
|
1400
|
-
// if the filter is not satisfied, count it
|
|
1401
|
-
propFilterSatisfiedCount++;
|
|
1402
|
-
// AND relation
|
|
1403
|
-
}
|
|
1404
|
-
else {
|
|
1405
|
-
// 'and' relation will need to know the next filter
|
|
1406
|
-
// so we save this current filter to include it in the next filter
|
|
1407
|
-
lastFilterResults.push(!filterFunc(value, filterData.value));
|
|
1408
|
-
// check first if we have a filter on the next index to pair it with this current filter
|
|
1409
|
-
const nextFilterData = propFilters[filterIndex + 1];
|
|
1410
|
-
// stop the sequence if there is no next filter or if the next filter is not an 'and' relation
|
|
1411
|
-
if (!nextFilterData || nextFilterData.relation !== 'and') {
|
|
1412
|
-
// let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
|
|
1413
|
-
if (lastFilterResults.indexOf(true) === -1) {
|
|
1414
|
-
// reset the array of last filter results
|
|
1415
|
-
lastFilterResults = [];
|
|
1416
|
-
continue;
|
|
1417
|
-
}
|
|
1418
|
-
// we need to add all of the lastFilterResults since we need to satisfy all
|
|
1419
|
-
propFilterSatisfiedCount += lastFilterResults.length;
|
|
1420
|
-
// reset the array of last filter results
|
|
1421
|
-
lastFilterResults = [];
|
|
1422
|
-
}
|
|
1512
|
+
continue;
|
|
1423
1513
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1514
|
+
// we need to add all of the lastFilterResults since we need to satisfy all
|
|
1515
|
+
propFilterSatisfiedCount += lastFilterResults.length;
|
|
1516
|
+
// reset the array of last filter results
|
|
1517
|
+
lastFilterResults = [];
|
|
1428
1518
|
}
|
|
1429
|
-
}
|
|
1519
|
+
}
|
|
1520
|
+
} // end of propFilters forEach
|
|
1521
|
+
return propFilterSatisfiedCount === propFilters.length;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Checks if the current filter is the final one in an AND sequence.
|
|
1526
|
+
* @param index - Current filter index in the list.
|
|
1527
|
+
* @param filters - Array of filters for the property.
|
|
1528
|
+
* @returns True if this is the last AND condition; false otherwise.
|
|
1529
|
+
*/
|
|
1530
|
+
function isFinalAndFilter(index, filters) {
|
|
1531
|
+
const nextFilter = filters[index + 1]; // Get the next filter in the list.
|
|
1532
|
+
// Return true if there's no next filter or if the next filter defined and is not part of the AND sequence.
|
|
1533
|
+
return !nextFilter || (!!nextFilter.relation && nextFilter.relation !== 'and');
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Determines if all conditions in an AND sequence are satisfied.
|
|
1537
|
+
* @param pendingResults - An array of results from the AND conditions.
|
|
1538
|
+
* @returns True if all conditions are satisfied; false otherwise.
|
|
1539
|
+
*/
|
|
1540
|
+
function allAndConditionsSatisfied(pendingResults) {
|
|
1541
|
+
// Check if there are any failed conditions in the pending results.
|
|
1542
|
+
return !pendingResults.includes(true);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// provide collapse data
|
|
1546
|
+
function doCollapse(pIndex, source) {
|
|
1547
|
+
const model = source[pIndex];
|
|
1548
|
+
const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];
|
|
1549
|
+
const trimmed = {};
|
|
1550
|
+
let i = pIndex + 1;
|
|
1551
|
+
const total = source.length;
|
|
1552
|
+
while (i < total) {
|
|
1553
|
+
const currentModel = source[i];
|
|
1554
|
+
if (isGrouping(currentModel)) {
|
|
1555
|
+
const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];
|
|
1556
|
+
if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
currentModel[GROUP_EXPANDED] = false;
|
|
1560
|
+
}
|
|
1561
|
+
trimmed[i++] = true;
|
|
1562
|
+
}
|
|
1563
|
+
model[GROUP_EXPANDED] = false;
|
|
1564
|
+
return { trimmed };
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
*
|
|
1568
|
+
* @param pIndex - physical index
|
|
1569
|
+
* @param vIndex - virtual index, need to update item collection
|
|
1570
|
+
* @param source - data source
|
|
1571
|
+
* @param rowItemsIndexes - rgRow indexes
|
|
1572
|
+
*/
|
|
1573
|
+
function doExpand(vIndex, source, rowItemsIndexes) {
|
|
1574
|
+
const physicalIndex = rowItemsIndexes[vIndex];
|
|
1575
|
+
const model = source[physicalIndex];
|
|
1576
|
+
const currentGroup = getParsedGroup(model[PSEUDO_GROUP_ITEM_ID]);
|
|
1577
|
+
const trimmed = {};
|
|
1578
|
+
// no group found
|
|
1579
|
+
if (!currentGroup) {
|
|
1580
|
+
return { trimmed };
|
|
1581
|
+
}
|
|
1582
|
+
const groupItems = [];
|
|
1583
|
+
model[GROUP_EXPANDED] = true;
|
|
1584
|
+
let i = physicalIndex + 1;
|
|
1585
|
+
const total = source.length;
|
|
1586
|
+
let groupLevelOnly = 0;
|
|
1587
|
+
// go through all rows
|
|
1588
|
+
while (i < total) {
|
|
1589
|
+
const currentModel = source[i];
|
|
1590
|
+
const isGroup = isGrouping(currentModel);
|
|
1591
|
+
// group found
|
|
1592
|
+
if (isGroup) {
|
|
1593
|
+
if (!isSameGroup(currentGroup, model, currentModel)) {
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
else if (!groupLevelOnly) {
|
|
1597
|
+
// if get group first it's group only level
|
|
1598
|
+
groupLevelOnly = currentModel[GROUP_DEPTH];
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
// level 0 or same depth
|
|
1602
|
+
if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[GROUP_DEPTH])) {
|
|
1603
|
+
trimmed[i] = false;
|
|
1604
|
+
groupItems.push(i);
|
|
1605
|
+
}
|
|
1606
|
+
i++;
|
|
1607
|
+
}
|
|
1608
|
+
const result = {
|
|
1609
|
+
trimmed,
|
|
1610
|
+
};
|
|
1611
|
+
if (groupItems.length) {
|
|
1612
|
+
const items = [...rowItemsIndexes];
|
|
1613
|
+
items.splice(vIndex + 1, 0, ...groupItems);
|
|
1614
|
+
result.items = items;
|
|
1615
|
+
}
|
|
1616
|
+
return result;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
const TRIMMED_GROUPING = 'grouping';
|
|
1620
|
+
/**
|
|
1621
|
+
* Prepare trimming updated indexes for grouping
|
|
1622
|
+
* @param initiallyTrimed
|
|
1623
|
+
* @param firstLevelMap
|
|
1624
|
+
* @param secondLevelMap
|
|
1625
|
+
*/
|
|
1626
|
+
function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
|
|
1627
|
+
const trimemedOptionsToUpgrade = {};
|
|
1628
|
+
/**
|
|
1629
|
+
* go through all groups except grouping
|
|
1630
|
+
*/
|
|
1631
|
+
for (let type in initiallyTrimed) {
|
|
1632
|
+
if (type === TRIMMED_GROUPING) {
|
|
1633
|
+
continue;
|
|
1634
|
+
}
|
|
1635
|
+
const items = initiallyTrimed[type];
|
|
1636
|
+
const newItems = {};
|
|
1637
|
+
for (let initialIndex in items) {
|
|
1638
|
+
/**
|
|
1639
|
+
* if item exists we find it in collection
|
|
1640
|
+
* we support 2 level of conversions
|
|
1641
|
+
*/
|
|
1642
|
+
let newConversionIndex = firstLevelMap[initialIndex];
|
|
1643
|
+
if (secondLevelMap) {
|
|
1644
|
+
newConversionIndex = secondLevelMap[newConversionIndex];
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* if item was trimmed previously
|
|
1648
|
+
* trimming makes sense to apply
|
|
1649
|
+
*/
|
|
1650
|
+
if (items[initialIndex]) {
|
|
1651
|
+
newItems[newConversionIndex] = true;
|
|
1652
|
+
/**
|
|
1653
|
+
* If changes present apply changes to new source
|
|
1654
|
+
*/
|
|
1655
|
+
if (newConversionIndex !== parseInt(initialIndex, 10)) {
|
|
1656
|
+
trimemedOptionsToUpgrade[type] = newItems;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
return trimemedOptionsToUpgrade;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
/** `Object#toString` result references. */
|
|
1665
|
+
var stringTag = '[object String]';
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* Checks if `value` is classified as a `String` primitive or object.
|
|
1669
|
+
*
|
|
1670
|
+
* @static
|
|
1671
|
+
* @since 0.1.0
|
|
1672
|
+
* @memberOf _
|
|
1673
|
+
* @category Lang
|
|
1674
|
+
* @param {*} value The value to check.
|
|
1675
|
+
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
1676
|
+
* @example
|
|
1677
|
+
*
|
|
1678
|
+
* _.isString('abc');
|
|
1679
|
+
* // => true
|
|
1680
|
+
*
|
|
1681
|
+
* _.isString(1);
|
|
1682
|
+
* // => false
|
|
1683
|
+
*/
|
|
1684
|
+
function isString(value) {
|
|
1685
|
+
return typeof value == 'string' ||
|
|
1686
|
+
(!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Gets the size of an ASCII `string`.
|
|
1691
|
+
*
|
|
1692
|
+
* @private
|
|
1693
|
+
* @param {string} string The string inspect.
|
|
1694
|
+
* @returns {number} Returns the string size.
|
|
1695
|
+
*/
|
|
1696
|
+
var asciiSize = baseProperty('length');
|
|
1697
|
+
|
|
1698
|
+
const asciiSize$1 = asciiSize;
|
|
1699
|
+
|
|
1700
|
+
/** Used to compose unicode character classes. */
|
|
1701
|
+
var rsAstralRange$1 = '\\ud800-\\udfff',
|
|
1702
|
+
rsComboMarksRange$1 = '\\u0300-\\u036f',
|
|
1703
|
+
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
|
|
1704
|
+
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
|
|
1705
|
+
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
|
|
1706
|
+
rsVarRange$1 = '\\ufe0e\\ufe0f';
|
|
1707
|
+
|
|
1708
|
+
/** Used to compose unicode capture groups. */
|
|
1709
|
+
var rsZWJ$1 = '\\u200d';
|
|
1710
|
+
|
|
1711
|
+
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
1712
|
+
var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* Checks if `string` contains Unicode symbols.
|
|
1716
|
+
*
|
|
1717
|
+
* @private
|
|
1718
|
+
* @param {string} string The string to inspect.
|
|
1719
|
+
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
1720
|
+
*/
|
|
1721
|
+
function hasUnicode(string) {
|
|
1722
|
+
return reHasUnicode.test(string);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/** Used to compose unicode character classes. */
|
|
1726
|
+
var rsAstralRange = '\\ud800-\\udfff',
|
|
1727
|
+
rsComboMarksRange = '\\u0300-\\u036f',
|
|
1728
|
+
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
1729
|
+
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
1730
|
+
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
|
1731
|
+
rsVarRange = '\\ufe0e\\ufe0f';
|
|
1732
|
+
|
|
1733
|
+
/** Used to compose unicode capture groups. */
|
|
1734
|
+
var rsAstral = '[' + rsAstralRange + ']',
|
|
1735
|
+
rsCombo = '[' + rsComboRange + ']',
|
|
1736
|
+
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
1737
|
+
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
1738
|
+
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
1739
|
+
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
1740
|
+
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
1741
|
+
rsZWJ = '\\u200d';
|
|
1742
|
+
|
|
1743
|
+
/** Used to compose unicode regexes. */
|
|
1744
|
+
var reOptMod = rsModifier + '?',
|
|
1745
|
+
rsOptVar = '[' + rsVarRange + ']?',
|
|
1746
|
+
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
1747
|
+
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
1748
|
+
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
1749
|
+
|
|
1750
|
+
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
1751
|
+
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* Gets the size of a Unicode `string`.
|
|
1755
|
+
*
|
|
1756
|
+
* @private
|
|
1757
|
+
* @param {string} string The string inspect.
|
|
1758
|
+
* @returns {number} Returns the string size.
|
|
1759
|
+
*/
|
|
1760
|
+
function unicodeSize(string) {
|
|
1761
|
+
var result = reUnicode.lastIndex = 0;
|
|
1762
|
+
while (reUnicode.test(string)) {
|
|
1763
|
+
++result;
|
|
1764
|
+
}
|
|
1765
|
+
return result;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Gets the number of symbols in `string`.
|
|
1770
|
+
*
|
|
1771
|
+
* @private
|
|
1772
|
+
* @param {string} string The string to inspect.
|
|
1773
|
+
* @returns {number} Returns the string size.
|
|
1774
|
+
*/
|
|
1775
|
+
function stringSize(string) {
|
|
1776
|
+
return hasUnicode(string)
|
|
1777
|
+
? unicodeSize(string)
|
|
1778
|
+
: asciiSize$1(string);
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
/** `Object#toString` result references. */
|
|
1782
|
+
var mapTag = '[object Map]',
|
|
1783
|
+
setTag = '[object Set]';
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* Gets the size of `collection` by returning its length for array-like
|
|
1787
|
+
* values or the number of own enumerable string keyed properties for objects.
|
|
1788
|
+
*
|
|
1789
|
+
* @static
|
|
1790
|
+
* @memberOf _
|
|
1791
|
+
* @since 0.1.0
|
|
1792
|
+
* @category Collection
|
|
1793
|
+
* @param {Array|Object|string} collection The collection to inspect.
|
|
1794
|
+
* @returns {number} Returns the collection size.
|
|
1795
|
+
* @example
|
|
1796
|
+
*
|
|
1797
|
+
* _.size([1, 2, 3]);
|
|
1798
|
+
* // => 3
|
|
1799
|
+
*
|
|
1800
|
+
* _.size({ 'a': 1, 'b': 2 });
|
|
1801
|
+
* // => 2
|
|
1802
|
+
*
|
|
1803
|
+
* _.size('pebbles');
|
|
1804
|
+
* // => 7
|
|
1805
|
+
*/
|
|
1806
|
+
function size(collection) {
|
|
1807
|
+
if (collection == null) {
|
|
1808
|
+
return 0;
|
|
1809
|
+
}
|
|
1810
|
+
if (isArrayLike(collection)) {
|
|
1811
|
+
return isString(collection) ? stringSize(collection) : collection.length;
|
|
1812
|
+
}
|
|
1813
|
+
var tag = getTag(collection);
|
|
1814
|
+
if (tag == mapTag || tag == setTag) {
|
|
1815
|
+
return collection.size;
|
|
1816
|
+
}
|
|
1817
|
+
return baseKeys(collection).length;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
function sortIndexByItems(indexes, source, sortingFunc = {}) {
|
|
1821
|
+
// if no sorting - return unsorted indexes
|
|
1822
|
+
if (Object.entries(sortingFunc).length === 0) {
|
|
1823
|
+
// Unsorted indexes
|
|
1824
|
+
return [...Array(indexes.length).keys()];
|
|
1825
|
+
}
|
|
1826
|
+
//
|
|
1827
|
+
/**
|
|
1828
|
+
* go through all indexes and align in new order
|
|
1829
|
+
* performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.
|
|
1830
|
+
*/
|
|
1831
|
+
return indexes.sort((a, b) => {
|
|
1832
|
+
const itemA = source[a];
|
|
1833
|
+
const itemB = source[b];
|
|
1834
|
+
for (const [prop, cmp] of Object.entries(sortingFunc)) {
|
|
1835
|
+
if (isGrouping(itemA)) {
|
|
1836
|
+
if (itemA['__rvgr-prop'] !== prop) {
|
|
1837
|
+
return 0;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
if (isGrouping(itemB)) {
|
|
1841
|
+
if (itemB['__rvgr-prop'] !== prop) {
|
|
1842
|
+
return 0;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* If the comparison function returns a non-zero value (sorted), it means that the items should be sorted based on the given property. In such a case, the function immediately returns the sorted value, indicating the order in which the items should be arranged.
|
|
1847
|
+
* If none of the comparison functions result in a non-zero value, indicating that the items are equal or should remain in the same order, the function eventually returns 0.
|
|
1848
|
+
*/
|
|
1849
|
+
const sorted = cmp === null || cmp === void 0 ? void 0 : cmp(prop, itemA, itemB);
|
|
1850
|
+
if (sorted) {
|
|
1851
|
+
return sorted;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
return 0;
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
/**
|
|
1859
|
+
* Lifecycle
|
|
1860
|
+
* 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
|
|
1861
|
+
* 1.1. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
|
|
1862
|
+
* 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
|
|
1863
|
+
* 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
|
|
1864
|
+
* 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
|
|
1865
|
+
*
|
|
1866
|
+
* Note: If you prevent an event, it will not proceed to the subsequent steps.
|
|
1867
|
+
*/
|
|
1868
|
+
class SortingPlugin extends BasePlugin {
|
|
1869
|
+
runSorting(order, comparison, ignoreViewportUpdate) {
|
|
1870
|
+
var _a;
|
|
1871
|
+
this.sort(order, comparison, undefined, ignoreViewportUpdate);
|
|
1872
|
+
(_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1873
|
+
this.sortingPromise = null;
|
|
1874
|
+
}
|
|
1875
|
+
constructor(revogrid, providers, config) {
|
|
1876
|
+
super(revogrid, providers);
|
|
1877
|
+
this.revogrid = revogrid;
|
|
1878
|
+
this.sortingPromise = null;
|
|
1879
|
+
this.postponeSort = debounce((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
|
|
1880
|
+
const setConfig = (cfg) => {
|
|
1881
|
+
var _a;
|
|
1882
|
+
if (cfg) {
|
|
1883
|
+
const sortingFunc = {};
|
|
1884
|
+
const order = {};
|
|
1885
|
+
(_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
|
|
1886
|
+
sortingFunc[col.prop] = this.getComparer(col, col.order);
|
|
1887
|
+
order[col.prop] = col.order;
|
|
1888
|
+
});
|
|
1889
|
+
// // set sorting
|
|
1890
|
+
this.sorting = order;
|
|
1891
|
+
this.sortingFunc = sortingFunc;
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
setConfig(config);
|
|
1895
|
+
this.addEventListener('sortingconfigchanged', ({ detail }) => {
|
|
1896
|
+
config = detail;
|
|
1897
|
+
setConfig(detail);
|
|
1898
|
+
this.startSorting(this.sorting, this.sortingFunc);
|
|
1430
1899
|
});
|
|
1431
|
-
|
|
1900
|
+
this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
|
|
1901
|
+
// if sorting was provided - sort data
|
|
1902
|
+
if (!!this.sorting && this.sortingFunc) {
|
|
1903
|
+
const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
|
|
1904
|
+
if (event.defaultPrevented) {
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
this.startSorting(this.sorting, this.sortingFunc);
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1910
|
+
this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
|
|
1911
|
+
// if config provided - do nothing, read from config
|
|
1912
|
+
if (config) {
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
const columns = this.providers.column.getColumns();
|
|
1916
|
+
const sortingFunc = {};
|
|
1917
|
+
for (let prop in order) {
|
|
1918
|
+
const cmp = this.getComparer(getColumnByProp(columns, prop), order[prop]);
|
|
1919
|
+
sortingFunc[prop] = cmp;
|
|
1920
|
+
}
|
|
1921
|
+
// set sorting
|
|
1922
|
+
this.sorting = order;
|
|
1923
|
+
this.sortingFunc = order && sortingFunc;
|
|
1924
|
+
});
|
|
1925
|
+
this.addEventListener('beforeheaderclick', (e) => {
|
|
1926
|
+
var _a, _b, _c, _d;
|
|
1927
|
+
if (e.defaultPrevented) {
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
if (!((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.sortable)) {
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
this.headerclick(e.detail.column, e.detail.index, (_d = (_c = e.detail) === null || _c === void 0 ? void 0 : _c.originalEvent) === null || _d === void 0 ? void 0 : _d.shiftKey);
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
startSorting(order, sortingFunc, ignoreViewportUpdate) {
|
|
1937
|
+
if (!this.sortingPromise) {
|
|
1938
|
+
// add job before render
|
|
1939
|
+
this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
|
|
1940
|
+
this.sortingPromise = resolve;
|
|
1941
|
+
}));
|
|
1942
|
+
}
|
|
1943
|
+
this.postponeSort(order, sortingFunc, ignoreViewportUpdate);
|
|
1944
|
+
}
|
|
1945
|
+
getComparer(column, order) {
|
|
1946
|
+
var _a, _b;
|
|
1947
|
+
const cellCmp = ((_a = column === null || column === void 0 ? void 0 : column.cellCompare) === null || _a === void 0 ? void 0 : _a.bind({ order })) || ((_b = this.defaultCellCompare) === null || _b === void 0 ? void 0 : _b.bind({ column, order }));
|
|
1948
|
+
if (order == 'asc') {
|
|
1949
|
+
return cellCmp;
|
|
1950
|
+
}
|
|
1951
|
+
if (order == 'desc') {
|
|
1952
|
+
return this.descCellCompare(cellCmp);
|
|
1953
|
+
}
|
|
1954
|
+
return undefined;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Apply sorting to data on header click
|
|
1958
|
+
* If additive - add to existing sorting, multiple columns can be sorted
|
|
1959
|
+
*/
|
|
1960
|
+
headerclick(column, index, additive) {
|
|
1961
|
+
var _a, _b;
|
|
1962
|
+
let order = this.getNextOrder(column.order);
|
|
1963
|
+
const beforeEvent = this.emit('beforesorting', { column, order, additive });
|
|
1964
|
+
if (beforeEvent.defaultPrevented) {
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
order = beforeEvent.detail.order;
|
|
1968
|
+
const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
|
|
1969
|
+
// apply sort data
|
|
1970
|
+
const beforeApplyEvent = this.emit('beforesortingapply', {
|
|
1971
|
+
column: newCol,
|
|
1972
|
+
order,
|
|
1973
|
+
additive,
|
|
1974
|
+
});
|
|
1975
|
+
if (beforeApplyEvent.defaultPrevented) {
|
|
1976
|
+
return;
|
|
1977
|
+
}
|
|
1978
|
+
const cmp = this.getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
|
|
1979
|
+
if (beforeApplyEvent.detail.additive && this.sorting) {
|
|
1980
|
+
const sorting = {};
|
|
1981
|
+
const sortingFunc = {};
|
|
1982
|
+
this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
|
|
1983
|
+
// extend sorting function with new sorting for multiple columns sorting
|
|
1984
|
+
this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
|
|
1985
|
+
if (column.prop in sorting && size(sorting) > 1 && order === undefined) {
|
|
1986
|
+
delete sorting[column.prop];
|
|
1987
|
+
delete sortingFunc[column.prop];
|
|
1988
|
+
}
|
|
1989
|
+
else {
|
|
1990
|
+
sorting[column.prop] = order;
|
|
1991
|
+
sortingFunc[column.prop] = cmp;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
else {
|
|
1995
|
+
if (order) {
|
|
1996
|
+
// reset sorting
|
|
1997
|
+
this.sorting = { [column.prop]: order };
|
|
1998
|
+
this.sortingFunc = { [column.prop]: cmp };
|
|
1999
|
+
}
|
|
2000
|
+
else {
|
|
2001
|
+
(_a = this.sorting) === null || _a === void 0 ? true : delete _a[column.prop];
|
|
2002
|
+
(_b = this.sortingFunc) === null || _b === void 0 ? true : delete _b[column.prop];
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
this.startSorting(this.sorting, this.sortingFunc);
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Sort items by sorting function
|
|
2009
|
+
* @requires proxyItems applied to row store
|
|
2010
|
+
* @requires source applied to row store
|
|
2011
|
+
*
|
|
2012
|
+
* @param sorting - per column sorting
|
|
2013
|
+
* @param data - this.stores['rgRow'].store.get('source')
|
|
2014
|
+
*/
|
|
2015
|
+
sort(sorting, sortingFunc, types = rowTypes, ignoreViewportUpdate = false) {
|
|
2016
|
+
// if no sorting - reset
|
|
2017
|
+
if (!Object.keys(sorting || {}).length) {
|
|
2018
|
+
for (let type of types) {
|
|
2019
|
+
const storeService = this.providers.data.stores[type];
|
|
2020
|
+
// row data
|
|
2021
|
+
const source = storeService.store.get('source');
|
|
2022
|
+
// row indexes
|
|
2023
|
+
const proxyItems = storeService.store.get('proxyItems');
|
|
2024
|
+
// row indexes
|
|
2025
|
+
const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
|
|
2026
|
+
this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
|
|
2027
|
+
storeService.setData({ proxyItems: newItemsOrder, source: [...source], });
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
else {
|
|
2031
|
+
for (let type of types) {
|
|
2032
|
+
const storeService = this.providers.data.stores[type];
|
|
2033
|
+
// row data
|
|
2034
|
+
const source = storeService.store.get('source');
|
|
2035
|
+
// row indexes
|
|
2036
|
+
const proxyItems = storeService.store.get('proxyItems');
|
|
2037
|
+
const newItemsOrder = sortIndexByItems([...proxyItems], source, sortingFunc);
|
|
2038
|
+
// take row indexes before trim applied and proxy items
|
|
2039
|
+
const prevItems = storeService.store.get('items');
|
|
2040
|
+
storeService.setData({
|
|
2041
|
+
proxyItems: newItemsOrder,
|
|
2042
|
+
source: [...source],
|
|
2043
|
+
});
|
|
2044
|
+
// take currently visible row indexes
|
|
2045
|
+
const newItems = storeService.store.get('items');
|
|
2046
|
+
if (!ignoreViewportUpdate) {
|
|
2047
|
+
this.providers.dimension
|
|
2048
|
+
.updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
this.emit('aftersortingapply');
|
|
2053
|
+
}
|
|
2054
|
+
defaultCellCompare(prop, a, b) {
|
|
2055
|
+
const aRaw = this.column ? getCellRaw(a, this.column) : a === null || a === void 0 ? void 0 : a[prop];
|
|
2056
|
+
const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
|
|
2057
|
+
const av = aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
2058
|
+
const bv = bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
|
|
2059
|
+
return av == bv ? 0 : av > bv ? 1 : -1;
|
|
2060
|
+
}
|
|
2061
|
+
descCellCompare(cmp) {
|
|
2062
|
+
return (prop, a, b) => {
|
|
2063
|
+
return -1 * cmp(prop, a, b);
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
getNextOrder(currentOrder) {
|
|
2067
|
+
switch (currentOrder) {
|
|
2068
|
+
case undefined:
|
|
2069
|
+
return 'asc';
|
|
2070
|
+
case 'asc':
|
|
2071
|
+
return 'desc';
|
|
2072
|
+
case 'desc':
|
|
2073
|
+
return undefined;
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
class GroupingRowPlugin extends BasePlugin {
|
|
2079
|
+
getStore(type = GROUPING_ROW_TYPE) {
|
|
2080
|
+
return this.providers.data.stores[type].store;
|
|
2081
|
+
}
|
|
2082
|
+
constructor(revogrid, providers) {
|
|
2083
|
+
super(revogrid, providers);
|
|
2084
|
+
this.revogrid = revogrid;
|
|
2085
|
+
this.providers = providers;
|
|
2086
|
+
}
|
|
2087
|
+
// befoce cell focus
|
|
2088
|
+
onFocus(e) {
|
|
2089
|
+
if (isGrouping(e.detail.model)) {
|
|
2090
|
+
e.preventDefault();
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
// expand event triggered
|
|
2094
|
+
onExpand({ virtualIndex }) {
|
|
2095
|
+
const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
|
|
2096
|
+
let newTrimmed = this.getStore().get('trimmed')[TRIMMED_GROUPING];
|
|
2097
|
+
let i = getPhysical(this.getStore(), virtualIndex);
|
|
2098
|
+
const isExpanded = getExpanded(source[i]);
|
|
2099
|
+
if (!isExpanded) {
|
|
2100
|
+
const { trimmed, items } = doExpand(virtualIndex, source, this.getStore().get('items'));
|
|
2101
|
+
newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
|
|
2102
|
+
if (items) {
|
|
2103
|
+
setItems(this.getStore(), items);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
else {
|
|
2107
|
+
const { trimmed } = doCollapse(i, source);
|
|
2108
|
+
newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
|
|
2109
|
+
this.revogrid.clearFocus();
|
|
2110
|
+
}
|
|
2111
|
+
this.getStore().set('source', source);
|
|
2112
|
+
this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
|
|
2113
|
+
}
|
|
2114
|
+
setColumnGrouping(cols) {
|
|
2115
|
+
// if 0 column as holder
|
|
2116
|
+
if (cols === null || cols === void 0 ? void 0 : cols.length) {
|
|
2117
|
+
cols[0][PSEUDO_GROUP_COLUMN] = true;
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
return false;
|
|
2121
|
+
}
|
|
2122
|
+
setColumns({ columns }) {
|
|
2123
|
+
for (let type of columnTypes) {
|
|
2124
|
+
if (this.setColumnGrouping(columns[type])) {
|
|
2125
|
+
break;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
// evaluate drag between groups
|
|
2130
|
+
onDrag(e) {
|
|
2131
|
+
const { from, to } = e.detail;
|
|
2132
|
+
const isDown = to - from >= 0;
|
|
2133
|
+
const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
|
|
2134
|
+
const items = this.getStore().get('items');
|
|
2135
|
+
let i = isDown ? from : to;
|
|
2136
|
+
const end = isDown ? to : from;
|
|
2137
|
+
for (; i < end; i++) {
|
|
2138
|
+
const model = source[items[i]];
|
|
2139
|
+
const isGroup = isGrouping(model);
|
|
2140
|
+
if (isGroup) {
|
|
2141
|
+
e.preventDefault();
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
beforeTrimmedApply(trimmed, type) {
|
|
2147
|
+
/** Before filter apply remove grouping filtering */
|
|
2148
|
+
if (type === FILTER_TRIMMED_TYPE) {
|
|
2149
|
+
const source = this.getStore().get('source');
|
|
2150
|
+
for (let index in trimmed) {
|
|
2151
|
+
if (trimmed[index] && isGrouping(source[index])) {
|
|
2152
|
+
trimmed[index] = false;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
isSortingRunning() {
|
|
2158
|
+
const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
|
|
2159
|
+
return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
|
|
2160
|
+
}
|
|
2161
|
+
// subscribe to grid events to process them accordingly
|
|
2162
|
+
subscribe() {
|
|
2163
|
+
/** if grouping present and new data source arrived */
|
|
2164
|
+
this.addEventListener('beforesourceset', ({ detail }) => {
|
|
2165
|
+
var _a, _b, _c;
|
|
2166
|
+
if (!(((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length) && ((_c = detail === null || detail === void 0 ? void 0 : detail.source) === null || _c === void 0 ? void 0 : _c.length))) {
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
// if sorting is running don't apply grouping, wait for sorting, then it'll apply in @aftersortingapply
|
|
2170
|
+
if (this.isSortingRunning()) {
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
this.onDataSet(detail);
|
|
2174
|
+
});
|
|
2175
|
+
this.addEventListener('beforecolumnsset', ({ detail }) => {
|
|
2176
|
+
this.setColumns(detail);
|
|
2177
|
+
});
|
|
2178
|
+
/**
|
|
2179
|
+
* filter applied need to clear grouping and apply again
|
|
2180
|
+
* based on new results can be new grouping
|
|
2181
|
+
*/
|
|
2182
|
+
this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
|
|
2183
|
+
/**
|
|
2184
|
+
* sorting applied need to clear grouping and apply again
|
|
2185
|
+
* based on new results whole grouping order will changed
|
|
2186
|
+
*/
|
|
2187
|
+
this.addEventListener('aftersortingapply', () => {
|
|
2188
|
+
var _a, _b;
|
|
2189
|
+
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
this.doSourceUpdate(Object.assign({}, this.options));
|
|
2193
|
+
});
|
|
2194
|
+
/**
|
|
2195
|
+
* Apply logic for focus inside of grouping
|
|
2196
|
+
* We can't focus on grouping rows, navigation only inside of groups for now
|
|
2197
|
+
*/
|
|
2198
|
+
this.addEventListener('beforecellfocus', e => this.onFocus(e));
|
|
2199
|
+
/**
|
|
2200
|
+
* Prevent rgRow drag outside the group
|
|
2201
|
+
*/
|
|
2202
|
+
this.addEventListener('roworderchanged', e => this.onDrag(e));
|
|
2203
|
+
/**
|
|
2204
|
+
* When grouping expand icon was clicked
|
|
2205
|
+
*/
|
|
2206
|
+
this.addEventListener('groupexpandclick', e => this.onExpand(e.detail));
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Starts global source update with group clearing and applying new one
|
|
2210
|
+
* Initiated when need to reapply grouping
|
|
2211
|
+
*/
|
|
2212
|
+
doSourceUpdate(options) {
|
|
2213
|
+
var _a;
|
|
2214
|
+
/**
|
|
2215
|
+
* Get source without grouping
|
|
2216
|
+
* @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
|
|
2217
|
+
*/
|
|
2218
|
+
const { source, prevExpanded, oldNewIndexes } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
|
|
2219
|
+
const expanded = Object.assign({ prevExpanded }, options);
|
|
2220
|
+
/**
|
|
2221
|
+
* Group again
|
|
2222
|
+
* @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
|
|
2223
|
+
*/
|
|
2224
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], expanded);
|
|
2225
|
+
const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
|
|
2226
|
+
// setup source
|
|
2227
|
+
this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
|
|
2228
|
+
this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Apply grouping on data set
|
|
2232
|
+
* Clear grouping from source
|
|
2233
|
+
* If source came from other plugin
|
|
2234
|
+
*/
|
|
2235
|
+
onDataSet(data) {
|
|
2236
|
+
var _a, _b;
|
|
2237
|
+
let preservedExpanded = {};
|
|
2238
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.preserveGroupingOnUpdate) !== false) {
|
|
2239
|
+
let { prevExpanded } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
|
|
2240
|
+
preservedExpanded = prevExpanded;
|
|
2241
|
+
}
|
|
2242
|
+
const source = data.source.filter(s => !isGrouping(s));
|
|
2243
|
+
const options = Object.assign(Object.assign({}, (this.revogrid.grouping || {})), { prevExpanded: preservedExpanded });
|
|
2244
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
|
|
2245
|
+
data.source = sourceWithGroups;
|
|
2246
|
+
this.providers.data.setGrouping({ depth });
|
|
2247
|
+
this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Externam call to apply grouping. Called by revogrid when prop changed.
|
|
2251
|
+
*/
|
|
2252
|
+
setGrouping(options) {
|
|
2253
|
+
var _a, _b;
|
|
2254
|
+
// unsubscribe from all events when group applied
|
|
2255
|
+
this.clearSubscriptions();
|
|
2256
|
+
this.options = options;
|
|
2257
|
+
// clear props, no grouping exists
|
|
2258
|
+
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
2259
|
+
this.clearGrouping();
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
// props exist and source inited
|
|
2263
|
+
const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
|
|
2264
|
+
if (source.length) {
|
|
2265
|
+
this.doSourceUpdate(Object.assign({}, options));
|
|
2266
|
+
}
|
|
2267
|
+
// props exist and columns inited
|
|
2268
|
+
for (let t of columnTypes) {
|
|
2269
|
+
if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
|
|
2270
|
+
this.providers.column.refreshByType(t);
|
|
2271
|
+
break;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
// if has any grouping subscribe to events again
|
|
2275
|
+
this.subscribe();
|
|
2276
|
+
}
|
|
2277
|
+
// clear grouping
|
|
2278
|
+
clearGrouping() {
|
|
2279
|
+
// clear columns
|
|
2280
|
+
columnTypes.forEach(t => {
|
|
2281
|
+
const cols = this.providers.column.getColumns(t);
|
|
2282
|
+
let deleted = false;
|
|
2283
|
+
cols.forEach(c => {
|
|
2284
|
+
if (isGroupingColumn(c)) {
|
|
2285
|
+
delete c[PSEUDO_GROUP_COLUMN];
|
|
2286
|
+
deleted = true;
|
|
2287
|
+
}
|
|
2288
|
+
});
|
|
2289
|
+
// if column store had grouping clear and refresh
|
|
2290
|
+
if (deleted) {
|
|
2291
|
+
this.providers.column.refreshByType(t);
|
|
2292
|
+
}
|
|
2293
|
+
});
|
|
2294
|
+
// clear rows
|
|
2295
|
+
const { source, oldNewIndexes } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
|
|
2296
|
+
this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
|
|
2297
|
+
this.updateTrimmed(undefined, undefined, oldNewIndexes);
|
|
2298
|
+
}
|
|
2299
|
+
updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap = {}, secondLevelMap) {
|
|
2300
|
+
// map previously trimmed data
|
|
2301
|
+
const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
|
|
2302
|
+
for (let type in trimemedOptionsToUpgrade) {
|
|
2303
|
+
this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
|
|
2304
|
+
}
|
|
2305
|
+
// const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
|
|
2306
|
+
// setup trimmed data for grouping
|
|
2307
|
+
this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
|
|
1432
2308
|
}
|
|
1433
2309
|
}
|
|
1434
2310
|
|
|
@@ -1507,7 +2383,7 @@ const DRAG_END = 'columndragend';
|
|
|
1507
2383
|
const BEFORE_DRAG_END = 'beforecolumndragend';
|
|
1508
2384
|
// use this event subscription to drop D&D for particular columns
|
|
1509
2385
|
const DRAG_START = 'columndragstart';
|
|
1510
|
-
class
|
|
2386
|
+
class ColumnMovePlugin extends BasePlugin {
|
|
1511
2387
|
constructor(revogrid, providers) {
|
|
1512
2388
|
super(revogrid, providers);
|
|
1513
2389
|
this.revogrid = revogrid;
|
|
@@ -1586,6 +2462,10 @@ class ColumnPlugin extends BasePlugin {
|
|
|
1586
2462
|
const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
1587
2463
|
const rgCol = getItemByPosition(this.staticDragData.cols, x);
|
|
1588
2464
|
this.orderUi.autoscroll(x, dragData.elRect.width);
|
|
2465
|
+
// prevent position change if out of bounds
|
|
2466
|
+
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
2467
|
+
return;
|
|
2468
|
+
}
|
|
1589
2469
|
this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
|
|
1590
2470
|
}
|
|
1591
2471
|
}
|
|
@@ -1606,14 +2486,16 @@ class ColumnPlugin extends BasePlugin {
|
|
|
1606
2486
|
}
|
|
1607
2487
|
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
|
|
1608
2488
|
const store = this.providers.column.stores[this.dragData.type].store;
|
|
1609
|
-
const
|
|
2489
|
+
const newItems = [...store.get('items')];
|
|
1610
2490
|
// prevent position change if needed
|
|
1611
|
-
const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[
|
|
2491
|
+
const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[newItems[this.staticDragData.startItem.itemIndex]] }));
|
|
1612
2492
|
if (!stopDrag) {
|
|
2493
|
+
const prevItems = [...newItems];
|
|
1613
2494
|
// todo: if move item out of group remove item from group
|
|
1614
|
-
const toMove =
|
|
1615
|
-
|
|
1616
|
-
store.set('items',
|
|
2495
|
+
const toMove = newItems.splice(this.staticDragData.startItem.itemIndex, 1);
|
|
2496
|
+
newItems.splice(newPosition.itemIndex, 0, ...toMove);
|
|
2497
|
+
store.set('items', newItems);
|
|
2498
|
+
this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
|
|
1617
2499
|
}
|
|
1618
2500
|
dispatch(this.revogrid, DRAG_END, this.dragData);
|
|
1619
2501
|
}
|
|
@@ -1654,6 +2536,6 @@ function getLeftRelative(absoluteX, gridPos, offset) {
|
|
|
1654
2536
|
return absoluteX - gridPos - offset;
|
|
1655
2537
|
}
|
|
1656
2538
|
|
|
1657
|
-
export { AutoSizeColumnPlugin as A, BasePlugin as B,
|
|
2539
|
+
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, StretchColumn as S, isStretchPlugin as a, ExportCsv as b, columnTypes as c, FILTER_CONFIG_CHANGED_EVENT as d, FILTE_PANEL as e, FilterPlugin as f, filterCoreFunctionsIndexedByType as g, filterTypes as h, isRowType as i, filterNames as j, getLeftRelative as k, SortingPlugin as l, forEach as m, rowTypes as r };
|
|
1658
2540
|
|
|
1659
|
-
//# sourceMappingURL=column.drag.plugin-
|
|
2541
|
+
//# sourceMappingURL=column.drag.plugin-50f49fa9.js.map
|