@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,192 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { usePiece, useOnRowsSelected, useRowIsSelected, useRowSelection, useRowsSelected, useEvent, useGlobalRefresh, useRowSelectionState, } from "@1771technologies/lytenyte-core/internal";
|
|
3
|
+
import {} from "@1771technologies/lytenyte-shared";
|
|
4
|
+
import { useRowByIndex } from "./source/use-row-by-index.js";
|
|
5
|
+
import { useRowIndexToRowId } from "./source/use-row-index-to-row-id.js";
|
|
6
|
+
import { useRowIdToRowIndex } from "./source/use-row-id-to-row-index.js";
|
|
7
|
+
import { useRowById } from "./source/use-row-by-id.js";
|
|
8
|
+
import { useOnViewChange } from "./source/use-on-view-change.js";
|
|
9
|
+
import { useSourceState } from "./source/use-source-state.js";
|
|
10
|
+
import { useSource } from "./source/use-source.js";
|
|
11
|
+
import { useRowParents } from "./source/use-row-parents.js";
|
|
12
|
+
import { useRowsBetween } from "./source/use-rows-between.js";
|
|
13
|
+
import { useRowChildren } from "./source/use-row-children.js";
|
|
14
|
+
import { useRowLeafs } from "./source/use-row-leafs.js";
|
|
15
|
+
import { useOnRowsUpdated } from "./source/use-on-rows-updated.js";
|
|
16
|
+
import { useRowDelete } from "./source/use-row-delete.js";
|
|
17
|
+
import { useRowAdd } from "./source/use-row-add.js";
|
|
18
|
+
import { useRowSiblings } from "./source/use-row-siblings.js";
|
|
19
|
+
export function useServerDataSource(props) {
|
|
20
|
+
const isolatedSelected = props.rowsIsolatedSelection ?? false;
|
|
21
|
+
const state = useSourceState(props);
|
|
22
|
+
const isLoading$ = usePiece(state.isLoading);
|
|
23
|
+
const loadError$ = usePiece(state.loadingError);
|
|
24
|
+
const requestsForView$ = usePiece(state.requestsForView, state.setRequestsForView);
|
|
25
|
+
const top$ = usePiece(state.topCount);
|
|
26
|
+
const bot$ = usePiece(state.botCount);
|
|
27
|
+
const maxDepth$ = usePiece(state.maxDepth);
|
|
28
|
+
const rowCount$ = usePiece(state.rowCount);
|
|
29
|
+
const globalSignal = useGlobalRefresh();
|
|
30
|
+
const source = useSource(props, state, globalSignal);
|
|
31
|
+
const rowById = useRowById(source);
|
|
32
|
+
const rowIdToRowIndex = useRowIdToRowIndex(source);
|
|
33
|
+
const rowIndexToRowId = useRowIndexToRowId(source);
|
|
34
|
+
const rowParents = useRowParents(source);
|
|
35
|
+
const rowsBetween = useRowsBetween(source);
|
|
36
|
+
const rowChildren = useRowChildren(source);
|
|
37
|
+
const onViewChange = useOnViewChange(source, state.requestsForView, state.setRequestsForView);
|
|
38
|
+
const idSpec = useEvent((id) => {
|
|
39
|
+
const node = source.tree.rowIdToNode.get(id);
|
|
40
|
+
if (!node || node.kind === "leaf")
|
|
41
|
+
return null;
|
|
42
|
+
return { size: node.size, children: node.byIndex };
|
|
43
|
+
});
|
|
44
|
+
const { rootIds, rootCount } = useMemo(() => {
|
|
45
|
+
const subset = props.rowSelectionIdUniverseSubtractions ?? new Set();
|
|
46
|
+
const rootIds = new Set([...source.tree.byIndex.values()].map((x) => x.row.id)).difference(subset);
|
|
47
|
+
const additions = new Set(props.rowSelectionIdUniverseAdditions?.filter((x) => x.root).map((x) => x.id) ?? []).difference(subset);
|
|
48
|
+
return { rootIds: rootIds.union(additions), rootCount: source.tree.size };
|
|
49
|
+
}, [
|
|
50
|
+
props.rowSelectionIdUniverseAdditions,
|
|
51
|
+
props.rowSelectionIdUniverseSubtractions,
|
|
52
|
+
source.tree.byIndex,
|
|
53
|
+
source.tree.size,
|
|
54
|
+
]);
|
|
55
|
+
// Handling row selection
|
|
56
|
+
const selectionState = useRowSelection(props.rowSelection, props.onRowSelectionChange, isolatedSelected, props.rowSelectKey ?? props.queryKey, useMemo(() => {
|
|
57
|
+
const subset = props.rowSelectionIdUniverseSubtractions ?? new Set();
|
|
58
|
+
if (!props.rowSelectionIdUniverseAdditions)
|
|
59
|
+
return state.idUniverse.difference(subset);
|
|
60
|
+
return state.idUniverse
|
|
61
|
+
.union(new Set(props.rowSelectionIdUniverseAdditions.map((x) => x.id)))
|
|
62
|
+
.difference(subset);
|
|
63
|
+
}, [props.rowSelectionIdUniverseAdditions, props.rowSelectionIdUniverseSubtractions, state.idUniverse]), rootIds, rootCount, globalSignal);
|
|
64
|
+
const onRowsSelected = useOnRowsSelected(selectionState, idSpec, rowParents, isolatedSelected, globalSignal);
|
|
65
|
+
const rowIsSelected = useRowIsSelected(selectionState, rowParents, rowById);
|
|
66
|
+
const rowsSelected = useRowsSelected(selectionState, source.tree.rowIdToNode, rowParents);
|
|
67
|
+
const rowSelectionState = useRowSelectionState(selectionState);
|
|
68
|
+
const rowLeafs = useRowLeafs(source);
|
|
69
|
+
const { rowByIndex, rowInvalidate } = useRowByIndex(source, selectionState, globalSignal, rowParents);
|
|
70
|
+
const setExpansions = state.onExpansionsChange;
|
|
71
|
+
const onRowsUpdated = useOnRowsUpdated(source, props.onRowDataChange, props.rowUpdateOptimistically, globalSignal);
|
|
72
|
+
const rowSiblings = useRowSiblings(source);
|
|
73
|
+
const rowDelete = useRowDelete(source, props.onRowsDeleted, props.rowUpdateOptimistically);
|
|
74
|
+
const rowAdd = useRowAdd(source, props.onRowsAdded, props.rowUpdateOptimistically);
|
|
75
|
+
const selection$ = usePiece(selectionState.rowSelectionsRaw);
|
|
76
|
+
const rowGroupsPresent$ = usePiece(props.hasRowBranches ?? "infer");
|
|
77
|
+
const rowSource = useMemo(() => {
|
|
78
|
+
const rowSource = {
|
|
79
|
+
rowById,
|
|
80
|
+
rowByIndex,
|
|
81
|
+
rowInvalidate,
|
|
82
|
+
rowIdToRowIndex,
|
|
83
|
+
rowIndexToRowId,
|
|
84
|
+
rowChildren,
|
|
85
|
+
rowsSelected,
|
|
86
|
+
rowIsSelected,
|
|
87
|
+
rowSelectionState,
|
|
88
|
+
rowDelete,
|
|
89
|
+
rowAdd,
|
|
90
|
+
rowUpdate: onRowsUpdated,
|
|
91
|
+
rowSiblings,
|
|
92
|
+
rowLeafs,
|
|
93
|
+
rowParents,
|
|
94
|
+
rowsBetween,
|
|
95
|
+
useTopCount: () => top$.useValue(),
|
|
96
|
+
useRowCount: () => rowCount$.useValue(),
|
|
97
|
+
useBottomCount: () => bot$.useValue(),
|
|
98
|
+
useRows: () => {
|
|
99
|
+
const rowCount = rowCount$.useValue();
|
|
100
|
+
const mappedMemo = useMemo(() => {
|
|
101
|
+
return {
|
|
102
|
+
get: (i) => {
|
|
103
|
+
const row = source.flat.rowIndexToRow.get(i);
|
|
104
|
+
if (!row && i >= 0 && i < rowCount) {
|
|
105
|
+
return {
|
|
106
|
+
kind: "leaf",
|
|
107
|
+
id: `__loading__placeholder__${i}`,
|
|
108
|
+
data: {},
|
|
109
|
+
depth: 0,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return row;
|
|
113
|
+
},
|
|
114
|
+
size: rowCount,
|
|
115
|
+
};
|
|
116
|
+
}, [rowCount]);
|
|
117
|
+
return mappedMemo;
|
|
118
|
+
},
|
|
119
|
+
useMaxRowGroupDepth: () => {
|
|
120
|
+
const maxDepth = maxDepth$.useValue();
|
|
121
|
+
const presence = rowGroupsPresent$.useValue();
|
|
122
|
+
if (presence === "infer")
|
|
123
|
+
return maxDepth;
|
|
124
|
+
return presence ? 1 : 0;
|
|
125
|
+
},
|
|
126
|
+
useSelectionState: selection$.useValue,
|
|
127
|
+
rowGroupExpansionChange: (deltaChanges) => {
|
|
128
|
+
setExpansions(deltaChanges);
|
|
129
|
+
},
|
|
130
|
+
onRowsSelected,
|
|
131
|
+
onViewChange,
|
|
132
|
+
onRowsUpdated,
|
|
133
|
+
// Specific to the server data source
|
|
134
|
+
isLoading: isLoading$,
|
|
135
|
+
loadingError: loadError$,
|
|
136
|
+
requestsForView: requestsForView$,
|
|
137
|
+
pushRequests: (requests) => source.handleRequests(requests),
|
|
138
|
+
pushResponses: source.handleResponses,
|
|
139
|
+
retry: () => {
|
|
140
|
+
source.retry();
|
|
141
|
+
rowSource.rowInvalidate();
|
|
142
|
+
},
|
|
143
|
+
refresh: (onSuccess, onError) => {
|
|
144
|
+
const requests = requestsForView$.get();
|
|
145
|
+
rowSource.pushRequests(requests, onSuccess, onError);
|
|
146
|
+
},
|
|
147
|
+
reset: () => source.reset(),
|
|
148
|
+
requestForGroup: (row) => {
|
|
149
|
+
const index = typeof row === "number" ? row : source.flat.rowIdToRowIndex.get(row.id);
|
|
150
|
+
if (index == null)
|
|
151
|
+
return null;
|
|
152
|
+
return source.requestForGroup(index);
|
|
153
|
+
},
|
|
154
|
+
requestForNextSlice: (req) => source.requestForNextSlice(req),
|
|
155
|
+
get seenRequests() {
|
|
156
|
+
return source.flat?.seenRequests ?? new Set();
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
return rowSource;
|
|
160
|
+
}, [
|
|
161
|
+
bot$,
|
|
162
|
+
isLoading$,
|
|
163
|
+
loadError$,
|
|
164
|
+
maxDepth$,
|
|
165
|
+
onRowsSelected,
|
|
166
|
+
onRowsUpdated,
|
|
167
|
+
onViewChange,
|
|
168
|
+
requestsForView$,
|
|
169
|
+
rowAdd,
|
|
170
|
+
rowById,
|
|
171
|
+
rowByIndex,
|
|
172
|
+
rowChildren,
|
|
173
|
+
rowCount$,
|
|
174
|
+
rowDelete,
|
|
175
|
+
rowGroupsPresent$,
|
|
176
|
+
rowIdToRowIndex,
|
|
177
|
+
rowIndexToRowId,
|
|
178
|
+
rowInvalidate,
|
|
179
|
+
rowIsSelected,
|
|
180
|
+
rowLeafs,
|
|
181
|
+
rowParents,
|
|
182
|
+
rowSelectionState,
|
|
183
|
+
rowSiblings,
|
|
184
|
+
rowsBetween,
|
|
185
|
+
rowsSelected,
|
|
186
|
+
selection$.useValue,
|
|
187
|
+
setExpansions,
|
|
188
|
+
source,
|
|
189
|
+
top$,
|
|
190
|
+
]);
|
|
191
|
+
return rowSource;
|
|
192
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRequestId(path: (string | null)[], start: number, end: number): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseTreeDataSourceParams } from "../use-tree-data-source";
|
|
2
|
+
export declare function useControlledState<T>({ onRowGroupExpansionChange, rowGroupDefaultExpansion, rowGroupExpansions, }: UseTreeDataSourceParams<T>): {
|
|
3
|
+
expansions: {
|
|
4
|
+
[rowId: string]: boolean | undefined;
|
|
5
|
+
};
|
|
6
|
+
onExpansionsChange: (delta: Record<string, boolean | undefined>) => void;
|
|
7
|
+
expandedFn: (id: string, depth: number) => boolean;
|
|
8
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useControlled, useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
export function useControlledState({ onRowGroupExpansionChange, rowGroupDefaultExpansion = false, rowGroupExpansions, }) {
|
|
4
|
+
const [expansions, setExpansions] = useControlled({
|
|
5
|
+
controlled: rowGroupExpansions,
|
|
6
|
+
default: {},
|
|
7
|
+
});
|
|
8
|
+
const onExpansionsChange = useEvent((delta) => {
|
|
9
|
+
setExpansions({ ...expansions, ...delta });
|
|
10
|
+
onRowGroupExpansionChange?.({ ...expansions, ...delta });
|
|
11
|
+
});
|
|
12
|
+
const expandedFn = useCallback((id, depth) => {
|
|
13
|
+
const s = expansions[id];
|
|
14
|
+
if (s != null)
|
|
15
|
+
return s;
|
|
16
|
+
if (typeof rowGroupDefaultExpansion === "boolean")
|
|
17
|
+
return rowGroupDefaultExpansion;
|
|
18
|
+
return depth <= rowGroupDefaultExpansion;
|
|
19
|
+
}, [expansions, rowGroupDefaultExpansion]);
|
|
20
|
+
return { expansions, onExpansionsChange, expandedFn };
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TreeRoot } from "../types";
|
|
2
|
+
import type { RowAggregated, RowLeaf, RowNode, SortFn } from "@1771technologies/lytenyte-shared";
|
|
3
|
+
export declare function useFlattened<T>(tree: TreeRoot, expandFn: (id: string, depth: number) => boolean, top: (RowLeaf<T> | RowAggregated)[] | undefined, bot: (RowLeaf<T> | RowAggregated)[] | undefined, idUniverseAdditions: {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly root: boolean;
|
|
6
|
+
}[] | null | undefined, idUniverseSubtractions: Set<string> | null | undefined, sort: SortFn<T> | null | undefined): {
|
|
7
|
+
idUniverse: Set<string>;
|
|
8
|
+
rootIds: Set<string>;
|
|
9
|
+
rootCount: number;
|
|
10
|
+
rows: RowNode<T>[];
|
|
11
|
+
indexToRow: Map<number, RowNode<T>>;
|
|
12
|
+
idToIndex: Map<string, number>;
|
|
13
|
+
rowCount: number;
|
|
14
|
+
topCount: number;
|
|
15
|
+
botCount: number;
|
|
16
|
+
maxDepth: number;
|
|
17
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
const empty = [];
|
|
3
|
+
export function useFlattened(tree, expandFn, top = empty, bot = empty, idUniverseAdditions, idUniverseSubtractions, sort) {
|
|
4
|
+
const flat = useMemo(() => {
|
|
5
|
+
const stack = [...tree.children.values()];
|
|
6
|
+
if (sort)
|
|
7
|
+
stack.sort((l, r) => sort(l.row, r.row));
|
|
8
|
+
const indexToRow = new Map();
|
|
9
|
+
const idToIndex = new Map();
|
|
10
|
+
const rows = [...top];
|
|
11
|
+
top.map((x, i) => {
|
|
12
|
+
indexToRow.set(i, x);
|
|
13
|
+
idToIndex.set(x.id, i);
|
|
14
|
+
});
|
|
15
|
+
let maxDepth = 0;
|
|
16
|
+
while (stack.length) {
|
|
17
|
+
const node = stack.shift();
|
|
18
|
+
indexToRow.set(rows.length, node.row);
|
|
19
|
+
idToIndex.set(node.row.id, rows.length);
|
|
20
|
+
rows.push(node.row);
|
|
21
|
+
if (node.kind === "parent")
|
|
22
|
+
maxDepth = Math.max(maxDepth, node.row.depth + 1);
|
|
23
|
+
if (node.kind === "parent" && expandFn(node.row.id, node.row.depth) && node.row.expandable) {
|
|
24
|
+
node.row.expanded = true;
|
|
25
|
+
const children = [...node.children.values()];
|
|
26
|
+
if (sort)
|
|
27
|
+
children.sort((l, r) => sort(l.row, r.row));
|
|
28
|
+
stack.unshift(...children);
|
|
29
|
+
}
|
|
30
|
+
else if (node.kind === "parent") {
|
|
31
|
+
node.row.expanded = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
rows.push(...bot);
|
|
35
|
+
bot.map((x, i) => {
|
|
36
|
+
indexToRow.set(i, x);
|
|
37
|
+
idToIndex.set(x.id, i);
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
rows,
|
|
41
|
+
indexToRow,
|
|
42
|
+
idToIndex,
|
|
43
|
+
rowCount: rows.length,
|
|
44
|
+
topCount: top.length,
|
|
45
|
+
botCount: bot.length,
|
|
46
|
+
maxDepth,
|
|
47
|
+
};
|
|
48
|
+
}, [bot, expandFn, sort, top, tree.children]);
|
|
49
|
+
return useMemo(() => {
|
|
50
|
+
const initialSet = new Set(tree.rowIdToNode.keys());
|
|
51
|
+
top.map((x) => initialSet.add(x.id));
|
|
52
|
+
bot.map((x) => initialSet.add(x.id));
|
|
53
|
+
const subSet = idUniverseSubtractions ?? new Set();
|
|
54
|
+
const rootAdds = idUniverseAdditions?.filter((x) => x.root)?.map((x) => x.id) ?? [];
|
|
55
|
+
const rootIds = new Set([...tree.children.values().map((x) => x.row.id)].concat(rootAdds)).difference(subSet);
|
|
56
|
+
return {
|
|
57
|
+
...flat,
|
|
58
|
+
idUniverse: idUniverseAdditions
|
|
59
|
+
? initialSet.union(new Set(idUniverseAdditions.map((x) => x.id) ?? [])).difference(subSet)
|
|
60
|
+
: initialSet.difference(subSet),
|
|
61
|
+
rootIds,
|
|
62
|
+
rootCount: rootIds.size,
|
|
63
|
+
};
|
|
64
|
+
}, [bot, flat, idUniverseAdditions, idUniverseSubtractions, top, tree.children, tree.rowIdToNode]);
|
|
65
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { UseTreeDataSourceParams } from "../use-tree-data-source";
|
|
2
|
+
import type { TreeRoot } from "../types";
|
|
3
|
+
export declare function useOnRowsUpdated<T>(tree: TreeRoot, p: UseTreeDataSourceParams<T>): (rows: Map<import("@1771technologies/lytenyte-shared").RowNode<any>, any>) => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
export function useOnRowsUpdated(tree, p) {
|
|
3
|
+
const onRowsUpdate = useEvent((updates) => {
|
|
4
|
+
if (!p.onRowDataChange)
|
|
5
|
+
return;
|
|
6
|
+
const changes = [];
|
|
7
|
+
const top = new Map();
|
|
8
|
+
const bottom = new Map();
|
|
9
|
+
for (const [row, u] of updates) {
|
|
10
|
+
// Updating data
|
|
11
|
+
if (row.kind === "branch") {
|
|
12
|
+
const node = tree.rowIdToNode.get(row.id);
|
|
13
|
+
if (!node) {
|
|
14
|
+
console.error(`Attempting to update a node that does not exist: ${row.id}`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let current = node.parent;
|
|
18
|
+
const path = [];
|
|
19
|
+
while (current.kind !== "root") {
|
|
20
|
+
path.push(current.key);
|
|
21
|
+
current = current.parent;
|
|
22
|
+
}
|
|
23
|
+
path.reverse();
|
|
24
|
+
changes.push({
|
|
25
|
+
key: node.key,
|
|
26
|
+
next: u,
|
|
27
|
+
parent: node?.parent.data,
|
|
28
|
+
prev: node.data,
|
|
29
|
+
path,
|
|
30
|
+
});
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const topIndex = p.topData?.findIndex((r) => r.id === row.id);
|
|
34
|
+
if (topIndex != null && topIndex !== -1) {
|
|
35
|
+
top.set(topIndex, u);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const botIndex = p.botData?.findIndex((r) => r.id === row.id);
|
|
39
|
+
if (botIndex != null && botIndex !== -1) {
|
|
40
|
+
bottom.set(botIndex, u);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
console.error(`Attempting to update a node that does not exist: ${row.id}`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
p.onRowDataChange({ changes, top, bottom });
|
|
47
|
+
});
|
|
48
|
+
return onRowsUpdate;
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
export function useRowChildren(tree) {
|
|
3
|
+
const rowChildren = useEvent((id) => {
|
|
4
|
+
const node = tree.rowIdToNode.get(id);
|
|
5
|
+
if (!node)
|
|
6
|
+
return [];
|
|
7
|
+
const ids = [...node.children.values()].map((x) => x.row.id);
|
|
8
|
+
return ids;
|
|
9
|
+
});
|
|
10
|
+
return rowChildren;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
export function useRowLeafs(tree) {
|
|
3
|
+
const rowLeafs = useEvent((id) => {
|
|
4
|
+
const node = tree.rowIdToNode.get(id);
|
|
5
|
+
if (!node || !node.row.expandable)
|
|
6
|
+
return [];
|
|
7
|
+
const rows = [];
|
|
8
|
+
const stack = [...node.children.values()];
|
|
9
|
+
while (stack.length) {
|
|
10
|
+
const next = stack.pop();
|
|
11
|
+
if (!next.row.expandable)
|
|
12
|
+
rows.push(next.row.id);
|
|
13
|
+
else {
|
|
14
|
+
stack.push(...next.children.values());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return rows;
|
|
18
|
+
});
|
|
19
|
+
return rowLeafs;
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
export function useRowParents(tree) {
|
|
3
|
+
const rowParents = useEvent((id) => {
|
|
4
|
+
const node = tree.rowIdToNode.get(id);
|
|
5
|
+
if (!node)
|
|
6
|
+
return [];
|
|
7
|
+
const parents = [];
|
|
8
|
+
let current = node.parent;
|
|
9
|
+
while (current && current.kind !== "root") {
|
|
10
|
+
parents.push(current.row.id);
|
|
11
|
+
current = current.parent;
|
|
12
|
+
}
|
|
13
|
+
return parents.reverse();
|
|
14
|
+
});
|
|
15
|
+
return rowParents;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
2
|
+
export function useRowSiblings(tree) {
|
|
3
|
+
const rowChildren = useEvent((id) => {
|
|
4
|
+
const node = tree.rowIdToNode.get(id);
|
|
5
|
+
const parent = node?.parent;
|
|
6
|
+
if (!parent)
|
|
7
|
+
return [];
|
|
8
|
+
const ids = [...parent.children.values()].map((x) => x.row.id);
|
|
9
|
+
return ids;
|
|
10
|
+
});
|
|
11
|
+
return rowChildren;
|
|
12
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { isObject } from "../utils/is-object.js";
|
|
3
|
+
const defaultIdFn = (path) => path.join("-->");
|
|
4
|
+
const rowValueFnDefault = (x) => {
|
|
5
|
+
if (!isObject(x))
|
|
6
|
+
return null;
|
|
7
|
+
const entries = Object.entries(x).filter((v) => !isObject(v[1]));
|
|
8
|
+
return Object.fromEntries(entries);
|
|
9
|
+
};
|
|
10
|
+
const rowChildrenFnDefault = (x) => {
|
|
11
|
+
if (!isObject(x))
|
|
12
|
+
return [];
|
|
13
|
+
return Object.entries(x).filter((x) => isObject(x[1]));
|
|
14
|
+
};
|
|
15
|
+
export function useTree({ data, filter, idFn = defaultIdFn, rowValueFn = rowValueFnDefault, rowChildrenFn = rowChildrenFnDefault, rowRootFn = Object.entries, }) {
|
|
16
|
+
const rowTree = useMemo(() => {
|
|
17
|
+
const root = {
|
|
18
|
+
kind: "root",
|
|
19
|
+
children: new Map(),
|
|
20
|
+
rowIdToNode: new Map(),
|
|
21
|
+
data,
|
|
22
|
+
};
|
|
23
|
+
const groupKeys = (parent, path, row, parentObj) => {
|
|
24
|
+
const value = rowValueFn(row, parentObj, path.at(-1));
|
|
25
|
+
const entries = rowChildrenFn(row, parentObj, path.at(-1));
|
|
26
|
+
if (filter && !filter(value))
|
|
27
|
+
return;
|
|
28
|
+
const expandable = entries.some((x) => isObject(x[1]));
|
|
29
|
+
const node = {
|
|
30
|
+
kind: "parent",
|
|
31
|
+
children: new Map(),
|
|
32
|
+
parent,
|
|
33
|
+
path,
|
|
34
|
+
data: row,
|
|
35
|
+
key: path.at(-1),
|
|
36
|
+
row: {
|
|
37
|
+
kind: "branch",
|
|
38
|
+
depth: path.length - 1,
|
|
39
|
+
expandable,
|
|
40
|
+
expanded: false,
|
|
41
|
+
key: path.at(-1),
|
|
42
|
+
last: !expandable,
|
|
43
|
+
id: idFn(path, value),
|
|
44
|
+
data: value,
|
|
45
|
+
parentId: parent.kind === "root" ? null : parent.row.id,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
parent.children.set(path.at(-1), node);
|
|
49
|
+
root.rowIdToNode.set(node.row.id, node);
|
|
50
|
+
entries.forEach((x) => groupKeys(node, [...path, x[0]], x[1], row));
|
|
51
|
+
};
|
|
52
|
+
const rootRows = rowRootFn(data);
|
|
53
|
+
for (const [path, row] of rootRows) {
|
|
54
|
+
groupKeys(root, [path], row, data);
|
|
55
|
+
}
|
|
56
|
+
return root;
|
|
57
|
+
}, [data, filter, idFn, rowChildrenFn, rowRootFn, rowValueFn]);
|
|
58
|
+
return rowTree;
|
|
59
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RowGroup } from "@1771technologies/lytenyte-shared";
|
|
2
|
+
export type TreeRoot = {
|
|
3
|
+
readonly kind: "root";
|
|
4
|
+
readonly children: Map<string, TreeParent>;
|
|
5
|
+
readonly rowIdToNode: Map<string, TreeParent>;
|
|
6
|
+
readonly data: object;
|
|
7
|
+
};
|
|
8
|
+
export type TreeParent = {
|
|
9
|
+
readonly kind: "parent";
|
|
10
|
+
readonly row: RowGroup;
|
|
11
|
+
readonly children: Map<string, TreeParent>;
|
|
12
|
+
readonly path: string[];
|
|
13
|
+
readonly parent: TreeParent | TreeRoot;
|
|
14
|
+
readonly data: object;
|
|
15
|
+
readonly key: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DimensionSort, RowAggregated, RowLeaf, RowNode, RowSelectionState, RowSource, SortFn } from "@1771technologies/lytenyte-shared";
|
|
2
|
+
export interface UseTreeDataSourceParams<T = unknown> {
|
|
3
|
+
readonly topData?: (RowLeaf<T> | RowAggregated)[];
|
|
4
|
+
readonly botData?: (RowLeaf<T> | RowAggregated)[];
|
|
5
|
+
readonly data: Record<string, unknown>;
|
|
6
|
+
readonly idFn?: (path: string[], data: any) => string;
|
|
7
|
+
readonly rowRootFn?: (x: object) => [key: string, child: object][];
|
|
8
|
+
readonly rowValueFn?: (x: any, parent: any, key: string) => any;
|
|
9
|
+
readonly rowChildrenFn?: (x: any, parent: any, key: string) => [key: string, child: object][];
|
|
10
|
+
readonly rowGroupExpansions?: {
|
|
11
|
+
[rowId: string]: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
readonly rowGroupDefaultExpansion?: boolean | number;
|
|
14
|
+
readonly onRowGroupExpansionChange?: (state: Record<string, boolean | undefined>) => void;
|
|
15
|
+
readonly sort?: SortFn<any> | DimensionSort<any>[] | null;
|
|
16
|
+
readonly filter?: ((data: any) => boolean) | null;
|
|
17
|
+
readonly rowsIsolatedSelection?: boolean;
|
|
18
|
+
readonly rowSelectKey?: unknown[];
|
|
19
|
+
readonly rowSelection?: RowSelectionState;
|
|
20
|
+
readonly rowSelectionIdUniverseAdditions?: {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
root: boolean;
|
|
23
|
+
}[];
|
|
24
|
+
readonly rowSelectionIdUniverseSubtractions?: Set<string>;
|
|
25
|
+
readonly onRowSelectionChange?: (state: RowSelectionState) => void;
|
|
26
|
+
readonly onRowDataChange?: (params: {
|
|
27
|
+
readonly changes: {
|
|
28
|
+
next: any;
|
|
29
|
+
prev: any;
|
|
30
|
+
parent: any;
|
|
31
|
+
key: string;
|
|
32
|
+
path: string[];
|
|
33
|
+
}[];
|
|
34
|
+
readonly top: Map<number, T>;
|
|
35
|
+
readonly bottom: Map<number, T>;
|
|
36
|
+
}) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface RowSourceTree<T> extends RowSource<T> {
|
|
39
|
+
readonly rowUpdate: (rows: Map<RowNode<T>, T>) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare function useTreeDataSource<T>(p: UseTreeDataSourceParams<T>): RowSource;
|