@1771technologies/lytenyte-pro 0.9.4 → 1.0.0-beta.0
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/README.md +3 -2
- package/dist/+types.d.ts +5299 -0
- package/dist/+types.js +1 -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 +2 -0
- package/dist/cell-selection/bound-selection-rect.js +17 -0
- package/dist/cell-selection/cell-selection-containers.d.ts +3 -0
- package/dist/cell-selection/cell-selection-containers.js +91 -0
- package/dist/cell-selection/cell-selection-driver.js +272 -0
- package/dist/{types/cell-selection → cell-selection}/cell-style-row.d.ts +2 -2
- package/dist/cell-selection/cell-style-row.js +84 -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-cell-selection-down.d.ts +5 -0
- package/dist/cell-selection/expand-cell-selection-down.js +39 -0
- package/dist/cell-selection/expand-cell-selection-end.d.ts +5 -0
- package/dist/cell-selection/expand-cell-selection-end.js +40 -0
- package/dist/cell-selection/expand-cell-selection-start.d.ts +5 -0
- package/dist/cell-selection/expand-cell-selection-start.js +39 -0
- package/dist/cell-selection/expand-cell-selection-up.d.ts +5 -0
- package/dist/cell-selection/expand-cell-selection-up.js +39 -0
- package/dist/cell-selection/full-width-start-end-index.d.ts +2 -0
- package/dist/cell-selection/full-width-start-end-index.js +5 -0
- package/dist/cell-selection/get-root-cell.d.ts +2 -0
- package/dist/cell-selection/get-root-cell.js +86 -0
- package/dist/cell-selection/index.d.ts +19 -0
- package/dist/cell-selection/index.js +19 -0
- package/dist/cell-selection/is-bottom-rect.d.ts +2 -0
- package/dist/cell-selection/is-bottom-rect.js +7 -0
- package/dist/cell-selection/is-center-col-rect.d.ts +5 -0
- package/dist/cell-selection/is-center-col-rect.js +5 -0
- package/dist/cell-selection/is-center-rect.d.ts +2 -0
- package/dist/cell-selection/is-center-rect.js +5 -0
- package/dist/cell-selection/is-end-rect.d.ts +5 -0
- package/dist/cell-selection/is-end-rect.js +4 -0
- package/dist/cell-selection/is-overlapping-rect.d.ts +2 -0
- package/dist/cell-selection/is-overlapping-rect.js +6 -0
- package/dist/cell-selection/is-start-rect.d.ts +5 -0
- package/dist/cell-selection/is-start-rect.js +4 -0
- package/dist/cell-selection/is-top-rect.d.ts +2 -0
- package/dist/cell-selection/is-top-rect.js +4 -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 +39 -0
- package/dist/cell-selection/split-cell-selection-rect.js +79 -0
- package/dist/cell-selection/update-additive-cell-selection.d.ts +5 -0
- package/dist/cell-selection/update-additive-cell-selection.js +25 -0
- package/dist/cell-selection/use-edge-scroll.d.ts +10 -0
- package/dist/cell-selection/use-edge-scroll.js +66 -0
- package/dist/cells/cell-default.d.ts +2 -0
- package/dist/cells/cell-default.js +8 -0
- package/dist/cells/cell-editor.d.ts +6 -0
- package/dist/cells/cell-editor.js +96 -0
- package/dist/cells/cell.d.ts +7 -0
- package/dist/cells/cell.js +37 -0
- package/dist/column-manager/branch-lookup-context.d.ts +4 -0
- package/dist/column-manager/branch-lookup-context.js +3 -0
- package/dist/column-manager/branch.d.ts +9 -0
- package/dist/column-manager/branch.js +38 -0
- package/dist/column-manager/column-manager.d.ts +15 -0
- package/dist/column-manager/column-manager.js +20 -0
- package/dist/column-manager/context.d.ts +7 -0
- package/dist/column-manager/context.js +3 -0
- package/dist/column-manager/label.d.ts +5 -0
- package/dist/column-manager/label.js +18 -0
- package/dist/column-manager/leaf.d.ts +6 -0
- package/dist/column-manager/leaf.js +40 -0
- package/dist/column-manager/move-handle.d.ts +12 -0
- package/dist/column-manager/move-handle.js +58 -0
- package/dist/column-manager/passive-scroll.d.ts +2 -0
- package/dist/column-manager/passive-scroll.js +2 -0
- package/dist/column-manager/root.d.ts +9 -0
- package/dist/column-manager/root.js +20 -0
- package/dist/column-manager/use-column-manager.d.ts +19 -0
- package/dist/column-manager/use-column-manager.js +24 -0
- package/dist/column-manager/use-columns-from-context.d.ts +3 -0
- package/dist/column-manager/use-columns-from-context.js +23 -0
- package/dist/column-manager/visibility-checkbox.d.ts +9 -0
- package/dist/column-manager/visibility-checkbox.js +30 -0
- package/dist/context.d.ts +10 -0
- package/dist/context.js +4 -0
- package/dist/filter-tree/branch.d.ts +10 -0
- package/dist/filter-tree/branch.js +21 -0
- package/dist/filter-tree/context.d.ts +27 -0
- package/dist/filter-tree/context.js +5 -0
- package/dist/filter-tree/filter-tree.d.ts +14 -0
- package/dist/filter-tree/filter-tree.js +18 -0
- package/dist/filter-tree/hooks/use-filter-tree.d.ts +37 -0
- package/dist/filter-tree/hooks/use-filter-tree.js +96 -0
- package/dist/filter-tree/hooks/use-tree-item.d.ts +8 -0
- package/dist/filter-tree/hooks/use-tree-item.js +116 -0
- package/dist/filter-tree/inclusion-checkbox.d.ts +9 -0
- package/dist/filter-tree/inclusion-checkbox.js +14 -0
- package/dist/filter-tree/label.d.ts +5 -0
- package/dist/filter-tree/label.js +18 -0
- package/dist/filter-tree/leaf.d.ts +6 -0
- package/dist/filter-tree/leaf.js +12 -0
- package/dist/filter-tree/root.d.ts +13 -0
- package/dist/filter-tree/root.js +30 -0
- package/dist/grid-box/+types.d.ts +13 -0
- package/dist/grid-box/+types.js +1 -0
- package/dist/grid-box/context.d.ts +9 -0
- package/dist/grid-box/context.js +3 -0
- package/dist/grid-box/grid-box.d.ts +12 -0
- package/dist/grid-box/grid-box.js +14 -0
- package/dist/grid-box/item.d.ts +7 -0
- package/dist/grid-box/item.js +33 -0
- package/dist/grid-box/panel.d.ts +1 -0
- package/dist/grid-box/panel.js +9 -0
- package/dist/grid-box/root.d.ts +9 -0
- package/dist/grid-box/root.js +8 -0
- package/dist/grid-box/use-aggregation-box-items.d.ts +18 -0
- package/dist/grid-box/use-aggregation-box-items.js +60 -0
- package/dist/grid-box/use-column-box-items.d.ts +31 -0
- package/dist/grid-box/use-column-box-items.js +81 -0
- package/dist/grid-box/use-row-group-box-items.d.ts +18 -0
- package/dist/grid-box/use-row-group-box-items.js +134 -0
- package/dist/grid-provider/context.d.ts +5 -0
- package/dist/grid-provider/context.js +2 -0
- package/dist/grid-provider/provider.d.ts +3 -0
- package/dist/grid-provider/provider.js +2 -0
- package/dist/grid-provider/use-grid.d.ts +3 -0
- package/dist/grid-provider/use-grid.js +3 -0
- package/dist/grid.d.ts +29 -0
- package/dist/grid.js +38 -0
- package/dist/header/header-cell.d.ts +10 -0
- package/dist/header/header-cell.js +24 -0
- package/dist/header/header-group-cell.d.ts +5 -0
- package/dist/header/header-group-cell.js +14 -0
- package/dist/header/header-row.d.ts +4 -0
- package/dist/header/header-row.js +10 -0
- package/dist/header/header.d.ts +1 -0
- package/dist/header/header.js +10 -0
- package/dist/header/resize-handler.d.ts +12 -0
- package/dist/header/resize-handler.js +128 -0
- package/dist/header/use-drag-move.d.ts +14 -0
- package/dist/header/use-drag-move.js +90 -0
- package/dist/header/use-header-cell-renderer.d.ts +4 -0
- package/dist/header/use-header-cell-renderer.js +36 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -3860
- package/dist/license.d.ts +2 -0
- package/dist/license.js +217 -0
- package/dist/listbox/context.d.ts +6 -0
- package/dist/listbox/context.js +3 -0
- package/dist/listbox/item.d.ts +1 -0
- package/dist/listbox/item.js +25 -0
- package/dist/listbox/panel.d.ts +1 -0
- package/dist/listbox/panel.js +50 -0
- package/dist/listbox/root.d.ts +6 -0
- package/dist/listbox/root.js +12 -0
- package/dist/root/dialog-driver.js +21 -0
- package/dist/root/popover-driver.js +21 -0
- package/dist/root/root.d.ts +8 -0
- package/dist/root/root.js +120 -0
- package/dist/row-data-source-client/+constants.d.ts +2 -0
- package/dist/row-data-source-client/+constants.js +2 -0
- package/dist/row-data-source-client/+types.d.ts +27 -0
- package/dist/row-data-source-client/+types.js +1 -0
- package/dist/row-data-source-client/built-ins/avg.d.ts +10 -0
- package/dist/row-data-source-client/built-ins/avg.js +16 -0
- package/dist/row-data-source-client/built-ins/built-ins.d.ts +44 -0
- package/dist/row-data-source-client/built-ins/built-ins.js +44 -0
- package/dist/row-data-source-client/built-ins/count.d.ts +10 -0
- package/dist/row-data-source-client/built-ins/count.js +16 -0
- package/dist/row-data-source-client/built-ins/first.d.ts +10 -0
- package/dist/row-data-source-client/built-ins/first.js +12 -0
- package/dist/row-data-source-client/built-ins/group.d.ts +1 -0
- package/dist/row-data-source-client/built-ins/group.js +3 -0
- package/dist/row-data-source-client/built-ins/last.d.ts +10 -0
- package/dist/row-data-source-client/built-ins/last.js +12 -0
- package/dist/row-data-source-client/built-ins/max.d.ts +11 -0
- package/dist/row-data-source-client/built-ins/max.js +25 -0
- package/dist/row-data-source-client/built-ins/min.d.ts +11 -0
- package/dist/row-data-source-client/built-ins/min.js +25 -0
- package/dist/row-data-source-client/built-ins/sum.d.ts +10 -0
- package/dist/row-data-source-client/built-ins/sum.js +21 -0
- package/dist/row-data-source-client/filter/+types.d.ts +23 -0
- package/dist/row-data-source-client/filter/+types.js +1 -0
- package/dist/row-data-source-client/filter/compute-filtered-rows.d.ts +2 -0
- package/dist/row-data-source-client/filter/compute-filtered-rows.js +109 -0
- package/dist/row-data-source-client/pivots/create-agg-model.d.ts +6 -0
- package/dist/row-data-source-client/pivots/create-agg-model.js +13 -0
- package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.d.ts +2 -0
- package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.js +50 -0
- package/dist/row-data-source-client/pivots/create-pivot-columns.d.ts +2 -0
- package/dist/row-data-source-client/pivots/create-pivot-columns.js +22 -0
- package/dist/row-data-source-client/pivots/create-pivot-tree.d.ts +2 -0
- package/dist/row-data-source-client/pivots/create-pivot-tree.js +23 -0
- package/dist/row-data-source-client/tree/client-tree.d.ts +18 -0
- package/dist/row-data-source-client/tree/client-tree.js +76 -0
- package/dist/row-data-source-client/tree/evaluator-aggregation.d.ts +2 -0
- package/dist/row-data-source-client/tree/evaluator-aggregation.js +8 -0
- package/dist/row-data-source-client/tree/evaluator-group.d.ts +2 -0
- package/dist/row-data-source-client/tree/evaluator-group.js +9 -0
- package/dist/row-data-source-client/tree/traverse.d.ts +2 -0
- package/dist/row-data-source-client/tree/traverse.js +22 -0
- package/dist/row-data-source-client/use-client-data-source-paginated.d.ts +10 -0
- package/dist/row-data-source-client/use-client-data-source-paginated.js +538 -0
- package/dist/row-data-source-client/use-client-data-source.d.ts +10 -0
- package/dist/row-data-source-client/use-client-data-source.js +667 -0
- package/dist/row-data-source-client/use-client-tree-data-source.d.ts +9 -0
- package/dist/row-data-source-client/use-client-tree-data-source.js +513 -0
- package/dist/row-data-source-server/async-tree/+constants.async-tree.d.ts +1 -0
- package/dist/row-data-source-server/async-tree/+constants.async-tree.js +1 -0
- package/dist/row-data-source-server/async-tree/+types.async-tree.d.ts +59 -0
- package/dist/row-data-source-server/async-tree/+types.async-tree.js +1 -0
- package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.js +27 -0
- package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.js +36 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.js +24 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.js +14 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.js +18 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.js +14 -0
- package/dist/row-data-source-server/async-tree/get-parent-node-by-path.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/get-parent-node-by-path.js +18 -0
- package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.js +3 -0
- package/dist/row-data-source-server/async-tree/make-async-tree.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/make-async-tree.js +19 -0
- package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.js +8 -0
- package/dist/row-data-source-server/async-tree/maybe-apply-resize.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/maybe-apply-resize.js +17 -0
- package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.d.ts +2 -0
- package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.js +51 -0
- package/dist/row-data-source-server/range-tree/range-tree.d.ts +66 -0
- package/dist/row-data-source-server/range-tree/range-tree.js +102 -0
- package/dist/row-data-source-server/use-server-data-source.d.ts +3 -0
- package/dist/row-data-source-server/use-server-data-source.js +679 -0
- package/dist/row-data-source-server/utils/get-node-depth.d.ts +2 -0
- package/dist/row-data-source-server/utils/get-node-depth.js +9 -0
- package/dist/row-data-source-server/utils/get-node-path.d.ts +2 -0
- package/dist/row-data-source-server/utils/get-node-path.js +9 -0
- package/dist/row-data-source-server/utils/get-request-id.d.ts +1 -0
- package/dist/row-data-source-server/utils/get-request-id.js +6 -0
- package/dist/rows/row/context.d.ts +6 -0
- package/dist/rows/row/context.js +3 -0
- package/dist/rows/row/row.d.ts +7 -0
- package/dist/rows/row/row.js +16 -0
- package/dist/rows/row/use-row-context-value.d.ts +6 -0
- package/dist/rows/row/use-row-context-value.js +29 -0
- package/dist/rows/row-detail-row.d.ts +4 -0
- package/dist/rows/row-detail-row.js +131 -0
- package/dist/rows/row-full-width.d.ts +8 -0
- package/dist/rows/row-full-width.js +17 -0
- package/dist/rows/rows-container.d.ts +1 -0
- package/dist/rows/rows-container.js +9 -0
- package/dist/rows/rows-sections.d.ts +3 -0
- package/dist/rows/rows-sections.js +27 -0
- package/dist/rows/scrollers/native-scroller.d.ts +2 -0
- package/dist/rows/scrollers/native-scroller.js +18 -0
- package/dist/{types/sort-manager/use-sort-state.d.ts → sort-manager/+types.d.ts} +5 -2
- package/dist/sort-manager/+types.js +1 -0
- package/dist/sort-manager/context.d.ts +14 -0
- package/dist/sort-manager/context.js +5 -0
- package/dist/sort-manager/hooks/use-sort-manager.d.ts +15 -0
- package/dist/sort-manager/hooks/use-sort-manager.js +56 -0
- package/dist/{types/sort-manager/sort-manager-container.d.ts → sort-manager/hooks/use-sort-row-item.d.ts} +5 -7
- package/dist/sort-manager/hooks/use-sort-row-item.js +145 -0
- package/dist/sort-manager/hooks/use-sortable-column-items.d.ts +5 -0
- package/dist/sort-manager/hooks/use-sortable-column-items.js +13 -0
- package/dist/sort-manager/root.d.ts +3 -0
- package/dist/sort-manager/root.js +14 -0
- package/dist/sort-manager/sort-add.d.ts +8 -0
- package/dist/sort-manager/sort-add.js +14 -0
- package/dist/sort-manager/sort-apply.d.ts +7 -0
- package/dist/sort-manager/sort-apply.js +24 -0
- package/dist/sort-manager/sort-cancel.d.ts +7 -0
- package/dist/sort-manager/sort-cancel.js +27 -0
- package/dist/sort-manager/sort-clear.d.ts +7 -0
- package/dist/sort-manager/sort-clear.js +22 -0
- package/dist/sort-manager/sort-column-select.d.ts +10 -0
- package/dist/sort-manager/sort-column-select.js +20 -0
- package/dist/sort-manager/sort-direction-select.d.ts +10 -0
- package/dist/sort-manager/sort-direction-select.js +24 -0
- package/dist/sort-manager/sort-manager.d.ts +16 -0
- package/dist/sort-manager/sort-manager.js +26 -0
- package/dist/sort-manager/sort-remove.d.ts +7 -0
- package/dist/sort-manager/sort-remove.js +14 -0
- package/dist/sort-manager/sort-row.d.ts +5 -0
- package/dist/sort-manager/sort-row.js +7 -0
- package/dist/sort-manager/sort-rows.d.ts +1 -0
- package/dist/sort-manager/sort-rows.js +6 -0
- package/dist/sort-manager/sort-value-select.d.ts +11 -0
- package/dist/sort-manager/sort-value-select.js +25 -0
- package/dist/sort-manager/utils/sort-item-to-sort-model.d.ts +3 -0
- package/dist/sort-manager/utils/sort-item-to-sort-model.js +57 -0
- package/dist/sort-manager/utils/sort-model-to-sort-items.d.ts +3 -0
- package/dist/sort-manager/utils/sort-model-to-sort-items.js +49 -0
- package/dist/state/+types.d.ts +34 -0
- package/dist/state/+types.js +1 -0
- package/dist/state/api/column-autosize.d.ts +5 -0
- package/dist/state/api/column-autosize.js +72 -0
- package/dist/state/api/column-by-id.d.ts +2 -0
- package/dist/state/api/column-by-id.js +6 -0
- package/dist/state/api/column-field.d.ts +2 -0
- package/dist/state/api/column-field.js +23 -0
- package/dist/state/api/column-from-index.d.ts +2 -0
- package/dist/state/api/column-from-index.js +6 -0
- package/dist/state/api/column-group-toggle.d.ts +2 -0
- package/dist/state/api/column-group-toggle.js +10 -0
- package/dist/state/api/column-index.d.ts +2 -0
- package/dist/state/api/column-index.js +7 -0
- package/dist/state/api/column-move.d.ts +2 -0
- package/dist/state/api/column-move.js +49 -0
- package/dist/state/api/column-resize.d.ts +2 -0
- package/dist/state/api/column-resize.js +9 -0
- package/dist/state/api/column-update.d.ts +2 -0
- package/dist/state/api/column-update.js +13 -0
- package/dist/state/api/dialog-frame.d.ts +8 -0
- package/dist/state/api/dialog-frame.js +16 -0
- package/dist/state/api/edit-begin.d.ts +5 -0
- package/dist/state/api/edit-begin.js +91 -0
- package/dist/state/api/edit-end.d.ts +5 -0
- package/dist/state/api/edit-end.js +43 -0
- package/dist/state/api/edit-is-cell-active.d.ts +5 -0
- package/dist/state/api/edit-is-cell-active.js +27 -0
- package/dist/state/api/edit-update.d.ts +5 -0
- package/dist/state/api/edit-update.js +88 -0
- package/dist/state/api/event-listeners.d.ts +5 -0
- package/dist/state/api/event-listeners.js +19 -0
- package/dist/state/api/export-csv.d.ts +3 -0
- package/dist/state/api/export-csv.js +40 -0
- package/dist/state/api/export-data-rect.d.ts +2 -0
- package/dist/state/api/export-data-rect.js +24 -0
- package/dist/state/api/focus-cell.d.ts +5 -0
- package/dist/state/api/focus-cell.js +117 -0
- package/dist/state/api/popover-frame.d.ts +8 -0
- package/dist/state/api/popover-frame.js +16 -0
- package/dist/state/api/position-from-element.d.ts +2 -0
- package/dist/state/api/position-from-element.js +9 -0
- package/dist/state/api/row-by-id.d.ts +2 -0
- package/dist/state/api/row-by-id.js +5 -0
- package/dist/state/api/row-by-index.d.ts +2 -0
- package/dist/state/api/row-by-index.js +9 -0
- package/dist/state/api/row-detail-is-expanded.d.ts +2 -0
- package/dist/state/api/row-detail-is-expanded.js +6 -0
- package/dist/state/api/row-detail-rendered-height.d.ts +5 -0
- package/dist/state/api/row-detail-rendered-height.js +14 -0
- package/dist/state/api/row-detail-toggle.d.ts +2 -0
- package/dist/state/api/row-detail-toggle.js +32 -0
- package/dist/state/api/row-group-apply-expansions.d.ts +2 -0
- package/dist/state/api/row-group-apply-expansions.js +20 -0
- package/dist/state/api/row-group-column-index.d.ts +2 -0
- package/dist/state/api/row-group-column-index.js +14 -0
- package/dist/state/api/row-group-is-expanded.d.ts +2 -0
- package/dist/state/api/row-group-is-expanded.js +15 -0
- package/dist/state/api/row-group-toggle.d.ts +2 -0
- package/dist/state/api/row-group-toggle.js +7 -0
- package/dist/state/api/row-handle-select.d.ts +5 -0
- package/dist/state/api/row-handle-select.js +43 -0
- package/dist/state/api/row-select-all.d.ts +2 -0
- package/dist/state/api/row-select-all.js +17 -0
- package/dist/state/api/row-select.d.ts +5 -0
- package/dist/state/api/row-select.js +35 -0
- package/dist/state/api/row-selected.d.ts +2 -0
- package/dist/state/api/row-selected.js +13 -0
- package/dist/state/api/scroll-into-view.d.ts +5 -0
- package/dist/state/api/scroll-into-view.js +50 -0
- package/dist/state/api/sort-for-column.d.ts +2 -0
- package/dist/state/api/sort-for-column.js +9 -0
- package/dist/state/api/use-row-drag.d.ts +2 -0
- package/dist/state/api/use-row-drag.js +27 -0
- package/dist/state/helpers/cell-row-group.d.ts +2 -0
- package/dist/state/helpers/cell-row-group.js +19 -0
- package/dist/state/helpers/column-add-row-group.d.ts +9 -0
- package/dist/state/helpers/column-add-row-group.js +66 -0
- package/dist/state/helpers/column-layout.d.ts +3 -0
- package/dist/state/helpers/column-layout.js +65 -0
- package/dist/state/helpers/column-marker.d.ts +8 -0
- package/dist/state/helpers/column-marker.js +43 -0
- package/dist/state/helpers/column-view.d.ts +21 -0
- package/dist/state/helpers/column-view.js +33 -0
- package/dist/state/helpers/edit-on-change.d.ts +15 -0
- package/dist/state/helpers/edit-on-change.js +26 -0
- package/dist/state/helpers/empty-row-data-source.d.ts +2 -0
- package/dist/state/helpers/empty-row-data-source.js +17 -0
- package/dist/state/helpers/get-data-rect.d.ts +13 -0
- package/dist/state/helpers/get-data-rect.js +65 -0
- package/dist/state/helpers/get-full-width-callback.d.ts +2 -0
- package/dist/state/helpers/get-full-width-callback.js +8 -0
- package/dist/state/helpers/get-span-callback.d.ts +2 -0
- package/dist/state/helpers/get-span-callback.js +20 -0
- package/dist/state/helpers/resolve-column.d.ts +4 -0
- package/dist/state/helpers/resolve-column.js +22 -0
- package/dist/state/helpers/row-layout/get-focus-criteria.d.ts +17 -0
- package/dist/state/helpers/row-layout/get-focus-criteria.js +62 -0
- package/dist/state/helpers/row-layout/row-layout.d.ts +18 -0
- package/dist/state/helpers/row-layout/row-layout.js +414 -0
- package/dist/state/use-lytenyte.d.ts +3 -0
- package/dist/state/use-lytenyte.js +579 -0
- package/dist/tree-view/branch/branch.d.ts +11 -0
- package/dist/tree-view/branch/branch.js +61 -0
- package/dist/tree-view/branch/use-branch-keys.d.ts +2 -0
- package/dist/tree-view/branch/use-branch-keys.js +87 -0
- package/dist/tree-view/context.d.ts +22 -0
- package/dist/tree-view/context.js +3 -0
- package/dist/tree-view/depth-provider.d.ts +2 -0
- package/dist/tree-view/depth-provider.js +3 -0
- package/dist/tree-view/hooks/use-tree-view-paths.d.ts +2 -0
- package/dist/tree-view/hooks/use-tree-view-paths.js +9 -0
- package/dist/tree-view/index.d.ts +16 -0
- package/dist/tree-view/index.js +16 -0
- package/dist/tree-view/leaf.d.ts +4 -0
- package/dist/tree-view/leaf.js +27 -0
- package/dist/tree-view/navigation/get-all-ids.d.ts +1 -0
- package/dist/tree-view/navigation/get-all-ids.js +7 -0
- package/dist/tree-view/navigation/get-first-node.d.ts +1 -0
- package/dist/tree-view/navigation/get-first-node.js +7 -0
- package/dist/tree-view/navigation/get-last-node.d.ts +1 -0
- package/dist/tree-view/navigation/get-last-node.js +7 -0
- package/dist/tree-view/navigation/get-next-node.d.ts +1 -0
- package/dist/tree-view/navigation/get-next-node.js +13 -0
- package/dist/tree-view/navigation/get-prev-node.d.ts +1 -0
- package/dist/tree-view/navigation/get-prev-node.js +13 -0
- package/dist/tree-view/panel/make-handle-navigation.d.ts +2 -0
- package/dist/tree-view/panel/make-handle-navigation.js +39 -0
- package/dist/tree-view/panel/make-handle-selection.d.ts +2 -0
- package/dist/tree-view/panel/make-handle-selection.js +92 -0
- package/dist/tree-view/panel/make-handle-typeahead.d.ts +1 -0
- package/dist/tree-view/panel/make-handle-typeahead.js +45 -0
- package/dist/tree-view/panel/panel.d.ts +1 -0
- package/dist/tree-view/panel/panel.js +30 -0
- package/dist/tree-view/panel/use-tree-navigation.d.ts +1 -0
- package/dist/tree-view/panel/use-tree-navigation.js +63 -0
- package/dist/tree-view/root.d.ts +17 -0
- package/dist/tree-view/root.js +63 -0
- package/dist/tree-view/utils/get-focusable-nodes.d.ts +1 -0
- package/dist/tree-view/utils/get-focusable-nodes.js +5 -0
- package/dist/tree-view/utils/get-focused-node.d.ts +1 -0
- package/dist/tree-view/utils/get-focused-node.js +14 -0
- package/dist/tree-view/utils/get-ids-between-nodes.d.ts +1 -0
- package/dist/tree-view/utils/get-ids-between-nodes.js +15 -0
- package/dist/tree-view/utils/get-panel.d.ts +1 -0
- package/dist/tree-view/utils/get-panel.js +7 -0
- package/dist/tree-view/utils/get-parent-node.d.ts +1 -0
- package/dist/tree-view/utils/get-parent-node.js +10 -0
- package/dist/tree-view/utils/get-sibling-branches.d.ts +1 -0
- package/dist/tree-view/utils/get-sibling-branches.js +14 -0
- package/dist/tree-view/utils/get-tree-node-id.d.ts +1 -0
- package/dist/tree-view/utils/get-tree-node-id.js +3 -0
- package/dist/tree-view/utils/is-branch-node.d.ts +1 -0
- package/dist/tree-view/utils/is-branch-node.js +3 -0
- package/dist/tree-view/utils/is-leaf-node.d.ts +1 -0
- package/dist/tree-view/utils/is-leaf-node.js +3 -0
- package/dist/tree-view/utils/is-tree-node-disabled.d.ts +1 -0
- package/dist/tree-view/utils/is-tree-node-disabled.js +3 -0
- package/dist/tree-view/utils/select-node.d.ts +2 -0
- package/dist/tree-view/utils/select-node.js +15 -0
- package/dist/tree-view/utils/toggle-all-selections.d.ts +2 -0
- package/dist/tree-view/utils/toggle-all-selections.js +9 -0
- package/dist/tree-view/utils/toggle-selection.d.ts +2 -0
- package/dist/tree-view/utils/toggle-selection.js +21 -0
- package/dist/tree-view/virtualized/force-sync-scrolling.d.ts +2 -0
- package/dist/tree-view/virtualized/force-sync-scrolling.js +23 -0
- package/dist/tree-view/virtualized/get-virtual-tree-paths.d.ts +2 -0
- package/dist/tree-view/virtualized/get-virtual-tree-paths.js +14 -0
- package/dist/tree-view/virtualized/make-virtual-tree.d.ts +31 -0
- package/dist/tree-view/virtualized/make-virtual-tree.js +90 -0
- package/dist/tree-view/virtualized/use-flattened-tree.d.ts +9 -0
- package/dist/tree-view/virtualized/use-flattened-tree.js +36 -0
- package/dist/tree-view/virtualized/use-row-start-and-end.d.ts +2 -0
- package/dist/tree-view/virtualized/use-row-start-and-end.js +27 -0
- package/dist/tree-view/virtualized/use-virtualized-tree.d.ts +22 -0
- package/dist/tree-view/virtualized/use-virtualized-tree.js +100 -0
- package/dist/types/types.d.ts +8 -13
- package/dist/types/types.js +1 -0
- package/dist/utils/cycle-sorts.d.ts +2 -0
- package/dist/utils/cycle-sorts.js +16 -0
- package/dist/viewport/begin-editing.d.ts +5 -0
- package/dist/viewport/begin-editing.js +15 -0
- package/dist/viewport/viewport.d.ts +1 -0
- package/dist/viewport/viewport.js +77 -0
- package/main.css +315 -0
- package/package.json +31 -79
- package/dist/CompositeList-CGRaS6LQ.js +0 -149
- package/dist/DialogPortalContext-C2WZTqJ3.js +0 -47
- package/dist/DirectionContext-DIPP5cAe.js +0 -15
- package/dist/InternalBackdrop-C4RACVzs.js +0 -324
- package/dist/PopoverPortalContext-BdsDjihw.js +0 -26
- package/dist/anchor-context-Cqr_oiJt.js +0 -11
- package/dist/arrow-down-icon-B-3ldODD.js +0 -27
- package/dist/column-manager.js +0 -1228
- package/dist/column-menu-driver-cG-EZgLa.js +0 -491
- package/dist/cross-icon-CEMLAlFX.js +0 -20
- package/dist/dialog.js +0 -506
- package/dist/drag-store-BMsDBUy_.js +0 -1039
- package/dist/filter-manager.js +0 -1057
- package/dist/getPseudoElementBounds-BSHt6WYm.js +0 -26
- package/dist/grid-container.js +0 -18
- package/dist/icons.js +0 -516
- package/dist/lytenyte-pro.css +0 -2167
- package/dist/manage-columns-icon-D4CElo5H.js +0 -146
- package/dist/menu-lIx6h6Vn.js +0 -1885
- package/dist/menu.js +0 -4
- package/dist/more-dots-icon-CzAH3xHG.js +0 -26
- package/dist/pill-BHBLeJ6k.js +0 -1012
- package/dist/pill-manager.js +0 -737
- package/dist/plus-icon-ToqW5CC-.js +0 -15
- package/dist/popover.js +0 -795
- package/dist/proptypes-BjYr2nFr.js +0 -6472
- package/dist/row-group-icon-DFUMye0v.js +0 -186
- package/dist/search-icon-CcG1lqsn.js +0 -86
- package/dist/select-Db5ksjoS.js +0 -2256
- package/dist/separator-BnPPeAk8.js +0 -21
- package/dist/sort-descending-BMtfaa2L.js +0 -34
- package/dist/sort-manager.js +0 -308
- package/dist/tickmark-icon-CoogRMoO.js +0 -51
- package/dist/types/anchor-context/anchor-context.d.ts +0 -6
- package/dist/types/cell-selection/cell-selection-containers.d.ts +0 -3
- package/dist/types/column-manager/column-manager-context.d.ts +0 -12
- package/dist/types/column-manager/column-manager-drag-box-controls.d.ts +0 -1
- package/dist/types/column-manager/column-manager-drag-box-expander.d.ts +0 -1
- package/dist/types/column-manager/column-manager-drag-box-label.d.ts +0 -5
- package/dist/types/column-manager/column-manager-drag-box.d.ts +0 -13
- package/dist/types/column-manager/column-manager-drag-placeholder.d.ts +0 -5
- package/dist/types/column-manager/column-manager-drop-zone.d.ts +0 -10
- package/dist/types/column-manager/column-manager-impl.d.ts +0 -36
- package/dist/types/column-manager/column-manager-pill.d.ts +0 -4
- package/dist/types/column-manager/column-manager-pivot-mode-toggle.d.ts +0 -1
- package/dist/types/column-manager/column-manager-search.d.ts +0 -1
- package/dist/types/column-manager/column-manager-state.d.ts +0 -8
- package/dist/types/column-manager/column-manager-tree-item.d.ts +0 -6
- package/dist/types/column-manager/column-manager-tree.d.ts +0 -11
- package/dist/types/column-manager/column-manager-types.d.ts +0 -1
- package/dist/types/column-manager/column-manager.d.ts +0 -1
- package/dist/types/column-manager/utils/all-leafs.d.ts +0 -3
- package/dist/types/column-manager/utils/can-hide-item.d.ts +0 -3
- package/dist/types/column-manager/utils/handle-item-hide.d.ts +0 -3
- package/dist/types/components-internal/button/button.d.ts +0 -9
- package/dist/types/components-internal/grid-frame/grid-frame.d.ts +0 -11
- package/dist/types/components-internal/radio/radio.d.ts +0 -5
- package/dist/types/components-internal/separator/separator.d.ts +0 -8
- package/dist/types/components-internal/toggle/toggle.d.ts +0 -7
- package/dist/types/dialog/dialog-impl.d.ts +0 -6
- package/dist/types/dialog/dialog.d.ts +0 -8
- package/dist/types/dialog/use-dialog-class.d.ts +0 -1
- package/dist/types/external.d.ts +0 -2
- package/dist/types/filter-manager/combined-to-flat.d.ts +0 -3
- package/dist/types/filter-manager/components/apply-filter-button.d.ts +0 -1
- package/dist/types/filter-manager/components/clear-filter-button.d.ts +0 -1
- package/dist/types/filter-manager/components/flatten-tree-items.d.ts +0 -4
- package/dist/types/filter-manager/components/get-child-values.d.ts +0 -2
- package/dist/types/filter-manager/components/in-filter-container.d.ts +0 -1
- package/dist/types/filter-manager/components/in-filter-error.d.ts +0 -5
- package/dist/types/filter-manager/components/in-filter-loading.d.ts +0 -1
- package/dist/types/filter-manager/components/in-filter-root.d.ts +0 -11
- package/dist/types/filter-manager/components/in-filter-tree.d.ts +0 -15
- package/dist/types/filter-manager/components/simple-filter-additional-switch.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-operator/date-operator.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-operator/number-operator.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-operator/simple-filter-operator.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-operator/text-operator.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-root.d.ts +0 -9
- package/dist/types/filter-manager/components/simple-filter-value/date-value.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-value/number-value.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-value/simple-filter-value.d.ts +0 -1
- package/dist/types/filter-manager/components/simple-filter-value/text-value.d.ts +0 -1
- package/dist/types/filter-manager/components/use-date-filter-callbacks.d.ts +0 -9
- package/dist/types/filter-manager/components/use-in-filter-item-loader.d.ts +0 -7
- package/dist/types/filter-manager/components/use-number-filter-callbacks.d.ts +0 -8
- package/dist/types/filter-manager/components/use-text-filter-callbacks.d.ts +0 -8
- package/dist/types/filter-manager/filter-manager-impl.d.ts +0 -27
- package/dist/types/filter-manager/filter-manager.d.ts +0 -1
- package/dist/types/filter-manager/filter-state-context.d.ts +0 -16
- package/dist/types/filter-manager/flat-to-combined.d.ts +0 -3
- package/dist/types/filter-manager/flatten-combined-filter.d.ts +0 -3
- package/dist/types/filter-manager/is-filter-complete.d.ts +0 -2
- package/dist/types/filter-manager/types.d.ts +0 -15
- package/dist/types/filter-manager/use-in-filter.d.ts +0 -5
- package/dist/types/filter-manager/use-simple-filters.d.ts +0 -8
- package/dist/types/grid-container/grid-container-impl.d.ts +0 -6
- package/dist/types/grid-container/grid-container.d.ts +0 -2
- package/dist/types/header-cell/header-cell-default.d.ts +0 -2
- package/dist/types/icons.d.ts +0 -1
- package/dist/types/index.d.ts +0 -8
- package/dist/types/license.d.ts +0 -12
- package/dist/types/list-view/list-view-context.d.ts +0 -21
- package/dist/types/list-view/list-view.d.ts +0 -26
- package/dist/types/lytenyte-pro.d.ts +0 -7
- package/dist/types/menu/arrow-svg.d.ts +0 -1
- package/dist/types/menu/column-menu/column-menu-driver.d.ts +0 -4
- package/dist/types/menu/context-menu/context-menu-driver.d.ts +0 -1
- package/dist/types/menu/context-menu/use-context-menu-listener.d.ts +0 -6
- package/dist/types/menu/menu-impl.d.ts +0 -18
- package/dist/types/menu/menu.d.ts +0 -19
- package/dist/types/menu/use-menu-class-name.d.ts +0 -1
- package/dist/types/menu-frame/menu-frame-driver.d.ts +0 -1
- package/dist/types/overlay/load-error-overlay.d.ts +0 -1
- package/dist/types/overlay/loading-overlay.d.ts +0 -1
- package/dist/types/overlay/no-data-overlay.d.ts +0 -1
- package/dist/types/overlay/overlay-driver.d.ts +0 -1
- package/dist/types/pill/pill.d.ts +0 -5
- package/dist/types/pill-manager/pill-manager-agg-menu.d.ts +0 -7
- package/dist/types/pill-manager/pill-manager-controls.d.ts +0 -9
- package/dist/types/pill-manager/pill-manager-drag-placeholder.d.ts +0 -5
- package/dist/types/pill-manager/pill-manager-expander.d.ts +0 -1
- package/dist/types/pill-manager/pill-manager-impl.d.ts +0 -50
- package/dist/types/pill-manager/pill-manager-pill.d.ts +0 -5
- package/dist/types/pill-manager/pill-manager-pills/pill-manager-pills.d.ts +0 -2
- package/dist/types/pill-manager/pill-manager-pills/use-aggregation-source.d.ts +0 -2
- package/dist/types/pill-manager/pill-manager-pills/use-column-pivot-source.d.ts +0 -2
- package/dist/types/pill-manager/pill-manager-pills/use-column-source.d.ts +0 -2
- package/dist/types/pill-manager/pill-manager-pills/use-measures-source.d.ts +0 -2
- package/dist/types/pill-manager/pill-manager-pills/use-row-groups-source.d.ts +0 -2
- package/dist/types/pill-manager/pill-manager-pills/utils.d.ts +0 -3
- package/dist/types/pill-manager/pill-manager-row-label.d.ts +0 -22
- package/dist/types/pill-manager/pill-manager-row.d.ts +0 -12
- package/dist/types/pill-manager/pill-manager-rows.d.ts +0 -1
- package/dist/types/pill-manager/pill-manager-separator.d.ts +0 -1
- package/dist/types/pill-manager/pill-manager-types.d.ts +0 -36
- package/dist/types/pill-manager/pill-manager.d.ts +0 -1
- package/dist/types/popover/popover-impl.d.ts +0 -8
- package/dist/types/popover/popover.d.ts +0 -10
- package/dist/types/popover/use-popover-class.d.ts +0 -1
- package/dist/types/select/select.d.ts +0 -26
- package/dist/types/sort-manager/sort-adder.d.ts +0 -4
- package/dist/types/sort-manager/sort-apply.d.ts +0 -1
- package/dist/types/sort-manager/sort-cancel.d.ts +0 -1
- package/dist/types/sort-manager/sort-clear.d.ts +0 -1
- package/dist/types/sort-manager/sort-column-select.d.ts +0 -6
- package/dist/types/sort-manager/sort-direction-select.d.ts +0 -6
- package/dist/types/sort-manager/sort-items-to-sort-model.d.ts +0 -3
- package/dist/types/sort-manager/sort-manager-context.d.ts +0 -4
- package/dist/types/sort-manager/sort-manager-impl.d.ts +0 -32
- package/dist/types/sort-manager/sort-manager.d.ts +0 -1
- package/dist/types/sort-manager/sort-model-to-sort-items.d.ts +0 -4
- package/dist/types/sort-manager/sort-remove.d.ts +0 -4
- package/dist/types/sort-manager/sort-sort-select.d.ts +0 -6
- package/dist/types/sort-manager/use-sortable-column-items.d.ts +0 -9
- package/dist/types/use-client-data-source.d.ts +0 -6
- package/dist/types/use-edge-scroll.d.ts +0 -7
- package/dist/types/use-grid.d.ts +0 -6
- package/dist/types/use-lytenyte.d.ts +0 -11
- package/dist/types/use-server-data-source.d.ts +0 -3
- package/dist/types/use-tree-data-source.d.ts +0 -3
- package/dist/types/watermark.d.ts +0 -3
- package/dist/types.js +0 -1
- package/dist/useAnchorPositioning-52zK7jlD.js +0 -241
- package/dist/useButton-DWXzFgcr.js +0 -184
- package/dist/useScrollLock-D4UY33Sb.js +0 -425
- /package/dist/{types/cell-selection → cell-selection}/cell-selection-driver.d.ts +0 -0
- /package/dist/{types/dialog → root}/dialog-driver.d.ts +0 -0
- /package/dist/{types/popover → root}/popover-driver.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,3860 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { useContext, useMemo, useEffect, useRef, useState, useCallback, memo } from "react";
|
|
9
|
-
import { sizeFromCoord, clsx, getClientX, IsoResizeObserver, getPreciseElementDimensions, getClientY, getFocusableElements, clamp, equal, getRelativeXPosition, getRelativeYPosition } from "@1771technologies/js-utils";
|
|
10
|
-
import { useDraggable, useDroppable, dragState } from "@1771technologies/react-dragon";
|
|
11
|
-
import { getHoveredRowIndex, getHoveredColumnIndex, getRootCell } from "@1771technologies/grid-core";
|
|
12
|
-
import { c as useGrid$1, u as useControlled, a as useTransitionStatus, b as useScrollLock, G as GridProvider } from "./useScrollLock-D4UY33Sb.js";
|
|
13
|
-
import * as ReactDOM from "react-dom";
|
|
14
|
-
import { createPortal } from "react-dom";
|
|
15
|
-
import { cascada, signal } from "@1771technologies/react-cascada";
|
|
16
|
-
import { M as MenuRoot, a as MenuPortal, t as translateOpenChangeReason, P as PATIENT_CLICK_THRESHOLD, C as ColumnMenuDriver } from "./column-menu-driver-cG-EZgLa.js";
|
|
17
|
-
import { SplitPane, splitPaneAxe } from "@1771technologies/react-split-pane";
|
|
18
|
-
import { A as AnchorProvider } from "./anchor-context-Cqr_oiJt.js";
|
|
19
|
-
import { F as FloatingPortal, P as PropTypes, H as HTMLElementType, r as refType, j as useEventCallback, n as useOpenChangeComplete, p as useFloatingRootContext, x as useRole, v as useClick, w as useDismiss, L as getTarget, A as useInteractions, m as mergeProps, q as useHover, t as safePolygon } from "./proptypes-BjYr2nFr.js";
|
|
20
|
-
import { u as useDialogRootContext, D as DialogPortalContext, b as useOptionalDialogRootContext, c as DialogContext, d as DialogRootContext } from "./DialogPortalContext-C2WZTqJ3.js";
|
|
21
|
-
import { P as PopoverRootContext, u as usePopoverRootContext, b as PopoverPortalContext } from "./PopoverPortalContext-BdsDjihw.js";
|
|
22
|
-
import { makeGridPro } from "@1771technologies/grid-store-pro";
|
|
23
|
-
import { M as MoreDotsIcon } from "./more-dots-icon-CzAH3xHG.js";
|
|
24
|
-
import { S as SortAscending, a as SortDescending } from "./sort-descending-BMtfaa2L.js";
|
|
25
|
-
import { createClientDataSource } from "@1771technologies/grid-client-data-source-pro";
|
|
26
|
-
import { createTreeDataSource } from "@1771technologies/grid-tree-data-source";
|
|
27
|
-
import { createServerDataSource } from "@1771technologies/grid-server-data-source";
|
|
28
|
-
function useGrid() {
|
|
29
|
-
return useContext(context);
|
|
30
|
-
}
|
|
31
|
-
function useHeaderDisplayGridTemplate(levelsCount, headerHeight, groupHeaderHeight, floatingRowEnabled, floatingRowHeight) {
|
|
32
|
-
const gridTemplateRows = useMemo(() => {
|
|
33
|
-
const groupHeight = typeof groupHeaderHeight === "number" ? `${groupHeaderHeight}px` : "auto";
|
|
34
|
-
const height = typeof headerHeight === "number" ? `${headerHeight}px` : "auto";
|
|
35
|
-
const template = Array.from({ length: levelsCount }, () => groupHeight);
|
|
36
|
-
template.push(height);
|
|
37
|
-
if (floatingRowEnabled) {
|
|
38
|
-
const floatingHeight = typeof floatingRowHeight === "number" ? `${floatingRowHeight}px` : "auto";
|
|
39
|
-
template.push(floatingHeight);
|
|
40
|
-
}
|
|
41
|
-
return template.join(" ");
|
|
42
|
-
}, [floatingRowEnabled, floatingRowHeight, groupHeaderHeight, headerHeight, levelsCount]);
|
|
43
|
-
return gridTemplateRows;
|
|
44
|
-
}
|
|
45
|
-
function HeaderCellMarker({ api }) {
|
|
46
|
-
const mode = api.getState().rowSelectionMode.use() === "multiple";
|
|
47
|
-
const supportsSelectedAll = api.rowSelectionSelectAllSupported() && mode;
|
|
48
|
-
const allSelected = api.rowSelectionAllRowsSelected();
|
|
49
|
-
const selected = api.getState().rowSelectionSelectedIds.use();
|
|
50
|
-
const someSelected = useMemo(() => {
|
|
51
|
-
for (const c of selected) {
|
|
52
|
-
if (api.rowById(c)) return true;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}, [api, selected]);
|
|
56
|
-
if (!supportsSelectedAll) return null;
|
|
57
|
-
return /* @__PURE__ */ jsx(
|
|
58
|
-
"div",
|
|
59
|
-
{
|
|
60
|
-
style: {
|
|
61
|
-
display: "flex",
|
|
62
|
-
alignItems: "center",
|
|
63
|
-
justifyContent: "center",
|
|
64
|
-
width: "100%",
|
|
65
|
-
height: "100%"
|
|
66
|
-
},
|
|
67
|
-
children: /* @__PURE__ */ jsx(
|
|
68
|
-
Checkbox,
|
|
69
|
-
{
|
|
70
|
-
tabIndex: -1,
|
|
71
|
-
isChecked: allSelected || someSelected,
|
|
72
|
-
isDeterminate: !allSelected && someSelected,
|
|
73
|
-
onClick: () => {
|
|
74
|
-
if (allSelected) api.rowSelectionClear();
|
|
75
|
-
else api.rowSelectionSelectAll();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
function useHeaderCellRenderer(api, column) {
|
|
83
|
-
const sx = api.getState();
|
|
84
|
-
const renderers = sx.columnHeaderRenderers.use();
|
|
85
|
-
const base = sx.columnBase.use();
|
|
86
|
-
const defaultRenderer = sx.internal.columnHeaderDefaultRenderer.peek();
|
|
87
|
-
const Renderer = useMemo(() => {
|
|
88
|
-
if (column.id === COLUMN_MARKER_ID) return HeaderCellMarker;
|
|
89
|
-
const fn = column.headerRenderer ?? base.headerRenderer;
|
|
90
|
-
if (!fn) return defaultRenderer;
|
|
91
|
-
if (typeof fn === "string") {
|
|
92
|
-
const cell = renderers[fn];
|
|
93
|
-
if (!cell) throw new Error(`Header cell renderer with name ${fn} does not exist.`);
|
|
94
|
-
return cell;
|
|
95
|
-
}
|
|
96
|
-
return fn;
|
|
97
|
-
}, [base.headerRenderer, column.headerRenderer, column.id, defaultRenderer, renderers]);
|
|
98
|
-
return Renderer;
|
|
99
|
-
}
|
|
100
|
-
function useHeaderMove(api, column, columnIndex, ref) {
|
|
101
|
-
const gridId = api.getState().gridId.use();
|
|
102
|
-
const dragProps = useDraggable({
|
|
103
|
-
onDragStart: () => {
|
|
104
|
-
document.body.classList.add("lng1771-drag-on");
|
|
105
|
-
},
|
|
106
|
-
onDragEnd: () => {
|
|
107
|
-
document.body.classList.remove("lng1771-drag-on");
|
|
108
|
-
},
|
|
109
|
-
onDragCancel: () => {
|
|
110
|
-
document.body.classList.remove("lng1771-drag-on");
|
|
111
|
-
},
|
|
112
|
-
dragData: () => ({ columns: [column], columnIndex }),
|
|
113
|
-
dragTags: () => {
|
|
114
|
-
const c = [`${gridId}:grid:${column.pin ?? "none"}`];
|
|
115
|
-
const groupable = api.columnIsRowGroupable(column);
|
|
116
|
-
const isGrouped = api.getState().rowGroupModel.peek().includes(column.id);
|
|
117
|
-
if (groupable && !isGrouped) c.push(`${gridId}:grid:groupable`);
|
|
118
|
-
return c;
|
|
119
|
-
},
|
|
120
|
-
placeholder: () => /* @__PURE__ */ jsx(DragPlaceholder$1, { column })
|
|
121
|
-
});
|
|
122
|
-
const { canDrop, isOver, ...dropProps } = useDroppable({
|
|
123
|
-
tags: [`${gridId}:grid:${column.pin ?? "none"}`],
|
|
124
|
-
onDrop: (p2) => {
|
|
125
|
-
const data2 = p2.getData();
|
|
126
|
-
const dragIndex2 = data2.columnIndex;
|
|
127
|
-
const isBefore2 = columnIndex < dragIndex2;
|
|
128
|
-
const src = data2.columns.map((c) => c.id);
|
|
129
|
-
const target = column.id;
|
|
130
|
-
if (src.includes(target)) return;
|
|
131
|
-
if (isBefore2) api.columnMoveBefore(src, target);
|
|
132
|
-
else api.columnMoveAfter(src, target);
|
|
133
|
-
setTimeout(() => {
|
|
134
|
-
if (!ref.current) return;
|
|
135
|
-
const parent = ref.current.parentElement;
|
|
136
|
-
const movedEl = parent?.querySelector(
|
|
137
|
-
`[data-lng1771-column-id="${src[0]}"]`
|
|
138
|
-
);
|
|
139
|
-
movedEl?.focus();
|
|
140
|
-
}, 10);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
const dragData = dragState.dragData.use();
|
|
144
|
-
const data = dragData?.();
|
|
145
|
-
const dragIndex = data?.columnIndex ?? -1;
|
|
146
|
-
const isBefore = columnIndex < dragIndex;
|
|
147
|
-
const moveProps = api.columnIsMovable(column) ? dragProps : {};
|
|
148
|
-
return { moveProps, dropProps, isBefore, canDrop, isOver, dragIndex };
|
|
149
|
-
}
|
|
150
|
-
function DragPlaceholder$1(c) {
|
|
151
|
-
return /* @__PURE__ */ jsxs("div", { className: "lng1771-header-drag-placeholder--default", children: [
|
|
152
|
-
/* @__PURE__ */ jsx(
|
|
153
|
-
"svg",
|
|
154
|
-
{
|
|
155
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
156
|
-
width: "20px",
|
|
157
|
-
height: "20px",
|
|
158
|
-
fill: "currentcolor",
|
|
159
|
-
viewBox: "0 0 256 256",
|
|
160
|
-
children: /* @__PURE__ */ jsx("path", { d: "M90.34,61.66a8,8,0,0,1,0-11.32l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V96a8,8,0,0,1-16,0V43.31L101.66,61.66A8,8,0,0,1,90.34,61.66Zm64,132.68L136,212.69V160a8,8,0,0,0-16,0v52.69l-18.34-18.35a8,8,0,0,0-11.32,11.32l32,32a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm83.32-72-32-32a8,8,0,0,0-11.32,11.32L212.69,120H160a8,8,0,0,0,0,16h52.69l-18.35,18.34a8,8,0,0,0,11.32,11.32l32-32A8,8,0,0,0,237.66,122.34ZM43.31,136H96a8,8,0,0,0,0-16H43.31l18.35-18.34A8,8,0,0,0,50.34,90.34l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32Z" })
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
/* @__PURE__ */ jsx("span", { children: c.column.headerName ?? c.column.id })
|
|
164
|
-
] });
|
|
165
|
-
}
|
|
166
|
-
function useHeaderFocus(api, ref, columnIndex) {
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
const sx = api.getState();
|
|
169
|
-
const unsub = sx.internal.navigatePosition.watch(() => {
|
|
170
|
-
const position = sx.internal.navigatePosition.peek();
|
|
171
|
-
if (!ref.current || !position || position.kind !== HEADER_CELL_POSITION) return;
|
|
172
|
-
if (position.columnIndex === columnIndex && !ref.current.contains(document.activeElement)) {
|
|
173
|
-
api.navigateScrollIntoView(null, columnIndex);
|
|
174
|
-
ref.current.focus();
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
return () => unsub();
|
|
178
|
-
}, [api, columnIndex, ref]);
|
|
179
|
-
const onFocus = useEvent(() => {
|
|
180
|
-
api.getState().internal.navigatePosition.set({ kind: HEADER_CELL_POSITION, columnIndex });
|
|
181
|
-
});
|
|
182
|
-
return { onFocus };
|
|
183
|
-
}
|
|
184
|
-
function HeaderCell({
|
|
185
|
-
api,
|
|
186
|
-
column,
|
|
187
|
-
columnIndex,
|
|
188
|
-
viewportWidth,
|
|
189
|
-
rowStart,
|
|
190
|
-
rowEnd,
|
|
191
|
-
xPositions
|
|
192
|
-
}) {
|
|
193
|
-
const isStart = column.pin === "start";
|
|
194
|
-
const isEnd = column.pin === "end";
|
|
195
|
-
const rtl = api.getState().rtl.use();
|
|
196
|
-
const style = useMemo(() => {
|
|
197
|
-
const x2 = isEnd ? xPositions[columnIndex] - xPositions.at(-1) + viewportWidth : xPositions[columnIndex];
|
|
198
|
-
const width = sizeFromCoord(columnIndex, xPositions);
|
|
199
|
-
const style2 = {
|
|
200
|
-
transform: getTransform(x2 * (rtl ? -1 : 1), 0),
|
|
201
|
-
gridRowStart: rowStart,
|
|
202
|
-
gridRowEnd: rowEnd,
|
|
203
|
-
width
|
|
204
|
-
};
|
|
205
|
-
if (isStart || isEnd) {
|
|
206
|
-
style2.insetInlineStart = "0px";
|
|
207
|
-
style2.position = "sticky";
|
|
208
|
-
style2.zIndex = 2;
|
|
209
|
-
}
|
|
210
|
-
return style2;
|
|
211
|
-
}, [columnIndex, isEnd, isStart, rowEnd, rowStart, rtl, viewportWidth, xPositions]);
|
|
212
|
-
const Renderer = useHeaderCellRenderer(api, column);
|
|
213
|
-
const ref = useRef(null);
|
|
214
|
-
const { moveProps, dropProps, isBefore, isOver, canDrop, dragIndex } = useHeaderMove(
|
|
215
|
-
api,
|
|
216
|
-
column,
|
|
217
|
-
columnIndex,
|
|
218
|
-
ref
|
|
219
|
-
);
|
|
220
|
-
const sx = api.getState();
|
|
221
|
-
sx.sortModel.use();
|
|
222
|
-
const events = useHeaderFocus(api, ref, columnIndex);
|
|
223
|
-
if (api.columnIsEmpty(column)) {
|
|
224
|
-
return /* @__PURE__ */ jsx(
|
|
225
|
-
"button",
|
|
226
|
-
{
|
|
227
|
-
...events,
|
|
228
|
-
ref,
|
|
229
|
-
onClick: () => {
|
|
230
|
-
const id = column.id.replace(COLUMN_EMPTY_PREFIX, "").split("|>").slice(0, -1);
|
|
231
|
-
api.columnGroupToggle(id.join(api.getState().columnGroupIdDelimiter.peek()));
|
|
232
|
-
},
|
|
233
|
-
style,
|
|
234
|
-
className: "lng1771-header__cell-expand",
|
|
235
|
-
children: "+"
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
const sortDir = api.columnSortDirection(column);
|
|
240
|
-
return /* @__PURE__ */ jsx(
|
|
241
|
-
"div",
|
|
242
|
-
{
|
|
243
|
-
style,
|
|
244
|
-
ref,
|
|
245
|
-
role: "columnheader",
|
|
246
|
-
"data-lng1771-column-id": column.id,
|
|
247
|
-
"data-lng1771-kind": "header",
|
|
248
|
-
"aria-colindex": columnIndex + 1,
|
|
249
|
-
"aria-colspan": 1,
|
|
250
|
-
"aria-sort": sortDir === "asc" ? "ascending" : sortDir === "desc" ? "descending" : "none",
|
|
251
|
-
tabIndex: -1,
|
|
252
|
-
...moveProps,
|
|
253
|
-
...dropProps,
|
|
254
|
-
...events,
|
|
255
|
-
className: clsx(
|
|
256
|
-
"lng1771-header__cell",
|
|
257
|
-
isOver && columnIndex !== dragIndex && "lng1771-header__cell--over",
|
|
258
|
-
isOver && isBefore && "lng1771-header__cell--over-before",
|
|
259
|
-
isOver && !isBefore && "lng1771-header__cell--over-after",
|
|
260
|
-
isOver && !canDrop && "lng1771-header__cell--over-not-allowed"
|
|
261
|
-
),
|
|
262
|
-
children: /* @__PURE__ */ jsx(Renderer, { api, column })
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
function useHeaderCells(api) {
|
|
267
|
-
const sx = api.getState();
|
|
268
|
-
const visibleColumns = sx.columnsVisible.use();
|
|
269
|
-
const xPositions = sx.columnPositions.use();
|
|
270
|
-
const bounds = sx.internal.virtBounds.use();
|
|
271
|
-
const hierarchy = sx.columnGroupLevels.use();
|
|
272
|
-
const startCount = sx.columnVisibleStartCount.use();
|
|
273
|
-
const centerCount = sx.columnVisibleCenterCount.use();
|
|
274
|
-
const endCount = sx.columnVisibleEndCount.use();
|
|
275
|
-
const viewportWidth = sx.internal.viewportInnerWidth.use();
|
|
276
|
-
return useMemo(() => {
|
|
277
|
-
const cells = [];
|
|
278
|
-
const columnRowCount = hierarchy.length + 1;
|
|
279
|
-
function handleCell(i) {
|
|
280
|
-
const column = visibleColumns[i];
|
|
281
|
-
let rowStart = columnRowCount;
|
|
282
|
-
let level = columnRowCount - 2;
|
|
283
|
-
while (hierarchy[level]?.[i] === null) {
|
|
284
|
-
rowStart--;
|
|
285
|
-
level--;
|
|
286
|
-
}
|
|
287
|
-
cells.push(
|
|
288
|
-
/* @__PURE__ */ jsx(
|
|
289
|
-
HeaderCell,
|
|
290
|
-
{
|
|
291
|
-
api,
|
|
292
|
-
column,
|
|
293
|
-
columnIndex: i,
|
|
294
|
-
viewportWidth,
|
|
295
|
-
xPositions,
|
|
296
|
-
rowStart,
|
|
297
|
-
rowEnd: columnRowCount + 1,
|
|
298
|
-
startCount,
|
|
299
|
-
centerCount,
|
|
300
|
-
endCount
|
|
301
|
-
},
|
|
302
|
-
column.id
|
|
303
|
-
)
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
for (let i = 0; i < startCount; i++) {
|
|
307
|
-
handleCell(i);
|
|
308
|
-
}
|
|
309
|
-
for (let i = bounds.columnStart; i < bounds.columnEnd; i++) {
|
|
310
|
-
handleCell(i);
|
|
311
|
-
}
|
|
312
|
-
const first = startCount + centerCount;
|
|
313
|
-
for (let i = first; i < visibleColumns.length; i++) {
|
|
314
|
-
handleCell(i);
|
|
315
|
-
}
|
|
316
|
-
return cells;
|
|
317
|
-
}, [
|
|
318
|
-
api,
|
|
319
|
-
bounds.columnEnd,
|
|
320
|
-
bounds.columnStart,
|
|
321
|
-
centerCount,
|
|
322
|
-
endCount,
|
|
323
|
-
hierarchy,
|
|
324
|
-
startCount,
|
|
325
|
-
viewportWidth,
|
|
326
|
-
visibleColumns,
|
|
327
|
-
xPositions
|
|
328
|
-
]);
|
|
329
|
-
}
|
|
330
|
-
function useResizeDivider(api, column) {
|
|
331
|
-
const isResizable = api.columnIsResizable(column);
|
|
332
|
-
const [active, setActive] = useState(false);
|
|
333
|
-
const resizeProps = useMemo(() => {
|
|
334
|
-
if (!isResizable) return {};
|
|
335
|
-
const onPointerDown = (e) => {
|
|
336
|
-
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
337
|
-
const startWidth = api.columnVisualWidth(column);
|
|
338
|
-
const isRtl = api.getState().rtl.peek();
|
|
339
|
-
let startX = null;
|
|
340
|
-
let anim = null;
|
|
341
|
-
let delta = 0;
|
|
342
|
-
e.preventDefault();
|
|
343
|
-
e.stopPropagation();
|
|
344
|
-
document.body.classList.add("lng1771-column-resize-active");
|
|
345
|
-
setActive(true);
|
|
346
|
-
const controller = new AbortController();
|
|
347
|
-
document.addEventListener(
|
|
348
|
-
"pointermove",
|
|
349
|
-
(ev) => {
|
|
350
|
-
if (startX === null) {
|
|
351
|
-
startX = getClientX(ev);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
const endAdjust = column.pin === "end" ? -1 : 1;
|
|
355
|
-
const rtlAdjust = isRtl ? -1 : 1;
|
|
356
|
-
delta = (getClientX(ev) - startX) * endAdjust * rtlAdjust;
|
|
357
|
-
if (anim) cancelAnimationFrame(anim);
|
|
358
|
-
anim = requestAnimationFrame(() => {
|
|
359
|
-
api.getState().internal.columnWidthDeltas.set({ [column.id]: delta });
|
|
360
|
-
});
|
|
361
|
-
},
|
|
362
|
-
{ signal: controller.signal }
|
|
363
|
-
);
|
|
364
|
-
window.addEventListener(
|
|
365
|
-
"pointerup",
|
|
366
|
-
() => {
|
|
367
|
-
if (anim) cancelAnimationFrame(anim);
|
|
368
|
-
setActive(false);
|
|
369
|
-
document.body.classList.remove("lng1771-column-resize-active");
|
|
370
|
-
const newWidth = startWidth + delta;
|
|
371
|
-
api.columnResize(column, newWidth);
|
|
372
|
-
api.getState().internal.columnWidthDeltas.set(null);
|
|
373
|
-
controller.abort();
|
|
374
|
-
},
|
|
375
|
-
{ signal: controller.signal }
|
|
376
|
-
);
|
|
377
|
-
};
|
|
378
|
-
return { onPointerDown };
|
|
379
|
-
}, [api, column, isResizable]);
|
|
380
|
-
return { ...resizeProps, active };
|
|
381
|
-
}
|
|
382
|
-
function HeaderDivider({
|
|
383
|
-
api,
|
|
384
|
-
columnIndex,
|
|
385
|
-
xPositions,
|
|
386
|
-
viewportWidth,
|
|
387
|
-
rowStart,
|
|
388
|
-
rowEnd,
|
|
389
|
-
column,
|
|
390
|
-
startCount,
|
|
391
|
-
centerCount,
|
|
392
|
-
endCount
|
|
393
|
-
}) {
|
|
394
|
-
const isResizable = api.columnIsResizable(column);
|
|
395
|
-
const isLastStart = startCount > 0 && columnIndex === startCount - 1;
|
|
396
|
-
const isFirstEnd = endCount > 0 && startCount + centerCount === columnIndex;
|
|
397
|
-
const isLast = startCount + centerCount + endCount - 1 === columnIndex;
|
|
398
|
-
const { onPointerDown, active: resizeActive } = useResizeDivider(api, column);
|
|
399
|
-
const rtl = api.getState().rtl.use();
|
|
400
|
-
const style = useMemo(() => {
|
|
401
|
-
const isStart = column.pin === "start";
|
|
402
|
-
const isEnd = column.pin == "end";
|
|
403
|
-
const endAdjustment = centerCount + startCount - 1 === columnIndex && endCount > 0 ? 2 : 0;
|
|
404
|
-
const x2 = isEnd ? xPositions[columnIndex] - xPositions.at(-1) + viewportWidth - 2 : xPositions[columnIndex] + sizeFromCoord(columnIndex, xPositions) - 3 - endAdjustment;
|
|
405
|
-
const xAdjustment = isLastStart ? 1 : isFirstEnd ? 0 : isLast ? 1 : 0;
|
|
406
|
-
const style2 = {
|
|
407
|
-
transform: getTransform((x2 - xAdjustment) * (rtl ? -1 : 1), 0),
|
|
408
|
-
gridRowStart: rowStart,
|
|
409
|
-
gridRowEnd: rowEnd
|
|
410
|
-
};
|
|
411
|
-
if (isStart || isEnd) {
|
|
412
|
-
style2.insetInlineStart = "0px";
|
|
413
|
-
style2.position = "sticky";
|
|
414
|
-
style2.zIndex = 2;
|
|
415
|
-
}
|
|
416
|
-
if (isLast && !isResizable) style2.opacity = 0;
|
|
417
|
-
return style2;
|
|
418
|
-
}, [
|
|
419
|
-
centerCount,
|
|
420
|
-
column.pin,
|
|
421
|
-
columnIndex,
|
|
422
|
-
endCount,
|
|
423
|
-
isFirstEnd,
|
|
424
|
-
isLast,
|
|
425
|
-
isLastStart,
|
|
426
|
-
isResizable,
|
|
427
|
-
rowEnd,
|
|
428
|
-
rowStart,
|
|
429
|
-
rtl,
|
|
430
|
-
startCount,
|
|
431
|
-
viewportWidth,
|
|
432
|
-
xPositions
|
|
433
|
-
]);
|
|
434
|
-
return /* @__PURE__ */ jsx(
|
|
435
|
-
"div",
|
|
436
|
-
{
|
|
437
|
-
onPointerDown,
|
|
438
|
-
"data-resize-active": resizeActive,
|
|
439
|
-
onDoubleClick: () => {
|
|
440
|
-
const autosize = api.getState().autosizeDoubleClickHeader.peek();
|
|
441
|
-
if (autosize) api.autosizeColumn(column, { includeHeader: true });
|
|
442
|
-
},
|
|
443
|
-
className: clsx(
|
|
444
|
-
"lng1771-header__cell-divider",
|
|
445
|
-
isResizable && "lng1771-header__cell-divider--resizable"
|
|
446
|
-
),
|
|
447
|
-
style,
|
|
448
|
-
children: /* @__PURE__ */ jsx("div", {})
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
function useHeaderDividers(api) {
|
|
453
|
-
const sx = api.getState();
|
|
454
|
-
const xPositions = sx.columnPositions.use();
|
|
455
|
-
const hierarchy = sx.columnGroupLevels.use();
|
|
456
|
-
const viewportWidth = sx.internal.viewportInnerWidth.use();
|
|
457
|
-
const bounds = sx.internal.virtBounds.use();
|
|
458
|
-
const startCount = sx.columnVisibleStartCount.use();
|
|
459
|
-
const centerCount = sx.columnVisibleCenterCount.use();
|
|
460
|
-
const endCount = sx.columnVisibleEndCount.use();
|
|
461
|
-
const columns = sx.columnsVisible.use();
|
|
462
|
-
return useMemo(() => {
|
|
463
|
-
const firstEndIndex = xPositions.length - 1 - endCount;
|
|
464
|
-
const columnRowCount = hierarchy.length + 1;
|
|
465
|
-
const dividers = [];
|
|
466
|
-
const indices = Array.from(
|
|
467
|
-
{ length: bounds.columnEnd - bounds.columnStart },
|
|
468
|
-
(_, i) => i + bounds.columnStart
|
|
469
|
-
);
|
|
470
|
-
for (let i = startCount - 1; i >= 0; i--) indices.unshift(i);
|
|
471
|
-
const first = startCount + centerCount;
|
|
472
|
-
for (let j = first; j < centerCount + startCount + endCount; j++) indices.push(j);
|
|
473
|
-
for (let i = 0; i < indices.length - endCount; i++) {
|
|
474
|
-
const columnIndex = indices[i];
|
|
475
|
-
const rowStart = getRowStart(hierarchy, startCount, firstEndIndex, columnIndex);
|
|
476
|
-
const column = columns[columnIndex];
|
|
477
|
-
dividers.push(
|
|
478
|
-
/* @__PURE__ */ jsx(
|
|
479
|
-
HeaderDivider,
|
|
480
|
-
{
|
|
481
|
-
api,
|
|
482
|
-
column,
|
|
483
|
-
xPositions,
|
|
484
|
-
viewportWidth,
|
|
485
|
-
rowStart,
|
|
486
|
-
rowEnd: columnRowCount + 1,
|
|
487
|
-
columnIndex,
|
|
488
|
-
startCount,
|
|
489
|
-
centerCount,
|
|
490
|
-
endCount
|
|
491
|
-
},
|
|
492
|
-
column.id
|
|
493
|
-
)
|
|
494
|
-
);
|
|
495
|
-
}
|
|
496
|
-
for (let i = indices.length - endCount; i < indices.length; i++) {
|
|
497
|
-
const columnIndex = indices[i];
|
|
498
|
-
const rowStart = getRowStart(hierarchy, startCount, firstEndIndex, columnIndex);
|
|
499
|
-
const column = columns[columnIndex];
|
|
500
|
-
dividers.push(
|
|
501
|
-
/* @__PURE__ */ jsx(
|
|
502
|
-
HeaderDivider,
|
|
503
|
-
{
|
|
504
|
-
api,
|
|
505
|
-
column,
|
|
506
|
-
xPositions,
|
|
507
|
-
viewportWidth,
|
|
508
|
-
rowStart,
|
|
509
|
-
rowEnd: columnRowCount + 1,
|
|
510
|
-
columnIndex,
|
|
511
|
-
startCount,
|
|
512
|
-
centerCount,
|
|
513
|
-
endCount
|
|
514
|
-
},
|
|
515
|
-
column.id
|
|
516
|
-
)
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
return dividers;
|
|
520
|
-
}, [
|
|
521
|
-
api,
|
|
522
|
-
bounds.columnEnd,
|
|
523
|
-
bounds.columnStart,
|
|
524
|
-
centerCount,
|
|
525
|
-
columns,
|
|
526
|
-
endCount,
|
|
527
|
-
hierarchy,
|
|
528
|
-
startCount,
|
|
529
|
-
viewportWidth,
|
|
530
|
-
xPositions
|
|
531
|
-
]);
|
|
532
|
-
}
|
|
533
|
-
function isPartOfGroup(columnIndex, hierarchy) {
|
|
534
|
-
if (!hierarchy.length) return false;
|
|
535
|
-
return hierarchy.length > 0 && hierarchy[0][columnIndex] != null;
|
|
536
|
-
}
|
|
537
|
-
function getRowStart(hierarchy, startCount, firstEndIndex, columnIndex) {
|
|
538
|
-
const isFirstEndIndex = columnIndex === firstEndIndex;
|
|
539
|
-
const isLastStartIndex = columnIndex === startCount - 1 && startCount > 0;
|
|
540
|
-
const hasGroup = isPartOfGroup(columnIndex, hierarchy);
|
|
541
|
-
if (isFirstEndIndex || isLastStartIndex || !hasGroup) return 1;
|
|
542
|
-
let level = 0;
|
|
543
|
-
while (level < hierarchy.length && hierarchy[level][columnIndex] != null) {
|
|
544
|
-
level++;
|
|
545
|
-
}
|
|
546
|
-
while (hierarchy[level - 1]?.[columnIndex] && hierarchy[level - 1][columnIndex].end - 1 === columnIndex) {
|
|
547
|
-
level--;
|
|
548
|
-
}
|
|
549
|
-
return level + 1;
|
|
550
|
-
}
|
|
551
|
-
function useHeaderGroupMove(api, item, pin) {
|
|
552
|
-
const sx = api.getState();
|
|
553
|
-
const gridId = sx.gridId.use();
|
|
554
|
-
const visible = sx.columnsVisible.use();
|
|
555
|
-
const columns = useMemo(() => {
|
|
556
|
-
return visible.slice(item.start, item.end);
|
|
557
|
-
}, [item.end, item.start, visible]);
|
|
558
|
-
const move = useDraggable({
|
|
559
|
-
dragTags: () => [`${gridId}:grid:${pin ?? "none"}`],
|
|
560
|
-
dragData: () => ({ columns, columnIndex: item.start }),
|
|
561
|
-
placeholder: () => /* @__PURE__ */ jsx(
|
|
562
|
-
DragPlaceholder,
|
|
563
|
-
{
|
|
564
|
-
cnt: item.end - item.start,
|
|
565
|
-
label: item.id.split(sx.columnGroupIdDelimiter.peek()).at(-1)
|
|
566
|
-
}
|
|
567
|
-
)
|
|
568
|
-
});
|
|
569
|
-
const isMovable = columns.every((c) => api.columnIsMovable(c));
|
|
570
|
-
return { moveProps: isMovable ? move : {} };
|
|
571
|
-
}
|
|
572
|
-
function DragPlaceholder(c) {
|
|
573
|
-
return /* @__PURE__ */ jsxs("div", { className: "lng1771-drag-placeholder", children: [
|
|
574
|
-
c.label,
|
|
575
|
-
" | moving ",
|
|
576
|
-
c.cnt,
|
|
577
|
-
" columns"
|
|
578
|
-
] });
|
|
579
|
-
}
|
|
580
|
-
function HeaderGroupCell({
|
|
581
|
-
api,
|
|
582
|
-
groupItem,
|
|
583
|
-
pin,
|
|
584
|
-
viewportWidth,
|
|
585
|
-
rowStart,
|
|
586
|
-
xPositions
|
|
587
|
-
}) {
|
|
588
|
-
const rtl = api.getState().rtl.use();
|
|
589
|
-
const style = useMemo(() => {
|
|
590
|
-
const isStart = pin === "start";
|
|
591
|
-
const isEnd = pin == "end";
|
|
592
|
-
const width = sizeFromCoord(groupItem.start, xPositions, groupItem.end - groupItem.start);
|
|
593
|
-
const columnIndex = groupItem.start;
|
|
594
|
-
const x2 = isEnd ? xPositions[columnIndex] - xPositions.at(-1) + viewportWidth : xPositions[columnIndex];
|
|
595
|
-
const style2 = {
|
|
596
|
-
transform: getTransform(x2 * (rtl ? -1 : 1), 0),
|
|
597
|
-
gridRowStart: rowStart,
|
|
598
|
-
gridRowEnd: rowStart + 1,
|
|
599
|
-
width
|
|
600
|
-
};
|
|
601
|
-
if (isStart || isEnd) {
|
|
602
|
-
style2.insetInlineStart = "0px";
|
|
603
|
-
style2.position = "sticky";
|
|
604
|
-
style2.zIndex = 2;
|
|
605
|
-
}
|
|
606
|
-
return style2;
|
|
607
|
-
}, [groupItem.end, groupItem.start, pin, rowStart, rtl, viewportWidth, xPositions]);
|
|
608
|
-
const headerMove = useHeaderGroupMove(api, groupItem, pin);
|
|
609
|
-
const ref = useRef(null);
|
|
610
|
-
const skipRef = useRef(false);
|
|
611
|
-
useEffect(() => {
|
|
612
|
-
const sx = api.getState();
|
|
613
|
-
const position = sx.internal.navigatePosition;
|
|
614
|
-
const unsub = position.watch(() => {
|
|
615
|
-
const pos = position.peek();
|
|
616
|
-
if (!pos || !ref.current || pos.kind !== HEADER_GROUP_CELL_POSITION) return;
|
|
617
|
-
if (groupItem.start === pos.columnStartIndex && groupItem.end === pos.columnEndIndex && pos.hierarchyRowIndex === rowStart - 1 && !ref.current.contains(document.activeElement) && ref.current !== document.activeElement) {
|
|
618
|
-
api.navigateScrollIntoView(null, pos.columnIndex);
|
|
619
|
-
skipRef.current = true;
|
|
620
|
-
ref.current.focus();
|
|
621
|
-
}
|
|
622
|
-
});
|
|
623
|
-
return () => unsub();
|
|
624
|
-
}, [api, groupItem.end, groupItem.start, rowStart]);
|
|
625
|
-
const onFocus = useEvent(() => {
|
|
626
|
-
if (skipRef.current) {
|
|
627
|
-
skipRef.current = false;
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
api.getState().internal.navigatePosition.set({
|
|
631
|
-
kind: HEADER_GROUP_CELL_POSITION,
|
|
632
|
-
columnStartIndex: groupItem.start,
|
|
633
|
-
columnEndIndex: groupItem.end,
|
|
634
|
-
columnIndex: groupItem.start,
|
|
635
|
-
hierarchyRowIndex: rowStart - 1
|
|
636
|
-
});
|
|
637
|
-
});
|
|
638
|
-
const Renderer = api.getState().columnGroupHeaderRenderer.use() ?? HeaderGroupDefault;
|
|
639
|
-
return /* @__PURE__ */ jsx(
|
|
640
|
-
"div",
|
|
641
|
-
{
|
|
642
|
-
ref,
|
|
643
|
-
onFocus,
|
|
644
|
-
style,
|
|
645
|
-
"data-lng1771-group-id": groupItem.id,
|
|
646
|
-
"data-lng1771-kind": "header-group",
|
|
647
|
-
"aria-colindex": groupItem.start + 1,
|
|
648
|
-
"aria-colspan": groupItem.end - groupItem.start,
|
|
649
|
-
role: "columnheader",
|
|
650
|
-
tabIndex: -1,
|
|
651
|
-
...headerMove.moveProps,
|
|
652
|
-
className: "lng1771-header__group",
|
|
653
|
-
children: /* @__PURE__ */ jsx(Renderer, { group: groupItem, api })
|
|
654
|
-
}
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
function HeaderGroupDefault({ group, api }) {
|
|
658
|
-
const label = useMemo(() => {
|
|
659
|
-
const delimiter = api.getState().columnGroupIdDelimiter.peek();
|
|
660
|
-
return group.id.split(delimiter).at(-1);
|
|
661
|
-
}, [api, group.id]);
|
|
662
|
-
const expansionState = api.getState().columnGroupExpansionState.use();
|
|
663
|
-
const isExpanded = expansionState[group.id] ?? api.getState().columnGroupDefaultExpansion.peek()(group.id);
|
|
664
|
-
return /* @__PURE__ */ jsxs(
|
|
665
|
-
"div",
|
|
666
|
-
{
|
|
667
|
-
style: {
|
|
668
|
-
width: "100%",
|
|
669
|
-
height: "100%",
|
|
670
|
-
display: "flex",
|
|
671
|
-
alignItems: "center",
|
|
672
|
-
boxSizing: "border-box",
|
|
673
|
-
justifyContent: "space-between",
|
|
674
|
-
paddingInline: 12
|
|
675
|
-
},
|
|
676
|
-
children: [
|
|
677
|
-
label,
|
|
678
|
-
group.isCollapsible && isExpanded && /* @__PURE__ */ jsx(CollapseButton, { onClick: () => api.columnGroupToggle(group.id), children: "-" })
|
|
679
|
-
]
|
|
680
|
-
}
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
function useHeaderGroupCells(api) {
|
|
684
|
-
const sx = api.getState();
|
|
685
|
-
const bounds = sx.internal.virtBounds.use();
|
|
686
|
-
const hierarchy = sx.columnGroupLevels.use();
|
|
687
|
-
const xPositions = sx.columnPositions.use();
|
|
688
|
-
const startCount = sx.columnVisibleStartCount.use();
|
|
689
|
-
const centerCount = sx.columnVisibleCenterCount.use();
|
|
690
|
-
const endCount = sx.columnVisibleEndCount.use();
|
|
691
|
-
const viewportWidth = sx.internal.viewportInnerWidth.use();
|
|
692
|
-
return useMemo(() => {
|
|
693
|
-
const cells = [];
|
|
694
|
-
function handleCell(groupItem, levelIndex, pin) {
|
|
695
|
-
cells.push(
|
|
696
|
-
/* @__PURE__ */ jsx(
|
|
697
|
-
HeaderGroupCell,
|
|
698
|
-
{
|
|
699
|
-
api,
|
|
700
|
-
groupItem,
|
|
701
|
-
pin,
|
|
702
|
-
rowStart: levelIndex + 1,
|
|
703
|
-
viewportWidth,
|
|
704
|
-
centerCount,
|
|
705
|
-
startCount,
|
|
706
|
-
endCount,
|
|
707
|
-
xPositions
|
|
708
|
-
},
|
|
709
|
-
groupItem.occurrenceKey
|
|
710
|
-
)
|
|
711
|
-
);
|
|
712
|
-
}
|
|
713
|
-
for (let level = 0; level < hierarchy.length; level++) {
|
|
714
|
-
const processedIndices = /* @__PURE__ */ new Set();
|
|
715
|
-
const row = hierarchy[level];
|
|
716
|
-
for (let i = 0; i < startCount; i++) {
|
|
717
|
-
const groupItem = row[i];
|
|
718
|
-
if (!groupItem) continue;
|
|
719
|
-
if (!processedIndices.has(i)) handleCell(groupItem, level, "start");
|
|
720
|
-
for (let j = groupItem.start; j < groupItem.end; j++) processedIndices.add(j);
|
|
721
|
-
}
|
|
722
|
-
for (let i = bounds.columnStart; i < bounds.columnEnd; i++) {
|
|
723
|
-
const groupItem = row[i];
|
|
724
|
-
if (!groupItem) continue;
|
|
725
|
-
if (!processedIndices.has(i)) handleCell(groupItem, level, null);
|
|
726
|
-
for (let j = groupItem.start; j < groupItem.end; j++) processedIndices.add(j);
|
|
727
|
-
}
|
|
728
|
-
const first = startCount + centerCount;
|
|
729
|
-
for (let i = first; i < row.length; i++) {
|
|
730
|
-
const groupItem = row[i];
|
|
731
|
-
if (!groupItem) continue;
|
|
732
|
-
if (!processedIndices.has(i)) handleCell(groupItem, level, "end");
|
|
733
|
-
for (let j = groupItem.start; j < groupItem.end; j++) processedIndices.add(j);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
return cells;
|
|
737
|
-
}, [
|
|
738
|
-
api,
|
|
739
|
-
bounds.columnEnd,
|
|
740
|
-
bounds.columnStart,
|
|
741
|
-
centerCount,
|
|
742
|
-
endCount,
|
|
743
|
-
hierarchy,
|
|
744
|
-
startCount,
|
|
745
|
-
viewportWidth,
|
|
746
|
-
xPositions
|
|
747
|
-
]);
|
|
748
|
-
}
|
|
749
|
-
function useFloatingFocus(api, ref, columnIndex) {
|
|
750
|
-
useEffect(() => {
|
|
751
|
-
const sx = api.getState();
|
|
752
|
-
const unsub = sx.internal.navigatePosition.watch(() => {
|
|
753
|
-
const position = sx.internal.navigatePosition.peek();
|
|
754
|
-
if (!ref.current || !position || position.kind !== FLOATING_CELL_POSITION) return;
|
|
755
|
-
if (position.columnIndex === columnIndex && !ref.current.contains(document.activeElement)) {
|
|
756
|
-
api.navigateScrollIntoView(null, columnIndex);
|
|
757
|
-
ref.current.focus();
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
return () => unsub();
|
|
761
|
-
}, [api, columnIndex, ref]);
|
|
762
|
-
const onFocus = useEvent(() => {
|
|
763
|
-
api.getState().internal.navigatePosition.set({ kind: FLOATING_CELL_POSITION, columnIndex });
|
|
764
|
-
});
|
|
765
|
-
return { onFocus };
|
|
766
|
-
}
|
|
767
|
-
function FloatingCell({
|
|
768
|
-
api,
|
|
769
|
-
viewportWidth,
|
|
770
|
-
column,
|
|
771
|
-
xPositions,
|
|
772
|
-
columnIndex,
|
|
773
|
-
rowStart,
|
|
774
|
-
startCount
|
|
775
|
-
}) {
|
|
776
|
-
const isStart = column.pin === "start";
|
|
777
|
-
const isEnd = column.pin === "end";
|
|
778
|
-
const isLastStart = columnIndex === startCount - 1;
|
|
779
|
-
const rtl = api.getState().rtl.use();
|
|
780
|
-
const style = useMemo(() => {
|
|
781
|
-
const x2 = isEnd ? xPositions[columnIndex] - xPositions.at(-1) + viewportWidth : xPositions[columnIndex];
|
|
782
|
-
const width = sizeFromCoord(columnIndex, xPositions);
|
|
783
|
-
const style2 = {
|
|
784
|
-
transform: getTransform(x2 * (rtl ? -1 : 1), 0),
|
|
785
|
-
gridRowStart: rowStart,
|
|
786
|
-
gridRowEnd: rowStart + 1,
|
|
787
|
-
width
|
|
788
|
-
};
|
|
789
|
-
if (isStart || isEnd) {
|
|
790
|
-
style2.insetInlineStart = "0px";
|
|
791
|
-
style2.position = "sticky";
|
|
792
|
-
style2.zIndex = 2;
|
|
793
|
-
}
|
|
794
|
-
return style2;
|
|
795
|
-
}, [columnIndex, isEnd, isStart, rowStart, rtl, viewportWidth, xPositions]);
|
|
796
|
-
const sx = api.getState();
|
|
797
|
-
const base = sx.columnBase.use();
|
|
798
|
-
const rendererKey = column.floatingCellRenderer ?? base.floatingCellRenderer;
|
|
799
|
-
const renderers = sx.floatingCellRenderers.use();
|
|
800
|
-
const Component = useMemo(() => {
|
|
801
|
-
if (typeof rendererKey === "string") {
|
|
802
|
-
if (!renderers[rendererKey])
|
|
803
|
-
throw new Error(`Failed to find floating renderer: ${rendererKey}`);
|
|
804
|
-
return renderers[rendererKey];
|
|
805
|
-
}
|
|
806
|
-
if (!rendererKey) return () => /* @__PURE__ */ jsx(Fragment, {});
|
|
807
|
-
return rendererKey;
|
|
808
|
-
}, [rendererKey, renderers]);
|
|
809
|
-
const ref = useRef(null);
|
|
810
|
-
const events = useFloatingFocus(api, ref, columnIndex);
|
|
811
|
-
const hide = api.columnIsGridGenerated(column) && !api.columnIsGroupAutoColumn(column);
|
|
812
|
-
return /* @__PURE__ */ jsx(
|
|
813
|
-
"div",
|
|
814
|
-
{
|
|
815
|
-
ref,
|
|
816
|
-
style,
|
|
817
|
-
...events,
|
|
818
|
-
role: "columnheader",
|
|
819
|
-
"data-lng1771-kind": "floating",
|
|
820
|
-
"data-lng1771-pin": column.pin ?? "center",
|
|
821
|
-
"data-lng1771-last-start": isLastStart ? true : void 0,
|
|
822
|
-
"data-lng1771-column-id": column.id,
|
|
823
|
-
"aria-colindex": columnIndex,
|
|
824
|
-
"aria-colspan": 1,
|
|
825
|
-
tabIndex: -1,
|
|
826
|
-
className: "lng1771-header__cell-floating",
|
|
827
|
-
children: !hide && /* @__PURE__ */ jsx(Component, { api, column })
|
|
828
|
-
}
|
|
829
|
-
);
|
|
830
|
-
}
|
|
831
|
-
function useFloatingCells(api, enabled) {
|
|
832
|
-
const sx = api.getState();
|
|
833
|
-
const visibleColumns = sx.columnsVisible.use();
|
|
834
|
-
const xPositions = sx.columnPositions.use();
|
|
835
|
-
const bounds = sx.internal.virtBounds.use();
|
|
836
|
-
const hierarchy = sx.columnGroupLevels.use();
|
|
837
|
-
const startCount = sx.columnVisibleStartCount.use();
|
|
838
|
-
const centerCount = sx.columnVisibleCenterCount.use();
|
|
839
|
-
const endCount = sx.columnVisibleEndCount.use();
|
|
840
|
-
const viewportWidth = sx.internal.viewportInnerWidth.use();
|
|
841
|
-
return useMemo(() => {
|
|
842
|
-
if (!enabled) return [];
|
|
843
|
-
const cells = [];
|
|
844
|
-
const columnRowCount = hierarchy.length + 1;
|
|
845
|
-
function handleCell(i) {
|
|
846
|
-
const column = visibleColumns[i];
|
|
847
|
-
const rowStart = columnRowCount + 1;
|
|
848
|
-
cells.push(
|
|
849
|
-
/* @__PURE__ */ jsx(
|
|
850
|
-
FloatingCell,
|
|
851
|
-
{
|
|
852
|
-
api,
|
|
853
|
-
column,
|
|
854
|
-
columnIndex: i,
|
|
855
|
-
viewportWidth,
|
|
856
|
-
xPositions,
|
|
857
|
-
rowStart,
|
|
858
|
-
startCount,
|
|
859
|
-
centerCount,
|
|
860
|
-
endCount
|
|
861
|
-
},
|
|
862
|
-
column.id
|
|
863
|
-
)
|
|
864
|
-
);
|
|
865
|
-
}
|
|
866
|
-
for (let i = 0; i < startCount; i++) {
|
|
867
|
-
handleCell(i);
|
|
868
|
-
}
|
|
869
|
-
for (let i = bounds.columnStart; i < bounds.columnEnd; i++) {
|
|
870
|
-
handleCell(i);
|
|
871
|
-
}
|
|
872
|
-
const first = startCount + centerCount;
|
|
873
|
-
for (let i = first; i < visibleColumns.length; i++) {
|
|
874
|
-
handleCell(i);
|
|
875
|
-
}
|
|
876
|
-
return cells;
|
|
877
|
-
}, [
|
|
878
|
-
api,
|
|
879
|
-
bounds.columnEnd,
|
|
880
|
-
bounds.columnStart,
|
|
881
|
-
centerCount,
|
|
882
|
-
enabled,
|
|
883
|
-
endCount,
|
|
884
|
-
hierarchy.length,
|
|
885
|
-
startCount,
|
|
886
|
-
viewportWidth,
|
|
887
|
-
visibleColumns,
|
|
888
|
-
xPositions
|
|
889
|
-
]);
|
|
890
|
-
}
|
|
891
|
-
function Header() {
|
|
892
|
-
const { state, api } = useGrid();
|
|
893
|
-
const columnHeaderHeight = state.columnHeaderHeight.use();
|
|
894
|
-
const columnGroupHeaderHeight = state.columnGroupHeaderHeight.use();
|
|
895
|
-
const floatingRowHeight = state.floatingRowHeight.use();
|
|
896
|
-
const floatingRowEnabled = state.floatingRowEnabled.use();
|
|
897
|
-
const hierarchy = state.columnGroupLevels.use();
|
|
898
|
-
const headerGroupCells = useHeaderGroupCells(api);
|
|
899
|
-
const headerCells = useHeaderCells(api);
|
|
900
|
-
const headerDividers = useHeaderDividers(api);
|
|
901
|
-
const floatingCells = useFloatingCells(api, floatingRowEnabled);
|
|
902
|
-
const gridTemplateRows = useHeaderDisplayGridTemplate(
|
|
903
|
-
hierarchy.length,
|
|
904
|
-
columnHeaderHeight,
|
|
905
|
-
columnGroupHeaderHeight,
|
|
906
|
-
floatingRowEnabled,
|
|
907
|
-
floatingRowHeight
|
|
908
|
-
);
|
|
909
|
-
const headerHeightSetting = state.internal.viewportHeaderHeight.use();
|
|
910
|
-
const headerHeight = useMemo(() => {
|
|
911
|
-
return `${headerHeightSetting - (floatingRowEnabled ? floatingRowHeight : 0)}px`;
|
|
912
|
-
}, [floatingRowEnabled, floatingRowHeight, headerHeightSetting]);
|
|
913
|
-
return /* @__PURE__ */ jsxs(
|
|
914
|
-
"div",
|
|
915
|
-
{
|
|
916
|
-
role: "row",
|
|
917
|
-
className: "lng1771-header",
|
|
918
|
-
style: { gridTemplateRows, "--lng1771-header-height": headerHeight },
|
|
919
|
-
children: [
|
|
920
|
-
headerGroupCells,
|
|
921
|
-
headerCells,
|
|
922
|
-
headerDividers,
|
|
923
|
-
floatingCells
|
|
924
|
-
]
|
|
925
|
-
}
|
|
926
|
-
);
|
|
927
|
-
}
|
|
928
|
-
function HeaderContainer({ style }) {
|
|
929
|
-
const { state } = useGrid();
|
|
930
|
-
const [header, setHeader] = useState(null);
|
|
931
|
-
useIsoEffect(() => {
|
|
932
|
-
if (!header) return;
|
|
933
|
-
const resize = new IsoResizeObserver(() => {
|
|
934
|
-
if (!header) return;
|
|
935
|
-
const prec = getPreciseElementDimensions(header);
|
|
936
|
-
state.internal.viewportHeaderHeight.set(prec.outerHeight);
|
|
937
|
-
});
|
|
938
|
-
resize.observe(header);
|
|
939
|
-
return () => resize.disconnect();
|
|
940
|
-
}, [header]);
|
|
941
|
-
return /* @__PURE__ */ jsx("div", { ref: setHeader, className: "lng1771-header-container", style, children: /* @__PURE__ */ jsx(Header, {}) });
|
|
942
|
-
}
|
|
943
|
-
function RowDetail({ api, row, rowPin, yPositions, rowIndex, height }) {
|
|
944
|
-
const sx = api.getState();
|
|
945
|
-
const width = sx.internal.viewportInnerWidth.use();
|
|
946
|
-
const Renderer = sx.rowDetailRenderer.use() ?? RowDetailDefault;
|
|
947
|
-
const style = useMemo(() => {
|
|
948
|
-
const isTop = rowPin === "top";
|
|
949
|
-
const isBot = rowPin === "bottom";
|
|
950
|
-
const rowCount = sx.internal.rowCount.peek();
|
|
951
|
-
const rowTopCount = sx.internal.rowTopCount.peek();
|
|
952
|
-
const rowBotCount = sx.internal.rowBottomCount.peek();
|
|
953
|
-
const firstBotIndex = rowCount - rowBotCount;
|
|
954
|
-
const offset = sizeFromCoord(rowIndex, yPositions) - height;
|
|
955
|
-
const y2 = isBot ? yPositions[rowIndex] - yPositions[firstBotIndex] : isTop ? yPositions[rowIndex] : yPositions[rowIndex] - yPositions[rowTopCount];
|
|
956
|
-
const transform = getTransform(0, y2 + offset);
|
|
957
|
-
return { width, height, transform };
|
|
958
|
-
}, [
|
|
959
|
-
height,
|
|
960
|
-
rowIndex,
|
|
961
|
-
rowPin,
|
|
962
|
-
sx.internal.rowBottomCount,
|
|
963
|
-
sx.internal.rowCount,
|
|
964
|
-
sx.internal.rowTopCount,
|
|
965
|
-
width,
|
|
966
|
-
yPositions
|
|
967
|
-
]);
|
|
968
|
-
return /* @__PURE__ */ jsx("div", { style, className: "lng1771-row-detail", children: /* @__PURE__ */ jsx(Renderer, { api, row }) });
|
|
969
|
-
}
|
|
970
|
-
function RowDetailDefault() {
|
|
971
|
-
return /* @__PURE__ */ jsx("div", { children: "Not Implemented" });
|
|
972
|
-
}
|
|
973
|
-
function RowDragIndicator({ section }) {
|
|
974
|
-
const { state } = useGrid();
|
|
975
|
-
const rowIndex = state.internal.rowDragOverIndex.use();
|
|
976
|
-
const dragIndex = state.internal.rowDragStartIndex.use();
|
|
977
|
-
const yPositions = state.internal.rowPositions.use();
|
|
978
|
-
const width = state.internal.viewportInnerWidth.use();
|
|
979
|
-
const topCount = state.internal.rowTopCount.use();
|
|
980
|
-
const bottomCount = state.internal.rowBottomCount.use();
|
|
981
|
-
const rowCount = state.internal.rowCount.use();
|
|
982
|
-
const isBefore = rowIndex < dragIndex;
|
|
983
|
-
if (rowIndex === -1 || rowIndex == null) return null;
|
|
984
|
-
if (section === "top" && rowIndex > topCount) return null;
|
|
985
|
-
if (section === "center" && rowIndex < topCount || rowIndex >= rowCount - bottomCount)
|
|
986
|
-
return null;
|
|
987
|
-
if (section === "bottom" && rowIndex < rowCount - bottomCount) return null;
|
|
988
|
-
const firstBotIndex = rowCount - bottomCount;
|
|
989
|
-
const height = sizeFromCoord(rowIndex, yPositions);
|
|
990
|
-
const y2 = section === "bottom" ? yPositions[rowIndex] - yPositions[firstBotIndex] : section === "top" ? yPositions[rowIndex] : yPositions[rowIndex] - yPositions[topCount];
|
|
991
|
-
return /* @__PURE__ */ jsx(
|
|
992
|
-
"div",
|
|
993
|
-
{
|
|
994
|
-
style: { transform: getTransform(0, y2 + (isBefore ? 0 : height)), width },
|
|
995
|
-
className: "lng1771-row-drag-indicator"
|
|
996
|
-
}
|
|
997
|
-
);
|
|
998
|
-
}
|
|
999
|
-
function Rows({
|
|
1000
|
-
width,
|
|
1001
|
-
...els
|
|
1002
|
-
}) {
|
|
1003
|
-
const { state, api } = useGrid();
|
|
1004
|
-
const layout = state.internal.virtLayout.use();
|
|
1005
|
-
const xPositions = state.columnPositions.use();
|
|
1006
|
-
const yPositions = state.internal.rowPositions.use();
|
|
1007
|
-
const columns = state.columnsVisible.use();
|
|
1008
|
-
const refreshKey = state.internal.rowRefreshCount.use();
|
|
1009
|
-
const headerHeight = state.internal.viewportHeaderHeight.use();
|
|
1010
|
-
const rowCount = state.internal.rowCount.use();
|
|
1011
|
-
const topCount = state.internal.rowTopCount.use();
|
|
1012
|
-
const botCount = state.internal.rowBottomCount.use();
|
|
1013
|
-
const topHeight = yPositions[topCount];
|
|
1014
|
-
const botHeight = yPositions.at(-1) - yPositions[rowCount - botCount];
|
|
1015
|
-
const detailHeight = state.internal.rowDetailHeight.use();
|
|
1016
|
-
const [fullWidthCache, cellCache] = useMemo(() => {
|
|
1017
|
-
return [{}, {}];
|
|
1018
|
-
}, [botCount, columns, headerHeight, refreshKey, rowCount, topCount, xPositions, yPositions]);
|
|
1019
|
-
const firstBotIndex = rowCount - botCount;
|
|
1020
|
-
const paginate = state.paginate.use();
|
|
1021
|
-
const currentPage = state.paginateCurrentPage.use();
|
|
1022
|
-
const [top, center, bottom] = useMemo(() => {
|
|
1023
|
-
const top2 = [];
|
|
1024
|
-
const center2 = [];
|
|
1025
|
-
const bottom2 = [];
|
|
1026
|
-
let paginateOffset = 0;
|
|
1027
|
-
if (paginate) {
|
|
1028
|
-
const [rowStart] = api.paginateRowStartAndEndForPage(currentPage);
|
|
1029
|
-
paginateOffset = yPositions[rowStart];
|
|
1030
|
-
}
|
|
1031
|
-
for (const [rowIndex, cells] of layout) {
|
|
1032
|
-
if (rowIndex >= rowCount) continue;
|
|
1033
|
-
const isTop = rowIndex < topCount;
|
|
1034
|
-
const isBot = rowIndex >= firstBotIndex;
|
|
1035
|
-
const isCenter = !isTop && !isBot;
|
|
1036
|
-
const place = isCenter ? center2 : isTop ? top2 : bottom2;
|
|
1037
|
-
const row = api.rowByIndex(rowIndex);
|
|
1038
|
-
if (!row) continue;
|
|
1039
|
-
let i = 0;
|
|
1040
|
-
while (i < cells.length) {
|
|
1041
|
-
const encoding = cells[i];
|
|
1042
|
-
if (encoding === FULL_ENCODING) {
|
|
1043
|
-
fullWidthCache[rowIndex] ??= /* @__PURE__ */ jsx(
|
|
1044
|
-
CellFullWidth,
|
|
1045
|
-
{
|
|
1046
|
-
api,
|
|
1047
|
-
row,
|
|
1048
|
-
colCount: columns.length,
|
|
1049
|
-
rowPin: rowIndex < topCount ? "top" : rowIndex >= firstBotIndex ? "bottom" : null,
|
|
1050
|
-
rowIndex,
|
|
1051
|
-
yPositions,
|
|
1052
|
-
paginateOffset
|
|
1053
|
-
},
|
|
1054
|
-
`${rowIndex}-full`
|
|
1055
|
-
);
|
|
1056
|
-
place.push(fullWidthCache[rowIndex]);
|
|
1057
|
-
i++;
|
|
1058
|
-
} else if (encoding === END_ENCODING) {
|
|
1059
|
-
break;
|
|
1060
|
-
} else {
|
|
1061
|
-
const rowIndex2 = cells[i++];
|
|
1062
|
-
const rowSpan = cells[i++];
|
|
1063
|
-
const colIndex = cells[i++];
|
|
1064
|
-
const colSpan = cells[i++];
|
|
1065
|
-
cellCache[rowIndex2] ??= {};
|
|
1066
|
-
cellCache[rowIndex2][colIndex] = /* @__PURE__ */ jsx(
|
|
1067
|
-
Cell,
|
|
1068
|
-
{
|
|
1069
|
-
api,
|
|
1070
|
-
column: columns[colIndex],
|
|
1071
|
-
rowIndex: rowIndex2,
|
|
1072
|
-
rowSpan,
|
|
1073
|
-
colSpan,
|
|
1074
|
-
rowPin: rowIndex2 < topCount ? "top" : rowIndex2 >= firstBotIndex ? "bottom" : null,
|
|
1075
|
-
rowNode: row,
|
|
1076
|
-
columnIndex: colIndex,
|
|
1077
|
-
yPositions,
|
|
1078
|
-
xPositions,
|
|
1079
|
-
paginateOffset
|
|
1080
|
-
},
|
|
1081
|
-
`r${rowIndex2}-c${colIndex}`
|
|
1082
|
-
);
|
|
1083
|
-
place.push(cellCache[rowIndex2][colIndex]);
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
const rowDetailHeight = detailHeight(rowIndex);
|
|
1087
|
-
if (rowDetailHeight > 0) {
|
|
1088
|
-
place.push(
|
|
1089
|
-
/* @__PURE__ */ jsx(
|
|
1090
|
-
RowDetail,
|
|
1091
|
-
{
|
|
1092
|
-
api,
|
|
1093
|
-
height: rowDetailHeight,
|
|
1094
|
-
row,
|
|
1095
|
-
rowPin: rowIndex < topCount ? "top" : rowIndex >= firstBotIndex ? "bottom" : null,
|
|
1096
|
-
rowIndex,
|
|
1097
|
-
yPositions
|
|
1098
|
-
},
|
|
1099
|
-
`r${rowIndex}-detail`
|
|
1100
|
-
)
|
|
1101
|
-
);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
return [top2, center2, bottom2];
|
|
1105
|
-
}, [
|
|
1106
|
-
api,
|
|
1107
|
-
cellCache,
|
|
1108
|
-
columns,
|
|
1109
|
-
currentPage,
|
|
1110
|
-
detailHeight,
|
|
1111
|
-
firstBotIndex,
|
|
1112
|
-
fullWidthCache,
|
|
1113
|
-
layout,
|
|
1114
|
-
paginate,
|
|
1115
|
-
rowCount,
|
|
1116
|
-
topCount,
|
|
1117
|
-
xPositions,
|
|
1118
|
-
yPositions
|
|
1119
|
-
]);
|
|
1120
|
-
const viewportWidth = state.internal.viewportInnerWidth.use();
|
|
1121
|
-
const endCount = state.columnVisibleEndCount.use();
|
|
1122
|
-
const minWidth = Math.max(endCount > 0 ? viewportWidth : 0, width);
|
|
1123
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1124
|
-
topHeight > 0 && /* @__PURE__ */ jsxs(
|
|
1125
|
-
"div",
|
|
1126
|
-
{
|
|
1127
|
-
style: {
|
|
1128
|
-
width,
|
|
1129
|
-
minWidth,
|
|
1130
|
-
top: headerHeight,
|
|
1131
|
-
height: topHeight,
|
|
1132
|
-
minHeight: topHeight,
|
|
1133
|
-
maxHeight: topHeight
|
|
1134
|
-
},
|
|
1135
|
-
className: "lng1771-rows__top-section",
|
|
1136
|
-
children: [
|
|
1137
|
-
top,
|
|
1138
|
-
/* @__PURE__ */ jsx(RowDragIndicator, { section: "top" }),
|
|
1139
|
-
/* @__PURE__ */ jsx(els.top, {})
|
|
1140
|
-
]
|
|
1141
|
-
}
|
|
1142
|
-
),
|
|
1143
|
-
/* @__PURE__ */ jsxs(
|
|
1144
|
-
"div",
|
|
1145
|
-
{
|
|
1146
|
-
style: {
|
|
1147
|
-
width,
|
|
1148
|
-
minWidth
|
|
1149
|
-
},
|
|
1150
|
-
className: "lng1771-rows__center-section",
|
|
1151
|
-
children: [
|
|
1152
|
-
center,
|
|
1153
|
-
/* @__PURE__ */ jsx(RowDragIndicator, { section: "center" }),
|
|
1154
|
-
/* @__PURE__ */ jsx(els.center, {})
|
|
1155
|
-
]
|
|
1156
|
-
}
|
|
1157
|
-
),
|
|
1158
|
-
botHeight > 0 && /* @__PURE__ */ jsxs(
|
|
1159
|
-
"div",
|
|
1160
|
-
{
|
|
1161
|
-
style: {
|
|
1162
|
-
bottom: 0,
|
|
1163
|
-
width,
|
|
1164
|
-
minWidth,
|
|
1165
|
-
height: botHeight,
|
|
1166
|
-
minHeight: botHeight,
|
|
1167
|
-
maxHeight: botHeight
|
|
1168
|
-
},
|
|
1169
|
-
className: "lng1771-rows__bottom-section",
|
|
1170
|
-
children: [
|
|
1171
|
-
bottom,
|
|
1172
|
-
/* @__PURE__ */ jsx(RowDragIndicator, { section: "bottom" }),
|
|
1173
|
-
/* @__PURE__ */ jsx(els.bottom, {})
|
|
1174
|
-
]
|
|
1175
|
-
}
|
|
1176
|
-
)
|
|
1177
|
-
] });
|
|
1178
|
-
}
|
|
1179
|
-
function RowContainer({
|
|
1180
|
-
totalHeight,
|
|
1181
|
-
totalWidth,
|
|
1182
|
-
children
|
|
1183
|
-
}) {
|
|
1184
|
-
const { api, state } = useGrid();
|
|
1185
|
-
const gridId = state.gridId.use();
|
|
1186
|
-
const { onDragOver, onDrop } = useDroppable({
|
|
1187
|
-
tags: [`${gridId}:row-drag`],
|
|
1188
|
-
onDrop: (p2) => {
|
|
1189
|
-
const overIndex = state.internal.rowDragOverIndex.peek();
|
|
1190
|
-
const data = p2.getData();
|
|
1191
|
-
if (!data?.rows || !data?.api) return;
|
|
1192
|
-
const isExternal = data.api !== api;
|
|
1193
|
-
const additional = isExternal ? { externalGridApi: data.api, isExternal: true } : {};
|
|
1194
|
-
api.eventFire("onRowDragDrop", {
|
|
1195
|
-
api,
|
|
1196
|
-
event: p2.event,
|
|
1197
|
-
overIndex,
|
|
1198
|
-
rows: data.rows,
|
|
1199
|
-
...additional
|
|
1200
|
-
});
|
|
1201
|
-
}
|
|
1202
|
-
});
|
|
1203
|
-
const columns = state.columnsVisible.use();
|
|
1204
|
-
if (columns.length === 0) return /* @__PURE__ */ jsx(Fragment, {});
|
|
1205
|
-
return /* @__PURE__ */ jsx(
|
|
1206
|
-
"div",
|
|
1207
|
-
{
|
|
1208
|
-
style: { width: totalWidth, minHeight: totalHeight },
|
|
1209
|
-
onDrop,
|
|
1210
|
-
onDragOver,
|
|
1211
|
-
className: "lng1771-row-container",
|
|
1212
|
-
children
|
|
1213
|
-
}
|
|
1214
|
-
);
|
|
1215
|
-
}
|
|
1216
|
-
function NavigationDriver() {
|
|
1217
|
-
const { state, api } = useGrid();
|
|
1218
|
-
const viewport = state.internal.viewport.use();
|
|
1219
|
-
const rtl = state.rtl.use();
|
|
1220
|
-
useEffect(() => {
|
|
1221
|
-
if (!viewport) return;
|
|
1222
|
-
const controller = new AbortController();
|
|
1223
|
-
viewport.addEventListener(
|
|
1224
|
-
"keydown",
|
|
1225
|
-
(ev) => {
|
|
1226
|
-
const key = ev.key;
|
|
1227
|
-
const startDir = rtl ? "ArrowRight" : "ArrowLeft";
|
|
1228
|
-
const endDir = rtl ? "ArrowLeft" : "ArrowRight";
|
|
1229
|
-
const position = state.internal.navigatePosition.peek();
|
|
1230
|
-
const activeEdit = state.internal.cellEditActiveLocation.peek();
|
|
1231
|
-
if (activeEdit || ev.shiftKey) return;
|
|
1232
|
-
if (document.activeElement === viewport && (key === "ArrowDown" || key === endDir)) {
|
|
1233
|
-
if (state.columnsVisible.peek().length) {
|
|
1234
|
-
state.internal.navigatePosition.set({ kind: HEADER_CELL_POSITION, columnIndex: 0 });
|
|
1235
|
-
}
|
|
1236
|
-
ev.preventDefault();
|
|
1237
|
-
ev.stopPropagation();
|
|
1238
|
-
}
|
|
1239
|
-
if (!position) return;
|
|
1240
|
-
let handled = false;
|
|
1241
|
-
const meta = ev.ctrlKey || ev.metaKey;
|
|
1242
|
-
if (key === "PageUp") {
|
|
1243
|
-
api.navigatePageUp();
|
|
1244
|
-
handled = true;
|
|
1245
|
-
} else if (key === "PageDown") {
|
|
1246
|
-
api.navigatePageDown();
|
|
1247
|
-
handled = true;
|
|
1248
|
-
} else if (key === "Home") {
|
|
1249
|
-
api.navigateToTop();
|
|
1250
|
-
handled = true;
|
|
1251
|
-
} else if (key === "End") {
|
|
1252
|
-
api.navigateToBottom();
|
|
1253
|
-
handled = true;
|
|
1254
|
-
} else if (key === "ArrowUp") {
|
|
1255
|
-
if (meta) {
|
|
1256
|
-
api.navigateToTop();
|
|
1257
|
-
} else {
|
|
1258
|
-
api.navigateUp();
|
|
1259
|
-
}
|
|
1260
|
-
handled = true;
|
|
1261
|
-
} else if (key === "ArrowDown") {
|
|
1262
|
-
if (meta) {
|
|
1263
|
-
api.navigateToBottom();
|
|
1264
|
-
} else {
|
|
1265
|
-
api.navigateDown();
|
|
1266
|
-
}
|
|
1267
|
-
handled = true;
|
|
1268
|
-
} else if (key === startDir) {
|
|
1269
|
-
if (meta) {
|
|
1270
|
-
api.navigateToStart();
|
|
1271
|
-
} else {
|
|
1272
|
-
api.navigatePrev();
|
|
1273
|
-
}
|
|
1274
|
-
handled = true;
|
|
1275
|
-
} else if (key === endDir) {
|
|
1276
|
-
if (meta) {
|
|
1277
|
-
api.navigateToEnd();
|
|
1278
|
-
} else {
|
|
1279
|
-
api.navigateNext();
|
|
1280
|
-
}
|
|
1281
|
-
handled = true;
|
|
1282
|
-
}
|
|
1283
|
-
if (handled) {
|
|
1284
|
-
ev.preventDefault();
|
|
1285
|
-
ev.stopPropagation();
|
|
1286
|
-
}
|
|
1287
|
-
},
|
|
1288
|
-
{ signal: controller.signal }
|
|
1289
|
-
);
|
|
1290
|
-
const unsub = state.internal.navigatePosition.watch(() => {
|
|
1291
|
-
const position = state.internal.navigatePosition.peek();
|
|
1292
|
-
if (!position) return;
|
|
1293
|
-
const rowIndex = "rowIndex" in position ? position.rowIndex : null;
|
|
1294
|
-
const columnIndex = position.columnIndex;
|
|
1295
|
-
api.navigateScrollIntoView(rowIndex, columnIndex);
|
|
1296
|
-
});
|
|
1297
|
-
viewport.addEventListener(
|
|
1298
|
-
"focusout",
|
|
1299
|
-
() => {
|
|
1300
|
-
setTimeout(() => {
|
|
1301
|
-
if (viewport.contains(document.activeElement)) {
|
|
1302
|
-
return;
|
|
1303
|
-
}
|
|
1304
|
-
api.getState().internal.navigatePosition.set(null);
|
|
1305
|
-
}, 100);
|
|
1306
|
-
},
|
|
1307
|
-
{ signal: controller.signal }
|
|
1308
|
-
);
|
|
1309
|
-
return () => {
|
|
1310
|
-
controller.abort();
|
|
1311
|
-
unsub();
|
|
1312
|
-
};
|
|
1313
|
-
}, [
|
|
1314
|
-
api,
|
|
1315
|
-
rtl,
|
|
1316
|
-
state.columnsVisible,
|
|
1317
|
-
state.internal.cellEditActiveLocation,
|
|
1318
|
-
state.internal.navigatePosition,
|
|
1319
|
-
viewport
|
|
1320
|
-
]);
|
|
1321
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1322
|
-
}
|
|
1323
|
-
function cellEditLocation(c) {
|
|
1324
|
-
return `r${c.rowIndex}-c${c.columnIndex}`;
|
|
1325
|
-
}
|
|
1326
|
-
function handleBeginCellEditFromEvent(api, event) {
|
|
1327
|
-
if (event.button !== 0) return;
|
|
1328
|
-
const clientY = getClientY(event);
|
|
1329
|
-
const clientX = getClientX(event);
|
|
1330
|
-
const rowIndex = getHoveredRowIndex(api, clientY);
|
|
1331
|
-
const columnIndex = getHoveredColumnIndex(api, clientX);
|
|
1332
|
-
if (rowIndex == null || columnIndex == null) return;
|
|
1333
|
-
const sx = api.getState();
|
|
1334
|
-
const active = sx.internal.cellEditActiveEdits.peek();
|
|
1335
|
-
const l = { rowIndex, columnIndex };
|
|
1336
|
-
const key = cellEditLocation(l);
|
|
1337
|
-
if (active.has(key)) return;
|
|
1338
|
-
api.cellEditBegin(l, true);
|
|
1339
|
-
}
|
|
1340
|
-
function CellEditDriver() {
|
|
1341
|
-
const { state, api } = useGrid();
|
|
1342
|
-
const viewport = state.internal.viewport.use();
|
|
1343
|
-
const cellEditActivator = state.cellEditPointerActivator.use();
|
|
1344
|
-
useEffect(() => {
|
|
1345
|
-
if (!viewport) return;
|
|
1346
|
-
const controller = new AbortController();
|
|
1347
|
-
const signal2 = controller.signal;
|
|
1348
|
-
if (cellEditActivator === "single-click") {
|
|
1349
|
-
viewport.addEventListener("pointerdown", (ev) => handleBeginCellEditFromEvent(api, ev), {
|
|
1350
|
-
signal: signal2
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
|
-
if (cellEditActivator === "double-click") {
|
|
1354
|
-
viewport.addEventListener(
|
|
1355
|
-
"dblclick",
|
|
1356
|
-
(ev) => {
|
|
1357
|
-
if (state.internal.cellEditActiveEdits.peek().size > 0) return;
|
|
1358
|
-
handleBeginCellEditFromEvent(api, ev);
|
|
1359
|
-
},
|
|
1360
|
-
{ signal: signal2 }
|
|
1361
|
-
);
|
|
1362
|
-
}
|
|
1363
|
-
return () => controller.abort();
|
|
1364
|
-
}, [
|
|
1365
|
-
api,
|
|
1366
|
-
cellEditActivator,
|
|
1367
|
-
state.columnsVisible,
|
|
1368
|
-
state.internal.cellEditActiveEdits,
|
|
1369
|
-
state.internal.cellEditActiveLocation,
|
|
1370
|
-
viewport
|
|
1371
|
-
]);
|
|
1372
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1373
|
-
}
|
|
1374
|
-
function RowHoverDriver() {
|
|
1375
|
-
const s3 = useGrid();
|
|
1376
|
-
const grid = s3.state.internal.viewport.use();
|
|
1377
|
-
const hoveredRow = s3.state.internal.hoveredRow.use();
|
|
1378
|
-
useEffect(() => {
|
|
1379
|
-
if (hoveredRow == null || !grid) return;
|
|
1380
|
-
const cells = Array.from(
|
|
1381
|
-
grid.querySelectorAll(`div > div > .lng1771-cell[aria-rowindex="${hoveredRow + 1}"]`)
|
|
1382
|
-
);
|
|
1383
|
-
cells.forEach((c) => {
|
|
1384
|
-
if (c.classList.contains(".lng1771-cell--selected"))
|
|
1385
|
-
c.style.backgroundColor = "var(--lng1771-primary-30)";
|
|
1386
|
-
else c.style.backgroundColor = "var(--lng1771-gray-10)";
|
|
1387
|
-
});
|
|
1388
|
-
return () => {
|
|
1389
|
-
cells.forEach((c) => {
|
|
1390
|
-
c.style.removeProperty("background-color");
|
|
1391
|
-
});
|
|
1392
|
-
};
|
|
1393
|
-
}, [grid, hoveredRow]);
|
|
1394
|
-
if (hoveredRow == null) return;
|
|
1395
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1396
|
-
}
|
|
1397
|
-
function Viewport({
|
|
1398
|
-
children,
|
|
1399
|
-
...els
|
|
1400
|
-
}) {
|
|
1401
|
-
const { state } = useGrid();
|
|
1402
|
-
const onSizeChange = useEvent((size) => {
|
|
1403
|
-
state.internal.viewportInnerHeight.set(size.innerHeight);
|
|
1404
|
-
state.internal.viewportInnerWidth.set(size.innerWidth);
|
|
1405
|
-
state.internal.viewportOuterWidth.set(size.outerWidth);
|
|
1406
|
-
state.internal.viewportOuterHeight.set(size.outerHeight);
|
|
1407
|
-
const el = state.internal.viewport.peek();
|
|
1408
|
-
if (el) {
|
|
1409
|
-
state.internal.viewportXScroll.set(Math.abs(el.scrollLeft));
|
|
1410
|
-
state.internal.viewportYScroll.set(Math.abs(el.scrollTop));
|
|
1411
|
-
state.internal.viewportInnerWidth.set(el.clientWidth);
|
|
1412
|
-
state.internal.viewportInnerHeight.set(el.clientHeight);
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
const onInit = useEvent((_, size) => {
|
|
1416
|
-
onSizeChange(size);
|
|
1417
|
-
});
|
|
1418
|
-
const onScroll = useEvent(() => {
|
|
1419
|
-
const viewport = state.internal.viewport.peek();
|
|
1420
|
-
if (!viewport) return;
|
|
1421
|
-
state.internal.viewportXScroll.set(Math.abs(viewport.scrollLeft));
|
|
1422
|
-
state.internal.viewportYScroll.set(Math.abs(viewport.scrollTop));
|
|
1423
|
-
});
|
|
1424
|
-
const ref = useEvent((el) => {
|
|
1425
|
-
state.internal.viewport.set(el);
|
|
1426
|
-
});
|
|
1427
|
-
const paginate = state.paginate.use();
|
|
1428
|
-
const totalHeight = paginate ? void 0 : state.internal.rowPositions.use().at(-1);
|
|
1429
|
-
const totalWidth = state.columnPositions.use().at(-1);
|
|
1430
|
-
const rtl = state.rtl.use();
|
|
1431
|
-
const grid = state.gridId.use();
|
|
1432
|
-
return /* @__PURE__ */ jsxs(
|
|
1433
|
-
Sizer,
|
|
1434
|
-
{
|
|
1435
|
-
onInit,
|
|
1436
|
-
onSizeChange,
|
|
1437
|
-
onScroll,
|
|
1438
|
-
elRef: ref,
|
|
1439
|
-
style: { direction: rtl ? "rtl" : void 0 },
|
|
1440
|
-
id: grid,
|
|
1441
|
-
className: "lng1771-viewport",
|
|
1442
|
-
children: [
|
|
1443
|
-
/* @__PURE__ */ jsx(HeaderContainer, { style: { width: totalWidth } }),
|
|
1444
|
-
/* @__PURE__ */ jsx(RowContainer, { totalHeight, totalWidth, children: /* @__PURE__ */ jsx(Rows, { width: totalWidth, ...els }) }),
|
|
1445
|
-
/* @__PURE__ */ jsx(NavigationDriver, {}),
|
|
1446
|
-
/* @__PURE__ */ jsx(CellEditDriver, {}),
|
|
1447
|
-
/* @__PURE__ */ jsx(RowHoverDriver, {}),
|
|
1448
|
-
children
|
|
1449
|
-
]
|
|
1450
|
-
}
|
|
1451
|
-
);
|
|
1452
|
-
}
|
|
1453
|
-
function getEditRows(locations, predicate) {
|
|
1454
|
-
const validLocations = Object.groupBy(
|
|
1455
|
-
[...locations].filter(([_, l]) => predicate(l)).map(([_, l]) => l),
|
|
1456
|
-
(l) => l.rowIndex
|
|
1457
|
-
);
|
|
1458
|
-
return Object.entries(validLocations);
|
|
1459
|
-
}
|
|
1460
|
-
function TextEditor({
|
|
1461
|
-
value,
|
|
1462
|
-
setValue,
|
|
1463
|
-
isValid,
|
|
1464
|
-
column
|
|
1465
|
-
}) {
|
|
1466
|
-
const opts = column.cellEditParams ?? {};
|
|
1467
|
-
return /* @__PURE__ */ jsx(
|
|
1468
|
-
Input,
|
|
1469
|
-
{
|
|
1470
|
-
error: !isValid,
|
|
1471
|
-
maxLength: opts.maxLength,
|
|
1472
|
-
className: "lng1771-cell__edit-input",
|
|
1473
|
-
value: `${value}`,
|
|
1474
|
-
onChange: (event) => setValue(event.target.value)
|
|
1475
|
-
}
|
|
1476
|
-
);
|
|
1477
|
-
}
|
|
1478
|
-
function NumberEditor({
|
|
1479
|
-
value,
|
|
1480
|
-
setValue,
|
|
1481
|
-
isValid,
|
|
1482
|
-
column
|
|
1483
|
-
}) {
|
|
1484
|
-
const opts = column.cellEditParams ?? {};
|
|
1485
|
-
return /* @__PURE__ */ jsx(
|
|
1486
|
-
Input,
|
|
1487
|
-
{
|
|
1488
|
-
type: "number",
|
|
1489
|
-
min: opts.min,
|
|
1490
|
-
max: opts.max,
|
|
1491
|
-
step: opts.step,
|
|
1492
|
-
error: !isValid,
|
|
1493
|
-
className: "lng1771-cell__edit-input",
|
|
1494
|
-
value: `${value ?? ""}`,
|
|
1495
|
-
onChange: (event) => setValue(Number.parseFloat(event.target.value))
|
|
1496
|
-
}
|
|
1497
|
-
);
|
|
1498
|
-
}
|
|
1499
|
-
function DateEditor({
|
|
1500
|
-
value,
|
|
1501
|
-
setValue,
|
|
1502
|
-
isValid,
|
|
1503
|
-
column
|
|
1504
|
-
}) {
|
|
1505
|
-
const opts = column.cellEditParams ?? {};
|
|
1506
|
-
return /* @__PURE__ */ jsx(
|
|
1507
|
-
Input,
|
|
1508
|
-
{
|
|
1509
|
-
type: "date",
|
|
1510
|
-
className: "lng1771-cell__edit-input",
|
|
1511
|
-
error: !isValid,
|
|
1512
|
-
min: opts.min,
|
|
1513
|
-
max: opts.max,
|
|
1514
|
-
value: String(value),
|
|
1515
|
-
onChange: (event) => setValue(event.target.value)
|
|
1516
|
-
}
|
|
1517
|
-
);
|
|
1518
|
-
}
|
|
1519
|
-
function getBuiltInEditorForType(c) {
|
|
1520
|
-
if (c.type === "number") return "number";
|
|
1521
|
-
if (c.type === "date") return "date";
|
|
1522
|
-
return "text";
|
|
1523
|
-
}
|
|
1524
|
-
function getCellEditor(api, c, base) {
|
|
1525
|
-
const editor = c.cellEditProvider ?? base.cellEditProvider ?? getBuiltInEditorForType(c);
|
|
1526
|
-
if (typeof editor === "string") {
|
|
1527
|
-
if (editor === "text") return TextEditor;
|
|
1528
|
-
if (editor === "date") return DateEditor;
|
|
1529
|
-
if (editor === "number") return NumberEditor;
|
|
1530
|
-
const cell = api.getState().cellEditProviders.peek()[editor];
|
|
1531
|
-
if (!cell) throw new Error(`No cell editor with id: ${editor} found.`);
|
|
1532
|
-
return cell;
|
|
1533
|
-
}
|
|
1534
|
-
return editor;
|
|
1535
|
-
}
|
|
1536
|
-
function useCellEditStyle(column, xPositions, yPositions, location) {
|
|
1537
|
-
const { state, api } = useGrid();
|
|
1538
|
-
const vpWidth = state.internal.viewportInnerWidth.use();
|
|
1539
|
-
const rtl = state.rtl.use();
|
|
1540
|
-
const style = useMemo(() => {
|
|
1541
|
-
const isStart = column.pin === "start";
|
|
1542
|
-
const isEnd = column.pin === "end";
|
|
1543
|
-
const root = getRootCell(api, location.rowIndex, location.columnIndex);
|
|
1544
|
-
const rowIndex = root?.rowIndex ?? location.rowIndex;
|
|
1545
|
-
const colIndex = root?.columnIndex ?? location.columnIndex;
|
|
1546
|
-
const rowSpan = root?.rowSpan ?? 1;
|
|
1547
|
-
const colSpan = root?.columnSpan ?? 1;
|
|
1548
|
-
const x2 = isEnd ? xPositions[colIndex] - xPositions.at(-1) + vpWidth : xPositions[colIndex];
|
|
1549
|
-
const height = sizeFromCoord(rowIndex, yPositions, rowSpan);
|
|
1550
|
-
const width = sizeFromCoord(colIndex, xPositions, colSpan);
|
|
1551
|
-
const rowCount = state.internal.rowCount.peek();
|
|
1552
|
-
const rowTopCount = state.internal.rowTopCount.peek();
|
|
1553
|
-
const rowBotCount = state.internal.rowBottomCount.peek();
|
|
1554
|
-
const firstBotIndex = rowCount - rowBotCount;
|
|
1555
|
-
const isTop = rowIndex < rowTopCount;
|
|
1556
|
-
const isBot = rowIndex >= rowCount - rowBotCount;
|
|
1557
|
-
let paginateOffset = 0;
|
|
1558
|
-
if (state.paginate.peek()) {
|
|
1559
|
-
const [rowStart] = api.paginateRowStartAndEndForPage(state.paginateCurrentPage.peek());
|
|
1560
|
-
paginateOffset = yPositions[rowStart];
|
|
1561
|
-
}
|
|
1562
|
-
const y2 = isBot ? yPositions[rowIndex] - yPositions[firstBotIndex] : isTop ? yPositions[rowIndex] : yPositions[rowIndex] - yPositions[rowTopCount] - paginateOffset;
|
|
1563
|
-
const transform = getTransform(x2 * (rtl ? -1 : 1), y2);
|
|
1564
|
-
const style2 = { width, height, transform, zIndex: 3 };
|
|
1565
|
-
if (isStart || isEnd) {
|
|
1566
|
-
style2.insetInlineStart = "0px";
|
|
1567
|
-
style2.position = "sticky";
|
|
1568
|
-
style2.zIndex = 5;
|
|
1569
|
-
}
|
|
1570
|
-
return style2;
|
|
1571
|
-
}, [
|
|
1572
|
-
api,
|
|
1573
|
-
column.pin,
|
|
1574
|
-
location.columnIndex,
|
|
1575
|
-
location.rowIndex,
|
|
1576
|
-
rtl,
|
|
1577
|
-
state.internal.rowBottomCount,
|
|
1578
|
-
state.internal.rowCount,
|
|
1579
|
-
state.internal.rowTopCount,
|
|
1580
|
-
state.paginate,
|
|
1581
|
-
state.paginateCurrentPage,
|
|
1582
|
-
vpWidth,
|
|
1583
|
-
xPositions,
|
|
1584
|
-
yPositions
|
|
1585
|
-
]);
|
|
1586
|
-
return style;
|
|
1587
|
-
}
|
|
1588
|
-
function useCellEditNavigation(api, location) {
|
|
1589
|
-
const onKeyDown = useEvent((ev) => {
|
|
1590
|
-
const sx = api.getState();
|
|
1591
|
-
let handled = false;
|
|
1592
|
-
if (ev.key === "Escape") {
|
|
1593
|
-
api.cellEditEnd(location);
|
|
1594
|
-
handled = true;
|
|
1595
|
-
sx.internal.cellFocusQueue.set({
|
|
1596
|
-
kind: "cell",
|
|
1597
|
-
columnIndex: location.columnIndex,
|
|
1598
|
-
rowIndex: location.rowIndex
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
const meta = ev.ctrlKey || ev.metaKey;
|
|
1602
|
-
if (ev.key === "Enter" && !meta) {
|
|
1603
|
-
const visible = sx.columnsVisible.peek();
|
|
1604
|
-
const columnIndex = location.columnIndex;
|
|
1605
|
-
const rowCount = sx.internal.rowCount.peek();
|
|
1606
|
-
let nextLocal = null;
|
|
1607
|
-
let currentRow = location.rowIndex;
|
|
1608
|
-
do {
|
|
1609
|
-
if (currentRow >= rowCount) break;
|
|
1610
|
-
const root = getRootCell(api, currentRow, columnIndex);
|
|
1611
|
-
currentRow = root ? root.rowIndex + root.rowSpan : currentRow + 1;
|
|
1612
|
-
const row = api.rowByIndex(currentRow);
|
|
1613
|
-
const isFull = sx.internal.rowIsFullWidthInternal.peek()(currentRow);
|
|
1614
|
-
if (!row) break;
|
|
1615
|
-
if (api.cellEditPredicate(row, visible[columnIndex]) && !isFull) {
|
|
1616
|
-
nextLocal = { rowIndex: currentRow, columnIndex };
|
|
1617
|
-
break;
|
|
1618
|
-
}
|
|
1619
|
-
} while (true);
|
|
1620
|
-
if (!nextLocal) {
|
|
1621
|
-
api.cellEditEnd(location);
|
|
1622
|
-
sx.internal.cellFocusQueue.set({
|
|
1623
|
-
kind: "cell",
|
|
1624
|
-
columnIndex: location.columnIndex,
|
|
1625
|
-
rowIndex: location.rowIndex
|
|
1626
|
-
});
|
|
1627
|
-
handled = true;
|
|
1628
|
-
} else {
|
|
1629
|
-
api.navigateScrollIntoView(nextLocal.rowIndex, nextLocal.columnIndex);
|
|
1630
|
-
api.cellEditBegin(nextLocal, true);
|
|
1631
|
-
handled = true;
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
if (ev.key === "Enter" && meta) {
|
|
1635
|
-
api.cellEditEnd(location);
|
|
1636
|
-
sx.internal.cellFocusQueue.set({
|
|
1637
|
-
kind: "cell",
|
|
1638
|
-
columnIndex: location.columnIndex,
|
|
1639
|
-
rowIndex: location.rowIndex
|
|
1640
|
-
});
|
|
1641
|
-
}
|
|
1642
|
-
if (ev.key === "Tab") {
|
|
1643
|
-
const visible = sx.columnsVisible.peek();
|
|
1644
|
-
const row = api.rowByIndex(location.rowIndex);
|
|
1645
|
-
if (!row) return;
|
|
1646
|
-
const indices = visible.map((c, i) => api.cellEditPredicate(row, c) ? i : null).filter((c) => c !== null);
|
|
1647
|
-
const check = ev.shiftKey ? Math.min(...indices) : Math.max(...indices);
|
|
1648
|
-
if (check === location.columnIndex) {
|
|
1649
|
-
handled = true;
|
|
1650
|
-
} else {
|
|
1651
|
-
const currentIndex = indices.findIndex((c) => c === location.columnIndex);
|
|
1652
|
-
const next = ev.shiftKey ? indices[currentIndex - 1] : indices[currentIndex + 1];
|
|
1653
|
-
const nextLocation = { rowIndex: location.rowIndex, columnIndex: next };
|
|
1654
|
-
api.navigateScrollIntoView(nextLocation.rowIndex, nextLocation.columnIndex);
|
|
1655
|
-
api.cellEditBegin(nextLocation, true);
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
if (handled) {
|
|
1659
|
-
ev.preventDefault();
|
|
1660
|
-
ev.stopPropagation();
|
|
1661
|
-
}
|
|
1662
|
-
});
|
|
1663
|
-
return onKeyDown;
|
|
1664
|
-
}
|
|
1665
|
-
function CellEditorCell({
|
|
1666
|
-
column,
|
|
1667
|
-
row,
|
|
1668
|
-
xPositions,
|
|
1669
|
-
yPositions,
|
|
1670
|
-
location,
|
|
1671
|
-
isActive
|
|
1672
|
-
}) {
|
|
1673
|
-
const { state, api } = useGrid();
|
|
1674
|
-
const style = useCellEditStyle(column, xPositions, yPositions, location);
|
|
1675
|
-
const Renderer = getCellEditor(api, column, state.columnBase.use());
|
|
1676
|
-
const values = state.internal.cellEditActiveEditValues.use();
|
|
1677
|
-
const value = values.get(cellEditLocation(location));
|
|
1678
|
-
const autoFocus = useCallback(
|
|
1679
|
-
(el) => {
|
|
1680
|
-
if (!isActive || !el) return;
|
|
1681
|
-
const focusable = getFocusableElements(el)[0];
|
|
1682
|
-
if (!focusable) return;
|
|
1683
|
-
setTimeout(() => {
|
|
1684
|
-
if (el.contains(document.activeElement)) return;
|
|
1685
|
-
focusable.focus();
|
|
1686
|
-
}, 20);
|
|
1687
|
-
},
|
|
1688
|
-
[isActive]
|
|
1689
|
-
);
|
|
1690
|
-
const setValue = useCallback(
|
|
1691
|
-
(v2) => {
|
|
1692
|
-
api.cellEditSetValue(location, v2);
|
|
1693
|
-
},
|
|
1694
|
-
[api, location]
|
|
1695
|
-
);
|
|
1696
|
-
const onKeyDown = useCellEditNavigation(api, location);
|
|
1697
|
-
return /* @__PURE__ */ jsx(
|
|
1698
|
-
"div",
|
|
1699
|
-
{
|
|
1700
|
-
ref: autoFocus,
|
|
1701
|
-
style,
|
|
1702
|
-
className: "lng1771-cell__edit",
|
|
1703
|
-
onFocus: () => {
|
|
1704
|
-
state.internal.cellEditActiveLocation.set(location);
|
|
1705
|
-
},
|
|
1706
|
-
onBlur: () => {
|
|
1707
|
-
if (state.internal.cellEditActiveEdits.peek().has(cellEditLocation(location)))
|
|
1708
|
-
api.cellEditEnd(location);
|
|
1709
|
-
state.internal.cellEditActiveLocation.set(null);
|
|
1710
|
-
},
|
|
1711
|
-
onKeyDown,
|
|
1712
|
-
children: /* @__PURE__ */ jsx(
|
|
1713
|
-
Renderer,
|
|
1714
|
-
{
|
|
1715
|
-
api,
|
|
1716
|
-
column,
|
|
1717
|
-
row,
|
|
1718
|
-
value,
|
|
1719
|
-
setValue,
|
|
1720
|
-
isValid: api.cellEditIsValueValid(location)
|
|
1721
|
-
}
|
|
1722
|
-
)
|
|
1723
|
-
}
|
|
1724
|
-
);
|
|
1725
|
-
}
|
|
1726
|
-
function CellEditorRow({ locations }) {
|
|
1727
|
-
const rowIndex = locations[0].rowIndex;
|
|
1728
|
-
const { state: s3, api } = useGrid();
|
|
1729
|
-
const xPositions = s3.columnPositions.use();
|
|
1730
|
-
const yPositions = s3.internal.rowPositions.use();
|
|
1731
|
-
const active = s3.internal.cellEditActiveLocation.use();
|
|
1732
|
-
const row = api.rowByIndex(rowIndex);
|
|
1733
|
-
const columns = s3.columnsVisible.use();
|
|
1734
|
-
if (!row) return null;
|
|
1735
|
-
return /* @__PURE__ */ jsx(Fragment, { children: locations.map((l) => {
|
|
1736
|
-
const columnIndex = l.columnIndex;
|
|
1737
|
-
const column = columns[columnIndex];
|
|
1738
|
-
return /* @__PURE__ */ jsx(
|
|
1739
|
-
CellEditorCell,
|
|
1740
|
-
{
|
|
1741
|
-
location: l,
|
|
1742
|
-
isActive: l.rowIndex === active?.rowIndex && l.columnIndex === active.columnIndex,
|
|
1743
|
-
column,
|
|
1744
|
-
row,
|
|
1745
|
-
xPositions,
|
|
1746
|
-
yPositions
|
|
1747
|
-
},
|
|
1748
|
-
column.id
|
|
1749
|
-
);
|
|
1750
|
-
}) });
|
|
1751
|
-
}
|
|
1752
|
-
function CellEditorTop() {
|
|
1753
|
-
const { state } = useGrid();
|
|
1754
|
-
const p2 = state.internal.cellEditActiveEdits.use();
|
|
1755
|
-
const topCount = state.internal.rowTopCount.use();
|
|
1756
|
-
const locations = useMemo(() => {
|
|
1757
|
-
return getEditRows(p2, (l) => l.rowIndex < topCount);
|
|
1758
|
-
}, [p2, topCount]);
|
|
1759
|
-
return /* @__PURE__ */ jsx(Fragment, { children: locations.map(([key, locations2]) => {
|
|
1760
|
-
return /* @__PURE__ */ jsx(CellEditorRow, { locations: locations2 }, key);
|
|
1761
|
-
}) });
|
|
1762
|
-
}
|
|
1763
|
-
function CellEditorCenter() {
|
|
1764
|
-
const { state } = useGrid();
|
|
1765
|
-
const yPositions = state.internal.rowPositions.use();
|
|
1766
|
-
const topCount = state.internal.rowTopCount.use();
|
|
1767
|
-
const p2 = state.internal.cellEditActiveEdits.use();
|
|
1768
|
-
const botCount = state.internal.rowBottomCount.use();
|
|
1769
|
-
const firstBotIndex = yPositions.length - 1 - botCount;
|
|
1770
|
-
const locations = useMemo(() => {
|
|
1771
|
-
return getEditRows(p2, (l) => l.rowIndex >= topCount && l.rowIndex < firstBotIndex);
|
|
1772
|
-
}, [firstBotIndex, p2, topCount]);
|
|
1773
|
-
return /* @__PURE__ */ jsx(Fragment, { children: locations.map(([key, locations2]) => {
|
|
1774
|
-
return /* @__PURE__ */ jsx(CellEditorRow, { locations: locations2 }, key);
|
|
1775
|
-
}) });
|
|
1776
|
-
}
|
|
1777
|
-
function CellEditorBottom() {
|
|
1778
|
-
const { state } = useGrid();
|
|
1779
|
-
const yPositions = state.internal.rowPositions.use();
|
|
1780
|
-
const p2 = state.internal.cellEditActiveEdits.use();
|
|
1781
|
-
const botCount = state.internal.rowBottomCount.use();
|
|
1782
|
-
const firstBotIndex = yPositions.length - 1 - botCount;
|
|
1783
|
-
const locations = useMemo(() => {
|
|
1784
|
-
return getEditRows(p2, (l) => l.rowIndex >= firstBotIndex);
|
|
1785
|
-
}, [firstBotIndex, p2]);
|
|
1786
|
-
return /* @__PURE__ */ jsx(Fragment, { children: locations.map(([key, locations2]) => {
|
|
1787
|
-
return /* @__PURE__ */ jsx(CellEditorRow, { locations: locations2 }, key);
|
|
1788
|
-
}) });
|
|
1789
|
-
}
|
|
1790
|
-
function useEdgeScroll(api) {
|
|
1791
|
-
const intervalIdX = useRef(null);
|
|
1792
|
-
const intervalIdY = useRef(null);
|
|
1793
|
-
const cancelX = useCallback(() => {
|
|
1794
|
-
if (intervalIdX.current) {
|
|
1795
|
-
clearInterval(intervalIdX.current);
|
|
1796
|
-
intervalIdX.current = null;
|
|
1797
|
-
}
|
|
1798
|
-
}, []);
|
|
1799
|
-
const cancelY = useCallback(() => {
|
|
1800
|
-
if (intervalIdY.current) {
|
|
1801
|
-
clearInterval(intervalIdY.current);
|
|
1802
|
-
intervalIdY.current = null;
|
|
1803
|
-
}
|
|
1804
|
-
}, []);
|
|
1805
|
-
const edgeScrollY = useCallback(
|
|
1806
|
-
(visualPositionY) => {
|
|
1807
|
-
const s3 = api.getState();
|
|
1808
|
-
const viewportClientHeight = s3.internal.viewportInnerHeight.peek();
|
|
1809
|
-
const viewport = s3.internal.viewport.peek();
|
|
1810
|
-
const viewportHeight = Math.min(viewportClientHeight * 0.1, 100);
|
|
1811
|
-
const buffer = viewportHeight;
|
|
1812
|
-
const topBound = buffer + s3.internal.viewportHeaderHeight.peek();
|
|
1813
|
-
const botBound = viewportClientHeight - buffer;
|
|
1814
|
-
const speed = 3;
|
|
1815
|
-
if (visualPositionY < topBound && !intervalIdY.current) {
|
|
1816
|
-
intervalIdY.current = setInterval(() => {
|
|
1817
|
-
viewport.scrollBy({ top: -speed });
|
|
1818
|
-
}, 6);
|
|
1819
|
-
} else if (visualPositionY > botBound && !intervalIdY.current) {
|
|
1820
|
-
intervalIdY.current = setInterval(() => {
|
|
1821
|
-
viewport.scrollBy({ top: speed });
|
|
1822
|
-
}, 6);
|
|
1823
|
-
}
|
|
1824
|
-
if (intervalIdY.current && visualPositionY > topBound && visualPositionY < botBound) {
|
|
1825
|
-
cancelY();
|
|
1826
|
-
}
|
|
1827
|
-
},
|
|
1828
|
-
[api, cancelY]
|
|
1829
|
-
);
|
|
1830
|
-
const edgeScrollX = useCallback(
|
|
1831
|
-
(visualPositionX, isRtl) => {
|
|
1832
|
-
const s3 = api.getState();
|
|
1833
|
-
const viewportClientWidth = s3.internal.viewportInnerWidth.peek();
|
|
1834
|
-
const viewport = s3.internal.viewport.peek();
|
|
1835
|
-
const viewportWidth = Math.min(viewportClientWidth * 0.1, 100);
|
|
1836
|
-
const buffer = viewportWidth;
|
|
1837
|
-
const leftBound = buffer;
|
|
1838
|
-
const rightBound = viewportClientWidth - buffer;
|
|
1839
|
-
const speed = 3;
|
|
1840
|
-
if (visualPositionX < leftBound && !intervalIdX.current) {
|
|
1841
|
-
intervalIdX.current = setInterval(() => {
|
|
1842
|
-
viewport.scrollBy({ left: isRtl ? speed : -speed });
|
|
1843
|
-
}, 6);
|
|
1844
|
-
} else if (visualPositionX > rightBound && !intervalIdX.current) {
|
|
1845
|
-
intervalIdX.current = setInterval(() => {
|
|
1846
|
-
viewport.scrollBy({ left: isRtl ? -speed : speed });
|
|
1847
|
-
}, 6);
|
|
1848
|
-
}
|
|
1849
|
-
if (intervalIdX.current && visualPositionX > leftBound && visualPositionX < rightBound) {
|
|
1850
|
-
cancelX();
|
|
1851
|
-
}
|
|
1852
|
-
},
|
|
1853
|
-
[api, cancelX]
|
|
1854
|
-
);
|
|
1855
|
-
return { cancelX, edgeScrollX, cancelY, edgeScrollY };
|
|
1856
|
-
}
|
|
1857
|
-
function splitCellSelectionRect({
|
|
1858
|
-
rect,
|
|
1859
|
-
colStartCount,
|
|
1860
|
-
colCenterCount,
|
|
1861
|
-
rowTopCount,
|
|
1862
|
-
rowCenterCount
|
|
1863
|
-
}) {
|
|
1864
|
-
const colStartBound = colStartCount;
|
|
1865
|
-
const colEndBound = colStartCount + colCenterCount;
|
|
1866
|
-
const colSplits = [];
|
|
1867
|
-
if (rect.columnStart < colStartBound && rect.columnEnd > colStartBound) {
|
|
1868
|
-
const startSplit = {
|
|
1869
|
-
...rect,
|
|
1870
|
-
columnEnd: colStartBound
|
|
1871
|
-
};
|
|
1872
|
-
colSplits.push(startSplit);
|
|
1873
|
-
rect = { ...rect, columnStart: colStartBound };
|
|
1874
|
-
}
|
|
1875
|
-
if (rect.columnStart < colEndBound && rect.columnEnd > colEndBound) {
|
|
1876
|
-
const endSplit = {
|
|
1877
|
-
...rect,
|
|
1878
|
-
columnStart: colEndBound
|
|
1879
|
-
};
|
|
1880
|
-
rect = { ...rect, columnEnd: colEndBound };
|
|
1881
|
-
colSplits.push(endSplit);
|
|
1882
|
-
}
|
|
1883
|
-
colSplits.push(rect);
|
|
1884
|
-
const topBound = rowTopCount;
|
|
1885
|
-
const bottomBound = rowTopCount + rowCenterCount;
|
|
1886
|
-
const rowSplits = [];
|
|
1887
|
-
for (let split of colSplits) {
|
|
1888
|
-
if (split.rowStart < topBound && split.rowEnd > topBound) {
|
|
1889
|
-
const topSplit = { ...split, rowEnd: topBound };
|
|
1890
|
-
split = { ...split, rowStart: topBound };
|
|
1891
|
-
rowSplits.push(topSplit);
|
|
1892
|
-
}
|
|
1893
|
-
if (split.rowStart < bottomBound && split.rowEnd > bottomBound) {
|
|
1894
|
-
const bottomSplit = { ...split, rowStart: bottomBound };
|
|
1895
|
-
split = { ...split, rowEnd: bottomBound };
|
|
1896
|
-
rowSplits.push(bottomSplit);
|
|
1897
|
-
}
|
|
1898
|
-
rowSplits.push(split);
|
|
1899
|
-
}
|
|
1900
|
-
return rowSplits.sort((l, r2) => {
|
|
1901
|
-
return l.rowStart - r2.rowStart || l.columnStart - r2.columnStart;
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
|
-
function boundSelectionRect(api, rect) {
|
|
1905
|
-
const s3 = api.getState();
|
|
1906
|
-
const rowCount = s3.internal.rowCount.peek();
|
|
1907
|
-
const maxRow = rowCount;
|
|
1908
|
-
const minRow = 0;
|
|
1909
|
-
const maxColumn = s3.columnsVisible.peek().length;
|
|
1910
|
-
const minColumn = 0;
|
|
1911
|
-
const rowStartMaybe = clamp(minRow, rect.rowStart, maxRow);
|
|
1912
|
-
const rowEndMaybe = clamp(minRow, rect.rowEnd, maxRow);
|
|
1913
|
-
const colStartMaybe = clamp(minColumn, rect.columnStart, maxColumn);
|
|
1914
|
-
const colEndMaybe = clamp(minColumn, rect.columnEnd, maxColumn);
|
|
1915
|
-
const rowStart = Math.min(rowStartMaybe, rowEndMaybe);
|
|
1916
|
-
const rowEnd = Math.max(rowStartMaybe, rowEndMaybe);
|
|
1917
|
-
const columnStart = Math.min(colStartMaybe, colEndMaybe);
|
|
1918
|
-
const columnEnd = Math.max(colStartMaybe, colEndMaybe);
|
|
1919
|
-
return { rowStart, rowEnd, columnStart, columnEnd };
|
|
1920
|
-
}
|
|
1921
|
-
function areRectsEqual(left, right) {
|
|
1922
|
-
return left.rowStart === right.rowStart && left.rowEnd === right.rowEnd && left.columnStart === right.columnStart && left.columnEnd === right.columnEnd;
|
|
1923
|
-
}
|
|
1924
|
-
function isOverlappingRect(rect1, rect2) {
|
|
1925
|
-
return !(rect1.rowEnd < rect2.rowStart || rect1.rowStart > rect2.rowEnd || rect1.columnEnd < rect2.columnStart || rect1.columnStart > rect2.columnEnd);
|
|
1926
|
-
}
|
|
1927
|
-
function deselectRectRange(rect, deselectRect) {
|
|
1928
|
-
if (!isOverlappingRect(rect, deselectRect)) return [rect];
|
|
1929
|
-
const result = [];
|
|
1930
|
-
if (deselectRect.rowStart > rect.rowStart) {
|
|
1931
|
-
result.push({
|
|
1932
|
-
rowStart: rect.rowStart,
|
|
1933
|
-
rowEnd: deselectRect.rowStart,
|
|
1934
|
-
columnStart: rect.columnStart,
|
|
1935
|
-
columnEnd: rect.columnEnd
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
if (deselectRect.rowEnd < rect.rowEnd) {
|
|
1939
|
-
result.push({
|
|
1940
|
-
rowStart: deselectRect.rowEnd,
|
|
1941
|
-
rowEnd: rect.rowEnd,
|
|
1942
|
-
columnStart: rect.columnStart,
|
|
1943
|
-
columnEnd: rect.columnEnd
|
|
1944
|
-
});
|
|
1945
|
-
}
|
|
1946
|
-
if (deselectRect.columnStart > rect.columnStart) {
|
|
1947
|
-
result.push({
|
|
1948
|
-
rowStart: Math.max(deselectRect.rowStart, rect.rowStart),
|
|
1949
|
-
rowEnd: Math.min(deselectRect.rowEnd, rect.rowEnd),
|
|
1950
|
-
columnStart: rect.columnStart,
|
|
1951
|
-
columnEnd: deselectRect.columnStart
|
|
1952
|
-
});
|
|
1953
|
-
}
|
|
1954
|
-
if (deselectRect.columnEnd < rect.columnEnd) {
|
|
1955
|
-
result.push({
|
|
1956
|
-
rowStart: Math.max(deselectRect.rowStart, rect.rowStart),
|
|
1957
|
-
rowEnd: Math.min(deselectRect.rowEnd, rect.rowEnd),
|
|
1958
|
-
columnStart: deselectRect.columnEnd,
|
|
1959
|
-
columnEnd: rect.columnEnd
|
|
1960
|
-
});
|
|
1961
|
-
}
|
|
1962
|
-
return result.filter(
|
|
1963
|
-
(rect2) => !(rect2.rowStart >= rect2.rowEnd || rect2.columnStart >= rect2.columnEnd)
|
|
1964
|
-
);
|
|
1965
|
-
}
|
|
1966
|
-
function adjustRectForRowAndCellSpan(api, rect) {
|
|
1967
|
-
let { rowStart, rowEnd, columnStart, columnEnd } = rect;
|
|
1968
|
-
for (let i = columnStart; i < columnEnd; i++) {
|
|
1969
|
-
let cell = getRootCell(api, rowStart, i);
|
|
1970
|
-
if (cell) {
|
|
1971
|
-
columnStart = Math.min(columnStart, cell.columnIndex);
|
|
1972
|
-
columnEnd = Math.max(columnEnd, cell.columnIndex + cell.columnSpan);
|
|
1973
|
-
rowStart = Math.min(rowStart, cell.rowIndex);
|
|
1974
|
-
rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
|
|
1975
|
-
}
|
|
1976
|
-
cell = getRootCell(api, rowEnd - 1, i);
|
|
1977
|
-
if (cell) {
|
|
1978
|
-
columnStart = Math.min(columnStart, cell.columnIndex);
|
|
1979
|
-
columnEnd = Math.max(columnEnd, cell.columnIndex + cell.columnSpan);
|
|
1980
|
-
rowStart = Math.min(rowStart, cell.rowIndex);
|
|
1981
|
-
rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
for (let i = rowStart; i < rowEnd; i++) {
|
|
1985
|
-
let cell = getRootCell(api, i, columnStart);
|
|
1986
|
-
if (cell) {
|
|
1987
|
-
columnStart = Math.min(columnStart, cell.columnIndex);
|
|
1988
|
-
columnEnd = Math.max(columnEnd, cell.columnIndex + cell.columnSpan);
|
|
1989
|
-
rowStart = Math.min(rowStart, cell.rowIndex);
|
|
1990
|
-
rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
|
|
1991
|
-
}
|
|
1992
|
-
cell = getRootCell(api, i, columnEnd - 1);
|
|
1993
|
-
if (cell) {
|
|
1994
|
-
columnStart = Math.min(columnStart, cell.columnIndex);
|
|
1995
|
-
columnEnd = Math.max(columnEnd, cell.columnIndex + cell.columnSpan);
|
|
1996
|
-
rowStart = Math.min(rowStart, cell.rowIndex);
|
|
1997
|
-
rowEnd = Math.max(rowEnd, cell.rowIndex + cell.rowSpan);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
return {
|
|
2001
|
-
rowStart,
|
|
2002
|
-
rowEnd,
|
|
2003
|
-
columnStart,
|
|
2004
|
-
columnEnd
|
|
2005
|
-
};
|
|
2006
|
-
}
|
|
2007
|
-
function updateAdditiveCellSelection(api, rect) {
|
|
2008
|
-
const s3 = api.getState();
|
|
2009
|
-
const rects = splitCellSelectionRect({
|
|
2010
|
-
rect: boundSelectionRect(api, adjustRectForRowAndCellSpan(api, rect)),
|
|
2011
|
-
colCenterCount: s3.columnVisibleCenterCount.peek(),
|
|
2012
|
-
colStartCount: s3.columnVisibleStartCount.peek(),
|
|
2013
|
-
rowCenterCount: s3.internal.rowCount.peek() - s3.internal.rowTopCount.peek() - s3.internal.rowBottomCount.peek(),
|
|
2014
|
-
rowTopCount: s3.internal.rowTopCount.peek()
|
|
2015
|
-
});
|
|
2016
|
-
const current = s3.internal.cellSelectionAdditiveRects.peek();
|
|
2017
|
-
if (current && current.length === rects.length) {
|
|
2018
|
-
if (current.every((c, i) => areRectsEqual(c, rects[i]))) return;
|
|
2019
|
-
}
|
|
2020
|
-
s3.internal.cellSelectionAdditiveRects.set(rects);
|
|
2021
|
-
}
|
|
2022
|
-
function isBottomRect(api, rect) {
|
|
2023
|
-
const s3 = api.getState();
|
|
2024
|
-
const bottomStart = s3.internal.rowCount.peek() - s3.internal.rowBottomCount.peek();
|
|
2025
|
-
return rect.rowStart >= bottomStart;
|
|
2026
|
-
}
|
|
2027
|
-
function isCenterRect(api, rect) {
|
|
2028
|
-
const s3 = api.getState();
|
|
2029
|
-
const bottomStart = s3.internal.rowCount.peek() - s3.internal.rowBottomCount.peek();
|
|
2030
|
-
return rect.rowStart < bottomStart && rect.rowStart >= s3.internal.rowTopCount.peek();
|
|
2031
|
-
}
|
|
2032
|
-
function isTopRect(api, rect) {
|
|
2033
|
-
const topCount = api.getState().internal.rowTopCount.peek();
|
|
2034
|
-
return rect.rowStart < topCount;
|
|
2035
|
-
}
|
|
2036
|
-
function isNormalClick(event) {
|
|
2037
|
-
return event.button === 0 && !event.ctrlKey && !event.altKey && !event.metaKey;
|
|
2038
|
-
}
|
|
2039
|
-
function CellSelectionDriver() {
|
|
2040
|
-
const { state, api } = useGrid$1();
|
|
2041
|
-
const viewport = state.internal.viewport.use();
|
|
2042
|
-
const mode = state.cellSelectionMode.use();
|
|
2043
|
-
const { cancelX, cancelY, edgeScrollX, edgeScrollY } = useEdgeScroll(api);
|
|
2044
|
-
useEffect(() => {
|
|
2045
|
-
if (!viewport || mode === "none" || mode === "single") {
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
const isMultiRange = mode === "multi-range";
|
|
2049
|
-
let isAdditive = false;
|
|
2050
|
-
let startSelection = null;
|
|
2051
|
-
let pointerStartX = 0;
|
|
2052
|
-
let pointerStartY = 0;
|
|
2053
|
-
let lastRect = null;
|
|
2054
|
-
let animFrame = null;
|
|
2055
|
-
const pointerMove = (event) => {
|
|
2056
|
-
if (animFrame) cancelAnimationFrame(animFrame);
|
|
2057
|
-
animFrame = requestAnimationFrame(() => {
|
|
2058
|
-
animFrame = null;
|
|
2059
|
-
const s3 = api.getState();
|
|
2060
|
-
const clientX = getClientX(event);
|
|
2061
|
-
const clientY = getClientY(event);
|
|
2062
|
-
const columnIndex = getHoveredColumnIndex(api, clientX);
|
|
2063
|
-
const rowIndex = getHoveredRowIndex(api, clientY);
|
|
2064
|
-
if (rowIndex == null || columnIndex == null) return;
|
|
2065
|
-
if (pointerStartX != null && pointerStartY != null) {
|
|
2066
|
-
const moveDeltaX = Math.abs(pointerStartX - clientX);
|
|
2067
|
-
const moveDeltaY = Math.abs(pointerStartY - clientY);
|
|
2068
|
-
if (moveDeltaX < 20 && moveDeltaY < 20) return;
|
|
2069
|
-
pointerStartX = null;
|
|
2070
|
-
pointerStartY = null;
|
|
2071
|
-
}
|
|
2072
|
-
if (!startSelection) return;
|
|
2073
|
-
const relativeX = getRelativeXPosition(viewport, clientX);
|
|
2074
|
-
const isRtl = s3.rtl.peek();
|
|
2075
|
-
const visualX = isRtl ? relativeX.right : relativeX.left;
|
|
2076
|
-
edgeScrollX(visualX, isRtl);
|
|
2077
|
-
const relativeY = getRelativeYPosition(viewport, clientY);
|
|
2078
|
-
edgeScrollY(relativeY.top);
|
|
2079
|
-
const topCount = s3.internal.rowTopCount.peek();
|
|
2080
|
-
const centerCount = s3.internal.rowCount.peek() - topCount - s3.internal.rowBottomCount.peek();
|
|
2081
|
-
const scrollY = s3.internal.viewport.peek().scrollTop;
|
|
2082
|
-
if (rowIndex < topCount && scrollY > 0) return;
|
|
2083
|
-
const maxScroll = viewport.scrollHeight - viewport.clientHeight - 4;
|
|
2084
|
-
if (rowIndex > topCount + centerCount - 1 && scrollY < maxScroll) return;
|
|
2085
|
-
const startCount = s3.columnVisibleStartCount.peek();
|
|
2086
|
-
const firstEnd = s3.columnVisibleCenterCount.peek() + startCount;
|
|
2087
|
-
const scrollX = Math.abs(s3.internal.viewport.peek().scrollLeft);
|
|
2088
|
-
if (columnIndex < startCount && scrollX > 0) return;
|
|
2089
|
-
const maxScrollX = viewport.scrollWidth - viewport.clientWidth - 4;
|
|
2090
|
-
if (columnIndex >= firstEnd && scrollX < maxScrollX) return;
|
|
2091
|
-
const startRow = rowIndex < startSelection.rowStart ? rowIndex : startSelection.rowStart;
|
|
2092
|
-
const endRow = rowIndex < startSelection.rowStart ? startSelection.rowEnd : rowIndex + 1;
|
|
2093
|
-
const startCol = columnIndex < startSelection.columnStart ? columnIndex : startSelection.columnStart;
|
|
2094
|
-
const endCol = columnIndex < startSelection.columnStart ? startSelection.columnEnd : columnIndex + 1;
|
|
2095
|
-
const active = [
|
|
2096
|
-
{ rowStart: startRow, rowEnd: endRow, columnStart: startCol, columnEnd: endCol }
|
|
2097
|
-
];
|
|
2098
|
-
if (isAdditive) {
|
|
2099
|
-
updateAdditiveCellSelection(api, active[0]);
|
|
2100
|
-
} else {
|
|
2101
|
-
s3.cellSelections.set(active);
|
|
2102
|
-
}
|
|
2103
|
-
lastRect = active[0];
|
|
2104
|
-
});
|
|
2105
|
-
};
|
|
2106
|
-
const pointerDown = (event) => {
|
|
2107
|
-
if (!isNormalClick(event)) {
|
|
2108
|
-
document.removeEventListener("pointermove", pointerMove);
|
|
2109
|
-
event.preventDefault();
|
|
2110
|
-
return;
|
|
2111
|
-
}
|
|
2112
|
-
const s3 = api.getState();
|
|
2113
|
-
const contextMenuOpen = !!s3.internal.contextMenuTarget.peek();
|
|
2114
|
-
const columnMenuOpen = !!s3.internal.columnMenuColumn.peek();
|
|
2115
|
-
const panelFrameOpen = !!s3.internal.panelFrameOpen.peek();
|
|
2116
|
-
const floatingFrameOpen = !!s3.internal.floatingFrameOpen.peek();
|
|
2117
|
-
if (contextMenuOpen || columnMenuOpen || panelFrameOpen || floatingFrameOpen) {
|
|
2118
|
-
document.removeEventListener("pointermove", pointerMove);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
isAdditive = isMultiRange && (event.ctrlKey || event.metaKey);
|
|
2122
|
-
const clientX = getClientX(event);
|
|
2123
|
-
const clientY = getClientY(event);
|
|
2124
|
-
const columnIndex = getHoveredColumnIndex(api, clientX);
|
|
2125
|
-
const rowIndex = getHoveredRowIndex(api, clientY);
|
|
2126
|
-
if (columnIndex == null || rowIndex == null) {
|
|
2127
|
-
s3.cellSelections.set([]);
|
|
2128
|
-
s3.internal.cellSelectionPivot.set(null);
|
|
2129
|
-
return;
|
|
2130
|
-
}
|
|
2131
|
-
const isDeselect = isAdditive && api.cellSelectionIsSelected(rowIndex, columnIndex);
|
|
2132
|
-
pointerStartX = event.clientX;
|
|
2133
|
-
pointerStartY = event.clientY;
|
|
2134
|
-
startSelection = {
|
|
2135
|
-
columnStart: columnIndex,
|
|
2136
|
-
columnEnd: columnIndex + 1,
|
|
2137
|
-
rowStart: rowIndex,
|
|
2138
|
-
rowEnd: rowIndex + 1
|
|
2139
|
-
};
|
|
2140
|
-
const pivot = s3.internal.cellSelectionPivot.peek();
|
|
2141
|
-
if (event.shiftKey && pivot) {
|
|
2142
|
-
const active = { ...pivot };
|
|
2143
|
-
active.columnStart = Math.min(columnIndex, active.columnStart);
|
|
2144
|
-
active.columnEnd = Math.max(columnIndex + 1, active.columnEnd);
|
|
2145
|
-
active.rowStart = Math.min(rowIndex, active.rowStart);
|
|
2146
|
-
active.rowEnd = Math.max(rowIndex + 1, active.rowEnd);
|
|
2147
|
-
s3.cellSelections.set([active]);
|
|
2148
|
-
event.preventDefault();
|
|
2149
|
-
return;
|
|
2150
|
-
}
|
|
2151
|
-
if (mode === "multi-range" && (event.metaKey || event.ctrlKey)) {
|
|
2152
|
-
event.preventDefault();
|
|
2153
|
-
}
|
|
2154
|
-
s3.internal.cellSelectionPivot.set(startSelection);
|
|
2155
|
-
s3.internal.cellSelectionIsDeselect.set(isDeselect);
|
|
2156
|
-
if (isAdditive) {
|
|
2157
|
-
updateAdditiveCellSelection(api, startSelection);
|
|
2158
|
-
} else {
|
|
2159
|
-
s3.cellSelections.set([startSelection]);
|
|
2160
|
-
}
|
|
2161
|
-
lastRect = startSelection;
|
|
2162
|
-
document.addEventListener("pointermove", pointerMove);
|
|
2163
|
-
document.addEventListener("contextmenu", pointerUp);
|
|
2164
|
-
document.addEventListener("pointerup", pointerUp);
|
|
2165
|
-
};
|
|
2166
|
-
const pointerUp = () => {
|
|
2167
|
-
startSelection = null;
|
|
2168
|
-
if (isAdditive) {
|
|
2169
|
-
const s3 = api.getState();
|
|
2170
|
-
const isDeselect = s3.internal.cellSelectionIsDeselect.peek();
|
|
2171
|
-
const rects = isDeselect ? s3.cellSelections.peek().flatMap((r2) => deselectRectRange(r2, lastRect)) : [...s3.cellSelections.peek(), lastRect];
|
|
2172
|
-
s3.cellSelections.set(rects);
|
|
2173
|
-
s3.internal.cellSelectionAdditiveRects.set(null);
|
|
2174
|
-
s3.internal.cellSelectionIsDeselect.set(false);
|
|
2175
|
-
isAdditive = false;
|
|
2176
|
-
}
|
|
2177
|
-
cancelX();
|
|
2178
|
-
cancelY();
|
|
2179
|
-
document.removeEventListener("pointerup", pointerUp);
|
|
2180
|
-
document.removeEventListener("contextmenu", pointerUp);
|
|
2181
|
-
document.removeEventListener("pointermove", pointerMove);
|
|
2182
|
-
};
|
|
2183
|
-
viewport.addEventListener("pointerdown", pointerDown);
|
|
2184
|
-
const handleKey = (ev) => {
|
|
2185
|
-
const rtl = state.rtl.peek();
|
|
2186
|
-
const start = rtl ? "ArrowRight" : "ArrowLeft";
|
|
2187
|
-
const end = rtl ? "ArrowLeft" : "ArrowRight";
|
|
2188
|
-
if (!ev.shiftKey) return;
|
|
2189
|
-
let handled = false;
|
|
2190
|
-
if (ev.key === start) {
|
|
2191
|
-
api.cellSelectionExpandStart();
|
|
2192
|
-
handled = true;
|
|
2193
|
-
} else if (ev.key === end) {
|
|
2194
|
-
api.cellSelectionExpandEnd();
|
|
2195
|
-
handled = true;
|
|
2196
|
-
} else if (ev.key === "ArrowDown") {
|
|
2197
|
-
api.cellSelectionExpandDown();
|
|
2198
|
-
handled = true;
|
|
2199
|
-
} else if (ev.key === "ArrowUp") {
|
|
2200
|
-
api.cellSelectionExpandUp();
|
|
2201
|
-
handled = true;
|
|
2202
|
-
}
|
|
2203
|
-
if (handled) {
|
|
2204
|
-
ev.preventDefault();
|
|
2205
|
-
ev.stopPropagation();
|
|
2206
|
-
}
|
|
2207
|
-
};
|
|
2208
|
-
viewport.addEventListener("keydown", handleKey);
|
|
2209
|
-
return () => {
|
|
2210
|
-
viewport.removeEventListener("pointerdown", pointerDown);
|
|
2211
|
-
viewport.removeEventListener("keydown", handleKey);
|
|
2212
|
-
};
|
|
2213
|
-
}, [
|
|
2214
|
-
api,
|
|
2215
|
-
cancelX,
|
|
2216
|
-
cancelY,
|
|
2217
|
-
edgeScrollX,
|
|
2218
|
-
edgeScrollY,
|
|
2219
|
-
mode,
|
|
2220
|
-
state.cellSelections,
|
|
2221
|
-
state.internal.cellSelectionPivot,
|
|
2222
|
-
state.internal.navigatePosition,
|
|
2223
|
-
state.rtl,
|
|
2224
|
-
viewport
|
|
2225
|
-
]);
|
|
2226
|
-
useEffect(() => {
|
|
2227
|
-
if (mode === "none" || !viewport) return;
|
|
2228
|
-
const controller = new AbortController();
|
|
2229
|
-
viewport.addEventListener(
|
|
2230
|
-
"keydown",
|
|
2231
|
-
(ev) => {
|
|
2232
|
-
const meta = ev.ctrlKey || ev.metaKey;
|
|
2233
|
-
if (ev.key === "c" && meta) {
|
|
2234
|
-
api.clipboardCopyCells();
|
|
2235
|
-
} else if (ev.key === "x" && meta) {
|
|
2236
|
-
api.clipboardCutCells();
|
|
2237
|
-
} else if (ev.key === "v" && meta) {
|
|
2238
|
-
api.clipboardPasteCells();
|
|
2239
|
-
}
|
|
2240
|
-
},
|
|
2241
|
-
{ signal: controller.signal }
|
|
2242
|
-
);
|
|
2243
|
-
let previousPos = state.internal.navigatePosition.peek();
|
|
2244
|
-
const unsub = state.internal.navigatePosition.watch(() => {
|
|
2245
|
-
const pos = state.internal.navigatePosition.peek();
|
|
2246
|
-
if (!pos || state.internal.cellSelectionSoftFocus.peek()) {
|
|
2247
|
-
state.internal.cellSelectionSoftFocus.set(false);
|
|
2248
|
-
return;
|
|
2249
|
-
}
|
|
2250
|
-
if (equal(previousPos, pos)) return;
|
|
2251
|
-
previousPos = pos;
|
|
2252
|
-
if (pos.kind !== GRID_CELL_POSITION) return state.cellSelections.set([]);
|
|
2253
|
-
else {
|
|
2254
|
-
const rect = adjustRectForRowAndCellSpan(api, {
|
|
2255
|
-
rowStart: pos.rowIndex,
|
|
2256
|
-
rowEnd: pos.rowIndex + 1,
|
|
2257
|
-
columnStart: pos.columnIndex,
|
|
2258
|
-
columnEnd: pos.columnIndex + 1
|
|
2259
|
-
});
|
|
2260
|
-
state.internal.cellSelectionPivot.set(rect);
|
|
2261
|
-
state.cellSelections.set([rect]);
|
|
2262
|
-
}
|
|
2263
|
-
});
|
|
2264
|
-
return () => {
|
|
2265
|
-
unsub();
|
|
2266
|
-
controller.abort();
|
|
2267
|
-
};
|
|
2268
|
-
}, [
|
|
2269
|
-
api,
|
|
2270
|
-
mode,
|
|
2271
|
-
state.cellSelections,
|
|
2272
|
-
state.internal.cellSelectionPivot,
|
|
2273
|
-
state.internal.cellSelectionSoftFocus,
|
|
2274
|
-
state.internal.navigatePosition,
|
|
2275
|
-
viewport
|
|
2276
|
-
]);
|
|
2277
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
2278
|
-
}
|
|
2279
|
-
function CellStyleRow({
|
|
2280
|
-
rect,
|
|
2281
|
-
isRowPinnedTop,
|
|
2282
|
-
isDeselect,
|
|
2283
|
-
isRowPinnedBottom,
|
|
2284
|
-
isPivot
|
|
2285
|
-
}) {
|
|
2286
|
-
const { state, api } = useGrid$1();
|
|
2287
|
-
const xPositions = state.columnPositions.use();
|
|
2288
|
-
const yPositions = state.internal.rowPositions.use();
|
|
2289
|
-
const rtl = state.rtl.use();
|
|
2290
|
-
const flash = state.internal.cellSelectionFlashOn.use();
|
|
2291
|
-
const startCount = state.columnVisibleStartCount.use();
|
|
2292
|
-
const centerCount = state.columnVisibleCenterCount.use();
|
|
2293
|
-
const paginate = state.paginate.use();
|
|
2294
|
-
const currentPage = state.paginateCurrentPage.use();
|
|
2295
|
-
const rowCount = state.internal.rowCount.use();
|
|
2296
|
-
const rowTopCount = state.internal.rowTopCount.use();
|
|
2297
|
-
const rowBotCount = state.internal.rowBottomCount.use();
|
|
2298
|
-
const vpWidth = state.internal.viewportInnerWidth.use();
|
|
2299
|
-
const style = useMemo(() => {
|
|
2300
|
-
const isStart = rect.columnStart < startCount;
|
|
2301
|
-
const isEnd = rect.columnStart >= startCount + centerCount;
|
|
2302
|
-
const isTop = isRowPinnedTop;
|
|
2303
|
-
const isBot = isRowPinnedBottom;
|
|
2304
|
-
const columnIndex = rect.columnStart;
|
|
2305
|
-
const rowIndex = rect.rowStart;
|
|
2306
|
-
const width = sizeFromCoord(rect.columnStart, xPositions, rect.columnEnd - rect.columnStart);
|
|
2307
|
-
const height = sizeFromCoord(rect.rowStart, yPositions, rect.rowEnd - rect.rowStart);
|
|
2308
|
-
const firstBotIndex = rowCount - rowBotCount;
|
|
2309
|
-
let paginateOffset = 0;
|
|
2310
|
-
if (paginate) {
|
|
2311
|
-
const [rowStart] = api.paginateRowStartAndEndForPage(currentPage);
|
|
2312
|
-
paginateOffset = yPositions[rowStart];
|
|
2313
|
-
}
|
|
2314
|
-
const x2 = isEnd ? xPositions[columnIndex] - xPositions.at(-1) + vpWidth : xPositions[columnIndex];
|
|
2315
|
-
const y2 = isBot ? yPositions[rowIndex] - yPositions[firstBotIndex] : isTop ? yPositions[rowIndex] : yPositions[rowIndex] - yPositions[rowTopCount] - paginateOffset;
|
|
2316
|
-
const transform = getTransform(x2 * (rtl ? -1 : 1), y2);
|
|
2317
|
-
const style2 = { height, width, transform };
|
|
2318
|
-
if (isStart || isEnd) {
|
|
2319
|
-
style2.insetInlineStart = "0px";
|
|
2320
|
-
style2.position = "sticky";
|
|
2321
|
-
style2.zIndex = 2;
|
|
2322
|
-
}
|
|
2323
|
-
if (isTop || isBot) {
|
|
2324
|
-
style2.position = "sticky";
|
|
2325
|
-
style2.top = "0px";
|
|
2326
|
-
style2.zIndex = isStart ? 4 : 3;
|
|
2327
|
-
}
|
|
2328
|
-
return style2;
|
|
2329
|
-
}, [
|
|
2330
|
-
api,
|
|
2331
|
-
centerCount,
|
|
2332
|
-
currentPage,
|
|
2333
|
-
isRowPinnedBottom,
|
|
2334
|
-
isRowPinnedTop,
|
|
2335
|
-
paginate,
|
|
2336
|
-
rect.columnEnd,
|
|
2337
|
-
rect.columnStart,
|
|
2338
|
-
rect.rowEnd,
|
|
2339
|
-
rect.rowStart,
|
|
2340
|
-
rowBotCount,
|
|
2341
|
-
rowCount,
|
|
2342
|
-
rowTopCount,
|
|
2343
|
-
rtl,
|
|
2344
|
-
startCount,
|
|
2345
|
-
vpWidth,
|
|
2346
|
-
xPositions,
|
|
2347
|
-
yPositions
|
|
2348
|
-
]);
|
|
2349
|
-
return /* @__PURE__ */ jsx(
|
|
2350
|
-
"div",
|
|
2351
|
-
{
|
|
2352
|
-
style,
|
|
2353
|
-
className: clsx(
|
|
2354
|
-
"lng1771-cell-selection",
|
|
2355
|
-
isDeselect && "lng1771-cell-selection--deselect",
|
|
2356
|
-
isPivot && "lng1771-cell-selection--pivot",
|
|
2357
|
-
flash && "lng1771-cell-selection--flash"
|
|
2358
|
-
)
|
|
2359
|
-
}
|
|
2360
|
-
);
|
|
2361
|
-
}
|
|
2362
|
-
const CellSelectionTop = memo(function CellSelectionTop2() {
|
|
2363
|
-
const { state, api } = useGrid$1();
|
|
2364
|
-
const allRects = state.internal.cellSelectionSplits.use();
|
|
2365
|
-
const topRects = useMemo(() => {
|
|
2366
|
-
return allRects.filter((rect) => isTopRect(api, rect));
|
|
2367
|
-
}, [allRects, api]);
|
|
2368
|
-
const mode = state.cellSelectionMode.use();
|
|
2369
|
-
const showPivot = mode === "multi-range" || mode === "range";
|
|
2370
|
-
const additive = state.internal.cellSelectionAdditiveRects.use();
|
|
2371
|
-
const isDeselect = state.internal.cellSelectionIsDeselect.use();
|
|
2372
|
-
const pivot = state.internal.cellSelectionPivot.use();
|
|
2373
|
-
const additiveRects = useMemo(() => {
|
|
2374
|
-
if (!additive) return [];
|
|
2375
|
-
return additive.filter((rect) => isTopRect(api, rect));
|
|
2376
|
-
}, [additive, api]);
|
|
2377
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2378
|
-
topRects.map((rect, i) => {
|
|
2379
|
-
return /* @__PURE__ */ jsx(CellStyleRow, { rect, isRowPinnedTop: true }, i);
|
|
2380
|
-
}),
|
|
2381
|
-
additiveRects.map((rect) => {
|
|
2382
|
-
return /* @__PURE__ */ jsx(CellStyleRow, { rect, isDeselect }, rect.columnStart);
|
|
2383
|
-
}),
|
|
2384
|
-
showPivot && pivot && isTopRect(api, pivot) && /* @__PURE__ */ jsx(CellStyleRow, { rect: pivot, isPivot: true, isRowPinnedTop: true })
|
|
2385
|
-
] });
|
|
2386
|
-
});
|
|
2387
|
-
const CellSelectionCenter = memo(function CellSelectionCenter2() {
|
|
2388
|
-
const { state, api } = useGrid$1();
|
|
2389
|
-
const allRects = state.internal.cellSelectionSplits.use();
|
|
2390
|
-
const pivot = state.internal.cellSelectionPivot.use();
|
|
2391
|
-
const centerRects = useMemo(() => {
|
|
2392
|
-
return allRects.filter((rect) => isCenterRect(api, rect));
|
|
2393
|
-
}, [allRects, api]);
|
|
2394
|
-
const additive = state.internal.cellSelectionAdditiveRects.use();
|
|
2395
|
-
const isDeselect = state.internal.cellSelectionIsDeselect.use();
|
|
2396
|
-
const additiveRects = useMemo(() => {
|
|
2397
|
-
if (!additive) return [];
|
|
2398
|
-
return additive.filter((rect) => isCenterRect(api, rect));
|
|
2399
|
-
}, [additive, api]);
|
|
2400
|
-
const mode = state.cellSelectionMode.use();
|
|
2401
|
-
const showPivot = mode === "multi-range" || mode === "range";
|
|
2402
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2403
|
-
centerRects.map((rect, i) => {
|
|
2404
|
-
return /* @__PURE__ */ jsx(CellStyleRow, { rect }, i);
|
|
2405
|
-
}),
|
|
2406
|
-
additiveRects.map((rect) => {
|
|
2407
|
-
return /* @__PURE__ */ jsx(CellStyleRow, { rect, isDeselect }, rect.columnStart);
|
|
2408
|
-
}),
|
|
2409
|
-
showPivot && pivot && isCenterRect(api, pivot) && /* @__PURE__ */ jsx(CellStyleRow, { rect: pivot, isPivot: true })
|
|
2410
|
-
] });
|
|
2411
|
-
});
|
|
2412
|
-
const CellSelectionBottom = memo(function CellSelectionBottom2() {
|
|
2413
|
-
const { state, api } = useGrid$1();
|
|
2414
|
-
const allRects = state.internal.cellSelectionSplits.use();
|
|
2415
|
-
const pivot = state.internal.cellSelectionPivot.use();
|
|
2416
|
-
const bottomRects = useMemo(() => {
|
|
2417
|
-
return allRects.filter((rect) => isBottomRect(api, rect));
|
|
2418
|
-
}, [allRects, api]);
|
|
2419
|
-
const additive = state.internal.cellSelectionAdditiveRects.use();
|
|
2420
|
-
const isDeselect = state.internal.cellSelectionIsDeselect.use();
|
|
2421
|
-
const additiveRects = useMemo(() => {
|
|
2422
|
-
if (!additive) return [];
|
|
2423
|
-
return additive.filter((rect) => isBottomRect(api, rect));
|
|
2424
|
-
}, [additive, api]);
|
|
2425
|
-
const mode = state.cellSelectionMode.use();
|
|
2426
|
-
const showPivot = mode === "multi-range" || mode === "range";
|
|
2427
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2428
|
-
bottomRects.map((rect, i) => {
|
|
2429
|
-
return /* @__PURE__ */ jsx(CellStyleRow, { rect, isRowPinnedBottom: true }, i);
|
|
2430
|
-
}),
|
|
2431
|
-
additiveRects.map((rect) => {
|
|
2432
|
-
return /* @__PURE__ */ jsx(CellStyleRow, { rect, isDeselect }, rect.columnStart);
|
|
2433
|
-
}),
|
|
2434
|
-
showPivot && pivot && isBottomRect(api, pivot) && /* @__PURE__ */ jsx(CellStyleRow, { rect: pivot, isPivot: true, isRowPinnedBottom: true })
|
|
2435
|
-
] });
|
|
2436
|
-
});
|
|
2437
|
-
const hashSalt = "faec0f3c45281b1fe12d87e64a6c3271";
|
|
2438
|
-
const issueDate = /* @__PURE__ */ new Date("2025-05-18");
|
|
2439
|
-
function getHostname() {
|
|
2440
|
-
const win = globalThis?.document?.defaultView || (typeof window !== "undefined" ? window : null);
|
|
2441
|
-
const loc = win?.location;
|
|
2442
|
-
const { hostname = "" } = loc ?? {};
|
|
2443
|
-
return hostname;
|
|
2444
|
-
}
|
|
2445
|
-
function isWebsiteUrl() {
|
|
2446
|
-
const hostname = getHostname();
|
|
2447
|
-
return hostname.match(/^((?:\w+\.)?1771technologies\.com)$/) !== null;
|
|
2448
|
-
}
|
|
2449
|
-
function isLocalhost() {
|
|
2450
|
-
const hostname = getHostname();
|
|
2451
|
-
return hostname.match(/^(?:127\.0\.0\.1|localhost)$/) !== null;
|
|
2452
|
-
}
|
|
2453
|
-
let hasAValidLicense = isWebsiteUrl() || isLocalhost();
|
|
2454
|
-
function activateLicense(license) {
|
|
2455
|
-
const parts = license.split("|");
|
|
2456
|
-
const details = parts[0];
|
|
2457
|
-
const hash = parts[1];
|
|
2458
|
-
const detailHash = new MD5().md5(details + hashSalt);
|
|
2459
|
-
if (detailHash !== hash) {
|
|
2460
|
-
console.error(
|
|
2461
|
-
`
|
|
2462
|
-
********************************************************************************
|
|
2463
|
-
INVALID LICENSE KEY SUPPLIED
|
|
2464
|
-
|
|
2465
|
-
The license key you provided is not a valid LyteNyte Grid license key. If you
|
|
2466
|
-
purchased a valid license from 1771 Technologies, please reach out to
|
|
2467
|
-
our dedicated support email support@1771technologies.com.
|
|
2468
|
-
|
|
2469
|
-
If you are interested in purchasing a valid license, please
|
|
2470
|
-
visit https://1771technolgies.com
|
|
2471
|
-
********************************************************************************
|
|
2472
|
-
`
|
|
2473
|
-
);
|
|
2474
|
-
return false;
|
|
2475
|
-
}
|
|
2476
|
-
const detailParts = details.split(" ");
|
|
2477
|
-
const endDate = new Date(detailParts[1]);
|
|
2478
|
-
if (issueDate > endDate) {
|
|
2479
|
-
console.error(`
|
|
2480
|
-
********************************************************************************
|
|
2481
|
-
LICENSE EXPIRED
|
|
2482
|
-
|
|
2483
|
-
The license provided is a valid LyteNyte license, however it is not valid for the
|
|
2484
|
-
current version of LyteNyte Grid being used. Please renew your license or use
|
|
2485
|
-
the fallback version valid under your license.
|
|
2486
|
-
|
|
2487
|
-
To purchase a new license or learn more about which versions your license is valid
|
|
2488
|
-
for please visit https://1771technologies.com.
|
|
2489
|
-
********************************************************************************
|
|
2490
|
-
`);
|
|
2491
|
-
return false;
|
|
2492
|
-
}
|
|
2493
|
-
hasAValidLicense = true;
|
|
2494
|
-
return true;
|
|
2495
|
-
}
|
|
2496
|
-
class MD5 {
|
|
2497
|
-
md5cycle(x2, k) {
|
|
2498
|
-
let a = x2[0];
|
|
2499
|
-
let b = x2[1];
|
|
2500
|
-
let c = x2[2];
|
|
2501
|
-
let d = x2[3];
|
|
2502
|
-
a = this.ff(a, b, c, d, k[0], 7, -680876936);
|
|
2503
|
-
d = this.ff(d, a, b, c, k[1], 12, -389564586);
|
|
2504
|
-
c = this.ff(c, d, a, b, k[2], 17, 606105819);
|
|
2505
|
-
b = this.ff(b, c, d, a, k[3], 22, -1044525330);
|
|
2506
|
-
a = this.ff(a, b, c, d, k[4], 7, -176418897);
|
|
2507
|
-
d = this.ff(d, a, b, c, k[5], 12, 1200080426);
|
|
2508
|
-
c = this.ff(c, d, a, b, k[6], 17, -1473231341);
|
|
2509
|
-
b = this.ff(b, c, d, a, k[7], 22, -45705983);
|
|
2510
|
-
a = this.ff(a, b, c, d, k[8], 7, 1770035416);
|
|
2511
|
-
d = this.ff(d, a, b, c, k[9], 12, -1958414417);
|
|
2512
|
-
c = this.ff(c, d, a, b, k[10], 17, -42063);
|
|
2513
|
-
b = this.ff(b, c, d, a, k[11], 22, -1990404162);
|
|
2514
|
-
a = this.ff(a, b, c, d, k[12], 7, 1804603682);
|
|
2515
|
-
d = this.ff(d, a, b, c, k[13], 12, -40341101);
|
|
2516
|
-
c = this.ff(c, d, a, b, k[14], 17, -1502002290);
|
|
2517
|
-
b = this.ff(b, c, d, a, k[15], 22, 1236535329);
|
|
2518
|
-
a = this.gg(a, b, c, d, k[1], 5, -165796510);
|
|
2519
|
-
d = this.gg(d, a, b, c, k[6], 9, -1069501632);
|
|
2520
|
-
c = this.gg(c, d, a, b, k[11], 14, 643717713);
|
|
2521
|
-
b = this.gg(b, c, d, a, k[0], 20, -373897302);
|
|
2522
|
-
a = this.gg(a, b, c, d, k[5], 5, -701558691);
|
|
2523
|
-
d = this.gg(d, a, b, c, k[10], 9, 38016083);
|
|
2524
|
-
c = this.gg(c, d, a, b, k[15], 14, -660478335);
|
|
2525
|
-
b = this.gg(b, c, d, a, k[4], 20, -405537848);
|
|
2526
|
-
a = this.gg(a, b, c, d, k[9], 5, 568446438);
|
|
2527
|
-
d = this.gg(d, a, b, c, k[14], 9, -1019803690);
|
|
2528
|
-
c = this.gg(c, d, a, b, k[3], 14, -187363961);
|
|
2529
|
-
b = this.gg(b, c, d, a, k[8], 20, 1163531501);
|
|
2530
|
-
a = this.gg(a, b, c, d, k[13], 5, -1444681467);
|
|
2531
|
-
d = this.gg(d, a, b, c, k[2], 9, -51403784);
|
|
2532
|
-
c = this.gg(c, d, a, b, k[7], 14, 1735328473);
|
|
2533
|
-
b = this.gg(b, c, d, a, k[12], 20, -1926607734);
|
|
2534
|
-
a = this.hh(a, b, c, d, k[5], 4, -378558);
|
|
2535
|
-
d = this.hh(d, a, b, c, k[8], 11, -2022574463);
|
|
2536
|
-
c = this.hh(c, d, a, b, k[11], 16, 1839030562);
|
|
2537
|
-
b = this.hh(b, c, d, a, k[14], 23, -35309556);
|
|
2538
|
-
a = this.hh(a, b, c, d, k[1], 4, -1530992060);
|
|
2539
|
-
d = this.hh(d, a, b, c, k[4], 11, 1272893353);
|
|
2540
|
-
c = this.hh(c, d, a, b, k[7], 16, -155497632);
|
|
2541
|
-
b = this.hh(b, c, d, a, k[10], 23, -1094730640);
|
|
2542
|
-
a = this.hh(a, b, c, d, k[13], 4, 681279174);
|
|
2543
|
-
d = this.hh(d, a, b, c, k[0], 11, -358537222);
|
|
2544
|
-
c = this.hh(c, d, a, b, k[3], 16, -722521979);
|
|
2545
|
-
b = this.hh(b, c, d, a, k[6], 23, 76029189);
|
|
2546
|
-
a = this.hh(a, b, c, d, k[9], 4, -640364487);
|
|
2547
|
-
d = this.hh(d, a, b, c, k[12], 11, -421815835);
|
|
2548
|
-
c = this.hh(c, d, a, b, k[15], 16, 530742520);
|
|
2549
|
-
b = this.hh(b, c, d, a, k[2], 23, -995338651);
|
|
2550
|
-
a = this.ii(a, b, c, d, k[0], 6, -198630844);
|
|
2551
|
-
d = this.ii(d, a, b, c, k[7], 10, 1126891415);
|
|
2552
|
-
c = this.ii(c, d, a, b, k[14], 15, -1416354905);
|
|
2553
|
-
b = this.ii(b, c, d, a, k[5], 21, -57434055);
|
|
2554
|
-
a = this.ii(a, b, c, d, k[12], 6, 1700485571);
|
|
2555
|
-
d = this.ii(d, a, b, c, k[3], 10, -1894986606);
|
|
2556
|
-
c = this.ii(c, d, a, b, k[10], 15, -1051523);
|
|
2557
|
-
b = this.ii(b, c, d, a, k[1], 21, -2054922799);
|
|
2558
|
-
a = this.ii(a, b, c, d, k[8], 6, 1873313359);
|
|
2559
|
-
d = this.ii(d, a, b, c, k[15], 10, -30611744);
|
|
2560
|
-
c = this.ii(c, d, a, b, k[6], 15, -1560198380);
|
|
2561
|
-
b = this.ii(b, c, d, a, k[13], 21, 1309151649);
|
|
2562
|
-
a = this.ii(a, b, c, d, k[4], 6, -145523070);
|
|
2563
|
-
d = this.ii(d, a, b, c, k[11], 10, -1120210379);
|
|
2564
|
-
c = this.ii(c, d, a, b, k[2], 15, 718787259);
|
|
2565
|
-
b = this.ii(b, c, d, a, k[9], 21, -343485551);
|
|
2566
|
-
x2[0] = this.add32(a, x2[0]);
|
|
2567
|
-
x2[1] = this.add32(b, x2[1]);
|
|
2568
|
-
x2[2] = this.add32(c, x2[2]);
|
|
2569
|
-
x2[3] = this.add32(d, x2[3]);
|
|
2570
|
-
}
|
|
2571
|
-
cmn(q2, a, b, x2, s3, t2) {
|
|
2572
|
-
a = this.add32(this.add32(a, q2), this.add32(x2, t2));
|
|
2573
|
-
return this.add32(a << s3 | a >>> 32 - s3, b);
|
|
2574
|
-
}
|
|
2575
|
-
ff(a, b, c, d, x2, s3, t2) {
|
|
2576
|
-
return this.cmn(b & c | ~b & d, a, b, x2, s3, t2);
|
|
2577
|
-
}
|
|
2578
|
-
gg(a, b, c, d, x2, s3, t2) {
|
|
2579
|
-
return this.cmn(b & d | c & ~d, a, b, x2, s3, t2);
|
|
2580
|
-
}
|
|
2581
|
-
hh(a, b, c, d, x2, s3, t2) {
|
|
2582
|
-
return this.cmn(b ^ c ^ d, a, b, x2, s3, t2);
|
|
2583
|
-
}
|
|
2584
|
-
ii(a, b, c, d, x2, s3, t2) {
|
|
2585
|
-
return this.cmn(c ^ (b | ~d), a, b, x2, s3, t2);
|
|
2586
|
-
}
|
|
2587
|
-
md51(s3) {
|
|
2588
|
-
const n2 = s3.length;
|
|
2589
|
-
const state = [1732584193, -271733879, -1732584194, 271733878];
|
|
2590
|
-
let i;
|
|
2591
|
-
for (i = 64; i <= s3.length; i += 64) {
|
|
2592
|
-
this.md5cycle(state, this.md5blk(s3.substring(i - 64, i)));
|
|
2593
|
-
}
|
|
2594
|
-
s3 = s3.substring(i - 64);
|
|
2595
|
-
const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
2596
|
-
for (i = 0; i < s3.length; i++) {
|
|
2597
|
-
tail[i >> 2] |= s3.charCodeAt(i) << (i % 4 << 3);
|
|
2598
|
-
}
|
|
2599
|
-
tail[i >> 2] |= 128 << (i % 4 << 3);
|
|
2600
|
-
if (i > 55) {
|
|
2601
|
-
this.md5cycle(state, tail);
|
|
2602
|
-
for (i = 0; i < 16; i++) {
|
|
2603
|
-
tail[i] = 0;
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
tail[14] = n2 * 8;
|
|
2607
|
-
this.md5cycle(state, tail);
|
|
2608
|
-
return state;
|
|
2609
|
-
}
|
|
2610
|
-
/* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5
|
|
2611
|
-
* algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and
|
|
2612
|
-
* shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character
|
|
2613
|
-
* was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched?
|
|
2614
|
-
* There is no way to standardize text to something like UTF-8 before transformation; speed cost is
|
|
2615
|
-
* utterly prohibitive. The JavaScript standard itself needs to look at this: it should start
|
|
2616
|
-
* providing access to strings as preformed UTF-8 8-bit unsigned value arrays.
|
|
2617
|
-
*/
|
|
2618
|
-
md5blk(s3) {
|
|
2619
|
-
const md5blks = [];
|
|
2620
|
-
for (let i = 0; i < 64; i += 4) {
|
|
2621
|
-
md5blks[i >> 2] = s3.charCodeAt(i) + (s3.charCodeAt(i + 1) << 8) + (s3.charCodeAt(i + 2) << 16) + (s3.charCodeAt(i + 3) << 24);
|
|
2622
|
-
}
|
|
2623
|
-
return md5blks;
|
|
2624
|
-
}
|
|
2625
|
-
rhex(n2) {
|
|
2626
|
-
const hex_chr = "0123456789abcdef".split("");
|
|
2627
|
-
let s3 = "";
|
|
2628
|
-
let j = 0;
|
|
2629
|
-
for (; j < 4; j++) {
|
|
2630
|
-
s3 += hex_chr[n2 >> j * 8 + 4 & 15] + hex_chr[n2 >> j * 8 & 15];
|
|
2631
|
-
}
|
|
2632
|
-
return s3;
|
|
2633
|
-
}
|
|
2634
|
-
hex(x2) {
|
|
2635
|
-
for (let i = 0; i < x2.length; i++) {
|
|
2636
|
-
x2[i] = this.rhex(x2[i]);
|
|
2637
|
-
}
|
|
2638
|
-
return x2.join("");
|
|
2639
|
-
}
|
|
2640
|
-
md5(s3) {
|
|
2641
|
-
return this.hex(this.md51(s3));
|
|
2642
|
-
}
|
|
2643
|
-
add32(a, b) {
|
|
2644
|
-
return this.add32Std(a, b);
|
|
2645
|
-
}
|
|
2646
|
-
add32Std(a, b) {
|
|
2647
|
-
return a + b & 4294967295;
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
const s2 = cascada(() => {
|
|
2651
|
-
return {
|
|
2652
|
-
showing: signal(null)
|
|
2653
|
-
};
|
|
2654
|
-
});
|
|
2655
|
-
function Watermark({
|
|
2656
|
-
id
|
|
2657
|
-
}) {
|
|
2658
|
-
const showing = s2.showing.use();
|
|
2659
|
-
const [mountable, setMountable] = useState(false);
|
|
2660
|
-
useEffect(() => {
|
|
2661
|
-
setMountable(true);
|
|
2662
|
-
}, []);
|
|
2663
|
-
useEffect(() => {
|
|
2664
|
-
if (showing && showing === id) s2.showing.set(id);
|
|
2665
|
-
return () => s2.showing.set(null);
|
|
2666
|
-
});
|
|
2667
|
-
useEffect(() => {
|
|
2668
|
-
if (hasAValidLicense) return;
|
|
2669
|
-
console.log(`
|
|
2670
|
-
********************************************************************************
|
|
2671
|
-
No valid license was detected for the version of LyteNyte Grid being used.
|
|
2672
|
-
|
|
2673
|
-
If you are only evaluating LyteNyte Grid you do not need to purchase license.
|
|
2674
|
-
|
|
2675
|
-
For commercial use a license for developers must be purchased.
|
|
2676
|
-
|
|
2677
|
-
Please visit https://1771technologies.com to learn more.
|
|
2678
|
-
********************************************************************************
|
|
2679
|
-
`);
|
|
2680
|
-
}, []);
|
|
2681
|
-
if (!mountable) return null;
|
|
2682
|
-
if (hasAValidLicense) return null;
|
|
2683
|
-
if (showing && showing !== id) return null;
|
|
2684
|
-
if (typeof document === "undefined") return null;
|
|
2685
|
-
setTimeout(() => {
|
|
2686
|
-
s2.showing.set(id);
|
|
2687
|
-
});
|
|
2688
|
-
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
2689
|
-
className: "c7kkngm",
|
|
2690
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
2691
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2692
|
-
style: {
|
|
2693
|
-
fontWeight: "bolder",
|
|
2694
|
-
fontSize: "1.25rem"
|
|
2695
|
-
},
|
|
2696
|
-
children: ["LyteNyte Grid for evaluation only.", /* @__PURE__ */ jsx("a", {
|
|
2697
|
-
style: {
|
|
2698
|
-
color: "blue"
|
|
2699
|
-
},
|
|
2700
|
-
href: "https://1771Technologies.com/pricing",
|
|
2701
|
-
children: "Click here"
|
|
2702
|
-
}), " ", "to secure your license."]
|
|
2703
|
-
})
|
|
2704
|
-
})
|
|
2705
|
-
}), document.body);
|
|
2706
|
-
}
|
|
2707
|
-
function LoadingOverlay() {
|
|
2708
|
-
return /* @__PURE__ */ jsx("div", { className: "lng1771-loading-overlay", children: /* @__PURE__ */ jsx("div", { className: "lng1771-loading-overlay__container", children: "Loading..." }) });
|
|
2709
|
-
}
|
|
2710
|
-
function NoDataOverlay() {
|
|
2711
|
-
return /* @__PURE__ */ jsx("div", { className: "lng1771-no-data-overlay", children: /* @__PURE__ */ jsx("div", { className: "lng1771-no-data-overlay__container", children: "No Data" }) });
|
|
2712
|
-
}
|
|
2713
|
-
function LoadErrorOverlay() {
|
|
2714
|
-
const { state, api } = useGrid$1();
|
|
2715
|
-
return /* @__PURE__ */ jsx("div", { className: "lng1771-loading-error-overlay", children: /* @__PURE__ */ jsxs("div", { className: "lng1771-loading-error-overlay__container", children: [
|
|
2716
|
-
/* @__PURE__ */ jsx("div", { children: "Loading data from external source failed." }),
|
|
2717
|
-
/* @__PURE__ */ jsx(
|
|
2718
|
-
GridButton,
|
|
2719
|
-
{
|
|
2720
|
-
onClick: () => {
|
|
2721
|
-
state.overlayToShow.set(null);
|
|
2722
|
-
api.rowReload();
|
|
2723
|
-
},
|
|
2724
|
-
style: { marginInlineStart: 4 },
|
|
2725
|
-
children: "Retry?"
|
|
2726
|
-
}
|
|
2727
|
-
)
|
|
2728
|
-
] }) });
|
|
2729
|
-
}
|
|
2730
|
-
function OverlayDriver() {
|
|
2731
|
-
const { state, api } = useGrid$1();
|
|
2732
|
-
const headerHeight = state.internal.viewportHeaderHeight.use();
|
|
2733
|
-
const overlayId = state.overlayToShow.use();
|
|
2734
|
-
const overlays = state.overlays.use();
|
|
2735
|
-
const width = state.internal.viewportInnerWidth.use();
|
|
2736
|
-
const height = state.internal.viewportInnerHeight.use();
|
|
2737
|
-
if (!overlayId) return;
|
|
2738
|
-
let overlay = overlays[overlayId];
|
|
2739
|
-
if (!overlay && overlayId === "lng1771-loading-overlay") overlay = { renderer: LoadingOverlay };
|
|
2740
|
-
if (!overlay && overlayId === "lng1771-load-error-overlay")
|
|
2741
|
-
overlay = { renderer: LoadErrorOverlay, overRows: true };
|
|
2742
|
-
if (!overlay && overlayId === "lng1771-no-data-overlay")
|
|
2743
|
-
overlay = { renderer: NoDataOverlay, overRows: true };
|
|
2744
|
-
const rowsOnly = !!overlay.overRows;
|
|
2745
|
-
return /* @__PURE__ */ jsx(
|
|
2746
|
-
"div",
|
|
2747
|
-
{
|
|
2748
|
-
style: { position: "sticky", width: 0, height: 0, insetInlineStart: 0, top: 0, zIndex: 20 },
|
|
2749
|
-
children: /* @__PURE__ */ jsx(
|
|
2750
|
-
"div",
|
|
2751
|
-
{
|
|
2752
|
-
onPointerDown: (e) => {
|
|
2753
|
-
e.stopPropagation();
|
|
2754
|
-
},
|
|
2755
|
-
onKeyDown: (e) => {
|
|
2756
|
-
e.stopPropagation();
|
|
2757
|
-
},
|
|
2758
|
-
className: "lng1771-overlay",
|
|
2759
|
-
style: {
|
|
2760
|
-
height: rowsOnly ? height - headerHeight : height,
|
|
2761
|
-
width,
|
|
2762
|
-
top: rowsOnly ? headerHeight : void 0
|
|
2763
|
-
},
|
|
2764
|
-
children: /* @__PURE__ */ jsx(overlay.renderer, { api })
|
|
2765
|
-
}
|
|
2766
|
-
)
|
|
2767
|
-
}
|
|
2768
|
-
);
|
|
2769
|
-
}
|
|
2770
|
-
function GridFrame({
|
|
2771
|
-
grid: { api, state },
|
|
2772
|
-
children,
|
|
2773
|
-
axe
|
|
2774
|
-
}) {
|
|
2775
|
-
const buttons = state.panelFrameButtons.use();
|
|
2776
|
-
const frames = state.panelFrames.use();
|
|
2777
|
-
const openId = state.internal.panelFrameOpen.use();
|
|
2778
|
-
const frame = openId ? frames[openId] : null;
|
|
2779
|
-
const [width, setWidth] = useState(500);
|
|
2780
|
-
const [frameSplit, setFrameSplit] = useState(70);
|
|
2781
|
-
useEffect(() => {
|
|
2782
|
-
if (width < 500) {
|
|
2783
|
-
setFrameSplit(1);
|
|
2784
|
-
return;
|
|
2785
|
-
}
|
|
2786
|
-
setFrameSplit(70);
|
|
2787
|
-
}, [width]);
|
|
2788
|
-
const [el, setEl] = useState(null);
|
|
2789
|
-
useEffect(() => {
|
|
2790
|
-
if (!el) return;
|
|
2791
|
-
const re = new ResizeObserver(() => {
|
|
2792
|
-
setWidth(el.clientWidth);
|
|
2793
|
-
api.panelFrameClose();
|
|
2794
|
-
});
|
|
2795
|
-
re.observe(el);
|
|
2796
|
-
return () => re.disconnect();
|
|
2797
|
-
}, [api, el]);
|
|
2798
|
-
const template = useMemo(() => {
|
|
2799
|
-
const f = ["1fr"];
|
|
2800
|
-
if (buttons.length) f.push("32px");
|
|
2801
|
-
return f.join(" ");
|
|
2802
|
-
}, [buttons.length]);
|
|
2803
|
-
const cellSelectionEnabled = state.cellSelectionMode.use() !== "none";
|
|
2804
|
-
return /* @__PURE__ */ jsxs(
|
|
2805
|
-
"div",
|
|
2806
|
-
{
|
|
2807
|
-
"data-cell-selection-enabled": cellSelectionEnabled ? true : void 0,
|
|
2808
|
-
className: "lng1771-grid-frame",
|
|
2809
|
-
style: { gridTemplateColumns: template },
|
|
2810
|
-
ref: setEl,
|
|
2811
|
-
children: [
|
|
2812
|
-
frame ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2813
|
-
SplitPane,
|
|
2814
|
-
{
|
|
2815
|
-
axe: axe ?? splitPaneAxe,
|
|
2816
|
-
orientation: "vertical",
|
|
2817
|
-
primary: /* @__PURE__ */ jsx("div", { className: "lng1771-grid-frame__grid-area", children }),
|
|
2818
|
-
secondary: /* @__PURE__ */ jsx(Sizer, { className: "lng1771-grid-frame__open-panel", children: /* @__PURE__ */ jsx(
|
|
2819
|
-
frame.component,
|
|
2820
|
-
{
|
|
2821
|
-
api,
|
|
2822
|
-
frame,
|
|
2823
|
-
context: state.internal.panelFrameContext.peek()
|
|
2824
|
-
}
|
|
2825
|
-
) }),
|
|
2826
|
-
split: frame ? frameSplit : 100,
|
|
2827
|
-
onSplitChange: (n2) => {
|
|
2828
|
-
console.log("n");
|
|
2829
|
-
setFrameSplit(n2);
|
|
2830
|
-
},
|
|
2831
|
-
min: width < 500 ? 0 : 20,
|
|
2832
|
-
max: width < 500 ? 100 : 80,
|
|
2833
|
-
disabled: width < 500,
|
|
2834
|
-
splitterClassName: "lng1771-grid-frame__open-panel--splitter"
|
|
2835
|
-
}
|
|
2836
|
-
) }) : /* @__PURE__ */ jsx("div", { children }),
|
|
2837
|
-
buttons.length > 0 && /* @__PURE__ */ jsx("div", { className: "lng1771-grid-frame__controls", children: buttons.map((c) => {
|
|
2838
|
-
const isActive = c.id === openId;
|
|
2839
|
-
return /* @__PURE__ */ jsxs(
|
|
2840
|
-
"button",
|
|
2841
|
-
{
|
|
2842
|
-
onClick: () => {
|
|
2843
|
-
if (isActive) api.panelFrameClose();
|
|
2844
|
-
else api.panelFrameOpen(c.id);
|
|
2845
|
-
},
|
|
2846
|
-
className: clsx(
|
|
2847
|
-
"lng1771-grid-frame__control-button",
|
|
2848
|
-
c.id === openId && "lng1771-grid-frame__control-button--open"
|
|
2849
|
-
),
|
|
2850
|
-
children: [
|
|
2851
|
-
/* @__PURE__ */ jsx("span", { className: "lng1771-grid-frame__control-button-icon", children: c.icon && /* @__PURE__ */ jsx(c.icon, {}) }),
|
|
2852
|
-
/* @__PURE__ */ jsx("span", { children: c.label })
|
|
2853
|
-
]
|
|
2854
|
-
},
|
|
2855
|
-
c.id
|
|
2856
|
-
);
|
|
2857
|
-
}) })
|
|
2858
|
-
]
|
|
2859
|
-
}
|
|
2860
|
-
);
|
|
2861
|
-
}
|
|
2862
|
-
function useContextMenuListener(setMenu) {
|
|
2863
|
-
const grid = useGrid$1();
|
|
2864
|
-
const viewport = grid.state.internal.viewport.use();
|
|
2865
|
-
const menuRenderer = grid.state.contextMenuRenderer.use();
|
|
2866
|
-
const predicate = grid.state.contextMenuPredicate.use();
|
|
2867
|
-
const target = grid.state.internal.contextMenuTarget.use();
|
|
2868
|
-
useEffect(() => {
|
|
2869
|
-
if (!viewport || !menuRenderer) return;
|
|
2870
|
-
const controller = new AbortController();
|
|
2871
|
-
viewport.addEventListener(
|
|
2872
|
-
"contextmenu",
|
|
2873
|
-
(e) => {
|
|
2874
|
-
if (e.ctrlKey || e.metaKey) return;
|
|
2875
|
-
if (target) {
|
|
2876
|
-
e.preventDefault();
|
|
2877
|
-
e.stopPropagation();
|
|
2878
|
-
return;
|
|
2879
|
-
}
|
|
2880
|
-
const x2 = getClientX(e);
|
|
2881
|
-
const hoveredCell = getHoveredColumnIndex(grid.api, x2);
|
|
2882
|
-
const y2 = getClientY(e);
|
|
2883
|
-
const hoveredRow = getHoveredRowIndex(grid.api, y2);
|
|
2884
|
-
let menuTarget = hoveredRow != null ? "cell" : null;
|
|
2885
|
-
if (hoveredRow == null) {
|
|
2886
|
-
let current = e.target;
|
|
2887
|
-
while (current && current.getAttribute("data-lng1771-kind") == null && current !== viewport) {
|
|
2888
|
-
current = current.parentElement;
|
|
2889
|
-
}
|
|
2890
|
-
if (current && current !== viewport) {
|
|
2891
|
-
const kind = current.getAttribute("data-lng1771-kind");
|
|
2892
|
-
if (kind === "floating") menuTarget = "header-floating";
|
|
2893
|
-
if (kind === "header") menuTarget = "header";
|
|
2894
|
-
if (kind === "header-group") menuTarget = "header-group";
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
if (!menuTarget || hoveredCell == null) {
|
|
2898
|
-
setMenu(null);
|
|
2899
|
-
return;
|
|
2900
|
-
}
|
|
2901
|
-
if (predicate && !predicate({ api: grid.api, menuTarget, columnIndex: hoveredCell, rowIndex: hoveredRow })) {
|
|
2902
|
-
return;
|
|
2903
|
-
}
|
|
2904
|
-
setMenu({
|
|
2905
|
-
menuTarget,
|
|
2906
|
-
hoveredRow,
|
|
2907
|
-
hoveredColumn: hoveredCell
|
|
2908
|
-
});
|
|
2909
|
-
e.stopPropagation();
|
|
2910
|
-
e.preventDefault();
|
|
2911
|
-
const cellSelectionMode = grid.state.cellSelectionMode.peek();
|
|
2912
|
-
if (menuTarget === "cell" && cellSelectionMode !== "none" && !grid.api.cellSelectionIsSelected(hoveredRow, hoveredCell)) {
|
|
2913
|
-
grid.state.cellSelections.set([
|
|
2914
|
-
{
|
|
2915
|
-
rowStart: hoveredRow,
|
|
2916
|
-
rowEnd: hoveredRow + 1,
|
|
2917
|
-
columnStart: hoveredCell,
|
|
2918
|
-
columnEnd: hoveredCell + 1
|
|
2919
|
-
}
|
|
2920
|
-
]);
|
|
2921
|
-
}
|
|
2922
|
-
grid.state.internal.contextMenuTarget.set({ x: x2, y: y2, width: 1, height: 1 });
|
|
2923
|
-
},
|
|
2924
|
-
{ signal: controller.signal }
|
|
2925
|
-
);
|
|
2926
|
-
return () => controller.abort();
|
|
2927
|
-
}, [
|
|
2928
|
-
target,
|
|
2929
|
-
grid.api,
|
|
2930
|
-
grid.state.cellSelectionMode,
|
|
2931
|
-
grid.state.cellSelections,
|
|
2932
|
-
grid.state.internal.contextMenuTarget,
|
|
2933
|
-
menuRenderer,
|
|
2934
|
-
viewport,
|
|
2935
|
-
setMenu,
|
|
2936
|
-
predicate
|
|
2937
|
-
]);
|
|
2938
|
-
}
|
|
2939
|
-
function ContextMenuDriver() {
|
|
2940
|
-
const grid = useGrid$1();
|
|
2941
|
-
const [menu, setMenu] = useState(null);
|
|
2942
|
-
const MenuRenderer = grid.state.contextMenuRenderer.use();
|
|
2943
|
-
const target = grid.state.internal.contextMenuTarget.use();
|
|
2944
|
-
useContextMenuListener(setMenu);
|
|
2945
|
-
const [open, setOpen] = useState(false);
|
|
2946
|
-
useEffect(() => {
|
|
2947
|
-
if (menu !== null) {
|
|
2948
|
-
setOpen(true);
|
|
2949
|
-
}
|
|
2950
|
-
}, [menu]);
|
|
2951
|
-
const soft = !!(menu?.hoveredRow != null && menu.hoveredColumn != null && grid.api.cellSelectionIsSelected(menu.hoveredRow, menu.hoveredColumn));
|
|
2952
|
-
return /* @__PURE__ */ jsx(
|
|
2953
|
-
MenuRoot,
|
|
2954
|
-
{
|
|
2955
|
-
open,
|
|
2956
|
-
onOpenChange: (c) => {
|
|
2957
|
-
setOpen(c);
|
|
2958
|
-
},
|
|
2959
|
-
onOpenChangeComplete: (c) => {
|
|
2960
|
-
if (c) {
|
|
2961
|
-
grid.state.internal.cellSelectionSoftFocus.set(soft);
|
|
2962
|
-
}
|
|
2963
|
-
if (!c) {
|
|
2964
|
-
grid.api.contextMenuClose();
|
|
2965
|
-
setMenu(null);
|
|
2966
|
-
}
|
|
2967
|
-
},
|
|
2968
|
-
children: /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(AnchorProvider, { anchor: target, children: menu && MenuRenderer && /* @__PURE__ */ jsx(
|
|
2969
|
-
MenuRenderer,
|
|
2970
|
-
{
|
|
2971
|
-
api: grid.api,
|
|
2972
|
-
menuTarget: menu.menuTarget,
|
|
2973
|
-
columnIndex: menu.hoveredColumn,
|
|
2974
|
-
rowIndex: menu.hoveredRow
|
|
2975
|
-
}
|
|
2976
|
-
) }) })
|
|
2977
|
-
}
|
|
2978
|
-
);
|
|
2979
|
-
}
|
|
2980
|
-
function DialogPortal(props) {
|
|
2981
|
-
const {
|
|
2982
|
-
children,
|
|
2983
|
-
keepMounted = false,
|
|
2984
|
-
container
|
|
2985
|
-
} = props;
|
|
2986
|
-
const {
|
|
2987
|
-
mounted
|
|
2988
|
-
} = useDialogRootContext();
|
|
2989
|
-
const shouldRender = mounted || keepMounted;
|
|
2990
|
-
if (!shouldRender) {
|
|
2991
|
-
return null;
|
|
2992
|
-
}
|
|
2993
|
-
return /* @__PURE__ */ jsx(DialogPortalContext.Provider, {
|
|
2994
|
-
value: keepMounted,
|
|
2995
|
-
children: /* @__PURE__ */ jsx(FloatingPortal, {
|
|
2996
|
-
root: container,
|
|
2997
|
-
children
|
|
2998
|
-
})
|
|
2999
|
-
});
|
|
3000
|
-
}
|
|
3001
|
-
process.env.NODE_ENV !== "production" ? DialogPortal.propTypes = {
|
|
3002
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3003
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3004
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
3005
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
3006
|
-
/**
|
|
3007
|
-
* @ignore
|
|
3008
|
-
*/
|
|
3009
|
-
children: PropTypes.node,
|
|
3010
|
-
/**
|
|
3011
|
-
* A parent element to render the portal element into.
|
|
3012
|
-
*/
|
|
3013
|
-
container: PropTypes.oneOfType([HTMLElementType, refType]),
|
|
3014
|
-
/**
|
|
3015
|
-
* Whether to keep the portal mounted in the DOM while the popup is hidden.
|
|
3016
|
-
* @default false
|
|
3017
|
-
*/
|
|
3018
|
-
keepMounted: PropTypes.bool
|
|
3019
|
-
} : void 0;
|
|
3020
|
-
function useEnhancedClickHandler(handler) {
|
|
3021
|
-
const lastClickInteractionTypeRef = React.useRef("");
|
|
3022
|
-
const handlePointerDown = React.useCallback((event) => {
|
|
3023
|
-
if (event.defaultPrevented) {
|
|
3024
|
-
return;
|
|
3025
|
-
}
|
|
3026
|
-
lastClickInteractionTypeRef.current = event.pointerType;
|
|
3027
|
-
}, []);
|
|
3028
|
-
const handleClick = React.useCallback((event) => {
|
|
3029
|
-
if (event.detail === 0) {
|
|
3030
|
-
handler(event, "keyboard");
|
|
3031
|
-
return;
|
|
3032
|
-
}
|
|
3033
|
-
if ("pointerType" in event) {
|
|
3034
|
-
handler(event, event.pointerType);
|
|
3035
|
-
}
|
|
3036
|
-
handler(event, lastClickInteractionTypeRef.current);
|
|
3037
|
-
lastClickInteractionTypeRef.current = "";
|
|
3038
|
-
}, [handler]);
|
|
3039
|
-
return {
|
|
3040
|
-
onClick: handleClick,
|
|
3041
|
-
onPointerDown: handlePointerDown
|
|
3042
|
-
};
|
|
3043
|
-
}
|
|
3044
|
-
function useOpenInteractionType(open) {
|
|
3045
|
-
const [openMethod, setOpenMethod] = React.useState(null);
|
|
3046
|
-
if (!open && openMethod !== null) {
|
|
3047
|
-
setOpenMethod(null);
|
|
3048
|
-
}
|
|
3049
|
-
const handleTriggerClick = React.useCallback((_, interactionType) => {
|
|
3050
|
-
if (!open) {
|
|
3051
|
-
setOpenMethod(interactionType);
|
|
3052
|
-
}
|
|
3053
|
-
}, [open, setOpenMethod]);
|
|
3054
|
-
const {
|
|
3055
|
-
onClick,
|
|
3056
|
-
onPointerDown
|
|
3057
|
-
} = useEnhancedClickHandler(handleTriggerClick);
|
|
3058
|
-
return React.useMemo(() => ({
|
|
3059
|
-
openMethod,
|
|
3060
|
-
triggerProps: {
|
|
3061
|
-
onClick,
|
|
3062
|
-
onPointerDown
|
|
3063
|
-
}
|
|
3064
|
-
}), [openMethod, onClick, onPointerDown]);
|
|
3065
|
-
}
|
|
3066
|
-
function useDialogRoot(params) {
|
|
3067
|
-
const {
|
|
3068
|
-
defaultOpen,
|
|
3069
|
-
dismissible,
|
|
3070
|
-
modal,
|
|
3071
|
-
onNestedDialogClose,
|
|
3072
|
-
onNestedDialogOpen,
|
|
3073
|
-
onOpenChange: onOpenChangeParameter,
|
|
3074
|
-
open: openParam,
|
|
3075
|
-
onOpenChangeComplete
|
|
3076
|
-
} = params;
|
|
3077
|
-
const [open, setOpenUnwrapped] = useControlled({
|
|
3078
|
-
controlled: openParam,
|
|
3079
|
-
default: defaultOpen,
|
|
3080
|
-
name: "DialogRoot",
|
|
3081
|
-
state: "open"
|
|
3082
|
-
});
|
|
3083
|
-
const popupRef = React.useRef(null);
|
|
3084
|
-
const backdropRef = React.useRef(null);
|
|
3085
|
-
const internalBackdropRef = React.useRef(null);
|
|
3086
|
-
const [titleElementId, setTitleElementId] = React.useState(void 0);
|
|
3087
|
-
const [descriptionElementId, setDescriptionElementId] = React.useState(void 0);
|
|
3088
|
-
const [triggerElement, setTriggerElement] = React.useState(null);
|
|
3089
|
-
const [popupElement, setPopupElement] = React.useState(null);
|
|
3090
|
-
const {
|
|
3091
|
-
mounted,
|
|
3092
|
-
setMounted,
|
|
3093
|
-
transitionStatus
|
|
3094
|
-
} = useTransitionStatus(open);
|
|
3095
|
-
const setOpen = useEventCallback((nextOpen, event, reason) => {
|
|
3096
|
-
onOpenChangeParameter?.(nextOpen, event, reason);
|
|
3097
|
-
setOpenUnwrapped(nextOpen);
|
|
3098
|
-
});
|
|
3099
|
-
const handleUnmount = useEventCallback(() => {
|
|
3100
|
-
setMounted(false);
|
|
3101
|
-
onOpenChangeComplete?.(false);
|
|
3102
|
-
});
|
|
3103
|
-
useOpenChangeComplete({
|
|
3104
|
-
enabled: !params.actionsRef,
|
|
3105
|
-
open,
|
|
3106
|
-
ref: popupRef,
|
|
3107
|
-
onComplete() {
|
|
3108
|
-
if (!open) {
|
|
3109
|
-
handleUnmount();
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
|
-
});
|
|
3113
|
-
React.useImperativeHandle(params.actionsRef, () => ({
|
|
3114
|
-
unmount: handleUnmount
|
|
3115
|
-
}), [handleUnmount]);
|
|
3116
|
-
useScrollLock(open && modal, popupElement);
|
|
3117
|
-
const handleFloatingUIOpenChange = (nextOpen, event, reason) => {
|
|
3118
|
-
setOpen(nextOpen, event, translateOpenChangeReason(reason));
|
|
3119
|
-
};
|
|
3120
|
-
const context2 = useFloatingRootContext({
|
|
3121
|
-
elements: {
|
|
3122
|
-
reference: triggerElement,
|
|
3123
|
-
floating: popupElement
|
|
3124
|
-
},
|
|
3125
|
-
open,
|
|
3126
|
-
onOpenChange: handleFloatingUIOpenChange
|
|
3127
|
-
});
|
|
3128
|
-
const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = React.useState(0);
|
|
3129
|
-
const isTopmost = ownNestedOpenDialogs === 0;
|
|
3130
|
-
const role = useRole(context2);
|
|
3131
|
-
const click = useClick(context2);
|
|
3132
|
-
const dismiss = useDismiss(context2, {
|
|
3133
|
-
outsidePressEvent: "mousedown",
|
|
3134
|
-
outsidePress(event) {
|
|
3135
|
-
const target = getTarget(event);
|
|
3136
|
-
if (isTopmost && dismissible) {
|
|
3137
|
-
const backdrop = target;
|
|
3138
|
-
if (modal) {
|
|
3139
|
-
return backdrop ? [internalBackdropRef.current, backdropRef.current].includes(backdrop) : false;
|
|
3140
|
-
}
|
|
3141
|
-
return true;
|
|
3142
|
-
}
|
|
3143
|
-
return false;
|
|
3144
|
-
},
|
|
3145
|
-
escapeKey: isTopmost
|
|
3146
|
-
});
|
|
3147
|
-
const {
|
|
3148
|
-
getReferenceProps,
|
|
3149
|
-
getFloatingProps
|
|
3150
|
-
} = useInteractions([role, click, dismiss]);
|
|
3151
|
-
React.useEffect(() => {
|
|
3152
|
-
if (onNestedDialogOpen && open) {
|
|
3153
|
-
onNestedDialogOpen(ownNestedOpenDialogs);
|
|
3154
|
-
}
|
|
3155
|
-
if (onNestedDialogClose && !open) {
|
|
3156
|
-
onNestedDialogClose();
|
|
3157
|
-
}
|
|
3158
|
-
return () => {
|
|
3159
|
-
if (onNestedDialogClose && open) {
|
|
3160
|
-
onNestedDialogClose();
|
|
3161
|
-
}
|
|
3162
|
-
};
|
|
3163
|
-
}, [open, onNestedDialogClose, onNestedDialogOpen, ownNestedOpenDialogs]);
|
|
3164
|
-
const handleNestedDialogOpen = React.useCallback((ownChildrenCount) => {
|
|
3165
|
-
setOwnNestedOpenDialogs(ownChildrenCount + 1);
|
|
3166
|
-
}, []);
|
|
3167
|
-
const handleNestedDialogClose = React.useCallback(() => {
|
|
3168
|
-
setOwnNestedOpenDialogs(0);
|
|
3169
|
-
}, []);
|
|
3170
|
-
const {
|
|
3171
|
-
openMethod,
|
|
3172
|
-
triggerProps
|
|
3173
|
-
} = useOpenInteractionType(open);
|
|
3174
|
-
const getTriggerProps = React.useCallback((externalProps = {}) => getReferenceProps(mergeProps(triggerProps, externalProps)), [getReferenceProps, triggerProps]);
|
|
3175
|
-
return React.useMemo(() => {
|
|
3176
|
-
return {
|
|
3177
|
-
modal,
|
|
3178
|
-
setOpen,
|
|
3179
|
-
open,
|
|
3180
|
-
titleElementId,
|
|
3181
|
-
setTitleElementId,
|
|
3182
|
-
descriptionElementId,
|
|
3183
|
-
setDescriptionElementId,
|
|
3184
|
-
onNestedDialogOpen: handleNestedDialogOpen,
|
|
3185
|
-
onNestedDialogClose: handleNestedDialogClose,
|
|
3186
|
-
nestedOpenDialogCount: ownNestedOpenDialogs,
|
|
3187
|
-
openMethod,
|
|
3188
|
-
mounted,
|
|
3189
|
-
transitionStatus,
|
|
3190
|
-
getTriggerProps,
|
|
3191
|
-
getPopupProps: getFloatingProps,
|
|
3192
|
-
setTriggerElement,
|
|
3193
|
-
setPopupElement,
|
|
3194
|
-
popupRef,
|
|
3195
|
-
backdropRef,
|
|
3196
|
-
internalBackdropRef,
|
|
3197
|
-
floatingRootContext: context2
|
|
3198
|
-
};
|
|
3199
|
-
}, [modal, setOpen, open, titleElementId, descriptionElementId, handleNestedDialogOpen, handleNestedDialogClose, ownNestedOpenDialogs, openMethod, mounted, transitionStatus, getTriggerProps, getFloatingProps, context2]);
|
|
3200
|
-
}
|
|
3201
|
-
const DialogRoot = function DialogRoot2(props) {
|
|
3202
|
-
const {
|
|
3203
|
-
children,
|
|
3204
|
-
defaultOpen = false,
|
|
3205
|
-
dismissible = true,
|
|
3206
|
-
modal = true,
|
|
3207
|
-
onOpenChange,
|
|
3208
|
-
open,
|
|
3209
|
-
actionsRef,
|
|
3210
|
-
onOpenChangeComplete
|
|
3211
|
-
} = props;
|
|
3212
|
-
const parentDialogRootContext = useOptionalDialogRootContext();
|
|
3213
|
-
const dialogRoot = useDialogRoot({
|
|
3214
|
-
open,
|
|
3215
|
-
defaultOpen,
|
|
3216
|
-
onOpenChange,
|
|
3217
|
-
modal,
|
|
3218
|
-
dismissible,
|
|
3219
|
-
actionsRef,
|
|
3220
|
-
onOpenChangeComplete,
|
|
3221
|
-
onNestedDialogClose: parentDialogRootContext?.onNestedDialogClose,
|
|
3222
|
-
onNestedDialogOpen: parentDialogRootContext?.onNestedDialogOpen
|
|
3223
|
-
});
|
|
3224
|
-
const nested = Boolean(parentDialogRootContext);
|
|
3225
|
-
const dialogContextValue = React.useMemo(() => ({
|
|
3226
|
-
...dialogRoot,
|
|
3227
|
-
nested,
|
|
3228
|
-
onOpenChangeComplete
|
|
3229
|
-
}), [dialogRoot, nested, onOpenChangeComplete]);
|
|
3230
|
-
const dialogRootContextValue = React.useMemo(() => ({
|
|
3231
|
-
dismissible
|
|
3232
|
-
}), [dismissible]);
|
|
3233
|
-
return /* @__PURE__ */ jsx(DialogContext.Provider, {
|
|
3234
|
-
value: dialogContextValue,
|
|
3235
|
-
children: /* @__PURE__ */ jsx(DialogRootContext.Provider, {
|
|
3236
|
-
value: dialogRootContextValue,
|
|
3237
|
-
children
|
|
3238
|
-
})
|
|
3239
|
-
});
|
|
3240
|
-
};
|
|
3241
|
-
process.env.NODE_ENV !== "production" ? DialogRoot.propTypes = {
|
|
3242
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3243
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3244
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
3245
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
3246
|
-
/**
|
|
3247
|
-
* A ref to imperative actions.
|
|
3248
|
-
*/
|
|
3249
|
-
actionsRef: PropTypes.shape({
|
|
3250
|
-
current: PropTypes.shape({
|
|
3251
|
-
unmount: PropTypes.func.isRequired
|
|
3252
|
-
}).isRequired
|
|
3253
|
-
}),
|
|
3254
|
-
/**
|
|
3255
|
-
* @ignore
|
|
3256
|
-
*/
|
|
3257
|
-
children: PropTypes.node,
|
|
3258
|
-
/**
|
|
3259
|
-
* Whether the dialog is initially open.
|
|
3260
|
-
*
|
|
3261
|
-
* To render a controlled dialog, use the `open` prop instead.
|
|
3262
|
-
* @default false
|
|
3263
|
-
*/
|
|
3264
|
-
defaultOpen: PropTypes.bool,
|
|
3265
|
-
/**
|
|
3266
|
-
* Determines whether the dialog should close on outside clicks.
|
|
3267
|
-
* @default true
|
|
3268
|
-
*/
|
|
3269
|
-
dismissible: PropTypes.bool,
|
|
3270
|
-
/**
|
|
3271
|
-
* Whether the dialog should prevent outside clicks and lock page scroll when open.
|
|
3272
|
-
* @default true
|
|
3273
|
-
*/
|
|
3274
|
-
modal: PropTypes.bool,
|
|
3275
|
-
/**
|
|
3276
|
-
* Event handler called when the dialog is opened or closed.
|
|
3277
|
-
*/
|
|
3278
|
-
onOpenChange: PropTypes.func,
|
|
3279
|
-
/**
|
|
3280
|
-
* Event handler called after any animations complete when the dialog is opened or closed.
|
|
3281
|
-
*/
|
|
3282
|
-
onOpenChangeComplete: PropTypes.func,
|
|
3283
|
-
/**
|
|
3284
|
-
* Whether the dialog is currently open.
|
|
3285
|
-
*/
|
|
3286
|
-
open: PropTypes.bool
|
|
3287
|
-
} : void 0;
|
|
3288
|
-
function DialogDriver() {
|
|
3289
|
-
const grid = useGrid$1();
|
|
3290
|
-
const frames = grid.state.dialogFrames.use();
|
|
3291
|
-
const frameId = grid.state.internal.dialogFrameOpen.use();
|
|
3292
|
-
const context2 = grid.state.internal.dialogFrameContext.use();
|
|
3293
|
-
const frame = frameId ? frames[frameId] : null;
|
|
3294
|
-
const [open, setOpen] = useState(false);
|
|
3295
|
-
useEffect(() => {
|
|
3296
|
-
if (!frame) {
|
|
3297
|
-
setOpen(false);
|
|
3298
|
-
return;
|
|
3299
|
-
}
|
|
3300
|
-
setOpen(true);
|
|
3301
|
-
}, [frame]);
|
|
3302
|
-
return /* @__PURE__ */ jsx(
|
|
3303
|
-
DialogRoot,
|
|
3304
|
-
{
|
|
3305
|
-
open,
|
|
3306
|
-
onOpenChange: (c) => setOpen(c),
|
|
3307
|
-
onOpenChangeComplete: (c) => {
|
|
3308
|
-
if (!c) grid.api.dialogFrameClose();
|
|
3309
|
-
},
|
|
3310
|
-
children: /* @__PURE__ */ jsx(DialogPortal, { children: frame && /* @__PURE__ */ jsx(frame.component, { api: grid.api, frame, context: context2 }) })
|
|
3311
|
-
}
|
|
3312
|
-
);
|
|
3313
|
-
}
|
|
3314
|
-
const OPEN_DELAY = 300;
|
|
3315
|
-
function usePopoverRoot(params) {
|
|
3316
|
-
const {
|
|
3317
|
-
open: externalOpen,
|
|
3318
|
-
onOpenChange: onOpenChangeProp,
|
|
3319
|
-
defaultOpen = false,
|
|
3320
|
-
delay,
|
|
3321
|
-
closeDelay,
|
|
3322
|
-
openOnHover = false,
|
|
3323
|
-
onOpenChangeComplete,
|
|
3324
|
-
modal
|
|
3325
|
-
} = params;
|
|
3326
|
-
const delayWithDefault = delay ?? OPEN_DELAY;
|
|
3327
|
-
const closeDelayWithDefault = closeDelay ?? 0;
|
|
3328
|
-
const [instantType, setInstantType] = React.useState();
|
|
3329
|
-
const [titleId, setTitleId] = React.useState();
|
|
3330
|
-
const [descriptionId, setDescriptionId] = React.useState();
|
|
3331
|
-
const [triggerElement, setTriggerElement] = React.useState(null);
|
|
3332
|
-
const [positionerElement, setPositionerElement] = React.useState(null);
|
|
3333
|
-
const [openReason, setOpenReason] = React.useState(null);
|
|
3334
|
-
const [stickIfOpen, setStickIfOpen] = React.useState(true);
|
|
3335
|
-
const popupRef = React.useRef(null);
|
|
3336
|
-
const stickIfOpenTimeoutRef = React.useRef(-1);
|
|
3337
|
-
const [open, setOpenUnwrapped] = useControlled({
|
|
3338
|
-
controlled: externalOpen,
|
|
3339
|
-
default: defaultOpen,
|
|
3340
|
-
name: "Popover",
|
|
3341
|
-
state: "open"
|
|
3342
|
-
});
|
|
3343
|
-
const onOpenChange = useEventCallback(onOpenChangeProp);
|
|
3344
|
-
const {
|
|
3345
|
-
mounted,
|
|
3346
|
-
setMounted,
|
|
3347
|
-
transitionStatus
|
|
3348
|
-
} = useTransitionStatus(open);
|
|
3349
|
-
useScrollLock(open && modal && openReason !== "hover", triggerElement);
|
|
3350
|
-
const setOpen = useEventCallback((nextOpen, event, reason) => {
|
|
3351
|
-
onOpenChange(nextOpen, event, reason);
|
|
3352
|
-
setOpenUnwrapped(nextOpen);
|
|
3353
|
-
if (nextOpen) {
|
|
3354
|
-
setOpenReason(reason ?? null);
|
|
3355
|
-
}
|
|
3356
|
-
});
|
|
3357
|
-
const handleUnmount = useEventCallback(() => {
|
|
3358
|
-
setMounted(false);
|
|
3359
|
-
setStickIfOpen(true);
|
|
3360
|
-
setOpenReason(null);
|
|
3361
|
-
onOpenChangeComplete?.(false);
|
|
3362
|
-
});
|
|
3363
|
-
useOpenChangeComplete({
|
|
3364
|
-
enabled: !params.actionsRef,
|
|
3365
|
-
open,
|
|
3366
|
-
ref: popupRef,
|
|
3367
|
-
onComplete() {
|
|
3368
|
-
if (!open) {
|
|
3369
|
-
handleUnmount();
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
});
|
|
3373
|
-
React.useImperativeHandle(params.actionsRef, () => ({
|
|
3374
|
-
unmount: handleUnmount
|
|
3375
|
-
}), [handleUnmount]);
|
|
3376
|
-
const clearStickIfOpenTimeout = useEventCallback(() => {
|
|
3377
|
-
clearTimeout(stickIfOpenTimeoutRef.current);
|
|
3378
|
-
});
|
|
3379
|
-
React.useEffect(() => {
|
|
3380
|
-
if (!open) {
|
|
3381
|
-
clearStickIfOpenTimeout();
|
|
3382
|
-
}
|
|
3383
|
-
}, [clearStickIfOpenTimeout, open]);
|
|
3384
|
-
React.useEffect(() => {
|
|
3385
|
-
return clearStickIfOpenTimeout;
|
|
3386
|
-
}, [clearStickIfOpenTimeout]);
|
|
3387
|
-
const context2 = useFloatingRootContext({
|
|
3388
|
-
elements: {
|
|
3389
|
-
reference: triggerElement,
|
|
3390
|
-
floating: positionerElement
|
|
3391
|
-
},
|
|
3392
|
-
open,
|
|
3393
|
-
onOpenChange(openValue, eventValue, reasonValue) {
|
|
3394
|
-
const isHover = reasonValue === "hover" || reasonValue === "safe-polygon";
|
|
3395
|
-
const isKeyboardClick = reasonValue === "click" && eventValue.detail === 0;
|
|
3396
|
-
const isDismissClose = !openValue && (reasonValue === "escape-key" || reasonValue == null);
|
|
3397
|
-
function changeState() {
|
|
3398
|
-
setOpen(openValue, eventValue, translateOpenChangeReason(reasonValue));
|
|
3399
|
-
}
|
|
3400
|
-
if (isHover) {
|
|
3401
|
-
setStickIfOpen(true);
|
|
3402
|
-
clearStickIfOpenTimeout();
|
|
3403
|
-
stickIfOpenTimeoutRef.current = window.setTimeout(() => {
|
|
3404
|
-
setStickIfOpen(false);
|
|
3405
|
-
}, PATIENT_CLICK_THRESHOLD);
|
|
3406
|
-
ReactDOM.flushSync(changeState);
|
|
3407
|
-
} else {
|
|
3408
|
-
changeState();
|
|
3409
|
-
}
|
|
3410
|
-
if (isKeyboardClick || isDismissClose) {
|
|
3411
|
-
setInstantType(isKeyboardClick ? "click" : "dismiss");
|
|
3412
|
-
} else {
|
|
3413
|
-
setInstantType(void 0);
|
|
3414
|
-
}
|
|
3415
|
-
}
|
|
3416
|
-
});
|
|
3417
|
-
const {
|
|
3418
|
-
openMethod,
|
|
3419
|
-
triggerProps
|
|
3420
|
-
} = useOpenInteractionType(open);
|
|
3421
|
-
const computedRestMs = delayWithDefault;
|
|
3422
|
-
const hover = useHover(context2, {
|
|
3423
|
-
enabled: openOnHover && (openMethod !== "touch" || openReason !== "click"),
|
|
3424
|
-
mouseOnly: true,
|
|
3425
|
-
move: false,
|
|
3426
|
-
handleClose: safePolygon({
|
|
3427
|
-
blockPointerEvents: true
|
|
3428
|
-
}),
|
|
3429
|
-
restMs: computedRestMs,
|
|
3430
|
-
delay: {
|
|
3431
|
-
close: closeDelayWithDefault
|
|
3432
|
-
}
|
|
3433
|
-
});
|
|
3434
|
-
const click = useClick(context2, {
|
|
3435
|
-
stickIfOpen
|
|
3436
|
-
});
|
|
3437
|
-
const dismiss = useDismiss(context2);
|
|
3438
|
-
const role = useRole(context2);
|
|
3439
|
-
const {
|
|
3440
|
-
getReferenceProps,
|
|
3441
|
-
getFloatingProps
|
|
3442
|
-
} = useInteractions([hover, click, dismiss, role]);
|
|
3443
|
-
const getRootTriggerProps = React.useCallback((externalProps = {}) => getReferenceProps(mergeProps(triggerProps, externalProps)), [getReferenceProps, triggerProps]);
|
|
3444
|
-
return React.useMemo(() => ({
|
|
3445
|
-
open,
|
|
3446
|
-
setOpen,
|
|
3447
|
-
mounted,
|
|
3448
|
-
setMounted,
|
|
3449
|
-
transitionStatus,
|
|
3450
|
-
setTriggerElement,
|
|
3451
|
-
positionerElement,
|
|
3452
|
-
setPositionerElement,
|
|
3453
|
-
popupRef,
|
|
3454
|
-
titleId,
|
|
3455
|
-
setTitleId,
|
|
3456
|
-
descriptionId,
|
|
3457
|
-
setDescriptionId,
|
|
3458
|
-
getRootTriggerProps,
|
|
3459
|
-
getRootPopupProps: getFloatingProps,
|
|
3460
|
-
floatingRootContext: context2,
|
|
3461
|
-
instantType,
|
|
3462
|
-
openMethod,
|
|
3463
|
-
openReason,
|
|
3464
|
-
onOpenChangeComplete
|
|
3465
|
-
}), [open, setOpen, mounted, setMounted, transitionStatus, positionerElement, titleId, descriptionId, getRootTriggerProps, getFloatingProps, context2, instantType, openMethod, openReason, onOpenChangeComplete]);
|
|
3466
|
-
}
|
|
3467
|
-
const PopoverRoot = function PopoverRoot2(props) {
|
|
3468
|
-
const {
|
|
3469
|
-
defaultOpen = false,
|
|
3470
|
-
onOpenChange,
|
|
3471
|
-
open,
|
|
3472
|
-
openOnHover = false,
|
|
3473
|
-
delay,
|
|
3474
|
-
closeDelay = 0,
|
|
3475
|
-
actionsRef,
|
|
3476
|
-
onOpenChangeComplete,
|
|
3477
|
-
modal = false
|
|
3478
|
-
} = props;
|
|
3479
|
-
const delayWithDefault = delay ?? OPEN_DELAY;
|
|
3480
|
-
const popoverRoot = usePopoverRoot({
|
|
3481
|
-
...props,
|
|
3482
|
-
defaultOpen,
|
|
3483
|
-
onOpenChange,
|
|
3484
|
-
open,
|
|
3485
|
-
openOnHover,
|
|
3486
|
-
onOpenChangeComplete,
|
|
3487
|
-
delay: delayWithDefault,
|
|
3488
|
-
closeDelay,
|
|
3489
|
-
actionsRef,
|
|
3490
|
-
modal
|
|
3491
|
-
});
|
|
3492
|
-
const contextValue = React.useMemo(() => ({
|
|
3493
|
-
...popoverRoot,
|
|
3494
|
-
openOnHover,
|
|
3495
|
-
delay: delayWithDefault,
|
|
3496
|
-
closeDelay,
|
|
3497
|
-
modal
|
|
3498
|
-
}), [popoverRoot, openOnHover, delayWithDefault, closeDelay, modal]);
|
|
3499
|
-
return /* @__PURE__ */ jsx(PopoverRootContext.Provider, {
|
|
3500
|
-
value: contextValue,
|
|
3501
|
-
children: props.children
|
|
3502
|
-
});
|
|
3503
|
-
};
|
|
3504
|
-
process.env.NODE_ENV !== "production" ? PopoverRoot.propTypes = {
|
|
3505
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3506
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3507
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
3508
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
3509
|
-
/**
|
|
3510
|
-
* A ref to imperative actions.
|
|
3511
|
-
*/
|
|
3512
|
-
actionsRef: PropTypes.shape({
|
|
3513
|
-
current: PropTypes.shape({
|
|
3514
|
-
unmount: PropTypes.func.isRequired
|
|
3515
|
-
}).isRequired
|
|
3516
|
-
}),
|
|
3517
|
-
/**
|
|
3518
|
-
* @ignore
|
|
3519
|
-
*/
|
|
3520
|
-
children: PropTypes.node,
|
|
3521
|
-
/**
|
|
3522
|
-
* How long to wait before closing the popover that was opened on hover.
|
|
3523
|
-
* Specified in milliseconds.
|
|
3524
|
-
*
|
|
3525
|
-
* Requires the `openOnHover` prop.
|
|
3526
|
-
* @default 0
|
|
3527
|
-
*/
|
|
3528
|
-
closeDelay: PropTypes.number,
|
|
3529
|
-
/**
|
|
3530
|
-
* Whether the popover is initially open.
|
|
3531
|
-
*
|
|
3532
|
-
* To render a controlled popover, use the `open` prop instead.
|
|
3533
|
-
* @default false
|
|
3534
|
-
*/
|
|
3535
|
-
defaultOpen: PropTypes.bool,
|
|
3536
|
-
/**
|
|
3537
|
-
* How long to wait before the popover may be opened on hover. Specified in milliseconds.
|
|
3538
|
-
*
|
|
3539
|
-
* Requires the `openOnHover` prop.
|
|
3540
|
-
* @default 300
|
|
3541
|
-
*/
|
|
3542
|
-
delay: PropTypes.number,
|
|
3543
|
-
/**
|
|
3544
|
-
* Whether the popover should prevent outside clicks and lock page scroll when open.
|
|
3545
|
-
* @default false
|
|
3546
|
-
*/
|
|
3547
|
-
modal: PropTypes.bool,
|
|
3548
|
-
/**
|
|
3549
|
-
* Event handler called when the popover is opened or closed.
|
|
3550
|
-
*/
|
|
3551
|
-
onOpenChange: PropTypes.func,
|
|
3552
|
-
/**
|
|
3553
|
-
* Event handler called after any animations complete when the popover is opened or closed.
|
|
3554
|
-
*/
|
|
3555
|
-
onOpenChangeComplete: PropTypes.func,
|
|
3556
|
-
/**
|
|
3557
|
-
* Whether the popover is currently open.
|
|
3558
|
-
*/
|
|
3559
|
-
open: PropTypes.bool,
|
|
3560
|
-
/**
|
|
3561
|
-
* Whether the popover should also open when the trigger is hovered.
|
|
3562
|
-
* @default false
|
|
3563
|
-
*/
|
|
3564
|
-
openOnHover: PropTypes.bool
|
|
3565
|
-
} : void 0;
|
|
3566
|
-
function PopoverPortal(props) {
|
|
3567
|
-
const {
|
|
3568
|
-
children,
|
|
3569
|
-
keepMounted = false,
|
|
3570
|
-
container
|
|
3571
|
-
} = props;
|
|
3572
|
-
const {
|
|
3573
|
-
mounted
|
|
3574
|
-
} = usePopoverRootContext();
|
|
3575
|
-
const shouldRender = mounted || keepMounted;
|
|
3576
|
-
if (!shouldRender) {
|
|
3577
|
-
return null;
|
|
3578
|
-
}
|
|
3579
|
-
return /* @__PURE__ */ jsx(PopoverPortalContext.Provider, {
|
|
3580
|
-
value: keepMounted,
|
|
3581
|
-
children: /* @__PURE__ */ jsx(FloatingPortal, {
|
|
3582
|
-
root: container,
|
|
3583
|
-
children
|
|
3584
|
-
})
|
|
3585
|
-
});
|
|
3586
|
-
}
|
|
3587
|
-
process.env.NODE_ENV !== "production" ? PopoverPortal.propTypes = {
|
|
3588
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3589
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3590
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
3591
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
3592
|
-
/**
|
|
3593
|
-
* @ignore
|
|
3594
|
-
*/
|
|
3595
|
-
children: PropTypes.node,
|
|
3596
|
-
/**
|
|
3597
|
-
* A parent element to render the portal element into.
|
|
3598
|
-
*/
|
|
3599
|
-
container: PropTypes.oneOfType([HTMLElementType, refType]),
|
|
3600
|
-
/**
|
|
3601
|
-
* Whether to keep the portal mounted in the DOM while the popup is hidden.
|
|
3602
|
-
* @default false
|
|
3603
|
-
*/
|
|
3604
|
-
keepMounted: PropTypes.bool
|
|
3605
|
-
} : void 0;
|
|
3606
|
-
function PopoverDriver() {
|
|
3607
|
-
const grid = useGrid$1();
|
|
3608
|
-
const frames = grid.state.popoverFrames.use();
|
|
3609
|
-
const frameId = grid.state.internal.popoverFrameOpen.use();
|
|
3610
|
-
const frameBB = grid.state.internal.popoverFrameBB.use();
|
|
3611
|
-
const frameContext = grid.state.internal.popoverFrameContext.use();
|
|
3612
|
-
const frame = frameId ? frames[frameId] : null;
|
|
3613
|
-
const [open, setOpen] = useState(false);
|
|
3614
|
-
useEffect(() => {
|
|
3615
|
-
if (!frame || !frameBB) {
|
|
3616
|
-
setOpen(false);
|
|
3617
|
-
return;
|
|
3618
|
-
}
|
|
3619
|
-
setOpen(true);
|
|
3620
|
-
}, [frame, frameBB]);
|
|
3621
|
-
return /* @__PURE__ */ jsx(
|
|
3622
|
-
PopoverRoot,
|
|
3623
|
-
{
|
|
3624
|
-
open,
|
|
3625
|
-
onOpenChange: (c) => setOpen(c),
|
|
3626
|
-
onOpenChangeComplete: (c) => {
|
|
3627
|
-
if (!c) grid.api.popoverFrameClose();
|
|
3628
|
-
},
|
|
3629
|
-
children: /* @__PURE__ */ jsx(AnchorProvider, { anchor: frameBB, children: /* @__PURE__ */ jsx(PopoverPortal, { children: frame && frameBB && /* @__PURE__ */ jsx(frame.component, { api: grid.api, frame, context: frameContext }) }) })
|
|
3630
|
-
}
|
|
3631
|
-
);
|
|
3632
|
-
}
|
|
3633
|
-
function MenuFrameDriver() {
|
|
3634
|
-
const grid = useGrid$1();
|
|
3635
|
-
const frames = grid.state.menuFrames.use();
|
|
3636
|
-
const frameId = grid.state.internal.menuFrameOpen.use();
|
|
3637
|
-
const frameBB = grid.state.internal.menuFrameBB.use();
|
|
3638
|
-
const context2 = grid.state.internal.menuFrameContext.use();
|
|
3639
|
-
const frame = frameId ? frames[frameId] : null;
|
|
3640
|
-
const [open, setOpen] = useState(false);
|
|
3641
|
-
useEffect(() => {
|
|
3642
|
-
if (!frame || !frameBB) {
|
|
3643
|
-
setOpen(false);
|
|
3644
|
-
return;
|
|
3645
|
-
}
|
|
3646
|
-
setOpen(true);
|
|
3647
|
-
}, [frame, frameBB]);
|
|
3648
|
-
return /* @__PURE__ */ jsx(
|
|
3649
|
-
MenuRoot,
|
|
3650
|
-
{
|
|
3651
|
-
open,
|
|
3652
|
-
onOpenChange: (c) => setOpen(c),
|
|
3653
|
-
onOpenChangeComplete: (c) => {
|
|
3654
|
-
if (!c) grid.api.menuFrameClose();
|
|
3655
|
-
},
|
|
3656
|
-
children: /* @__PURE__ */ jsx(AnchorProvider, { anchor: frameBB, children: /* @__PURE__ */ jsx(MenuPortal, { children: frame && frameBB && /* @__PURE__ */ jsx(frame.component, { api: grid.api, frame, context: context2 }) }) })
|
|
3657
|
-
}
|
|
3658
|
-
);
|
|
3659
|
-
}
|
|
3660
|
-
function LyteNyteGrid({ grid, frameAxe }) {
|
|
3661
|
-
return /* @__PURE__ */ jsx(GridProvider, { value: grid, children: /* @__PURE__ */ jsxs(GridFrame, { grid, axe: frameAxe, children: [
|
|
3662
|
-
/* @__PURE__ */ jsx(LyteNyteProImpl, {}),
|
|
3663
|
-
/* @__PURE__ */ jsx(ColumnMenuDriver, {}),
|
|
3664
|
-
/* @__PURE__ */ jsx(ContextMenuDriver, {}),
|
|
3665
|
-
/* @__PURE__ */ jsx(DialogDriver, {}),
|
|
3666
|
-
/* @__PURE__ */ jsx(PopoverDriver, {}),
|
|
3667
|
-
/* @__PURE__ */ jsx(MenuFrameDriver, {})
|
|
3668
|
-
] }) });
|
|
3669
|
-
}
|
|
3670
|
-
function LyteNyteProImpl() {
|
|
3671
|
-
const { state } = useGrid$1();
|
|
3672
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3673
|
-
/* @__PURE__ */ jsx(OverlayDriver, {}),
|
|
3674
|
-
/* @__PURE__ */ jsxs(Viewport, { top: Top, center: Center, bottom: Bottom, children: [
|
|
3675
|
-
/* @__PURE__ */ jsx(CellSelectionDriver, {}),
|
|
3676
|
-
/* @__PURE__ */ jsx(Watermark, { id: state.gridId.use() })
|
|
3677
|
-
] })
|
|
3678
|
-
] });
|
|
3679
|
-
}
|
|
3680
|
-
function Center() {
|
|
3681
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3682
|
-
/* @__PURE__ */ jsx(CellEditorCenter, {}),
|
|
3683
|
-
/* @__PURE__ */ jsx(CellSelectionCenter, {})
|
|
3684
|
-
] });
|
|
3685
|
-
}
|
|
3686
|
-
function Top() {
|
|
3687
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3688
|
-
/* @__PURE__ */ jsx(CellEditorTop, {}),
|
|
3689
|
-
/* @__PURE__ */ jsx(CellSelectionTop, {})
|
|
3690
|
-
] });
|
|
3691
|
-
}
|
|
3692
|
-
function Bottom() {
|
|
3693
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3694
|
-
/* @__PURE__ */ jsx(CellEditorBottom, {}),
|
|
3695
|
-
/* @__PURE__ */ jsx(CellSelectionBottom, {})
|
|
3696
|
-
] });
|
|
3697
|
-
}
|
|
3698
|
-
function HeaderCellDefault({ column, api }) {
|
|
3699
|
-
const sx = api.getState();
|
|
3700
|
-
const isSortable = api.columnIsSortable(column);
|
|
3701
|
-
const sortModel = sx.sortModel.use();
|
|
3702
|
-
const currentSort = api.columnSortDirection(column);
|
|
3703
|
-
const currentSortIndex = api.columnSortModelIndex(column);
|
|
3704
|
-
const nextSort = api.columnSortGetNext(column);
|
|
3705
|
-
const displaySortNumber = sortModel.length > 0 && currentSortIndex > 0;
|
|
3706
|
-
const hints = column.uiHints ?? sx.columnBase.peek().uiHints ?? {};
|
|
3707
|
-
const columnMenuOpen = sx.columnMenuActiveColumn.use();
|
|
3708
|
-
const hasControls = hints.columnMenu || hints.sortButton && isSortable;
|
|
3709
|
-
const rowGroup = sx.rowGroupModel.use();
|
|
3710
|
-
const aggModel = sx.aggModel.use();
|
|
3711
|
-
const agg = aggModel[column.id];
|
|
3712
|
-
const fn = useMemo(() => {
|
|
3713
|
-
return rowGroup.length > 0 && agg ? typeof agg.fn === "string" ? `(${agg.fn})` : "fn(x)" : null;
|
|
3714
|
-
}, [agg, rowGroup.length]);
|
|
3715
|
-
const subTitle = hints.subTitle;
|
|
3716
|
-
const stacked = hints.stacked ?? false;
|
|
3717
|
-
return /* @__PURE__ */ jsxs(
|
|
3718
|
-
"div",
|
|
3719
|
-
{
|
|
3720
|
-
className: clsx(
|
|
3721
|
-
"lng1771-header-default",
|
|
3722
|
-
column.type === "number" && "lng1771-header-default--end-justify",
|
|
3723
|
-
column.type !== "number" && "lng1771-header-default--start-justify"
|
|
3724
|
-
),
|
|
3725
|
-
children: [
|
|
3726
|
-
/* @__PURE__ */ jsxs(
|
|
3727
|
-
"div",
|
|
3728
|
-
{
|
|
3729
|
-
className: clsx(
|
|
3730
|
-
"lng1771-header-default__label",
|
|
3731
|
-
column.type === "number" && "lng1771-header-default__label--end-justify",
|
|
3732
|
-
column.type !== "number" && "lng1771-header-default__label--start-justify",
|
|
3733
|
-
stacked && "lng1771-header-default__label--stacked"
|
|
3734
|
-
),
|
|
3735
|
-
children: [
|
|
3736
|
-
/* @__PURE__ */ jsx("div", { className: "lng1771-header-default__label-primary", children: column.headerName ?? column.id }),
|
|
3737
|
-
/* @__PURE__ */ jsxs("div", { className: "lng1771-header-default__label-secondary", children: [
|
|
3738
|
-
subTitle && /* @__PURE__ */ jsx("div", { className: "lng1771-header-default__label-secondary-title", children: subTitle }),
|
|
3739
|
-
hints.showAggName && fn && /* @__PURE__ */ jsx("div", { className: "lng1771-header-default__label-secondary-agg", children: fn })
|
|
3740
|
-
] })
|
|
3741
|
-
]
|
|
3742
|
-
}
|
|
3743
|
-
),
|
|
3744
|
-
hasControls && /* @__PURE__ */ jsxs("div", { className: "lng1771-header-default__controls", children: [
|
|
3745
|
-
isSortable && hints.sortButton && /* @__PURE__ */ jsxs(
|
|
3746
|
-
"button",
|
|
3747
|
-
{
|
|
3748
|
-
tabIndex: -1,
|
|
3749
|
-
"data-active": currentSort != null,
|
|
3750
|
-
className: clsx("lng1771-header-default__button"),
|
|
3751
|
-
"data-is-sort": true,
|
|
3752
|
-
onClick: () => api.columnSortCycleToNext(column),
|
|
3753
|
-
children: [
|
|
3754
|
-
currentSort === "asc" && /* @__PURE__ */ jsx(SortAscending, { width: 16, height: 16 }),
|
|
3755
|
-
currentSort === "desc" && /* @__PURE__ */ jsx(SortDescending, { width: 16, height: 16 }),
|
|
3756
|
-
!currentSort && nextSort?.includes("asc") && /* @__PURE__ */ jsx(SortAscending, { width: 16, height: 16 }),
|
|
3757
|
-
!currentSort && nextSort?.includes("desc") && /* @__PURE__ */ jsx(SortDescending, { width: 16, height: 16 }),
|
|
3758
|
-
displaySortNumber && currentSortIndex > 0 && /* @__PURE__ */ jsx("span", { className: "lng1771-header-default__sort-count", children: currentSortIndex + 1 })
|
|
3759
|
-
]
|
|
3760
|
-
}
|
|
3761
|
-
),
|
|
3762
|
-
hints.columnMenu && /* @__PURE__ */ jsx(
|
|
3763
|
-
"button",
|
|
3764
|
-
{
|
|
3765
|
-
tabIndex: -1,
|
|
3766
|
-
className: "lng1771-header-default__button",
|
|
3767
|
-
onFocus: (ev) => {
|
|
3768
|
-
if (column !== columnMenuOpen) return;
|
|
3769
|
-
ev.currentTarget.parentElement?.parentElement?.parentElement?.focus();
|
|
3770
|
-
},
|
|
3771
|
-
"data-active": column === columnMenuOpen,
|
|
3772
|
-
onClick: (e) => api.columnMenuOpen(column, e.currentTarget),
|
|
3773
|
-
children: /* @__PURE__ */ jsx(MoreDotsIcon, { width: 16, height: 16 })
|
|
3774
|
-
}
|
|
3775
|
-
)
|
|
3776
|
-
] })
|
|
3777
|
-
]
|
|
3778
|
-
}
|
|
3779
|
-
);
|
|
3780
|
-
}
|
|
3781
|
-
const useLyteNytePro = (p2) => {
|
|
3782
|
-
const [grid] = useState(() => {
|
|
3783
|
-
const s3 = makeGridPro(p2);
|
|
3784
|
-
s3.state.internal.columnHeaderDefaultRenderer.set(() => HeaderCellDefault);
|
|
3785
|
-
const useSignalWatcher = (c, fn) => {
|
|
3786
|
-
const signal2 = s3.state[c];
|
|
3787
|
-
useEffect(() => {
|
|
3788
|
-
const unsub = signal2.watch(fn);
|
|
3789
|
-
return () => unsub();
|
|
3790
|
-
}, [fn, signal2]);
|
|
3791
|
-
};
|
|
3792
|
-
const useEvent2 = (ev, fn) => {
|
|
3793
|
-
useEffect(() => {
|
|
3794
|
-
const unsub = s3.api.eventAddListener(ev, fn);
|
|
3795
|
-
return () => unsub();
|
|
3796
|
-
}, [ev, fn]);
|
|
3797
|
-
};
|
|
3798
|
-
return { ...s3, useSignalWatcher, useEvent: useEvent2 };
|
|
3799
|
-
});
|
|
3800
|
-
return grid;
|
|
3801
|
-
};
|
|
3802
|
-
const createClientDataSourceReact = (init) => {
|
|
3803
|
-
return createClientDataSource(init);
|
|
3804
|
-
};
|
|
3805
|
-
function useClientDataSource(init) {
|
|
3806
|
-
return useState(() => {
|
|
3807
|
-
return createClientDataSource(init);
|
|
3808
|
-
})[0];
|
|
3809
|
-
}
|
|
3810
|
-
function useTreeDataSource(init) {
|
|
3811
|
-
const [ds] = useState(() => {
|
|
3812
|
-
return createTreeDataSource(init);
|
|
3813
|
-
});
|
|
3814
|
-
return ds;
|
|
3815
|
-
}
|
|
3816
|
-
function useServerDataSource(init) {
|
|
3817
|
-
const [ds] = useState(() => {
|
|
3818
|
-
return createServerDataSource(init);
|
|
3819
|
-
});
|
|
3820
|
-
return ds;
|
|
3821
|
-
}
|
|
3822
|
-
export {
|
|
3823
|
-
COLUMN_EMPTY_PREFIX,
|
|
3824
|
-
t as COLUMN_GROUP_HEADER_HEIGHT,
|
|
3825
|
-
n as COLUMN_GROUP_ID_DELIMITER,
|
|
3826
|
-
v as COLUMN_HEADER_HEIGHT,
|
|
3827
|
-
COLUMN_MARKER_ID,
|
|
3828
|
-
w as COLUMN_SCAN_DISTANCE,
|
|
3829
|
-
B as DEFAULT_MAX_WIDTH,
|
|
3830
|
-
J as DEFAULT_MIN_WIDTH,
|
|
3831
|
-
L as DEFAULT_SORT_CYCLE,
|
|
3832
|
-
K as DEFAULT_WIDTH,
|
|
3833
|
-
END_ENCODING,
|
|
3834
|
-
FLOATING_CELL_POSITION,
|
|
3835
|
-
FULL_ENCODING,
|
|
3836
|
-
M as FULL_WIDTH_POSITION,
|
|
3837
|
-
GRID_CELL_POSITION,
|
|
3838
|
-
q as GROUP_COLUMN_MULTI_PREFIX,
|
|
3839
|
-
p as GROUP_COLUMN_PREFIX,
|
|
3840
|
-
r as GROUP_COLUMN_SINGLE_ID,
|
|
3841
|
-
s as GROUP_COLUMN_TREE_DATA,
|
|
3842
|
-
HEADER_CELL_POSITION,
|
|
3843
|
-
HEADER_GROUP_CELL_POSITION,
|
|
3844
|
-
LyteNyteGrid,
|
|
3845
|
-
P as PAGINATE_PAGE_SIZE,
|
|
3846
|
-
x as ROW_BLANK_GROUP_KEY,
|
|
3847
|
-
o as ROW_DEFAULT_PATH_SEPARATOR,
|
|
3848
|
-
z as ROW_DETAIL_HEIGHT,
|
|
3849
|
-
m as ROW_GROUP_KIND,
|
|
3850
|
-
y as ROW_HEIGHT,
|
|
3851
|
-
R as ROW_LEAF_KIND,
|
|
3852
|
-
A as ROW_UPDATE_STACK_SIZE,
|
|
3853
|
-
activateLicense,
|
|
3854
|
-
createClientDataSourceReact,
|
|
3855
|
-
hasAValidLicense,
|
|
3856
|
-
useClientDataSource,
|
|
3857
|
-
useLyteNytePro,
|
|
3858
|
-
useServerDataSource,
|
|
3859
|
-
useTreeDataSource
|
|
3860
|
-
};
|
|
1
|
+
export { Grid } from "./grid.js";
|
|
2
|
+
export { SortManager } from "./sort-manager/sort-manager.js";
|
|
3
|
+
export { FilterTree } from "./filter-tree/filter-tree.js";
|
|
4
|
+
export { ColumnManager } from "./column-manager/column-manager.js";
|
|
5
|
+
export { GridBox } from "./grid-box/grid-box.js";
|
|
6
|
+
export { activateLicense } from "./license.js";
|