@1771technologies/lytenyte-pro 1.0.0-beta.36 → 1.0.0-beta.38
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/+types.d.ts +4469 -4219
- package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +38 -38
- package/dist/cell-selection/are-rects-equal.js +4 -6
- package/dist/cell-selection/bound-selection-rect.js +14 -14
- package/dist/cell-selection/cell-selection-containers.js +78 -108
- package/dist/cell-selection/cell-selection-driver.js +262 -250
- package/dist/cell-selection/cell-style-row.d.ts +6 -12
- package/dist/cell-selection/cell-style-row.js +79 -82
- package/dist/cell-selection/deselect-rect-range.js +40 -41
- package/dist/cell-selection/expand-cell-selection-down.d.ts +2 -5
- package/dist/cell-selection/expand-cell-selection-down.js +33 -29
- package/dist/cell-selection/expand-cell-selection-end.d.ts +2 -5
- package/dist/cell-selection/expand-cell-selection-end.js +34 -30
- package/dist/cell-selection/expand-cell-selection-start.d.ts +2 -5
- package/dist/cell-selection/expand-cell-selection-start.js +33 -29
- package/dist/cell-selection/expand-cell-selection-up.d.ts +2 -5
- package/dist/cell-selection/expand-cell-selection-up.js +33 -29
- package/dist/cell-selection/full-width-start-end-index.js +3 -3
- package/dist/cell-selection/get-root-cell.d.ts +1 -5
- package/dist/cell-selection/get-root-cell.js +79 -77
- package/dist/cell-selection/is-bottom-rect.js +5 -5
- package/dist/cell-selection/is-center-col-rect.d.ts +2 -5
- package/dist/cell-selection/is-center-col-rect.js +3 -5
- package/dist/cell-selection/is-center-rect.js +3 -3
- package/dist/cell-selection/is-end-rect.d.ts +2 -5
- package/dist/cell-selection/is-end-rect.js +2 -2
- package/dist/cell-selection/is-overlapping-rect.js +4 -6
- package/dist/cell-selection/is-start-rect.d.ts +2 -5
- package/dist/cell-selection/is-start-rect.js +2 -2
- package/dist/cell-selection/is-top-rect.js +2 -2
- package/dist/cell-selection/is-within-selection-rect.js +1 -1
- package/dist/cell-selection/split-cell-selection-rect.d.ts +6 -12
- package/dist/cell-selection/split-cell-selection-rect.js +47 -53
- package/dist/cell-selection/update-additive-cell-selection.d.ts +2 -5
- package/dist/cell-selection/update-additive-cell-selection.js +17 -16
- package/dist/cell-selection/use-edge-scroll.d.ts +6 -8
- package/dist/cell-selection/use-edge-scroll.js +63 -65
- package/dist/cells/cell-default.d.ts +1 -5
- package/dist/cells/cell-default.js +5 -5
- package/dist/cells/cell-editor.d.ts +2 -4
- package/dist/cells/cell-editor.js +92 -129
- package/dist/cells/cell.d.ts +3 -16
- package/dist/cells/cell.js +27 -56
- package/dist/column-manager/branch-lookup-context.d.ts +1 -3
- package/dist/column-manager/branch.d.ts +9 -17
- package/dist/column-manager/branch.js +46 -64
- package/dist/column-manager/column-manager.d.ts +8 -57
- package/dist/column-manager/column-manager.js +8 -8
- package/dist/column-manager/context.d.ts +1 -1
- package/dist/column-manager/label.d.ts +2 -10
- package/dist/column-manager/label.js +12 -11
- package/dist/column-manager/leaf.d.ts +2 -10
- package/dist/column-manager/leaf.js +49 -61
- package/dist/column-manager/move-handle.d.ts +6 -14
- package/dist/column-manager/move-handle.js +48 -52
- package/dist/column-manager/panel.d.ts +1 -10
- package/dist/column-manager/root.d.ts +3 -7
- package/dist/column-manager/root.js +1 -4
- package/dist/column-manager/use-column-manager.d.ts +5 -7
- package/dist/column-manager/use-column-manager.js +21 -15
- package/dist/column-manager/use-columns-from-context.d.ts +1 -3
- package/dist/column-manager/use-columns-from-context.js +18 -18
- package/dist/column-manager/visibility-checkbox.d.ts +6 -14
- package/dist/column-manager/visibility-checkbox.js +23 -36
- package/dist/context.d.ts +4 -4
- package/dist/filter-tree/branch.d.ts +8 -16
- package/dist/filter-tree/branch.js +13 -23
- package/dist/filter-tree/context.d.ts +16 -16
- package/dist/filter-tree/filter-tree.d.ts +8 -49
- package/dist/filter-tree/filter-tree.js +8 -8
- package/dist/filter-tree/hooks/use-filter-tree.d.ts +29 -35
- package/dist/filter-tree/hooks/use-filter-tree.js +92 -94
- package/dist/filter-tree/hooks/use-tree-item.d.ts +4 -4
- package/dist/filter-tree/hooks/use-tree-item.js +106 -99
- package/dist/filter-tree/inclusion-checkbox.d.ts +6 -14
- package/dist/filter-tree/inclusion-checkbox.js +9 -19
- package/dist/filter-tree/label.d.ts +2 -10
- package/dist/filter-tree/label.js +12 -11
- package/dist/filter-tree/leaf.d.ts +2 -10
- package/dist/filter-tree/leaf.js +5 -15
- package/dist/filter-tree/root.d.ts +7 -23
- package/dist/filter-tree/root.js +23 -51
- package/dist/grid-box/+types.d.ts +11 -11
- package/dist/grid-box/context.d.ts +3 -3
- package/dist/grid-box/grid-box.d.ts +6 -26
- package/dist/grid-box/grid-box.js +6 -6
- package/dist/grid-box/item.d.ts +5 -13
- package/dist/grid-box/item.js +56 -73
- package/dist/grid-box/panel.d.ts +1 -13
- package/dist/grid-box/panel.js +2 -9
- package/dist/grid-box/root.d.ts +5 -11
- package/dist/grid-box/root.js +2 -11
- package/dist/grid-box/use-aggregation-box-items.d.ts +13 -16
- package/dist/grid-box/use-aggregation-box-items.js +57 -56
- package/dist/grid-box/use-column-box-items.d.ts +23 -33
- package/dist/grid-box/use-column-box-items.js +75 -87
- package/dist/grid-box/use-row-group-box-items.d.ts +12 -17
- package/dist/grid-box/use-row-group-box-items.js +123 -120
- package/dist/grid-provider/context.d.ts +2 -4
- package/dist/grid-provider/provider.d.ts +2 -4
- package/dist/grid-provider/use-grid.d.ts +1 -1
- package/dist/grid.d.ts +14 -126
- package/dist/grid.js +14 -14
- package/dist/header/header-cell.d.ts +5 -13
- package/dist/header/header-cell.js +15 -41
- package/dist/header/header-group-cell.d.ts +2 -10
- package/dist/header/header-group-cell.js +8 -26
- package/dist/header/header-row.d.ts +2 -10
- package/dist/header/header-row.js +2 -2
- package/dist/header/header.d.ts +1 -10
- package/dist/header/header.js +2 -11
- package/dist/header/resize-handler.d.ts +6 -15
- package/dist/header/resize-handler.js +122 -131
- package/dist/header/use-drag-move.d.ts +11 -22
- package/dist/header/use-drag-move.js +94 -95
- package/dist/header/use-header-cell-renderer.d.ts +2 -9
- package/dist/header/use-header-cell-renderer.js +29 -25
- package/dist/icons/index.d.ts +1 -92
- package/dist/icons/index.js +1 -92
- package/dist/index.d.ts +5 -22
- package/dist/index.js +5 -22
- package/dist/license.js +174 -174
- package/dist/listbox/context.d.ts +2 -2
- package/dist/listbox/item.d.ts +1 -10
- package/dist/listbox/item.js +19 -23
- package/dist/listbox/panel.d.ts +1 -10
- package/dist/listbox/panel.js +43 -69
- package/dist/listbox/root.d.ts +3 -5
- package/dist/listbox/root.js +7 -7
- package/dist/root/dialog-driver.js +16 -22
- package/dist/root/popover-driver.js +16 -27
- package/dist/root/root.d.ts +3 -7
- package/dist/root/root.js +107 -111
- package/dist/row-data-source-client/+types.d.ts +17 -17
- package/dist/row-data-source-client/built-ins/avg.js +4 -3
- package/dist/row-data-source-client/built-ins/built-ins.d.ts +16 -16
- package/dist/row-data-source-client/built-ins/built-ins.js +16 -16
- package/dist/row-data-source-client/built-ins/count.js +5 -3
- package/dist/row-data-source-client/built-ins/first.js +1 -1
- package/dist/row-data-source-client/built-ins/group.js +1 -1
- package/dist/row-data-source-client/built-ins/last.js +1 -1
- package/dist/row-data-source-client/built-ins/max.js +13 -9
- package/dist/row-data-source-client/built-ins/min.js +13 -9
- package/dist/row-data-source-client/built-ins/sum.js +10 -8
- package/dist/row-data-source-client/filter/+types.d.ts +13 -35
- package/dist/row-data-source-client/filter/compute-filtered-rows.d.ts +2 -16
- package/dist/row-data-source-client/filter/compute-filtered-rows.js +102 -102
- package/dist/row-data-source-client/pivots/create-agg-model.d.ts +4 -8
- package/dist/row-data-source-client/pivots/create-agg-model.js +9 -8
- package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.d.ts +1 -6
- package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.js +46 -42
- package/dist/row-data-source-client/pivots/create-pivot-columns.d.ts +1 -6
- package/dist/row-data-source-client/pivots/create-pivot-columns.js +17 -16
- package/dist/row-data-source-client/pivots/create-pivot-tree.d.ts +1 -7
- package/dist/row-data-source-client/pivots/create-pivot-tree.js +19 -19
- package/dist/row-data-source-client/tree/client-tree.d.ts +13 -19
- package/dist/row-data-source-client/tree/client-tree.js +67 -64
- package/dist/row-data-source-client/tree/evaluator-aggregation.d.ts +1 -4
- package/dist/row-data-source-client/tree/evaluator-aggregation.js +6 -6
- package/dist/row-data-source-client/tree/evaluator-group.d.ts +1 -4
- package/dist/row-data-source-client/tree/evaluator-group.js +7 -6
- package/dist/row-data-source-client/tree/traverse.d.ts +1 -5
- package/dist/row-data-source-client/tree/traverse.js +18 -15
- package/dist/row-data-source-client/use-client-data-source-paginated.d.ts +5 -9
- package/dist/row-data-source-client/use-client-data-source-paginated.js +551 -566
- package/dist/row-data-source-client/use-client-data-source.d.ts +5 -9
- package/dist/row-data-source-client/use-client-data-source.js +661 -696
- package/dist/row-data-source-client/use-client-tree-data-source.d.ts +5 -9
- package/dist/row-data-source-client/use-client-tree-data-source.js +512 -523
- package/dist/row-data-source-server/async-tree/+types.async-tree.d.ts +33 -36
- package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.d.ts +1 -4
- package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.js +22 -18
- package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.d.ts +1 -4
- package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.js +25 -17
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.js +18 -18
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.js +10 -9
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.d.ts +1 -4
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.js +14 -13
- package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.js +10 -9
- package/dist/row-data-source-server/async-tree/get-parent-node-by-path.d.ts +1 -4
- package/dist/row-data-source-server/async-tree/get-parent-node-by-path.js +13 -13
- package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +1 -4
- package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.js +1 -1
- package/dist/row-data-source-server/async-tree/make-async-tree.js +14 -14
- package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +1 -3
- package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.js +6 -6
- package/dist/row-data-source-server/async-tree/maybe-apply-resize.d.ts +1 -5
- package/dist/row-data-source-server/async-tree/maybe-apply-resize.js +14 -11
- package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.d.ts +1 -4
- package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.js +46 -42
- package/dist/row-data-source-server/range-tree/range-tree.d.ts +28 -28
- package/dist/row-data-source-server/range-tree/range-tree.js +48 -49
- package/dist/row-data-source-server/use-server-data-source.d.ts +2 -11
- package/dist/row-data-source-server/use-server-data-source.js +675 -688
- package/dist/row-data-source-server/utils/get-node-depth.js +7 -7
- package/dist/row-data-source-server/utils/get-node-path.js +7 -7
- package/dist/row-data-source-server/utils/get-request-id.js +4 -3
- package/dist/rows/row/context.d.ts +2 -2
- package/dist/rows/row/row.d.ts +3 -16
- package/dist/rows/row/row.js +4 -19
- package/dist/rows/row/use-row-context-value.d.ts +2 -5
- package/dist/rows/row/use-row-context-value.js +26 -23
- package/dist/rows/row-detail-row.d.ts +2 -4
- package/dist/rows/row-detail-row.js +124 -147
- package/dist/rows/row-full-width.d.ts +4 -12
- package/dist/rows/row-full-width.js +7 -35
- package/dist/rows/rows-container.d.ts +1 -10
- package/dist/rows/rows-container.js +3 -12
- package/dist/rows/rows-sections.d.ts +3 -30
- package/dist/rows/rows-sections.js +10 -42
- package/dist/rows/scrollers/native-scroller.d.ts +1 -3
- package/dist/rows/scrollers/native-scroller.js +13 -17
- package/dist/sort-manager/+types.d.ts +7 -14
- package/dist/sort-manager/context.d.ts +4 -4
- package/dist/sort-manager/hooks/use-sort-manager.d.ts +9 -9
- package/dist/sort-manager/hooks/use-sort-manager.js +49 -45
- package/dist/sort-manager/hooks/use-sort-row-item.d.ts +46 -57
- package/dist/sort-manager/hooks/use-sort-row-item.js +131 -126
- package/dist/sort-manager/hooks/use-sortable-column-items.d.ts +3 -6
- package/dist/sort-manager/hooks/use-sortable-column-items.js +10 -10
- package/dist/sort-manager/root.d.ts +1 -7
- package/dist/sort-manager/root.js +10 -10
- package/dist/sort-manager/sort-add.d.ts +5 -13
- package/dist/sort-manager/sort-add.js +8 -8
- package/dist/sort-manager/sort-apply.d.ts +4 -12
- package/dist/sort-manager/sort-apply.js +16 -16
- package/dist/sort-manager/sort-cancel.d.ts +4 -12
- package/dist/sort-manager/sort-cancel.js +19 -19
- package/dist/sort-manager/sort-clear.d.ts +4 -12
- package/dist/sort-manager/sort-clear.js +16 -15
- package/dist/sort-manager/sort-column-select.d.ts +6 -14
- package/dist/sort-manager/sort-column-select.js +14 -22
- package/dist/sort-manager/sort-direction-select.d.ts +6 -14
- package/dist/sort-manager/sort-direction-select.js +19 -27
- package/dist/sort-manager/sort-manager.d.ts +12 -93
- package/dist/sort-manager/sort-manager.js +12 -12
- package/dist/sort-manager/sort-remove.d.ts +4 -12
- package/dist/sort-manager/sort-remove.js +8 -8
- package/dist/sort-manager/sort-row.d.ts +2 -10
- package/dist/sort-manager/sort-row.js +1 -4
- package/dist/sort-manager/sort-rows.d.ts +1 -10
- package/dist/sort-manager/sort-rows.js +1 -1
- package/dist/sort-manager/sort-value-select.d.ts +7 -15
- package/dist/sort-manager/sort-value-select.js +19 -28
- package/dist/sort-manager/utils/sort-item-to-sort-model.d.ts +1 -4
- package/dist/sort-manager/utils/sort-item-to-sort-model.js +49 -46
- package/dist/sort-manager/utils/sort-model-to-sort-items.d.ts +1 -4
- package/dist/sort-manager/utils/sort-model-to-sort-items.js +44 -36
- package/dist/state/+types.d.ts +29 -43
- package/dist/state/api/column-autosize.d.ts +2 -4
- package/dist/state/api/column-autosize.js +63 -62
- package/dist/state/api/column-by-id.js +4 -4
- package/dist/state/api/column-field.js +20 -17
- package/dist/state/api/column-from-index.js +4 -4
- package/dist/state/api/column-group-toggle.js +8 -8
- package/dist/state/api/column-index.js +5 -5
- package/dist/state/api/column-move.js +46 -48
- package/dist/state/api/column-resize.js +7 -9
- package/dist/state/api/column-update.d.ts +2 -4
- package/dist/state/api/column-update.js +23 -23
- package/dist/state/api/dialog-frame.d.ts +4 -8
- package/dist/state/api/dialog-frame.js +12 -11
- package/dist/state/api/edit-begin.d.ts +2 -4
- package/dist/state/api/edit-begin.js +84 -71
- package/dist/state/api/edit-end.d.ts +2 -4
- package/dist/state/api/edit-end.js +41 -38
- package/dist/state/api/edit-is-cell-active.d.ts +2 -4
- package/dist/state/api/edit-is-cell-active.js +24 -17
- package/dist/state/api/edit-update.d.ts +2 -4
- package/dist/state/api/edit-update.js +85 -74
- package/dist/state/api/event-listeners.d.ts +3 -12
- package/dist/state/api/event-listeners.js +17 -16
- package/dist/state/api/export-csv.js +35 -33
- package/dist/state/api/export-data-rect.js +21 -21
- package/dist/state/api/focus-cell.d.ts +2 -4
- package/dist/state/api/focus-cell.js +109 -110
- package/dist/state/api/popover-frame.d.ts +4 -8
- package/dist/state/api/popover-frame.js +12 -11
- package/dist/state/api/position-from-element.js +6 -5
- package/dist/state/api/row-by-id.js +3 -3
- package/dist/state/api/row-by-index.js +6 -11
- package/dist/state/api/row-detail-is-expanded.d.ts +1 -3
- package/dist/state/api/row-detail-is-expanded.js +4 -4
- package/dist/state/api/row-detail-rendered-height.d.ts +2 -4
- package/dist/state/api/row-detail-rendered-height.js +12 -10
- package/dist/state/api/row-detail-toggle.js +30 -26
- package/dist/state/api/row-group-apply-expansions.d.ts +1 -3
- package/dist/state/api/row-group-apply-expansions.js +17 -15
- package/dist/state/api/row-group-column-index.d.ts +1 -3
- package/dist/state/api/row-group-column-index.js +12 -14
- package/dist/state/api/row-group-is-expanded.d.ts +1 -3
- package/dist/state/api/row-group-is-expanded.js +13 -11
- package/dist/state/api/row-group-toggle.js +5 -5
- package/dist/state/api/row-handle-select.d.ts +2 -4
- package/dist/state/api/row-handle-select.js +40 -36
- package/dist/state/api/row-select-all.js +15 -14
- package/dist/state/api/row-select.d.ts +2 -4
- package/dist/state/api/row-select.js +33 -30
- package/dist/state/api/row-selected.js +11 -10
- package/dist/state/api/scroll-into-view.d.ts +2 -4
- package/dist/state/api/scroll-into-view.js +47 -47
- package/dist/state/api/sort-for-column.js +7 -6
- package/dist/state/api/use-row-drag.js +24 -22
- package/dist/state/helpers/cell-row-group.d.ts +1 -5
- package/dist/state/helpers/cell-row-group.js +16 -18
- package/dist/state/helpers/column-add-row-group.d.ts +7 -18
- package/dist/state/helpers/column-add-row-group.js +66 -71
- package/dist/state/helpers/column-layout.d.ts +1 -7
- package/dist/state/helpers/column-layout.js +60 -60
- package/dist/state/helpers/column-marker.d.ts +4 -8
- package/dist/state/helpers/column-marker.js +34 -38
- package/dist/state/helpers/column-view.d.ts +15 -21
- package/dist/state/helpers/column-view.js +32 -56
- package/dist/state/helpers/edit-on-change.d.ts +10 -18
- package/dist/state/helpers/edit-on-change.js +25 -25
- package/dist/state/helpers/empty-row-data-source.js +16 -16
- package/dist/state/helpers/get-data-rect.d.ts +10 -20
- package/dist/state/helpers/get-data-rect.js +62 -67
- package/dist/state/helpers/get-full-width-callback.d.ts +1 -5
- package/dist/state/helpers/get-full-width-callback.js +6 -5
- package/dist/state/helpers/get-span-callback.d.ts +1 -6
- package/dist/state/helpers/get-span-callback.js +18 -15
- package/dist/state/helpers/resolve-column.d.ts +2 -6
- package/dist/state/helpers/resolve-column.js +23 -23
- package/dist/state/helpers/row-layout/get-focus-criteria.d.ts +12 -15
- package/dist/state/helpers/row-layout/get-focus-criteria.js +56 -57
- package/dist/state/helpers/row-layout/row-layout.d.ts +9 -15
- package/dist/state/helpers/row-layout/row-layout.js +401 -387
- package/dist/state/use-lytenyte.js +528 -567
- package/dist/tree-view/branch/branch.d.ts +11 -19
- package/dist/tree-view/branch/branch.js +54 -106
- package/dist/tree-view/branch/use-branch-keys.d.ts +1 -5
- package/dist/tree-view/branch/use-branch-keys.js +74 -71
- package/dist/tree-view/context.d.ts +17 -21
- package/dist/tree-view/hooks/use-tree-view-paths.d.ts +1 -7
- package/dist/tree-view/hooks/use-tree-view-paths.js +5 -5
- package/dist/tree-view/index.d.ts +7 -35
- package/dist/tree-view/index.js +7 -7
- package/dist/tree-view/leaf.d.ts +2 -10
- package/dist/tree-view/leaf.js +21 -30
- package/dist/tree-view/navigation/get-all-ids.js +3 -3
- package/dist/tree-view/navigation/get-first-node.js +3 -3
- package/dist/tree-view/navigation/get-last-node.js +3 -3
- package/dist/tree-view/navigation/get-next-node.js +8 -6
- package/dist/tree-view/navigation/get-prev-node.js +8 -6
- package/dist/tree-view/panel/make-handle-navigation.js +31 -23
- package/dist/tree-view/panel/make-handle-selection.js +77 -68
- package/dist/tree-view/panel/make-handle-typeahead.js +40 -34
- package/dist/tree-view/panel/panel.d.ts +1 -10
- package/dist/tree-view/panel/panel.js +20 -40
- package/dist/tree-view/panel/use-tree-navigation.js +52 -64
- package/dist/tree-view/root.d.ts +14 -20
- package/dist/tree-view/root.js +55 -53
- package/dist/tree-view/utils/get-focusable-nodes.js +2 -4
- package/dist/tree-view/utils/get-focused-node.js +11 -11
- package/dist/tree-view/utils/get-ids-between-nodes.d.ts +1 -5
- package/dist/tree-view/utils/get-ids-between-nodes.js +11 -10
- package/dist/tree-view/utils/get-panel.js +5 -5
- package/dist/tree-view/utils/get-parent-node.js +7 -6
- package/dist/tree-view/utils/get-sibling-branches.js +10 -8
- package/dist/tree-view/utils/get-tree-node-id.js +1 -1
- package/dist/tree-view/utils/is-branch-node.js +1 -1
- package/dist/tree-view/utils/is-leaf-node.js +1 -1
- package/dist/tree-view/utils/is-tree-node-disabled.js +1 -1
- package/dist/tree-view/utils/select-node.d.ts +1 -5
- package/dist/tree-view/utils/select-node.js +11 -8
- package/dist/tree-view/utils/toggle-all-selections.js +6 -4
- package/dist/tree-view/utils/toggle-selection.js +18 -15
- package/dist/tree-view/virtualized/force-sync-scrolling.d.ts +1 -3
- package/dist/tree-view/virtualized/force-sync-scrolling.js +18 -24
- package/dist/tree-view/virtualized/get-virtual-tree-paths.d.ts +1 -3
- package/dist/tree-view/virtualized/get-virtual-tree-paths.js +12 -11
- package/dist/tree-view/virtualized/make-virtual-tree.d.ts +21 -26
- package/dist/tree-view/virtualized/make-virtual-tree.js +85 -79
- package/dist/tree-view/virtualized/use-flattened-tree.d.ts +8 -17
- package/dist/tree-view/virtualized/use-flattened-tree.js +31 -30
- package/dist/tree-view/virtualized/use-row-start-and-end.d.ts +1 -6
- package/dist/tree-view/virtualized/use-row-start-and-end.js +23 -21
- package/dist/tree-view/virtualized/use-virtualized-tree.d.ts +15 -21
- package/dist/tree-view/virtualized/use-virtualized-tree.js +90 -103
- package/dist/utils/cycle-sorts.js +14 -12
- package/dist/viewport/begin-editing.d.ts +2 -6
- package/dist/viewport/begin-editing.js +13 -9
- package/dist/viewport/viewport.d.ts +1 -10
- package/dist/viewport/viewport.js +70 -93
- package/main.css +4 -4
- package/package.json +7 -7
package/dist/grid-box/item.js
CHANGED
|
@@ -2,79 +2,62 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Item } from "../listbox/item";
|
|
4
4
|
import { dragState, DropWrap, useDraggable } from "@1771technologies/lytenyte-dragon";
|
|
5
|
-
import { useCombinedRefs, useSlot } from "@1771technologies/lytenyte-react-hooks";
|
|
5
|
+
import { useCombinedRefs, useSlot, } from "@1771technologies/lytenyte-react-hooks";
|
|
6
6
|
import { useGridBoxContext } from "./context";
|
|
7
|
-
export const BoxItem = forwardRef(function BoxItem(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
7
|
+
export const BoxItem = forwardRef(function BoxItem({ item, itemAs, itemClassName, itemStyle, children, ...props }, forwarded) {
|
|
8
|
+
const { accepted } = useGridBoxContext();
|
|
9
|
+
const { dragProps } = useDraggable({
|
|
10
|
+
getItems: () => {
|
|
11
|
+
return {
|
|
12
|
+
siteLocalData: item.dragData,
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
placeholder: item.dragPlaceholder,
|
|
16
|
+
});
|
|
17
|
+
const ref = useCombinedRefs(forwarded, dragProps.ref);
|
|
18
|
+
const extraProps = item.draggable ? { ...dragProps, ref } : { ref: forwarded };
|
|
19
|
+
const renderer = useSlot({
|
|
20
|
+
props: [
|
|
21
|
+
{
|
|
22
|
+
children: (_jsx(Item, { ...extraProps, onKeyDown: (ev) => {
|
|
23
|
+
if (ev.key === " ") {
|
|
24
|
+
item.onAction?.(ev.currentTarget);
|
|
25
|
+
ev.preventDefault();
|
|
26
|
+
}
|
|
27
|
+
if (ev.key === "Backspace" || ev.key === "Delete")
|
|
28
|
+
item.onDelete?.(ev.currentTarget);
|
|
29
|
+
}, onClick: (ev) => item.onAction(ev.currentTarget), className: itemClassName, style: itemStyle, "data-ln-source": item.source, "data-ln-index": item.index, children: children })),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
slot: itemAs ?? _jsx("div", {}),
|
|
33
|
+
});
|
|
34
|
+
return (_jsx(DropWrap, { ...props, onEnter: (e) => {
|
|
35
|
+
const data = dragState.active.get();
|
|
36
|
+
const thisSource = e.getAttribute("data-ln-source");
|
|
37
|
+
const dragSource = data?.getAttribute("data-ln-source");
|
|
38
|
+
if (!data)
|
|
39
|
+
return;
|
|
40
|
+
if (thisSource !== dragSource) {
|
|
41
|
+
e.setAttribute("data-ln-is-after", "true");
|
|
42
|
+
return;
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!data) return;
|
|
52
|
-
if (thisSource !== dragSource) {
|
|
53
|
-
e.setAttribute("data-ln-is-after", "true");
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const overIndex = Number.parseInt(e.getAttribute("data-ln-index"));
|
|
57
|
-
const dragIndex = Number.parseInt(data.getAttribute("data-ln-index"));
|
|
58
|
-
if (Number.isNaN(dragIndex) || Number.isNaN(overIndex) || overIndex === dragIndex) return;
|
|
59
|
-
if (overIndex < dragIndex) {
|
|
60
|
-
e.setAttribute("data-ln-is-before", "true");
|
|
61
|
-
} else {
|
|
62
|
-
e.setAttribute("data-ln-is-after", "true");
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
onLeave: (el) => {
|
|
66
|
-
el.removeAttribute("data-ln-is-before");
|
|
67
|
-
el.removeAttribute("data-ln-is-after");
|
|
68
|
-
},
|
|
69
|
-
"data-ln-source": item.source,
|
|
70
|
-
"data-ln-index": item.index,
|
|
71
|
-
accepted: accepted,
|
|
72
|
-
onDrop: (e) => {
|
|
73
|
-
const el = e.dropElement;
|
|
74
|
-
el.removeAttribute("data-ln-is-before");
|
|
75
|
-
el.removeAttribute("data-ln-is-after");
|
|
76
|
-
item.onDrop(e);
|
|
77
|
-
},
|
|
78
|
-
as: renderer,
|
|
79
|
-
});
|
|
44
|
+
const overIndex = Number.parseInt(e.getAttribute("data-ln-index"));
|
|
45
|
+
const dragIndex = Number.parseInt(data.getAttribute("data-ln-index"));
|
|
46
|
+
if (Number.isNaN(dragIndex) || Number.isNaN(overIndex) || overIndex === dragIndex)
|
|
47
|
+
return;
|
|
48
|
+
if (overIndex < dragIndex) {
|
|
49
|
+
e.setAttribute("data-ln-is-before", "true");
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
e.setAttribute("data-ln-is-after", "true");
|
|
53
|
+
}
|
|
54
|
+
}, onLeave: (el) => {
|
|
55
|
+
el.removeAttribute("data-ln-is-before");
|
|
56
|
+
el.removeAttribute("data-ln-is-after");
|
|
57
|
+
}, "data-ln-source": item.source, "data-ln-index": item.index, accepted: accepted, onDrop: (e) => {
|
|
58
|
+
const el = e.dropElement;
|
|
59
|
+
el.removeAttribute("data-ln-is-before");
|
|
60
|
+
el.removeAttribute("data-ln-is-after");
|
|
61
|
+
item.onDrop(e);
|
|
62
|
+
}, as: renderer }));
|
|
80
63
|
});
|
package/dist/grid-box/panel.d.ts
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
export declare const GridBoxPanel: import("react").ForwardRefExoticComponent<
|
|
2
|
-
Omit<
|
|
3
|
-
Omit<
|
|
4
|
-
import("react").DetailedHTMLProps<
|
|
5
|
-
import("react").HTMLAttributes<HTMLDivElement>,
|
|
6
|
-
HTMLDivElement
|
|
7
|
-
>,
|
|
8
|
-
"onDrop"
|
|
9
|
-
>,
|
|
10
|
-
"ref"
|
|
11
|
-
> &
|
|
12
|
-
import("react").RefAttributes<HTMLDivElement>
|
|
13
|
-
>;
|
|
1
|
+
export declare const GridBoxPanel: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onDrop">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/grid-box/panel.js
CHANGED
|
@@ -4,13 +4,6 @@ import { Panel } from "../listbox/panel";
|
|
|
4
4
|
import { DropWrap } from "@1771technologies/lytenyte-dragon";
|
|
5
5
|
import { useGridBoxContext } from "./context";
|
|
6
6
|
export const GridBoxPanel = forwardRef(function GridBoxPanel(props, forwarded) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
...props,
|
|
10
|
-
accepted: ctx.accepted,
|
|
11
|
-
"data-ln-orientation": ctx.orientation,
|
|
12
|
-
onDrop: ctx.onRootDrop,
|
|
13
|
-
ref: forwarded,
|
|
14
|
-
as: _jsx(Panel, {}),
|
|
15
|
-
});
|
|
7
|
+
const ctx = useGridBoxContext();
|
|
8
|
+
return (_jsx(DropWrap, { ...props, accepted: ctx.accepted, "data-ln-orientation": ctx.orientation, onDrop: ctx.onRootDrop, ref: forwarded, as: _jsx(Panel, {}) }));
|
|
16
9
|
});
|
package/dist/grid-box/root.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { type PropsWithChildren } from "react";
|
|
2
2
|
import type { DropEventParams, Grid } from "../+types";
|
|
3
3
|
export interface GridBoxRootProps<T> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly orientation?: "vertical" | "horizontal";
|
|
5
|
+
readonly onRootDrop: (p: DropEventParams) => void;
|
|
6
|
+
readonly accepted: string[];
|
|
7
|
+
readonly grid: Grid<T>;
|
|
8
8
|
}
|
|
9
|
-
export declare function GridBoxRoot<T>({
|
|
10
|
-
grid,
|
|
11
|
-
orientation,
|
|
12
|
-
accepted,
|
|
13
|
-
onRootDrop,
|
|
14
|
-
children,
|
|
15
|
-
}: PropsWithChildren<GridBoxRootProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function GridBoxRoot<T>({ grid, orientation, accepted, onRootDrop, children, }: PropsWithChildren<GridBoxRootProps<T>>): import("react/jsx-runtime").JSX.Element;
|
package/dist/grid-box/root.js
CHANGED
|
@@ -3,15 +3,6 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { Root } from "../listbox/root";
|
|
4
4
|
import { GridProvider } from "../grid-provider/provider";
|
|
5
5
|
import { GridBoxContext } from "./context";
|
|
6
|
-
export function GridBoxRoot({ grid, orientation = "vertical", accepted, onRootDrop, children }) {
|
|
7
|
-
|
|
8
|
-
value: grid,
|
|
9
|
-
children: _jsx(GridBoxContext.Provider, {
|
|
10
|
-
value: useMemo(
|
|
11
|
-
() => ({ accepted, orientation, onRootDrop }),
|
|
12
|
-
[accepted, onRootDrop, orientation],
|
|
13
|
-
),
|
|
14
|
-
children: _jsx(Root, { orientation: orientation, children: children }),
|
|
15
|
-
}),
|
|
16
|
-
});
|
|
6
|
+
export function GridBoxRoot({ grid, orientation = "vertical", accepted, onRootDrop, children, }) {
|
|
7
|
+
return (_jsx(GridProvider, { value: grid, children: _jsx(GridBoxContext.Provider, { value: useMemo(() => ({ accepted, orientation, onRootDrop }), [accepted, onRootDrop, orientation]), children: _jsx(Root, { orientation: orientation, children: children }) }) }));
|
|
17
8
|
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import type { AggModelFn, DropEventParams, Grid } from "../+types.js";
|
|
2
2
|
import type { GridBoxItem } from "./+types.js";
|
|
3
3
|
export interface UseAggregationBoxItemsProps<T> {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
readonly grid: Grid<T>;
|
|
5
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
6
6
|
}
|
|
7
|
-
export declare function useAggregationBoxItems<T>({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
id: string;
|
|
19
|
-
agg: AggModelFn<T>;
|
|
20
|
-
}>[];
|
|
7
|
+
export declare function useAggregationBoxItems<T>({ grid, orientation }: UseAggregationBoxItemsProps<T>): {
|
|
8
|
+
rootProps: {
|
|
9
|
+
accepted: string[];
|
|
10
|
+
onRootDrop: (p: DropEventParams) => void;
|
|
11
|
+
orientation: "horizontal" | "vertical" | undefined;
|
|
12
|
+
grid: Grid<T>;
|
|
13
|
+
};
|
|
14
|
+
items: GridBoxItem<{
|
|
15
|
+
id: string;
|
|
16
|
+
agg: AggModelFn<T>;
|
|
17
|
+
}>[];
|
|
21
18
|
};
|
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useEvent } from "@1771technologies/lytenyte-react-hooks";
|
|
3
3
|
export function useAggregationBoxItems({ grid, orientation }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
const model = grid.state.aggModel.useValue();
|
|
5
|
+
const gridId = grid.state.gridId.useValue();
|
|
6
|
+
const items = useMemo(() => {
|
|
7
|
+
const items = Object.entries(model).map(([id, agg], i) => {
|
|
8
|
+
const column = grid.api.columnById(id);
|
|
9
|
+
const name = column?.name ?? column?.id ?? id;
|
|
10
|
+
const fn = typeof agg.fn === "string" ? agg.fn : "Fn(x)";
|
|
11
|
+
return {
|
|
12
|
+
draggable: false,
|
|
13
|
+
id,
|
|
14
|
+
index: i,
|
|
15
|
+
source: "aggregation",
|
|
16
|
+
data: { id, agg },
|
|
17
|
+
dragData: {},
|
|
18
|
+
label: `${name} ${fn}`,
|
|
19
|
+
onAction: () => { },
|
|
20
|
+
onDelete: () => {
|
|
21
|
+
grid.state.aggModel.set((prev) => {
|
|
22
|
+
const next = { ...prev };
|
|
23
|
+
delete next[id];
|
|
24
|
+
return next;
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
onDrop: () => { },
|
|
28
|
+
dragPlaceholder: undefined,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return items;
|
|
32
|
+
}, [model, grid.api, grid.state.aggModel]);
|
|
33
|
+
const onRootDrop = useEvent((p) => {
|
|
34
|
+
const aggId = `${gridId}-agg`;
|
|
35
|
+
const c = p.state.siteLocalData?.[aggId];
|
|
36
|
+
if (!c)
|
|
37
|
+
return;
|
|
38
|
+
const current = model[c.id];
|
|
39
|
+
if (!current) {
|
|
40
|
+
const base = grid.state.columnBase.get();
|
|
41
|
+
const agg = c.uiHints?.aggDefault ??
|
|
42
|
+
c.uiHints?.aggsAllowed?.[0] ??
|
|
43
|
+
base.uiHints?.aggDefault ??
|
|
44
|
+
base.uiHints?.aggsAllowed?.[0];
|
|
45
|
+
if (!agg)
|
|
46
|
+
return;
|
|
47
|
+
const next = { fn: agg };
|
|
48
|
+
grid.state.aggModel.set((prev) => ({ ...prev, [c.id]: next }));
|
|
49
|
+
}
|
|
30
50
|
});
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
c.uiHints?.aggsAllowed?.[0] ??
|
|
43
|
-
base.uiHints?.aggDefault ??
|
|
44
|
-
base.uiHints?.aggsAllowed?.[0];
|
|
45
|
-
if (!agg) return;
|
|
46
|
-
const next = { fn: agg };
|
|
47
|
-
grid.state.aggModel.set((prev) => ({ ...prev, [c.id]: next }));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return useMemo(() => {
|
|
51
|
-
return {
|
|
52
|
-
rootProps: {
|
|
53
|
-
accepted: [`${gridId}-agg`],
|
|
54
|
-
onRootDrop,
|
|
55
|
-
orientation,
|
|
56
|
-
grid,
|
|
57
|
-
},
|
|
58
|
-
items,
|
|
59
|
-
};
|
|
60
|
-
}, [grid, gridId, items, onRootDrop, orientation]);
|
|
51
|
+
return useMemo(() => {
|
|
52
|
+
return {
|
|
53
|
+
rootProps: {
|
|
54
|
+
accepted: [`${gridId}-agg`],
|
|
55
|
+
onRootDrop,
|
|
56
|
+
orientation,
|
|
57
|
+
grid,
|
|
58
|
+
},
|
|
59
|
+
items,
|
|
60
|
+
};
|
|
61
|
+
}, [grid, gridId, items, onRootDrop, orientation]);
|
|
61
62
|
}
|
|
@@ -2,44 +2,34 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { Column, DropEventParams, Grid } from "../+types.js";
|
|
3
3
|
import type { GridBoxItem } from "./+types.js";
|
|
4
4
|
export interface OnDropParams<T> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
readonly target: Column<T>;
|
|
6
|
+
readonly src: Column<T>;
|
|
7
|
+
readonly isBefore: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface OnRootDropParams<T> {
|
|
10
|
-
|
|
10
|
+
readonly column: Column<T>;
|
|
11
11
|
}
|
|
12
12
|
export interface OnActionParams<T> {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
readonly column: Column<T>;
|
|
14
|
+
readonly el: HTMLElement;
|
|
15
15
|
}
|
|
16
16
|
export interface UseColumnBoxItemArgs<T> {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
readonly grid: Grid<T>;
|
|
18
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
19
|
+
readonly draggable?: boolean;
|
|
20
|
+
readonly itemFilter?: (c: Column<T>) => boolean;
|
|
21
|
+
readonly onRootDrop?: (p: OnRootDropParams<T>) => void;
|
|
22
|
+
readonly onDrop?: (p: OnDropParams<T>) => void;
|
|
23
|
+
readonly onAction?: (c: OnActionParams<T>) => void;
|
|
24
|
+
readonly onDelete?: (c: OnActionParams<T>) => void;
|
|
25
|
+
readonly dragPlaceholder?: (c: Column<T>) => ReactNode;
|
|
26
26
|
}
|
|
27
|
-
export declare function useColumnBoxItems<T>({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dragPlaceholder,
|
|
36
|
-
itemFilter,
|
|
37
|
-
}: UseColumnBoxItemArgs<T>): {
|
|
38
|
-
rootProps: {
|
|
39
|
-
accepted: string[];
|
|
40
|
-
orientation: "horizontal" | "vertical" | undefined;
|
|
41
|
-
onRootDrop: (p: DropEventParams) => void;
|
|
42
|
-
grid: Grid<T>;
|
|
43
|
-
};
|
|
44
|
-
items: GridBoxItem<Column<T>>[];
|
|
27
|
+
export declare function useColumnBoxItems<T>({ grid, onRootDrop, onDrop, onDelete, onAction, orientation, draggable, dragPlaceholder, itemFilter, }: UseColumnBoxItemArgs<T>): {
|
|
28
|
+
rootProps: {
|
|
29
|
+
accepted: string[];
|
|
30
|
+
orientation: "horizontal" | "vertical" | undefined;
|
|
31
|
+
onRootDrop: (p: DropEventParams) => void;
|
|
32
|
+
grid: Grid<T>;
|
|
33
|
+
};
|
|
34
|
+
items: GridBoxItem<Column<T>>[];
|
|
45
35
|
};
|
|
@@ -1,90 +1,78 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useEvent } from "@1771technologies/lytenyte-react-hooks";
|
|
3
|
-
export function useColumnBoxItems({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return useMemo(
|
|
79
|
-
() => ({
|
|
80
|
-
rootProps: {
|
|
81
|
-
accepted: [`${gridId}-column`],
|
|
82
|
-
orientation: orientation,
|
|
83
|
-
onRootDrop: onRootDropEv,
|
|
84
|
-
grid,
|
|
85
|
-
},
|
|
86
|
-
items,
|
|
87
|
-
}),
|
|
88
|
-
[grid, gridId, items, onRootDropEv, orientation],
|
|
89
|
-
);
|
|
3
|
+
export function useColumnBoxItems({ grid, onRootDrop, onDrop, onDelete, onAction, orientation, draggable = true, dragPlaceholder, itemFilter, }) {
|
|
4
|
+
const columns = grid.state.columns.useValue();
|
|
5
|
+
const base = grid.state.columnBase.useValue();
|
|
6
|
+
const gridId = grid.state.gridId.useValue();
|
|
7
|
+
const items = useMemo(() => {
|
|
8
|
+
const groupId = `${gridId}-group`;
|
|
9
|
+
const aggId = `${gridId}-agg`;
|
|
10
|
+
const columnId = `${gridId}-column`;
|
|
11
|
+
return columns
|
|
12
|
+
.filter((c) => {
|
|
13
|
+
return itemFilter ? itemFilter(c) : true;
|
|
14
|
+
})
|
|
15
|
+
.map((c, i) => {
|
|
16
|
+
const canGroup = c.uiHints?.rowGroupable ?? base.uiHints?.rowGroupable ?? false;
|
|
17
|
+
const canAgg = Boolean(c.uiHints?.aggDefault ??
|
|
18
|
+
c.uiHints?.aggDefault?.length ??
|
|
19
|
+
base.uiHints?.aggDefault ??
|
|
20
|
+
base.uiHints?.aggsAllowed?.length);
|
|
21
|
+
const data = {
|
|
22
|
+
[columnId]: c,
|
|
23
|
+
};
|
|
24
|
+
if (canGroup)
|
|
25
|
+
data[groupId] = c.id;
|
|
26
|
+
if (canAgg)
|
|
27
|
+
data[aggId] = c;
|
|
28
|
+
return {
|
|
29
|
+
label: c.name ?? c.id,
|
|
30
|
+
id: c.id,
|
|
31
|
+
index: i,
|
|
32
|
+
source: "columns",
|
|
33
|
+
draggable,
|
|
34
|
+
data: c,
|
|
35
|
+
dragData: data,
|
|
36
|
+
dragPlaceholder: dragPlaceholder ? () => dragPlaceholder?.(c) : undefined,
|
|
37
|
+
onAction: (el) => onAction?.({ column: c, el }),
|
|
38
|
+
onDelete: (el) => onDelete?.({ column: c, el }),
|
|
39
|
+
onDrop: (p) => {
|
|
40
|
+
const src = p.state.siteLocalData?.[columnId];
|
|
41
|
+
const target = c;
|
|
42
|
+
const dragIndex = columns.findIndex((x) => x.id === src.id);
|
|
43
|
+
const overIndex = columns.findIndex((x) => x.id === c.id);
|
|
44
|
+
const isBefore = overIndex < dragIndex;
|
|
45
|
+
if (overIndex === dragIndex)
|
|
46
|
+
return;
|
|
47
|
+
onDrop?.({ src, target, isBefore });
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}, [
|
|
52
|
+
base.uiHints?.aggDefault,
|
|
53
|
+
base.uiHints?.aggsAllowed?.length,
|
|
54
|
+
base.uiHints?.rowGroupable,
|
|
55
|
+
columns,
|
|
56
|
+
dragPlaceholder,
|
|
57
|
+
draggable,
|
|
58
|
+
gridId,
|
|
59
|
+
itemFilter,
|
|
60
|
+
onAction,
|
|
61
|
+
onDelete,
|
|
62
|
+
onDrop,
|
|
63
|
+
]);
|
|
64
|
+
const onRootDropEv = useEvent((p) => {
|
|
65
|
+
const columnId = `${gridId}-column`;
|
|
66
|
+
const src = p.state.siteLocalData?.[columnId];
|
|
67
|
+
onRootDrop?.(src);
|
|
68
|
+
});
|
|
69
|
+
return useMemo(() => ({
|
|
70
|
+
rootProps: {
|
|
71
|
+
accepted: [`${gridId}-column`],
|
|
72
|
+
orientation: orientation,
|
|
73
|
+
onRootDrop: onRootDropEv,
|
|
74
|
+
grid,
|
|
75
|
+
},
|
|
76
|
+
items,
|
|
77
|
+
}), [grid, gridId, items, onRootDropEv, orientation]);
|
|
90
78
|
}
|
|
@@ -2,22 +2,17 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { DropEventParams, Grid, RowGroupModelItem } from "../+types.js";
|
|
3
3
|
import type { GridBoxItem } from "./+types.js";
|
|
4
4
|
export interface UseRowGroupBoxItems<T> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
readonly grid: Grid<T>;
|
|
6
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
7
|
+
readonly dragPlaceholder?: (c: RowGroupModelItem<T>) => ReactNode;
|
|
8
|
+
readonly hideColumnOnGroup?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare function useRowGroupBoxItems<T>({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onRootDrop: (p: DropEventParams) => void;
|
|
19
|
-
orientation: "horizontal" | "vertical" | undefined;
|
|
20
|
-
grid: Grid<T>;
|
|
21
|
-
};
|
|
22
|
-
items: GridBoxItem<RowGroupModelItem<T>>[];
|
|
10
|
+
export declare function useRowGroupBoxItems<T>({ grid, orientation, dragPlaceholder, hideColumnOnGroup, }: UseRowGroupBoxItems<T>): {
|
|
11
|
+
rootProps: {
|
|
12
|
+
accepted: string[];
|
|
13
|
+
onRootDrop: (p: DropEventParams) => void;
|
|
14
|
+
orientation: "horizontal" | "vertical" | undefined;
|
|
15
|
+
grid: Grid<T>;
|
|
16
|
+
};
|
|
17
|
+
items: GridBoxItem<RowGroupModelItem<T>>[];
|
|
23
18
|
};
|