@1771technologies/lytenyte-pro 2.0.0-dev.0 → 2.0.0-dev.2
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/__play__/alpha.play.d.ts +3 -0
- package/dist/__play__/alpha.play.js +56 -0
- package/dist/__play__/basic-server-data/data.d.ts +10 -0
- package/dist/__play__/basic-server-data/data.js +17746 -0
- package/dist/__play__/basic-server-data/server.d.ts +36 -0
- package/dist/__play__/basic-server-data/server.js +105 -0
- package/dist/__play__/buttons.play.d.ts +4 -0
- package/dist/__play__/buttons.play.js +7 -0
- package/dist/__play__/inputs.play.d.ts +3 -0
- package/dist/__play__/inputs.play.js +13 -0
- package/dist/__play__/server.play.d.ts +3 -0
- package/dist/__play__/server.play.js +66 -0
- package/dist/__play__/tree.play.d.ts +3 -0
- package/dist/__play__/tree.play.js +47 -0
- package/dist/cell-selection/adjust-rect-for-row-and-cell-span.d.ts +2 -0
- package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +43 -0
- package/dist/cell-selection/are-rects-equal.d.ts +2 -0
- package/dist/cell-selection/are-rects-equal.js +6 -0
- package/dist/cell-selection/bound-selection-rect.d.ts +3 -0
- package/dist/cell-selection/bound-selection-rect.js +16 -0
- package/dist/cell-selection/cell-selection-containers.d.ts +3 -0
- package/dist/cell-selection/cell-selection-containers.js +86 -0
- package/dist/cell-selection/cell-selection-driver/cell-selection-driver.d.ts +1 -0
- package/dist/cell-selection/cell-selection-driver/cell-selection-driver.js +279 -0
- package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.d.ts +6 -0
- package/dist/cell-selection/cell-selection-driver/use-cell-focus-change.js +34 -0
- package/dist/cell-selection/cell-style-row.d.ts +8 -0
- package/dist/cell-selection/cell-style-row.js +79 -0
- package/dist/cell-selection/data-rect-from-cell-position.d.ts +3 -0
- package/dist/cell-selection/data-rect-from-cell-position.js +17 -0
- package/dist/cell-selection/deselect-rect-range.d.ts +2 -0
- package/dist/cell-selection/deselect-rect-range.js +43 -0
- package/dist/cell-selection/expand-selection-down.d.ts +3 -0
- package/dist/cell-selection/expand-selection-down.js +78 -0
- package/dist/cell-selection/expand-selection-end.d.ts +3 -0
- package/dist/cell-selection/expand-selection-end.js +76 -0
- package/dist/cell-selection/expand-selection-start.d.ts +3 -0
- package/dist/cell-selection/expand-selection-start.js +73 -0
- package/dist/cell-selection/expand-selection-up.d.ts +3 -0
- package/dist/cell-selection/expand-selection-up.js +74 -0
- package/dist/cell-selection/full-width-start-end-index.d.ts +2 -0
- package/dist/cell-selection/full-width-start-end-index.js +4 -0
- package/dist/cell-selection/get-root-cell.d.ts +3 -0
- package/dist/cell-selection/get-root-cell.js +6 -0
- package/dist/cell-selection/index.d.ts +13 -0
- package/dist/cell-selection/index.js +13 -0
- package/dist/cell-selection/is-bottom-rect.d.ts +2 -0
- package/dist/cell-selection/is-bottom-rect.js +4 -0
- package/dist/cell-selection/is-center-col-rect.d.ts +5 -0
- package/dist/cell-selection/is-center-col-rect.js +3 -0
- package/dist/cell-selection/is-center-rect.d.ts +2 -0
- package/dist/cell-selection/is-center-rect.js +4 -0
- package/dist/cell-selection/is-end-rect.d.ts +5 -0
- package/dist/cell-selection/is-end-rect.js +3 -0
- package/dist/cell-selection/is-fully-within-rect.d.ts +2 -0
- package/dist/cell-selection/is-fully-within-rect.js +6 -0
- package/dist/cell-selection/is-overlapping-rect.d.ts +2 -0
- package/dist/cell-selection/is-overlapping-rect.js +5 -0
- package/dist/cell-selection/is-start-rect.d.ts +5 -0
- package/dist/cell-selection/is-start-rect.js +3 -0
- package/dist/cell-selection/is-top-rect.d.ts +2 -0
- package/dist/cell-selection/is-top-rect.js +3 -0
- package/dist/cell-selection/is-within-selection-rect.d.ts +2 -0
- package/dist/cell-selection/is-within-selection-rect.js +3 -0
- package/dist/cell-selection/split-cell-selection-rect.d.ts +47 -0
- package/dist/cell-selection/split-cell-selection-rect.js +88 -0
- package/dist/cell-selection/split-on-pivot.d.ts +3 -0
- package/dist/cell-selection/split-on-pivot.js +50 -0
- package/dist/cell-selection/update-additive-cell-selection.d.ts +4 -0
- package/dist/cell-selection/update-additive-cell-selection.js +21 -0
- package/dist/cell-selection/use-edge-scroll.d.ts +6 -0
- package/dist/cell-selection/use-edge-scroll.js +71 -0
- package/dist/components/checkbox/checkbox.d.ts +15 -0
- package/dist/components/checkbox/checkbox.js +42 -0
- package/dist/components/checkbox/checkbox.play.d.ts +2 -0
- package/dist/components/checkbox/checkbox.play.js +6 -0
- package/dist/components/column-manager/column-manager.d.ts +13 -0
- package/dist/components/column-manager/column-manager.js +47 -0
- package/dist/components/external/clsx.d.ts +2 -0
- package/dist/components/external/clsx.js +44 -0
- package/dist/components/external/floating-ui.d.ts +268 -0
- package/dist/components/external/floating-ui.js +1802 -0
- package/dist/components/headless/dialog/arrow.d.ts +6 -0
- package/dist/components/headless/dialog/arrow.js +16 -0
- package/dist/components/headless/dialog/close.d.ts +10 -0
- package/dist/components/headless/dialog/close.js +22 -0
- package/dist/components/headless/dialog/container.d.ts +5 -0
- package/dist/components/headless/dialog/container.js +221 -0
- package/dist/components/headless/dialog/context.d.ts +32 -0
- package/dist/components/headless/dialog/context.js +3 -0
- package/dist/components/headless/dialog/description.d.ts +9 -0
- package/dist/components/headless/dialog/description.js +20 -0
- package/dist/components/headless/dialog/index.parts.d.ts +30 -0
- package/dist/components/headless/dialog/index.parts.js +17 -0
- package/dist/components/headless/dialog/root.d.ts +32 -0
- package/dist/components/headless/dialog/root.js +75 -0
- package/dist/components/headless/dialog/title.d.ts +9 -0
- package/dist/components/headless/dialog/title.js +20 -0
- package/dist/components/headless/dialog/transform-origin.d.ts +5 -0
- package/dist/components/headless/dialog/transform-origin.js +38 -0
- package/dist/components/headless/dialog/trigger.d.ts +10 -0
- package/dist/components/headless/dialog/trigger.js +24 -0
- package/dist/components/headless/dialog/use-dialog.d.ts +4 -0
- package/dist/components/headless/dialog/use-dialog.js +12 -0
- package/dist/components/headless/menu/checkbox-item.d.ts +11 -0
- package/dist/components/headless/menu/checkbox-item.js +42 -0
- package/dist/components/headless/menu/combo/combo-checkbox.d.ts +11 -0
- package/dist/components/headless/menu/combo/combo-checkbox.js +38 -0
- package/dist/components/headless/menu/combo/combo-context.d.ts +9 -0
- package/dist/components/headless/menu/combo/combo-context.js +3 -0
- package/dist/components/headless/menu/combo/combo-input.d.ts +7 -0
- package/dist/components/headless/menu/combo/combo-input.js +58 -0
- package/dist/components/headless/menu/combo/combo-menu.d.ts +5 -0
- package/dist/components/headless/menu/combo/combo-menu.js +24 -0
- package/dist/components/headless/menu/combo/combo-option.d.ts +9 -0
- package/dist/components/headless/menu/combo/combo-option.js +37 -0
- package/dist/components/headless/menu/container.d.ts +5 -0
- package/dist/components/headless/menu/container.js +19 -0
- package/dist/components/headless/menu/dom.d.ts +4 -0
- package/dist/components/headless/menu/dom.js +20 -0
- package/dist/components/headless/menu/index.d.ts +54 -0
- package/dist/components/headless/menu/index.js +39 -0
- package/dist/components/headless/menu/item/handle-vertical-navigation.d.ts +2 -0
- package/dist/components/headless/menu/item/handle-vertical-navigation.js +28 -0
- package/dist/components/headless/menu/item/item.d.ts +9 -0
- package/dist/components/headless/menu/item/item.js +45 -0
- package/dist/components/headless/menu/item/use-menu-item-events.d.ts +1 -0
- package/dist/components/headless/menu/item/use-menu-item-events.js +25 -0
- package/dist/components/headless/menu/menu-divider.d.ts +5 -0
- package/dist/components/headless/menu/menu-divider.js +6 -0
- package/dist/components/headless/menu/menu-group.d.ts +5 -0
- package/dist/components/headless/menu/menu-group.js +6 -0
- package/dist/components/headless/menu/menu-header.d.ts +5 -0
- package/dist/components/headless/menu/menu-header.js +6 -0
- package/dist/components/headless/menu/popover.d.ts +5 -0
- package/dist/components/headless/menu/popover.js +7 -0
- package/dist/components/headless/menu/radio-group/context.d.ts +11 -0
- package/dist/components/headless/menu/radio-group/context.js +7 -0
- package/dist/components/headless/menu/radio-group/radio-item.d.ts +10 -0
- package/dist/components/headless/menu/radio-group/radio-item.js +44 -0
- package/dist/components/headless/menu/submenu/submenu-context.d.ts +9 -0
- package/dist/components/headless/menu/submenu/submenu-context.js +3 -0
- package/dist/components/headless/menu/submenu/submenu-trigger.d.ts +7 -0
- package/dist/components/headless/menu/submenu/submenu-trigger.js +70 -0
- package/dist/components/headless/menu/submenu/submenu.d.ts +21 -0
- package/dist/components/headless/menu/submenu/submenu.js +55 -0
- package/dist/components/headless/menu/submenu/use-submenu-position.d.ts +5 -0
- package/dist/components/headless/menu/submenu/use-submenu-position.js +31 -0
- package/dist/components/headless/menu/use-menu.d.ts +1 -0
- package/dist/components/headless/menu/use-menu.js +52 -0
- package/dist/components/headless/popover/container.d.ts +5 -0
- package/dist/components/headless/popover/container.js +7 -0
- package/dist/components/headless/popover/context.d.ts +6 -0
- package/dist/components/headless/popover/context.js +3 -0
- package/dist/components/headless/popover/index.d.ts +30 -0
- package/dist/components/headless/popover/index.js +17 -0
- package/dist/components/headless/popover/root.d.ts +6 -0
- package/dist/components/headless/popover/root.js +8 -0
- package/dist/components/headless/popover/trigger.d.ts +7 -0
- package/dist/components/headless/popover/trigger.js +11 -0
- package/dist/components/pill-manager/container.d.ts +5 -0
- package/dist/components/pill-manager/container.js +127 -0
- package/dist/components/pill-manager/expander.d.ts +9 -0
- package/dist/components/pill-manager/expander.js +21 -0
- package/dist/components/pill-manager/icons.d.ts +12 -0
- package/dist/components/pill-manager/icons.js +35 -0
- package/dist/components/pill-manager/index.d.ts +33 -0
- package/dist/components/pill-manager/index.js +13 -0
- package/dist/components/pill-manager/item.d.ts +10 -0
- package/dist/components/pill-manager/item.js +178 -0
- package/dist/components/pill-manager/label.d.ts +10 -0
- package/dist/components/pill-manager/label.js +31 -0
- package/dist/components/pill-manager/pill-manager.play.d.ts +3 -0
- package/dist/components/pill-manager/pill-manager.play.js +73 -0
- package/dist/components/pill-manager/pill-row.context.d.ts +8 -0
- package/dist/components/pill-manager/pill-row.context.js +4 -0
- package/dist/components/pill-manager/pill-row.d.ts +12 -0
- package/dist/components/pill-manager/pill-row.js +22 -0
- package/dist/components/pill-manager/root.context.d.ts +40 -0
- package/dist/components/pill-manager/root.context.js +4 -0
- package/dist/components/pill-manager/root.d.ts +25 -0
- package/dist/components/pill-manager/root.js +33 -0
- package/dist/components/pill-manager/row-default.d.ts +3 -0
- package/dist/components/pill-manager/row-default.js +14 -0
- package/dist/components/pill-manager/types.d.ts +21 -0
- package/dist/components/pill-manager/types.js +1 -0
- package/dist/components/row-group-cell.d.ts +13 -0
- package/dist/components/row-group-cell.js +40 -0
- package/dist/components/select-all.d.ts +12 -0
- package/dist/components/select-all.js +34 -0
- package/dist/components/smart-select/chip-context.d.ts +8 -0
- package/dist/components/smart-select/chip-context.js +4 -0
- package/dist/components/smart-select/chip-remove.d.ts +1 -0
- package/dist/components/smart-select/chip-remove.js +13 -0
- package/dist/components/smart-select/chip.d.ts +13 -0
- package/dist/components/smart-select/chip.js +79 -0
- package/dist/components/smart-select/container.d.ts +1 -0
- package/dist/components/smart-select/container.js +13 -0
- package/dist/components/smart-select/context.d.ts +31 -0
- package/dist/components/smart-select/context.js +4 -0
- package/dist/components/smart-select/index.d.ts +30 -0
- package/dist/components/smart-select/index.js +19 -0
- package/dist/components/smart-select/option.d.ts +8 -0
- package/dist/components/smart-select/option.js +36 -0
- package/dist/components/smart-select/root.d.ts +17 -0
- package/dist/components/smart-select/root.js +165 -0
- package/dist/components/smart-select/smart-select.play.d.ts +2 -0
- package/dist/components/smart-select/smart-select.play.js +36 -0
- package/dist/components/smart-select/triggers/basic-trigger.d.ts +1 -0
- package/dist/components/smart-select/triggers/basic-trigger.js +18 -0
- package/dist/components/smart-select/triggers/combo-trigger.d.ts +1 -0
- package/dist/components/smart-select/triggers/combo-trigger.js +17 -0
- package/dist/components/smart-select/triggers/is-selectable-option.d.ts +1 -0
- package/dist/components/smart-select/triggers/is-selectable-option.js +3 -0
- package/dist/components/smart-select/triggers/multi-combo-trigger.d.ts +11 -0
- package/dist/components/smart-select/triggers/multi-combo-trigger.js +38 -0
- package/dist/components/smart-select/triggers/multi-trigger.d.ts +6 -0
- package/dist/components/smart-select/triggers/multi-trigger.js +8 -0
- package/dist/components/smart-select/triggers/use-combo-controls.d.ts +9 -0
- package/dist/components/smart-select/triggers/use-combo-controls.js +145 -0
- package/dist/components/smart-select/triggers/use-trigger-controls.d.ts +5 -0
- package/dist/components/smart-select/triggers/use-trigger-controls.js +126 -0
- package/dist/components/smart-select/type.d.ts +44 -0
- package/dist/components/smart-select/type.js +1 -0
- package/dist/components/smart-select/use-async-options.d.ts +8 -0
- package/dist/components/smart-select/use-async-options.js +42 -0
- package/dist/components/tree-view/index.d.ts +4 -0
- package/dist/components/tree-view/index.js +2 -0
- package/dist/components/tree-view/root.d.ts +37 -0
- package/dist/components/tree-view/root.js +139 -0
- package/dist/components/tree-view/select-all.d.ts +7 -0
- package/dist/components/tree-view/select-all.js +22 -0
- package/dist/components/tree-view/tree-children.d.ts +2 -0
- package/dist/components/tree-view/tree-children.js +15 -0
- package/dist/components/tree-view/types.d.ts +31 -0
- package/dist/components/tree-view/types.js +1 -0
- package/dist/components/types.d.ts +4 -0
- package/dist/components/types.js +1 -0
- package/dist/components/virtual-from-coordinates.d.ts +2 -0
- package/dist/components/virtual-from-coordinates.js +15 -0
- package/dist/components.d.ts +16 -0
- package/dist/components.js +11 -0
- package/dist/data-source-client/hooks/get-valid-leafs.d.ts +3 -0
- package/dist/data-source-client/hooks/get-valid-leafs.js +11 -0
- package/dist/data-source-client/hooks/use-controlled-ds-state.d.ts +13 -0
- package/dist/data-source-client/hooks/use-controlled-ds-state.js +39 -0
- package/dist/data-source-client/hooks/use-flattened-data.d.ts +18 -0
- package/dist/data-source-client/hooks/use-flattened-data.js +40 -0
- package/dist/data-source-client/hooks/use-flattened-groups.d.ts +5 -0
- package/dist/data-source-client/hooks/use-flattened-groups.js +63 -0
- package/dist/data-source-client/hooks/use-flattened-piece.d.ts +14 -0
- package/dist/data-source-client/hooks/use-flattened-piece.js +55 -0
- package/dist/data-source-client/hooks/use-group-tree/collapse-child.d.ts +2 -0
- package/dist/data-source-client/hooks/use-group-tree/collapse-child.js +11 -0
- package/dist/data-source-client/hooks/use-group-tree/collapse-last.d.ts +2 -0
- package/dist/data-source-client/hooks/use-group-tree/collapse-last.js +14 -0
- package/dist/data-source-client/hooks/use-group-tree/collapse.d.ts +2 -0
- package/dist/data-source-client/hooks/use-group-tree/collapse.js +17 -0
- package/dist/data-source-client/hooks/use-group-tree/use-group-tree.d.ts +31 -0
- package/dist/data-source-client/hooks/use-group-tree/use-group-tree.js +152 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.d.ts +2 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/apply-reference-column.js +22 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/evaluate-label-filter.d.ts +2 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/evaluate-label-filter.js +9 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths-with-totals.d.ts +18 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths-with-totals.js +140 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.d.ts +4 -0
- package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths.js +31 -0
- package/dist/data-source-client/hooks/use-pivot/use-agg-model.d.ts +4 -0
- package/dist/data-source-client/hooks/use-pivot/use-agg-model.js +45 -0
- package/dist/data-source-client/hooks/use-pivot/use-filtered-data.d.ts +2 -0
- package/dist/data-source-client/hooks/use-pivot/use-filtered-data.js +18 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.d.ts +14 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-columns.js +151 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-data.d.ts +32 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-data.js +83 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.d.ts +4 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-group-fn.js +23 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-state.d.ts +16 -0
- package/dist/data-source-client/hooks/use-pivot/use-pivot-state.js +40 -0
- package/dist/data-source-client/use-client-data-source.d.ts +91 -0
- package/dist/data-source-client/use-client-data-source.js +169 -0
- package/dist/data-source-server/async-tree/+constants.async-tree.d.ts +1 -0
- package/dist/data-source-server/async-tree/+constants.async-tree.js +1 -0
- package/dist/data-source-server/async-tree/apply-delete-action-to-tree.d.ts +2 -0
- package/dist/data-source-server/async-tree/apply-delete-action-to-tree.js +27 -0
- package/dist/data-source-server/async-tree/apply-set-action-to-tree.d.ts +2 -0
- package/dist/data-source-server/async-tree/apply-set-action-to-tree.js +26 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-unique.d.ts +2 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-unique.js +20 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-valid.d.ts +2 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-are-valid.js +12 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-fit.d.ts +2 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-keys-fit.js +18 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-kinds.d.ts +2 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action-item-kinds.js +12 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action.d.ts +2 -0
- package/dist/data-source-server/async-tree/data-integrity-checks/check-set-action.js +24 -0
- package/dist/data-source-server/async-tree/get-parent-node-by-path.d.ts +2 -0
- package/dist/data-source-server/async-tree/get-parent-node-by-path.js +18 -0
- package/dist/data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +2 -0
- package/dist/data-source-server/async-tree/is-set-action-a-no-op-on-node.js +3 -0
- package/dist/data-source-server/async-tree/make-async-tree.d.ts +2 -0
- package/dist/data-source-server/async-tree/make-async-tree.js +64 -0
- package/dist/data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +2 -0
- package/dist/data-source-server/async-tree/maybe-apply-parent-remove-self.js +8 -0
- package/dist/data-source-server/async-tree/maybe-apply-resize.d.ts +2 -0
- package/dist/data-source-server/async-tree/maybe-apply-resize.js +17 -0
- package/dist/data-source-server/async-tree/maybe-apply-set-action-items.d.ts +2 -0
- package/dist/data-source-server/async-tree/maybe-apply-set-action-items.js +54 -0
- package/dist/data-source-server/async-tree/types.d.ts +70 -0
- package/dist/data-source-server/async-tree/types.js +1 -0
- package/dist/data-source-server/range-tree/range-tree.d.ts +66 -0
- package/dist/data-source-server/range-tree/range-tree.js +102 -0
- package/dist/data-source-server/server-data.d.ts +73 -0
- package/dist/data-source-server/server-data.js +553 -0
- package/dist/data-source-server/source/use-on-rows-updated.d.ts +4 -0
- package/dist/data-source-server/source/use-on-rows-updated.js +29 -0
- package/dist/data-source-server/source/use-on-view-change.d.ts +3 -0
- package/dist/data-source-server/source/use-on-view-change.js +13 -0
- package/dist/data-source-server/source/use-row-add.d.ts +3 -0
- package/dist/data-source-server/source/use-row-add.js +36 -0
- package/dist/data-source-server/source/use-row-by-id.d.ts +2 -0
- package/dist/data-source-server/source/use-row-by-id.js +8 -0
- package/dist/data-source-server/source/use-row-by-index.d.ts +9 -0
- package/dist/data-source-server/source/use-row-by-index.js +89 -0
- package/dist/data-source-server/source/use-row-children.d.ts +2 -0
- package/dist/data-source-server/source/use-row-children.js +16 -0
- package/dist/data-source-server/source/use-row-delete.d.ts +3 -0
- package/dist/data-source-server/source/use-row-delete.js +39 -0
- package/dist/data-source-server/source/use-row-id-to-row-index.d.ts +2 -0
- package/dist/data-source-server/source/use-row-id-to-row-index.js +7 -0
- package/dist/data-source-server/source/use-row-index-to-row-id.d.ts +2 -0
- package/dist/data-source-server/source/use-row-index-to-row-id.js +7 -0
- package/dist/data-source-server/source/use-row-leafs.d.ts +2 -0
- package/dist/data-source-server/source/use-row-leafs.js +20 -0
- package/dist/data-source-server/source/use-row-parents.d.ts +2 -0
- package/dist/data-source-server/source/use-row-parents.js +16 -0
- package/dist/data-source-server/source/use-row-siblings.d.ts +2 -0
- package/dist/data-source-server/source/use-row-siblings.js +15 -0
- package/dist/data-source-server/source/use-rows-between.d.ts +2 -0
- package/dist/data-source-server/source/use-rows-between.js +20 -0
- package/dist/data-source-server/source/use-source-state.d.ts +28 -0
- package/dist/data-source-server/source/use-source-state.js +47 -0
- package/dist/data-source-server/source/use-source.d.ts +5 -0
- package/dist/data-source-server/source/use-source.js +66 -0
- package/dist/data-source-server/types.d.ts +42 -0
- package/dist/data-source-server/types.js +1 -0
- package/dist/data-source-server/use-server-data-source.d.ts +51 -0
- package/dist/data-source-server/use-server-data-source.js +192 -0
- package/dist/data-source-server/utils/get-node-depth.d.ts +2 -0
- package/dist/data-source-server/utils/get-node-depth.js +9 -0
- package/dist/data-source-server/utils/get-node-path.d.ts +2 -0
- package/dist/data-source-server/utils/get-node-path.js +9 -0
- package/dist/data-source-server/utils/get-request-id.d.ts +1 -0
- package/dist/data-source-server/utils/get-request-id.js +6 -0
- package/dist/data-source-tree/source/use-controlled-state.d.ts +8 -0
- package/dist/data-source-tree/source/use-controlled-state.js +21 -0
- package/dist/data-source-tree/source/use-flattened.d.ts +17 -0
- package/dist/data-source-tree/source/use-flattened.js +65 -0
- package/dist/data-source-tree/source/use-on-rows-updated.d.ts +3 -0
- package/dist/data-source-tree/source/use-on-rows-updated.js +49 -0
- package/dist/data-source-tree/source/use-row-by-id.d.ts +2 -0
- package/dist/data-source-tree/source/use-row-by-id.js +7 -0
- package/dist/data-source-tree/source/use-row-children.d.ts +2 -0
- package/dist/data-source-tree/source/use-row-children.js +11 -0
- package/dist/data-source-tree/source/use-row-leafs.d.ts +2 -0
- package/dist/data-source-tree/source/use-row-leafs.js +20 -0
- package/dist/data-source-tree/source/use-row-parents.d.ts +2 -0
- package/dist/data-source-tree/source/use-row-parents.js +16 -0
- package/dist/data-source-tree/source/use-row-siblings.d.ts +2 -0
- package/dist/data-source-tree/source/use-row-siblings.js +12 -0
- package/dist/data-source-tree/source/use-tree.d.ts +3 -0
- package/dist/data-source-tree/source/use-tree.js +59 -0
- package/dist/data-source-tree/types.d.ts +16 -0
- package/dist/data-source-tree/types.js +1 -0
- package/dist/data-source-tree/use-tree-data-source.d.ts +41 -0
- package/dist/data-source-tree/use-tree-data-source.js +101 -0
- package/dist/data-source-tree/utils/is-object.d.ts +1 -0
- package/dist/data-source-tree/utils/is-object.js +3 -0
- package/dist/hooks/use-slot/get-element-ref.d.ts +2 -0
- package/dist/hooks/use-slot/get-element-ref.js +20 -0
- package/dist/hooks/use-slot/index.d.ts +3 -0
- package/dist/hooks/use-slot/index.js +1 -0
- package/dist/hooks/use-slot/merge-props.d.ts +4 -0
- package/dist/hooks/use-slot/merge-props.js +27 -0
- package/dist/hooks/use-slot/react-version.d.ts +3 -0
- package/dist/hooks/use-slot/react-version.js +5 -0
- package/dist/hooks/use-slot/types.d.ts +4 -0
- package/dist/hooks/use-slot/types.js +1 -0
- package/dist/hooks/use-slot/use-slot.d.ts +12 -0
- package/dist/hooks/use-slot/use-slot.js +28 -0
- package/dist/hooks/use-transitioned-open.d.ts +2 -0
- package/dist/hooks/use-transitioned-open.js +50 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.js +23 -0
- package/dist/license/index.d.ts +1 -0
- package/dist/license/index.js +1 -0
- package/dist/license/license.d.ts +3 -0
- package/dist/license/license.js +215 -0
- package/dist/license/md5-hash.d.ts +9 -0
- package/dist/license/md5-hash.js +167 -0
- package/dist/license.d.ts +3 -0
- package/dist/license.js +214 -0
- package/dist/root/context.d.ts +16 -0
- package/dist/root/context.js +4 -0
- package/dist/root/hooks/use-pro-api.d.ts +2 -0
- package/dist/root/hooks/use-pro-api.js +8 -0
- package/dist/root/root.d.ts +15 -0
- package/dist/root/root.js +112 -0
- package/dist/types/api.d.ts +100 -0
- package/dist/types/api.js +1 -0
- package/dist/types/column.d.ts +73 -0
- package/dist/types/column.js +1 -0
- package/dist/types/events.d.ts +56 -0
- package/dist/types/events.js +1 -0
- package/dist/types/grid.d.ts +47 -0
- package/dist/types/grid.js +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +1 -0
- package/dist/types/props.d.ts +187 -0
- package/dist/types/props.js +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { useMemo, useRef } from "react";
|
|
2
|
+
import { collapse } from "./collapse.js";
|
|
3
|
+
import { collapseLast } from "./collapse-last.js";
|
|
4
|
+
import { evaluateLabelFilter } from "../use-pivot/auxiliary-functions/evaluate-label-filter.js";
|
|
5
|
+
import { getValidLeafs } from "../get-valid-leafs.js";
|
|
6
|
+
export function useGroupTree(leafs, workingSet, group, groupIdFn, rowGroupCollapseBehavior, labelFilter, having, agg) {
|
|
7
|
+
const groupNodeCacheRef = useRef(new Map());
|
|
8
|
+
const prevCollapse = useRef(rowGroupCollapseBehavior);
|
|
9
|
+
if (prevCollapse.current !== rowGroupCollapseBehavior) {
|
|
10
|
+
groupNodeCacheRef.current = new Map();
|
|
11
|
+
prevCollapse.current = rowGroupCollapseBehavior;
|
|
12
|
+
}
|
|
13
|
+
return useMemo(() => {
|
|
14
|
+
const groupIdToGroupNode = new Map();
|
|
15
|
+
if (!group)
|
|
16
|
+
return null;
|
|
17
|
+
const root = {
|
|
18
|
+
kind: "root",
|
|
19
|
+
children: new Map(),
|
|
20
|
+
groupLookup: groupIdToGroupNode,
|
|
21
|
+
maxDepth: 0,
|
|
22
|
+
};
|
|
23
|
+
for (let i = 0; i < workingSet.length; i++) {
|
|
24
|
+
const n = leafs[workingSet[i]];
|
|
25
|
+
const paths = group(n);
|
|
26
|
+
// Skip this row if its path is filtered out.
|
|
27
|
+
if (!evaluateLabelFilter(labelFilter, paths))
|
|
28
|
+
continue;
|
|
29
|
+
let current = root.children;
|
|
30
|
+
let currentGroup = root;
|
|
31
|
+
// This has been marked a non-terminal node
|
|
32
|
+
if (!paths?.length) {
|
|
33
|
+
current.set(current.size, { kind: "leaf", row: n, parent: root, key: current.size });
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
root.maxDepth = Math.max(paths.length, root.maxDepth);
|
|
37
|
+
for (let j = 0; j < paths.length; j++) {
|
|
38
|
+
const p = paths[j];
|
|
39
|
+
if (!current.has(p)) {
|
|
40
|
+
const partial = paths.slice(0, j + 1);
|
|
41
|
+
const groupId = groupIdFn(partial);
|
|
42
|
+
const children = new Map();
|
|
43
|
+
const isLast = j === paths.length - 1;
|
|
44
|
+
if (!groupNodeCacheRef.current.get(groupId))
|
|
45
|
+
groupNodeCacheRef.current.set(groupId, {
|
|
46
|
+
__children: children,
|
|
47
|
+
__invalidate: true,
|
|
48
|
+
last: isLast,
|
|
49
|
+
kind: "branch",
|
|
50
|
+
id: groupId,
|
|
51
|
+
data: null,
|
|
52
|
+
depth: j,
|
|
53
|
+
key: p,
|
|
54
|
+
parentId: currentGroup.kind === "root" ? null : currentGroup.id,
|
|
55
|
+
expandable: false,
|
|
56
|
+
expanded: false,
|
|
57
|
+
});
|
|
58
|
+
const node = groupNodeCacheRef.current.get(groupId);
|
|
59
|
+
node.__children = children;
|
|
60
|
+
node.__invalidate = true;
|
|
61
|
+
node.last = isLast;
|
|
62
|
+
node.parentId = currentGroup.kind === "root" ? null : currentGroup.id;
|
|
63
|
+
current.set(p, {
|
|
64
|
+
id: groupId,
|
|
65
|
+
row: node,
|
|
66
|
+
kind: "branch",
|
|
67
|
+
children,
|
|
68
|
+
leafs: [],
|
|
69
|
+
leafIds: new Set(),
|
|
70
|
+
path: partial,
|
|
71
|
+
last: j === paths.length - 1,
|
|
72
|
+
parent: currentGroup,
|
|
73
|
+
key: p,
|
|
74
|
+
});
|
|
75
|
+
groupIdToGroupNode.set(groupId, current.get(p));
|
|
76
|
+
}
|
|
77
|
+
const node = current.get(p);
|
|
78
|
+
if (node.kind !== "branch") {
|
|
79
|
+
console.error(`Invalid grouping path. Expected a group node for path: ${paths}, but found a leaf along the way.`, node);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
node.leafs.push(i);
|
|
83
|
+
node.leafIds.add(n.id);
|
|
84
|
+
currentGroup = node;
|
|
85
|
+
current = node.children;
|
|
86
|
+
}
|
|
87
|
+
const n_writable = n;
|
|
88
|
+
if (currentGroup.kind === "root") {
|
|
89
|
+
n_writable.depth = 0;
|
|
90
|
+
n_writable.parentId = null;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
n_writable.depth = currentGroup.row.depth + 1;
|
|
94
|
+
n_writable.parentId = currentGroup.id;
|
|
95
|
+
}
|
|
96
|
+
current.set(current.size, { kind: "leaf", row: n, parent: currentGroup, key: current.size });
|
|
97
|
+
}
|
|
98
|
+
// Doing filtering here. Then I can collapse afterwards
|
|
99
|
+
// TODO: @lee verify this logic is sound and test thoroughly
|
|
100
|
+
if (having) {
|
|
101
|
+
const traverse = (node, depth = 0) => {
|
|
102
|
+
if (node.kind === "leaf")
|
|
103
|
+
return;
|
|
104
|
+
if (node.kind === "branch") {
|
|
105
|
+
node.children.forEach((x) => {
|
|
106
|
+
if (x.kind === "leaf")
|
|
107
|
+
return;
|
|
108
|
+
traverse(x, depth + 1);
|
|
109
|
+
});
|
|
110
|
+
if (node.leafIds.size === 0) {
|
|
111
|
+
// Delete self
|
|
112
|
+
node.parent.children.delete(node.key);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Now we have traversed the group.
|
|
116
|
+
const filterFn = Array.isArray(having) ? (having[depth] ?? null) : having;
|
|
117
|
+
// We aren't filtering at this depth, so return early.
|
|
118
|
+
if (!filterFn)
|
|
119
|
+
return;
|
|
120
|
+
const row = node.row;
|
|
121
|
+
// We need to aggregate this row.
|
|
122
|
+
if (row.__invalidate) {
|
|
123
|
+
const data = agg ? agg(getValidLeafs(node, leafs, workingSet)) : {};
|
|
124
|
+
row.data = data;
|
|
125
|
+
row.__invalidate = false;
|
|
126
|
+
}
|
|
127
|
+
const shouldKeep = filterFn(row);
|
|
128
|
+
if (shouldKeep)
|
|
129
|
+
return;
|
|
130
|
+
// We need to remove this row, remove the leafs from the parents going upwards.
|
|
131
|
+
root.groupLookup.delete(node.id);
|
|
132
|
+
node.parent.children.delete(node.key);
|
|
133
|
+
if (node.parent.kind !== "root") {
|
|
134
|
+
let current = node.parent;
|
|
135
|
+
while (current) {
|
|
136
|
+
current.leafIds = current.leafIds.difference(node.leafIds);
|
|
137
|
+
if (current.parent.kind === "root")
|
|
138
|
+
break;
|
|
139
|
+
current = current.parent;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
root.children.forEach((x) => traverse(x, 0));
|
|
145
|
+
}
|
|
146
|
+
if (rowGroupCollapseBehavior === "full-tree")
|
|
147
|
+
root.children.forEach(collapse);
|
|
148
|
+
if (rowGroupCollapseBehavior === "last-only")
|
|
149
|
+
root.children.forEach(collapseLast);
|
|
150
|
+
return root;
|
|
151
|
+
}, [agg, group, groupIdFn, having, labelFilter, leafs, rowGroupCollapseBehavior, workingSet]);
|
|
152
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const omitKeys = [
|
|
2
|
+
"id",
|
|
3
|
+
"name",
|
|
4
|
+
"groupVisibility",
|
|
5
|
+
"groupPath",
|
|
6
|
+
"pin",
|
|
7
|
+
"hide",
|
|
8
|
+
"field",
|
|
9
|
+
"colSpan",
|
|
10
|
+
"rowSpan",
|
|
11
|
+
"editOnPrintable",
|
|
12
|
+
"editRenderer",
|
|
13
|
+
"editable",
|
|
14
|
+
"editSetter",
|
|
15
|
+
];
|
|
16
|
+
export function applyReferenceColumn(pivotColumn, reference) {
|
|
17
|
+
if (!reference)
|
|
18
|
+
return pivotColumn;
|
|
19
|
+
const final = Object.fromEntries(Object.entries(reference).filter((x) => !omitKeys.includes(x[0])));
|
|
20
|
+
Object.assign(pivotColumn, final);
|
|
21
|
+
return pivotColumn;
|
|
22
|
+
}
|
package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths-with-totals.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds ln__total rows at every dimension level (except the measure/leaf),
|
|
3
|
+
* plus ln__grand_total rows at the top level, for every distinct leaf.
|
|
4
|
+
*
|
|
5
|
+
* Rules:
|
|
6
|
+
* - Paths are split by "-->" (whitespace around segments is trimmed).
|
|
7
|
+
* - The last segment is treated as the "leaf" (e.g., measure name).
|
|
8
|
+
* - For every prefix group, we add a total row by replacing the next segment
|
|
9
|
+
* with ln__total and then appending the leaf.
|
|
10
|
+
* Example: A-->B-->C-->Leaf
|
|
11
|
+
* - A-->B-->ln__total-->Leaf (totals across C within A,B)
|
|
12
|
+
* - A-->ln__total-->Leaf (totals across B,C within A)
|
|
13
|
+
* - For each distinct leaf, we add ln__grand_total-->Leaf.
|
|
14
|
+
* - Output is ordered alphabetically (case-insensitive) within each group,
|
|
15
|
+
* with ln__total rows placed after non-total rows at the same grouping level,
|
|
16
|
+
* and ln__grand_total rows at the end.
|
|
17
|
+
*/
|
|
18
|
+
export declare function pivotPathsWithTotals(paths: string[], measures: string[]): string[];
|
package/dist/data-source-client/hooks/use-pivot/auxiliary-functions/pivot-paths-with-totals.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds ln__total rows at every dimension level (except the measure/leaf),
|
|
3
|
+
* plus ln__grand_total rows at the top level, for every distinct leaf.
|
|
4
|
+
*
|
|
5
|
+
* Rules:
|
|
6
|
+
* - Paths are split by "-->" (whitespace around segments is trimmed).
|
|
7
|
+
* - The last segment is treated as the "leaf" (e.g., measure name).
|
|
8
|
+
* - For every prefix group, we add a total row by replacing the next segment
|
|
9
|
+
* with ln__total and then appending the leaf.
|
|
10
|
+
* Example: A-->B-->C-->Leaf
|
|
11
|
+
* - A-->B-->ln__total-->Leaf (totals across C within A,B)
|
|
12
|
+
* - A-->ln__total-->Leaf (totals across B,C within A)
|
|
13
|
+
* - For each distinct leaf, we add ln__grand_total-->Leaf.
|
|
14
|
+
* - Output is ordered alphabetically (case-insensitive) within each group,
|
|
15
|
+
* with ln__total rows placed after non-total rows at the same grouping level,
|
|
16
|
+
* and ln__grand_total rows at the end.
|
|
17
|
+
*/
|
|
18
|
+
export function pivotPathsWithTotals(paths, measures) {
|
|
19
|
+
const SEP = "-->";
|
|
20
|
+
const TOTAL = "ln__total";
|
|
21
|
+
const GRAND = "ln__grand_total";
|
|
22
|
+
// ---- Parse + normalize ----
|
|
23
|
+
const parsed = paths
|
|
24
|
+
.map((p) => p
|
|
25
|
+
.split(SEP)
|
|
26
|
+
.map((s) => s.trim())
|
|
27
|
+
.filter((s) => s.length > 0))
|
|
28
|
+
.filter((parts) => parts.length >= 2); // need at least [dim, leaf]
|
|
29
|
+
if (parsed.length === 0)
|
|
30
|
+
return [];
|
|
31
|
+
// Leaf is always last segment
|
|
32
|
+
const leaves = new Set();
|
|
33
|
+
for (const parts of parsed)
|
|
34
|
+
leaves.add(parts[parts.length - 1]);
|
|
35
|
+
// Use a Set for de-duping output
|
|
36
|
+
const out = new Set();
|
|
37
|
+
// Always include original paths (normalized)
|
|
38
|
+
for (const parts of parsed)
|
|
39
|
+
out.add(parts.join(SEP));
|
|
40
|
+
// ---- Build totals at every dimension level (except the leaf) ----
|
|
41
|
+
//
|
|
42
|
+
// For a path: d0 -> d1 -> ... -> d(n-2) -> leaf
|
|
43
|
+
// We add totals at levels i = n-2 down to 1, producing:
|
|
44
|
+
// d0 -> ... -> d(i-1) -> TOTAL -> leaf
|
|
45
|
+
//
|
|
46
|
+
// (No group-total at level 0, since that's the grand total.)
|
|
47
|
+
const prefixesByLenAndLeaf = new Map();
|
|
48
|
+
// key: `${i}|${leaf}` where i is the prefix length (number of dims to keep, >=1)
|
|
49
|
+
// value: set of serialized prefixes (dims only, no leaf)
|
|
50
|
+
for (const parts of parsed) {
|
|
51
|
+
const leaf = parts[parts.length - 1];
|
|
52
|
+
const dims = parts.slice(0, -1); // all but leaf
|
|
53
|
+
// Consider all prefix lengths from 1..dims.length (we'll add totals below the prefix)
|
|
54
|
+
// For totals we need at least 1 kept dim, and at least one dim below it to total across.
|
|
55
|
+
// Example: dims length = 1 => no per-group totals possible.
|
|
56
|
+
for (let keep = 1; keep < dims.length; keep++) {
|
|
57
|
+
const prefix = dims.slice(0, keep).join(SEP);
|
|
58
|
+
const k = `${keep}|${leaf}`;
|
|
59
|
+
if (!prefixesByLenAndLeaf.has(k))
|
|
60
|
+
prefixesByLenAndLeaf.set(k, new Set());
|
|
61
|
+
prefixesByLenAndLeaf.get(k).add(prefix);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Create total rows
|
|
65
|
+
for (const [key, prefixes] of prefixesByLenAndLeaf.entries()) {
|
|
66
|
+
const [, leaf] = key.split("|");
|
|
67
|
+
for (const prefix of prefixes) {
|
|
68
|
+
out.add(`${prefix}${SEP}${TOTAL}${SEP}${leaf}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Also add "top level totals" like: d0 -> TOTAL -> leaf
|
|
72
|
+
// This is already covered by keep=1 when dims.length >= 2.
|
|
73
|
+
// ---- Grand totals per leaf ----
|
|
74
|
+
for (const leaf of leaves) {
|
|
75
|
+
out.add(`${GRAND}${SEP}${leaf}`);
|
|
76
|
+
}
|
|
77
|
+
// ---- Sorting rules ----
|
|
78
|
+
// We want:
|
|
79
|
+
// - Alphabetical ordering (case-insensitive) at each level
|
|
80
|
+
// - ln__total should come after normal values at the same level
|
|
81
|
+
// - ln__grand_total should come last overall
|
|
82
|
+
//
|
|
83
|
+
// We'll implement a comparator over the whole path that enforces:
|
|
84
|
+
// 1) GRAND always last
|
|
85
|
+
// 2) Otherwise compare segment-by-segment:
|
|
86
|
+
// - At any segment, non-TOTAL comes before TOTAL
|
|
87
|
+
// - Then alphabetical (case-insensitive), with a stable tie-breaker on raw
|
|
88
|
+
// 3) If one path is prefix of another, shorter first
|
|
89
|
+
const sortKey = (seg) => {
|
|
90
|
+
if (seg === TOTAL)
|
|
91
|
+
return [1, seg.toLowerCase(), seg];
|
|
92
|
+
return [0, seg.toLowerCase(), seg];
|
|
93
|
+
};
|
|
94
|
+
const tieIndex = Object.fromEntries(measures.map((x, i) => [x.toLowerCase(), i]));
|
|
95
|
+
const cmp = (a, b) => {
|
|
96
|
+
const aParts = a.split(SEP).map((s) => s.trim());
|
|
97
|
+
const bParts = b.split(SEP).map((s) => s.trim());
|
|
98
|
+
const aIsGrand = aParts[0] === GRAND;
|
|
99
|
+
const bIsGrand = bParts[0] === GRAND;
|
|
100
|
+
if (aIsGrand && !bIsGrand)
|
|
101
|
+
return 1;
|
|
102
|
+
if (!aIsGrand && bIsGrand)
|
|
103
|
+
return -1;
|
|
104
|
+
const len = Math.max(aParts.length, bParts.length);
|
|
105
|
+
for (let i = 0; i < len; i++) {
|
|
106
|
+
const as = aParts[i];
|
|
107
|
+
const bs = bParts[i];
|
|
108
|
+
if (as === undefined)
|
|
109
|
+
return -1;
|
|
110
|
+
if (bs === undefined)
|
|
111
|
+
return 1;
|
|
112
|
+
const ak = sortKey(as);
|
|
113
|
+
const bk = sortKey(bs);
|
|
114
|
+
// total positioning
|
|
115
|
+
if (ak[0] !== bk[0])
|
|
116
|
+
return ak[0] - bk[0];
|
|
117
|
+
// Tie break at leaf
|
|
118
|
+
if (i === aParts.length - 1 && i === bParts.length - 1) {
|
|
119
|
+
const left = tieIndex[ak[1]];
|
|
120
|
+
const right = tieIndex[bk[1]];
|
|
121
|
+
if (left < right)
|
|
122
|
+
return -1;
|
|
123
|
+
if (left > right)
|
|
124
|
+
return 1;
|
|
125
|
+
}
|
|
126
|
+
// case-insensitive alphabetical
|
|
127
|
+
if (ak[1] < bk[1])
|
|
128
|
+
return -1;
|
|
129
|
+
if (ak[1] > bk[1])
|
|
130
|
+
return 1;
|
|
131
|
+
// raw tie-breaker
|
|
132
|
+
if (ak[2] < bk[2])
|
|
133
|
+
return -1;
|
|
134
|
+
if (ak[2] > bk[2])
|
|
135
|
+
return 1;
|
|
136
|
+
}
|
|
137
|
+
return 0;
|
|
138
|
+
};
|
|
139
|
+
return Array.from(out).sort(cmp);
|
|
140
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RowLeaf } from "@1771technologies/lytenyte-shared";
|
|
2
|
+
import type { PivotModel } from "../../../use-client-data-source";
|
|
3
|
+
import type { GridSpec } from "../../../../types/index.js";
|
|
4
|
+
export declare function pivotPaths<Spec extends GridSpec>(filtered: number[], leafs: RowLeaf<Spec["data"]>[], columns: Required<PivotModel<Spec>>["columns"], measures: PivotModel<Spec>["measures"], labelFilter: PivotModel<Spec>["colLabelFilter"]): string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { computeField } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
import { pivotPathsWithTotals } from "./pivot-paths-with-totals.js";
|
|
3
|
+
export function pivotPaths(filtered, leafs, columns, measures, labelFilter) {
|
|
4
|
+
const pathSet = new Set();
|
|
5
|
+
for (let i = 0; i < filtered.length; i++) {
|
|
6
|
+
const row = leafs[filtered[i]];
|
|
7
|
+
const current = [];
|
|
8
|
+
for (let j = 0; j < columns.length; j++) {
|
|
9
|
+
const c = columns[j];
|
|
10
|
+
const filterFn = labelFilter?.[j];
|
|
11
|
+
const field = c.field ?? c.id;
|
|
12
|
+
const value = field ? computeField(field, row) : null;
|
|
13
|
+
if (filterFn && !filterFn(value === null ? value : String(value)))
|
|
14
|
+
continue;
|
|
15
|
+
const pivotKey = value == null ? "ln__blank__" : String(value);
|
|
16
|
+
current.push(pivotKey);
|
|
17
|
+
}
|
|
18
|
+
if (measures?.length) {
|
|
19
|
+
for (const measure of measures) {
|
|
20
|
+
pathSet.add([...current, measure.dim.id].join("-->"));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
current.push("ln__noop");
|
|
25
|
+
pathSet.add(current.join("-->"));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const paths = [...pathSet];
|
|
29
|
+
const pathsWithTotals = pivotPathsWithTotals(paths, measures?.map((x) => x.dim.id) ?? []);
|
|
30
|
+
return pathsWithTotals;
|
|
31
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Column, GridSpec } from "../../../types/index.js";
|
|
2
|
+
import type { PivotModel } from "../../use-client-data-source.js";
|
|
3
|
+
import type { AggregationFn, Aggregator } from "@1771technologies/lytenyte-shared";
|
|
4
|
+
export declare function usePivotAggFunction<Spec extends GridSpec>(pivotColumns: Column<Spec>[] | null, model: PivotModel<Spec> | undefined, aggs?: Record<string, Aggregator<Spec["data"]>>): AggregationFn<Spec["data"]> | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { computeField } from "@1771technologies/lytenyte-core/internal";
|
|
3
|
+
const pivotAggs = {};
|
|
4
|
+
export function usePivotAggFunction(pivotColumns, model, aggs = pivotAggs) {
|
|
5
|
+
const measures = model?.measures;
|
|
6
|
+
const columns = model?.columns;
|
|
7
|
+
const aggFn = useMemo(() => {
|
|
8
|
+
if (!measures?.length)
|
|
9
|
+
return null;
|
|
10
|
+
if (!pivotColumns?.length || !columns?.length)
|
|
11
|
+
return (rows) => {
|
|
12
|
+
const aggResult = {};
|
|
13
|
+
for (const m of measures) {
|
|
14
|
+
const id = m.dim.id;
|
|
15
|
+
const fn = typeof m.fn === "string" ? aggs[m.fn] : m.fn;
|
|
16
|
+
if (!fn) {
|
|
17
|
+
console.error(`Measure "${fn}" is not defined.`);
|
|
18
|
+
}
|
|
19
|
+
aggResult[id] = fn(m.dim.field ?? id, rows);
|
|
20
|
+
}
|
|
21
|
+
return aggResult;
|
|
22
|
+
};
|
|
23
|
+
const lookup = Object.fromEntries((measures ?? []).map((x) => [x.dim.id, x]));
|
|
24
|
+
return (rows) => {
|
|
25
|
+
const aggResult = {};
|
|
26
|
+
for (let i = 0; i < pivotColumns.length; i++) {
|
|
27
|
+
const column = pivotColumns[i];
|
|
28
|
+
const measureId = column.id.split("-->").at(-1);
|
|
29
|
+
if (measureId === "ln__noop")
|
|
30
|
+
break;
|
|
31
|
+
const finalLeafs = rows.filter((x) => computeField(column.field, x));
|
|
32
|
+
if (finalLeafs.length) {
|
|
33
|
+
const measure = lookup[measureId];
|
|
34
|
+
const fn = typeof measure.fn === "string" ? aggs[measure.fn] : measure.fn;
|
|
35
|
+
aggResult[column.id] = fn(measure.dim.field ?? measure.dim.id, finalLeafs);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
aggResult[column.id] = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return aggResult;
|
|
42
|
+
};
|
|
43
|
+
}, [aggs, columns?.length, measures, pivotColumns]);
|
|
44
|
+
return aggFn;
|
|
45
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
export function useFilteredData(pivotMode, filter, leafs) {
|
|
3
|
+
// We now have our filtered
|
|
4
|
+
const filtered = useMemo(() => {
|
|
5
|
+
if (!pivotMode)
|
|
6
|
+
return [];
|
|
7
|
+
if (!filter)
|
|
8
|
+
return Array.from({ length: leafs.length }, (_, i) => i);
|
|
9
|
+
const filtered = [];
|
|
10
|
+
for (let i = 0; i < leafs.length; i++) {
|
|
11
|
+
const node = leafs[i];
|
|
12
|
+
if (filter(node))
|
|
13
|
+
filtered.push(i);
|
|
14
|
+
}
|
|
15
|
+
return filtered;
|
|
16
|
+
}, [filter, leafs, pivotMode]);
|
|
17
|
+
return filtered;
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PivotModel } from "../../use-client-data-source";
|
|
2
|
+
import type { Column, GridSpec } from "../../../types/index.js";
|
|
3
|
+
import { type ColumnPin, type RowLeaf } from "@1771technologies/lytenyte-shared";
|
|
4
|
+
import type { ControlledPivotState } from "./use-pivot-state";
|
|
5
|
+
export interface PivotState {
|
|
6
|
+
readonly columnState: {
|
|
7
|
+
readonly ordering: string[];
|
|
8
|
+
readonly resizing: Record<string, number>;
|
|
9
|
+
readonly pinning: Record<string, ColumnPin>;
|
|
10
|
+
};
|
|
11
|
+
readonly columnGroupState: Record<string, boolean>;
|
|
12
|
+
readonly rowGroupExpansions: Record<string, boolean | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare function usePivotColumns<Spec extends GridSpec = GridSpec>(pivotMode: boolean, pivotControlled: ControlledPivotState, model: PivotModel<Spec> | undefined, leafs: RowLeaf<Spec["data"]>[], filtered: number[], processor: null | undefined | ((columns: Column<any>[]) => Column<any>[])): Column<Spec>[] | null;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { useMemo, useRef } from "react";
|
|
2
|
+
import { computeField } from "@1771technologies/lytenyte-core/internal";
|
|
3
|
+
import { equal, itemsWithIdToMap, measureText, } from "@1771technologies/lytenyte-shared";
|
|
4
|
+
import { pivotPaths } from "./auxiliary-functions/pivot-paths.js";
|
|
5
|
+
import { applyReferenceColumn } from "./auxiliary-functions/apply-reference-column.js";
|
|
6
|
+
export function usePivotColumns(pivotMode, pivotControlled, model, leafs, filtered, processor) {
|
|
7
|
+
const measures = model?.measures;
|
|
8
|
+
const columns = model?.columns;
|
|
9
|
+
const prevMeasuresRef = useRef(measures);
|
|
10
|
+
const prevColumnsRef = useRef(columns);
|
|
11
|
+
const pivotControlledImmediateRef = useRef(pivotControlled.state);
|
|
12
|
+
pivotControlledImmediateRef.current = pivotControlled.state;
|
|
13
|
+
const pivotColumns = useMemo(() => {
|
|
14
|
+
if (!pivotMode)
|
|
15
|
+
return null;
|
|
16
|
+
// At this point we should check if we need to replace the pivot state
|
|
17
|
+
const prevMeasures = prevMeasuresRef.current;
|
|
18
|
+
const prevColumns = prevColumnsRef.current;
|
|
19
|
+
// If the measures or columns have changed, then the pivot state should be reset.
|
|
20
|
+
if (!equal(prevMeasures, measures) || !equal(prevColumns, columns)) {
|
|
21
|
+
pivotControlled.setState((prev) => ({
|
|
22
|
+
...prev,
|
|
23
|
+
columnState: { ordering: [], pinning: {}, resizing: {} },
|
|
24
|
+
columnGroupState: {},
|
|
25
|
+
}));
|
|
26
|
+
pivotControlledImmediateRef.current = {
|
|
27
|
+
...pivotControlledImmediateRef.current,
|
|
28
|
+
columnState: { ordering: [], pinning: {}, resizing: {} },
|
|
29
|
+
columnGroupState: {},
|
|
30
|
+
};
|
|
31
|
+
prevColumnsRef.current = columns;
|
|
32
|
+
prevMeasuresRef.current = measures;
|
|
33
|
+
}
|
|
34
|
+
if (!measures?.length && !columns?.length)
|
|
35
|
+
return [];
|
|
36
|
+
// There are only measures, hence each measure should become a column.
|
|
37
|
+
if (!columns?.length) {
|
|
38
|
+
return measures.map((x) => {
|
|
39
|
+
const column = applyReferenceColumn({
|
|
40
|
+
id: x.dim.id,
|
|
41
|
+
field: x.dim.id,
|
|
42
|
+
name: x.dim.name,
|
|
43
|
+
}, x.dim);
|
|
44
|
+
return column;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const paths = pivotPaths(filtered, leafs, columns, measures, model?.colLabelFilter);
|
|
48
|
+
const lookup = Object.fromEntries((measures ?? []).map((x) => [x.dim.id, x]));
|
|
49
|
+
const cols = paths.map((path) => {
|
|
50
|
+
const partsRaw = path.split("-->");
|
|
51
|
+
const parts = partsRaw.map((x) => (x === "ln__blank__" ? "(blank)" : x));
|
|
52
|
+
if (parts.length === 1) {
|
|
53
|
+
return { id: path };
|
|
54
|
+
}
|
|
55
|
+
const measureId = parts.at(-1);
|
|
56
|
+
const measureRef = lookup[measureId]?.dim;
|
|
57
|
+
// Pop the last part as this is the aggregation value
|
|
58
|
+
parts.pop();
|
|
59
|
+
let name = measureId === "ln__noop" || measures?.length === 1 ? parts.at(-1) : measureId;
|
|
60
|
+
if (name === "ln__grand_total")
|
|
61
|
+
name = "Grand Total";
|
|
62
|
+
if (parts[0] === "ln__grand_total" && measures && measures.length > 1)
|
|
63
|
+
name = "Grand Total " + measureId;
|
|
64
|
+
if (name === "ln__total")
|
|
65
|
+
name = "Total";
|
|
66
|
+
const group = (parts.length === 1 && measures?.length === 1
|
|
67
|
+
? undefined
|
|
68
|
+
: !measures?.length || measures.length === 1
|
|
69
|
+
? parts.slice(0, -1)
|
|
70
|
+
: parts)?.map((x) => (x === "ln__total" ? "Total" : x));
|
|
71
|
+
partsRaw.pop();
|
|
72
|
+
const label = measures.length > 1 ? (measureRef?.name ?? name) : name;
|
|
73
|
+
const minWidth = measureText(label);
|
|
74
|
+
const column = applyReferenceColumn({
|
|
75
|
+
id: path,
|
|
76
|
+
name: label,
|
|
77
|
+
widthMin: minWidth?.width,
|
|
78
|
+
groupPath: group?.map((x) => {
|
|
79
|
+
if (x === "ln__grand_total")
|
|
80
|
+
return "Grand Total";
|
|
81
|
+
if (x === "ln__total")
|
|
82
|
+
return "Total";
|
|
83
|
+
return x;
|
|
84
|
+
}),
|
|
85
|
+
groupVisibility: path.includes("ln__total") || path.includes("ln__grand_total") ? "always" : "open",
|
|
86
|
+
field: ({ row }) => {
|
|
87
|
+
// If the value is a group then we can simply grab the aggregated value.
|
|
88
|
+
if (row.kind === "branch" || row.kind === "aggregated")
|
|
89
|
+
return row.data[path];
|
|
90
|
+
// Pivots do not have leafs displayed. So here we do something interesting. We return true if the
|
|
91
|
+
// row should be kept for this pivot, otherwise false. This is effectively a leaf row filter for pivots.
|
|
92
|
+
// We can then aggregate these.
|
|
93
|
+
for (let i = 0; i < columns.length; i++) {
|
|
94
|
+
const c = columns[i];
|
|
95
|
+
const field = c.field ?? c.id;
|
|
96
|
+
const value = field ? computeField(field, row) : false;
|
|
97
|
+
const match = partsRaw[i];
|
|
98
|
+
// This is a total columns. Totals will always be one shorter than than the path
|
|
99
|
+
if (i >= partsRaw.length)
|
|
100
|
+
return true;
|
|
101
|
+
const isMatch = match.startsWith("ln") ||
|
|
102
|
+
String(value) === match ||
|
|
103
|
+
(value == null && match === "ln__blank__");
|
|
104
|
+
if (!isMatch)
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
},
|
|
109
|
+
}, measureRef);
|
|
110
|
+
return column;
|
|
111
|
+
});
|
|
112
|
+
return cols;
|
|
113
|
+
}, [pivotMode, measures, columns, filtered, leafs, model?.colLabelFilter, pivotControlled]);
|
|
114
|
+
const pivotColumnsWithState = useMemo(() => {
|
|
115
|
+
if (!pivotColumns)
|
|
116
|
+
return null;
|
|
117
|
+
void pivotControlled.pivotColumnState;
|
|
118
|
+
const state = pivotControlledImmediateRef.current.columnState;
|
|
119
|
+
const byId = itemsWithIdToMap(pivotColumns);
|
|
120
|
+
const ordering = state.ordering.filter((x) => byId.has(x));
|
|
121
|
+
const withBlanks = pivotColumns.map((x) => (ordering.includes(x.id) ? null : x));
|
|
122
|
+
let orderPos = 0;
|
|
123
|
+
for (let i = 0; i < withBlanks.length; i++) {
|
|
124
|
+
if (withBlanks[i])
|
|
125
|
+
continue;
|
|
126
|
+
const id = state.ordering[orderPos];
|
|
127
|
+
const column = byId.get(id);
|
|
128
|
+
withBlanks[i] = column;
|
|
129
|
+
orderPos++;
|
|
130
|
+
}
|
|
131
|
+
Object.entries(state.resizing).forEach(([id, value]) => {
|
|
132
|
+
const column = byId.get(id);
|
|
133
|
+
if (!column)
|
|
134
|
+
return;
|
|
135
|
+
Object.assign(column, { width: value });
|
|
136
|
+
});
|
|
137
|
+
Object.entries(state.pinning).forEach(([id, value]) => {
|
|
138
|
+
const column = byId.get(id);
|
|
139
|
+
if (!column)
|
|
140
|
+
return;
|
|
141
|
+
Object.assign(column, { pin: value });
|
|
142
|
+
});
|
|
143
|
+
return withBlanks;
|
|
144
|
+
}, [pivotColumns, pivotControlled.pivotColumnState]);
|
|
145
|
+
const processedColumns = useMemo(() => {
|
|
146
|
+
if (!processor || !pivotColumnsWithState)
|
|
147
|
+
return pivotColumnsWithState;
|
|
148
|
+
return processor(pivotColumnsWithState);
|
|
149
|
+
}, [pivotColumnsWithState, processor]);
|
|
150
|
+
return processedColumns;
|
|
151
|
+
}
|