@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 @@
|
|
|
1
|
+
export declare function isSelectableOption(el: Element): boolean | "" | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ChangeEvent, type JSX } from "react";
|
|
2
|
+
import type { SlotComponent } from "../../../hooks/use-slot/types.js";
|
|
3
|
+
export type MultiComboTriggerProps = JSX.IntrinsicElements["div"] & {
|
|
4
|
+
readonly renderInput?: SlotComponent<{
|
|
5
|
+
query: string;
|
|
6
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
export declare const MultiComboTrigger: import("react").ForwardRefExoticComponent<Omit<MultiComboTriggerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo, useState } from "react";
|
|
3
|
+
import { useSmartSelect } from "../context.js";
|
|
4
|
+
import { useCombinedRefs } from "@1771technologies/lytenyte-core/internal";
|
|
5
|
+
import { useSlot } from "../../../hooks/use-slot/use-slot.js";
|
|
6
|
+
import { useComboControls } from "./use-combo-controls.js";
|
|
7
|
+
import { ChipContextProvider } from "../chip-context.js";
|
|
8
|
+
function MultiComboBase({ renderInput, children, ...props }, ref) {
|
|
9
|
+
const { kindAndValue, comboState, setTrigger, query, inputRef, open } = useSmartSelect();
|
|
10
|
+
const { __is_trigger, ...p } = props;
|
|
11
|
+
if ((__is_trigger && kindAndValue.kind !== "multi") ||
|
|
12
|
+
(!__is_trigger && kindAndValue.kind !== "multi-combo")) {
|
|
13
|
+
throw new Error(`Cannot use ${__is_trigger ? "MultiTrigger" : "MultiComboTrigger"} when SmartSelect kind is not "${__is_trigger ? "multi" : "multi-combo"}". Found: ${kindAndValue.kind}`);
|
|
14
|
+
}
|
|
15
|
+
const [activeChip, setActiveChip] = useState(null);
|
|
16
|
+
const controls = useComboControls(setActiveChip, true);
|
|
17
|
+
const slot = useSlot({
|
|
18
|
+
props: [controls],
|
|
19
|
+
slot: renderInput ??
|
|
20
|
+
(__is_trigger ? (_jsx("button", { style: {
|
|
21
|
+
padding: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
background: "transparent",
|
|
25
|
+
border: "0px solid transparent",
|
|
26
|
+
} })) : (_jsx("input", {}))),
|
|
27
|
+
ref: inputRef,
|
|
28
|
+
state: __is_trigger
|
|
29
|
+
? {}
|
|
30
|
+
: { query, onChange: controls.onChange, loading: comboState.loading, error: comboState.error },
|
|
31
|
+
});
|
|
32
|
+
const combined = useCombinedRefs(setTrigger, ref);
|
|
33
|
+
return (_jsx(ChipContextProvider, { value: useMemo(() => ({ activeChip, setActiveChip }), [activeChip]), children: _jsxs("div", { ...p, ref: combined, "data-ln-smart-select-trigger": true, "data-ln-open": open, "data-ln-smart-select-loading": comboState.loading, "data-ln-smart-select-error": !!comboState.error, onBlur: () => setActiveChip(null), onClick: () => {
|
|
34
|
+
controls.onClick();
|
|
35
|
+
inputRef.current?.focus();
|
|
36
|
+
}, children: [children, slot] }) }));
|
|
37
|
+
}
|
|
38
|
+
export const MultiComboTrigger = forwardRef(MultiComboBase);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type JSX } from "react";
|
|
2
|
+
import type { SlotComponent } from "../../../hooks/use-slot/types.js";
|
|
3
|
+
export type MultiTriggerProps = JSX.IntrinsicElements["div"] & {
|
|
4
|
+
readonly render?: SlotComponent;
|
|
5
|
+
};
|
|
6
|
+
export declare const MultiTrigger: import("react").ForwardRefExoticComponent<Omit<MultiTriggerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { MultiComboTrigger } from "./multi-combo-trigger.js";
|
|
4
|
+
function MultiTriggerBase({ render, ...props }, ref) {
|
|
5
|
+
const overrides = { __is_trigger: true };
|
|
6
|
+
return _jsx(MultiComboTrigger, { ...props, renderInput: render, ref: ref, ...overrides });
|
|
7
|
+
}
|
|
8
|
+
export const MultiTrigger = forwardRef(MultiTriggerBase);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from "react";
|
|
2
|
+
export declare function useComboControls(setActiveChip: Dispatch<SetStateAction<string | null>>, isMulti: boolean): {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
onFocus: () => void;
|
|
5
|
+
onBlur: (e: import("react").FocusEvent<HTMLInputElement, Element>) => void;
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (ev: import("react").ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
onKeyDown: (e: import("react").KeyboardEvent<HTMLInputElement>) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useSmartSelect } from "../context.js";
|
|
3
|
+
import { isSelectableOption } from "./is-selectable-option.js";
|
|
4
|
+
export function useComboControls(setActiveChip, isMulti) {
|
|
5
|
+
const { query, open, openOnClick, preventNextOpen, onOpenChange, setActiveId, container, onQueryChange, onOptionsChange, onOptionSelect, trigger, kindAndValue: { value }, rtl, closeKeys, openKeys, options, } = useSmartSelect();
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
return {
|
|
8
|
+
onClick: () => {
|
|
9
|
+
if (!open && openOnClick && !preventNextOpen.current) {
|
|
10
|
+
onOpenChange(true);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
onFocus: () => {
|
|
14
|
+
setActiveChip(null);
|
|
15
|
+
},
|
|
16
|
+
onBlur: (e) => {
|
|
17
|
+
if (e.currentTarget.contains(e.relatedTarget))
|
|
18
|
+
return;
|
|
19
|
+
onOpenChange(false);
|
|
20
|
+
return;
|
|
21
|
+
},
|
|
22
|
+
value: query,
|
|
23
|
+
onChange: (ev) => {
|
|
24
|
+
onQueryChange(ev.target.value);
|
|
25
|
+
if (!open)
|
|
26
|
+
onOpenChange(true);
|
|
27
|
+
},
|
|
28
|
+
onKeyDown: (e) => {
|
|
29
|
+
if (!open && openKeys.includes(e.key)) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
onOpenChange(true);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (open && closeKeys.includes(e.key)) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
onOpenChange(false);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if ((e.key === "Enter" || e.key === " ") && open) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
const active = container?.querySelector('[data-ln-active="true"]');
|
|
45
|
+
if (!active)
|
|
46
|
+
return;
|
|
47
|
+
const id = active.getAttribute("data-ln-smart-option");
|
|
48
|
+
const option = options.find((x) => x.id === id);
|
|
49
|
+
if (!option)
|
|
50
|
+
return;
|
|
51
|
+
onOptionSelect(option);
|
|
52
|
+
if (active.getAttribute("data-ln-close-on-select")) {
|
|
53
|
+
onOpenChange(false);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (isMulti && query.length === 0) {
|
|
58
|
+
const key = rtl ? "ArrowRight" : "ArrowLeft";
|
|
59
|
+
if (e.key === "Backspace") {
|
|
60
|
+
const chips = Array.from(trigger.querySelectorAll("[data-ln-smart-select-chip]"));
|
|
61
|
+
const lastChip = chips.at(-1);
|
|
62
|
+
if (!lastChip)
|
|
63
|
+
return;
|
|
64
|
+
const id = lastChip.getAttribute("data-ln-smart-select-chip");
|
|
65
|
+
onOptionsChange(value.filter((x) => x.id !== id));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (e.key === key) {
|
|
69
|
+
const chips = Array.from(trigger.querySelectorAll("[data-ln-smart-select-chip]"));
|
|
70
|
+
const first = chips.at(-1);
|
|
71
|
+
if (!first)
|
|
72
|
+
return;
|
|
73
|
+
first.focus();
|
|
74
|
+
onOpenChange(false);
|
|
75
|
+
setActiveChip(first.getAttribute("data-ln-smart-select-chip"));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (e.key === "ArrowDown" && !open) {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
onOpenChange(true);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!open || !container)
|
|
86
|
+
return;
|
|
87
|
+
if (e.key === "ArrowUp") {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
const active = container.querySelector('[data-ln-active="true"]');
|
|
91
|
+
let current = active?.previousElementSibling;
|
|
92
|
+
while (current && !isSelectableOption(current))
|
|
93
|
+
current = current.previousElementSibling;
|
|
94
|
+
if (!current) {
|
|
95
|
+
current = container.lastElementChild;
|
|
96
|
+
while (current && !isSelectableOption(current))
|
|
97
|
+
current = current.previousElementSibling;
|
|
98
|
+
}
|
|
99
|
+
if (current) {
|
|
100
|
+
setActiveId(current.getAttribute("data-ln-smart-option"));
|
|
101
|
+
current.scrollIntoView({ block: "nearest" });
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (e.key === "ArrowDown") {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
e.stopPropagation();
|
|
108
|
+
const active = container.querySelector('[data-ln-active="true"]');
|
|
109
|
+
let current = active?.nextElementSibling;
|
|
110
|
+
while (current && !isSelectableOption(current))
|
|
111
|
+
current = current.nextElementSibling;
|
|
112
|
+
if (!current) {
|
|
113
|
+
current = container.firstElementChild;
|
|
114
|
+
while (current && !isSelectableOption(current))
|
|
115
|
+
current = current.nextElementSibling;
|
|
116
|
+
}
|
|
117
|
+
if (current) {
|
|
118
|
+
setActiveId(current.getAttribute("data-ln-smart-option"));
|
|
119
|
+
current.scrollIntoView({ block: "nearest" });
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}, [
|
|
126
|
+
closeKeys,
|
|
127
|
+
container,
|
|
128
|
+
isMulti,
|
|
129
|
+
onOpenChange,
|
|
130
|
+
onOptionSelect,
|
|
131
|
+
onOptionsChange,
|
|
132
|
+
onQueryChange,
|
|
133
|
+
open,
|
|
134
|
+
openKeys,
|
|
135
|
+
openOnClick,
|
|
136
|
+
options,
|
|
137
|
+
preventNextOpen,
|
|
138
|
+
query,
|
|
139
|
+
rtl,
|
|
140
|
+
setActiveChip,
|
|
141
|
+
setActiveId,
|
|
142
|
+
trigger,
|
|
143
|
+
value,
|
|
144
|
+
]);
|
|
145
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useSelectControls(isMulti: boolean, setActiveChip: (s: string | null) => void): {
|
|
2
|
+
onClick: () => void;
|
|
3
|
+
onBlur: (e: import("react").FocusEvent<HTMLButtonElement, Element>) => void;
|
|
4
|
+
onKeyDown: (e: import("react").KeyboardEvent<HTMLButtonElement>) => void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useSmartSelect } from "../context.js";
|
|
3
|
+
import { isSelectableOption } from "./is-selectable-option.js";
|
|
4
|
+
export function useSelectControls(isMulti, setActiveChip) {
|
|
5
|
+
const { open, onOpenChange, openOnClick, setActiveId, container, rtl, trigger, onOptionsChange, kindAndValue: { value }, openKeys, closeKeys, options, onOptionSelect, } = useSmartSelect();
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
return {
|
|
8
|
+
onClick: () => {
|
|
9
|
+
if (!open && openOnClick)
|
|
10
|
+
onOpenChange(true);
|
|
11
|
+
},
|
|
12
|
+
onBlur: (e) => {
|
|
13
|
+
if (e.currentTarget.contains(e.relatedTarget))
|
|
14
|
+
return;
|
|
15
|
+
onOpenChange(false);
|
|
16
|
+
return;
|
|
17
|
+
},
|
|
18
|
+
onKeyDown: (e) => {
|
|
19
|
+
if (!open && openKeys.includes(e.key)) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
onOpenChange(true);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (open && closeKeys.includes(e.key)) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
onOpenChange(false);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if ((e.key === "Enter" || e.key === " ") && open) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
const active = container?.querySelector('[data-ln-active="true"]');
|
|
35
|
+
if (!active)
|
|
36
|
+
return;
|
|
37
|
+
const id = active.getAttribute("data-ln-smart-option");
|
|
38
|
+
const option = options.find((x) => x.id === id);
|
|
39
|
+
if (!option)
|
|
40
|
+
return;
|
|
41
|
+
onOptionSelect(option);
|
|
42
|
+
if (active.getAttribute("data-ln-close-on-select")) {
|
|
43
|
+
onOpenChange(false);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (isMulti) {
|
|
48
|
+
const key = rtl ? "ArrowRight" : "ArrowLeft";
|
|
49
|
+
if (e.key === "Backspace") {
|
|
50
|
+
const chips = Array.from(trigger.querySelectorAll("[data-ln-smart-select-chip]"));
|
|
51
|
+
const lastChip = chips.at(-1);
|
|
52
|
+
if (!lastChip)
|
|
53
|
+
return;
|
|
54
|
+
const id = lastChip.getAttribute("data-ln-smart-select-chip");
|
|
55
|
+
onOptionsChange(value.filter((x) => x.id !== id));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (e.key === key) {
|
|
59
|
+
const chips = Array.from(trigger.querySelectorAll("[data-ln-smart-select-chip]"));
|
|
60
|
+
const first = chips.at(-1);
|
|
61
|
+
if (!first)
|
|
62
|
+
return;
|
|
63
|
+
first.focus();
|
|
64
|
+
onOpenChange(false);
|
|
65
|
+
setActiveChip(first.getAttribute("data-ln-smart-select-chip"));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!open || !container)
|
|
70
|
+
return;
|
|
71
|
+
if (e.key === "ArrowUp") {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
const active = container.querySelector('[data-ln-active="true"]');
|
|
75
|
+
let current = active?.previousElementSibling;
|
|
76
|
+
while (current && !isSelectableOption(current))
|
|
77
|
+
current = current.previousElementSibling;
|
|
78
|
+
if (!current) {
|
|
79
|
+
current = container.lastElementChild;
|
|
80
|
+
while (current && !isSelectableOption(current))
|
|
81
|
+
current = current.previousElementSibling;
|
|
82
|
+
}
|
|
83
|
+
if (current) {
|
|
84
|
+
setActiveId(current.getAttribute("data-ln-smart-option"));
|
|
85
|
+
current.scrollIntoView({ block: "nearest" });
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (e.key === "ArrowDown") {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
const active = container.querySelector('[data-ln-active="true"]');
|
|
93
|
+
let current = active?.nextElementSibling;
|
|
94
|
+
while (current && !isSelectableOption(current))
|
|
95
|
+
current = current.nextElementSibling;
|
|
96
|
+
if (!current) {
|
|
97
|
+
current = container.firstElementChild;
|
|
98
|
+
while (current && !isSelectableOption(current))
|
|
99
|
+
current = current.nextElementSibling;
|
|
100
|
+
}
|
|
101
|
+
if (current) {
|
|
102
|
+
setActiveId(current.getAttribute("data-ln-smart-option"));
|
|
103
|
+
current.scrollIntoView({ block: "nearest" });
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}, [
|
|
110
|
+
closeKeys,
|
|
111
|
+
container,
|
|
112
|
+
isMulti,
|
|
113
|
+
onOpenChange,
|
|
114
|
+
onOptionSelect,
|
|
115
|
+
onOptionsChange,
|
|
116
|
+
open,
|
|
117
|
+
openKeys,
|
|
118
|
+
openOnClick,
|
|
119
|
+
options,
|
|
120
|
+
rtl,
|
|
121
|
+
setActiveChip,
|
|
122
|
+
setActiveId,
|
|
123
|
+
trigger,
|
|
124
|
+
value,
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type BaseOption = {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly selectable?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type BasicSelect<T extends BaseOption> = {
|
|
6
|
+
readonly kind: "basic";
|
|
7
|
+
readonly value: T | null;
|
|
8
|
+
readonly onOptionChange: (change: T | null) => void;
|
|
9
|
+
readonly options: T[];
|
|
10
|
+
};
|
|
11
|
+
export type MultiSelect<T extends BaseOption> = {
|
|
12
|
+
readonly kind: "multi";
|
|
13
|
+
readonly value: T[];
|
|
14
|
+
readonly onOptionChange: (change: T[]) => void;
|
|
15
|
+
readonly options: T[];
|
|
16
|
+
};
|
|
17
|
+
export type ComboSelect<T extends BaseOption> = {
|
|
18
|
+
readonly kind: "combo";
|
|
19
|
+
readonly value: T | null;
|
|
20
|
+
readonly onOptionChange: (change: T | null) => void;
|
|
21
|
+
readonly query?: string;
|
|
22
|
+
readonly onQueryChange?: (change: string) => void;
|
|
23
|
+
readonly searchDebounceMs?: number;
|
|
24
|
+
readonly clearOnSelect?: boolean;
|
|
25
|
+
readonly clearOnQuery?: boolean;
|
|
26
|
+
readonly options: (query: string | null) => Promise<T[]> | T[];
|
|
27
|
+
};
|
|
28
|
+
export type MultiComboSelect<T extends BaseOption> = {
|
|
29
|
+
readonly kind: "multi-combo";
|
|
30
|
+
readonly value: T[];
|
|
31
|
+
readonly onOptionChange: (change: T[]) => void;
|
|
32
|
+
readonly query?: string;
|
|
33
|
+
readonly onQueryChange?: (change: string) => void;
|
|
34
|
+
readonly searchDebounceMs?: number;
|
|
35
|
+
readonly clearOnSelect?: boolean;
|
|
36
|
+
readonly clearOnQuery?: boolean;
|
|
37
|
+
readonly options: (query: string | null) => Promise<T[]> | T[];
|
|
38
|
+
};
|
|
39
|
+
export type SmartSelectKinds<T extends BaseOption> = BasicSelect<T> | MultiSelect<T> | ComboSelect<T> | MultiComboSelect<T>;
|
|
40
|
+
export type OptionRenderProps<T extends BaseOption> = {
|
|
41
|
+
readonly option: T;
|
|
42
|
+
readonly active: boolean;
|
|
43
|
+
readonly selected: boolean;
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseOption } from "./type";
|
|
2
|
+
export interface ComboOptionState<T extends BaseOption> {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
error: unknown;
|
|
5
|
+
options: T[];
|
|
6
|
+
loadOptions: (query: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useAsyncOptions<T extends BaseOption>(p: null | ((query: string) => Promise<T[]> | T[]), clearOnQuery: boolean): ComboOptionState<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useMemo, useRef, useState } from "react";
|
|
2
|
+
import { useEvent } from "@1771technologies/lytenyte-core/internal";
|
|
3
|
+
export function useAsyncOptions(p, clearOnQuery) {
|
|
4
|
+
const [loading, setLoading] = useState(false);
|
|
5
|
+
const [error, setError] = useState(null);
|
|
6
|
+
const [options, setOptions] = useState([]);
|
|
7
|
+
const controllerRef = useRef(null);
|
|
8
|
+
const loadOptions = useEvent((query) => {
|
|
9
|
+
if (!p)
|
|
10
|
+
return;
|
|
11
|
+
if (controllerRef.current)
|
|
12
|
+
controllerRef.current.abort();
|
|
13
|
+
const opts = p(query);
|
|
14
|
+
if (Array.isArray(opts)) {
|
|
15
|
+
setOptions(opts);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const controller = new AbortController();
|
|
19
|
+
controllerRef.current = controller;
|
|
20
|
+
if (clearOnQuery)
|
|
21
|
+
setOptions([]);
|
|
22
|
+
setLoading(true);
|
|
23
|
+
setError(null);
|
|
24
|
+
opts
|
|
25
|
+
.then((res) => {
|
|
26
|
+
if (controller.signal.aborted)
|
|
27
|
+
return;
|
|
28
|
+
setOptions(res);
|
|
29
|
+
})
|
|
30
|
+
.catch((e) => {
|
|
31
|
+
if (controller.signal.aborted)
|
|
32
|
+
return;
|
|
33
|
+
setError(e);
|
|
34
|
+
})
|
|
35
|
+
.finally(() => {
|
|
36
|
+
if (controller.signal.aborted)
|
|
37
|
+
return;
|
|
38
|
+
setLoading(false);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return useMemo(() => ({ loading, error, options, loadOptions }), [error, loadOptions, loading, options]);
|
|
42
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type RowGroup, type RowLeaf, type RowSelectionLinked } from "@1771technologies/lytenyte-shared";
|
|
3
|
+
import type { TreeViewChildParams, TreeViewItem, TreeViewSelectAllParams } from "./types.js";
|
|
4
|
+
export interface TreeViewProps<T extends TreeViewItem> {
|
|
5
|
+
readonly items: T[];
|
|
6
|
+
readonly children?: (props: TreeViewChildParams<T>) => ReactNode;
|
|
7
|
+
readonly selectAllSlot?: (params: TreeViewSelectAllParams) => ReactNode;
|
|
8
|
+
readonly rowHeight?: number;
|
|
9
|
+
readonly defaultExpansion?: boolean | number;
|
|
10
|
+
readonly branchJoinSeparator?: string;
|
|
11
|
+
readonly rowSelectAllShow?: boolean;
|
|
12
|
+
readonly rowSelectionEnabled?: boolean;
|
|
13
|
+
readonly rowSelection?: RowSelectionLinked;
|
|
14
|
+
readonly onRowSelectionChange?: (selection: RowSelectionLinked) => void;
|
|
15
|
+
readonly rowGroupExpansions?: Record<string, boolean | undefined>;
|
|
16
|
+
readonly onRowGroupExpansionChange?: (change: Record<string, boolean | undefined>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* @alpha
|
|
19
|
+
* @internal
|
|
20
|
+
*
|
|
21
|
+
* Do not use this property unless you know what you are doing. Support for tree view drag
|
|
22
|
+
* and drag is still being prototyped.
|
|
23
|
+
*/
|
|
24
|
+
readonly draggable?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @alpha
|
|
27
|
+
* @internal
|
|
28
|
+
*
|
|
29
|
+
* Do not use this property unless you know what you are doing. Support for tree view drag
|
|
30
|
+
* and drag is still being prototyped.
|
|
31
|
+
*/
|
|
32
|
+
readonly onItemsReordered?: (items: T[]) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface TreeViewApi<T extends TreeViewItem> {
|
|
35
|
+
readonly rowsSelected: () => (RowLeaf<T> | RowGroup)[];
|
|
36
|
+
}
|
|
37
|
+
export declare const TreeView: <T extends TreeViewItem>(props: TreeViewProps<T>) => ReactNode;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from "react";
|
|
3
|
+
import { itemsWithIdToMap, moveRelative, } from "@1771technologies/lytenyte-shared";
|
|
4
|
+
import { TreeChildren } from "./tree-children.js";
|
|
5
|
+
import { SelectAll } from "./select-all.js";
|
|
6
|
+
import { useClientDataSource } from "../../data-source-client/use-client-data-source.js";
|
|
7
|
+
import { usePiece } from "@1771technologies/lytenyte-core/internal";
|
|
8
|
+
import { Root } from "../../root/root.js";
|
|
9
|
+
import { Grid } from "@1771technologies/lytenyte-core";
|
|
10
|
+
function TreeViewBase({ items, rowSelectAllShow: rowSelectAll = true, defaultExpansion, rowHeight = 28, children = TreeChildren, branchJoinSeparator = "/", rowSelectionEnabled = true, rowSelection, onRowSelectionChange, rowGroupExpansions, onRowGroupExpansionChange, selectAllSlot, draggable, onItemsReordered, }, forwarded) {
|
|
11
|
+
const groupFn = useMemo(() => {
|
|
12
|
+
return (x) => x.data.path;
|
|
13
|
+
}, []);
|
|
14
|
+
const finalItems = useMemo(() => {
|
|
15
|
+
if (!rowSelectAll)
|
|
16
|
+
return items;
|
|
17
|
+
return [{ id: "__ln_select_all", path: [], name: "Select All" }, ...items];
|
|
18
|
+
}, [items, rowSelectAll]);
|
|
19
|
+
const subtractions = useMemo(() => {
|
|
20
|
+
if (rowSelectAll)
|
|
21
|
+
return new Set(["__ln_select_all"]);
|
|
22
|
+
return new Set();
|
|
23
|
+
}, [rowSelectAll]);
|
|
24
|
+
const source = useClientDataSource({
|
|
25
|
+
group: groupFn,
|
|
26
|
+
data: finalItems,
|
|
27
|
+
rowGroupDefaultExpansion: defaultExpansion ?? false,
|
|
28
|
+
leafIdFn: useCallback((d) => d.id, []),
|
|
29
|
+
groupIdFn: useCallback((p) => p.join(branchJoinSeparator), [branchJoinSeparator]),
|
|
30
|
+
rowGroupExpansions,
|
|
31
|
+
onRowGroupExpansionChange,
|
|
32
|
+
rowSelectionIdUniverseSubtractions: subtractions,
|
|
33
|
+
rowSelection,
|
|
34
|
+
onRowSelectionChange: onRowSelectionChange,
|
|
35
|
+
});
|
|
36
|
+
const [overId, setOverId] = useState(null);
|
|
37
|
+
const [isBefore, setIsBefore] = useState(false);
|
|
38
|
+
const itemLookup = useMemo(() => itemsWithIdToMap(items), [items]);
|
|
39
|
+
const over$ = usePiece(overId);
|
|
40
|
+
const isBefore$ = usePiece(isBefore);
|
|
41
|
+
const [api, setApi] = useState(null);
|
|
42
|
+
const groupColumn = useMemo(() => {
|
|
43
|
+
return {
|
|
44
|
+
widthFlex: 1,
|
|
45
|
+
width: 20,
|
|
46
|
+
widthMin: 20,
|
|
47
|
+
cellRenderer: ({ row, rowIndex, api, indeterminate, selected }) => {
|
|
48
|
+
const { props, isDragActive } = api.useRowDrag({
|
|
49
|
+
rowIndex,
|
|
50
|
+
});
|
|
51
|
+
const over = over$.useValue();
|
|
52
|
+
const isBefore = isBefore$.useValue();
|
|
53
|
+
if (row.kind === "aggregated")
|
|
54
|
+
return null;
|
|
55
|
+
if (row.id === "__ln_select_all") {
|
|
56
|
+
if (!api)
|
|
57
|
+
return null;
|
|
58
|
+
return _jsx(SelectAll, { api: api, render: selectAllSlot });
|
|
59
|
+
}
|
|
60
|
+
const leafs = () => row.kind === "branch"
|
|
61
|
+
? api.rowLeafs(row.id).map((x) => itemLookup.get(x))
|
|
62
|
+
: [itemLookup.get(row.id)];
|
|
63
|
+
return children({
|
|
64
|
+
row,
|
|
65
|
+
leafs,
|
|
66
|
+
selectEnabled: rowSelectionEnabled,
|
|
67
|
+
selected,
|
|
68
|
+
indeterminate,
|
|
69
|
+
select: (b) => api.rowSelect({ selected: row.id, deselect: !(b ?? selected) }),
|
|
70
|
+
handleSelect: api.rowHandleSelect,
|
|
71
|
+
toggle: (b) => api.rowGroupToggle(row.id, b),
|
|
72
|
+
dragProps: draggable ? props : {},
|
|
73
|
+
isBefore: isBefore,
|
|
74
|
+
isOver: !isDragActive && row.id === over,
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}, [children, draggable, isBefore$, itemLookup, over$, rowSelectionEnabled, selectAllSlot]);
|
|
79
|
+
useImperativeHandle(forwarded, () => {
|
|
80
|
+
return {
|
|
81
|
+
rowsSelected: () => (api?.rowsSelected().rows ?? []).filter((x) => x.id !== "__ln_select_all"),
|
|
82
|
+
};
|
|
83
|
+
}, [api]);
|
|
84
|
+
return (_jsx(Root, { ref: setApi, rowSource: source, rowGroupColumn: groupColumn, rowAlternateAttr: false, headerHeight: 0, rowHeight: rowHeight, rowSelectionMode: rowSelectionEnabled ? "multiple" : "none", rowSelectionActivator: "none", onRowDragEnter: (p) => {
|
|
85
|
+
if (p.over.kind === "viewport")
|
|
86
|
+
return;
|
|
87
|
+
setOverId(p.over.row.id);
|
|
88
|
+
setIsBefore(p.over.rowIndex < p.source.rowIndex);
|
|
89
|
+
}, onRowDragLeave: (p) => {
|
|
90
|
+
if (p.over.kind === "viewport")
|
|
91
|
+
return;
|
|
92
|
+
setOverId(null);
|
|
93
|
+
}, onRowDrop: (p) => {
|
|
94
|
+
setOverId(null);
|
|
95
|
+
if (p.over.kind === "viewport")
|
|
96
|
+
return;
|
|
97
|
+
const sourceRow = p.source.row;
|
|
98
|
+
const rows = sourceRow.kind === "branch" ? p.source.api.rowLeafs(sourceRow.id) : [sourceRow.id];
|
|
99
|
+
const overRow = p.over.row;
|
|
100
|
+
const overId = p.over.row.kind === "branch" ? p.over.api.rowLeafs(overRow.id)[0] : overRow.id;
|
|
101
|
+
if (rows.includes(overId))
|
|
102
|
+
return;
|
|
103
|
+
const moveItems = rows.map((r) => items.findIndex((x) => x.id === r)).sort((l, r) => l - r);
|
|
104
|
+
const target = items.findIndex((x) => x.id === overId);
|
|
105
|
+
const next = moveRelative(items, moveItems[0], target, moveItems.slice(1));
|
|
106
|
+
onItemsReordered?.(next);
|
|
107
|
+
}, events: useMemo(() => {
|
|
108
|
+
return {
|
|
109
|
+
cell: {
|
|
110
|
+
keyDown: ({ api, event, row }) => {
|
|
111
|
+
if (event.key === " " && row.kind === "branch") {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
api.rowGroupToggle(row.id);
|
|
114
|
+
}
|
|
115
|
+
if (event.key === "ArrowLeft" && row.kind === "branch") {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
api.rowGroupToggle(row.id, false);
|
|
119
|
+
}
|
|
120
|
+
if (event.key === "ArrowRight" && row.kind === "branch") {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
event.stopPropagation();
|
|
123
|
+
api.rowGroupToggle(row.id, true);
|
|
124
|
+
}
|
|
125
|
+
if (event.key === "Enter") {
|
|
126
|
+
api.rowSelect({ selected: row.id, deselect: api.rowIsSelected(row.id) });
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}, []), styles: useMemo(() => {
|
|
132
|
+
return {
|
|
133
|
+
viewport: {
|
|
134
|
+
className: "ln-tree-view",
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}, []), children: _jsx(Grid.Viewport, { children: _jsx(Grid.RowsContainer, { children: _jsx(Grid.RowsCenter, {}) }) }) }));
|
|
138
|
+
}
|
|
139
|
+
export const TreeView = forwardRef(TreeViewBase);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { TreeViewSelectAllParams } from "./types";
|
|
3
|
+
import type { API } from "../../types";
|
|
4
|
+
export declare function SelectAll({ api, render, }: {
|
|
5
|
+
render?: (params: TreeViewSelectAllParams) => ReactNode;
|
|
6
|
+
api: API;
|
|
7
|
+
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|