@1771technologies/lytenyte-pro 1.0.0-beta.34 → 1.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/+types.d.ts +4203 -4009
- package/dist/cell-selection/adjust-rect-for-row-and-cell-span.js +38 -38
- package/dist/cell-selection/are-rects-equal.js +6 -4
- package/dist/cell-selection/bound-selection-rect.js +14 -14
- package/dist/cell-selection/cell-selection-containers.js +108 -78
- package/dist/cell-selection/cell-selection-driver.js +250 -262
- package/dist/cell-selection/cell-style-row.d.ts +12 -6
- package/dist/cell-selection/cell-style-row.js +82 -79
- package/dist/cell-selection/deselect-rect-range.js +41 -40
- package/dist/cell-selection/expand-cell-selection-down.d.ts +5 -2
- package/dist/cell-selection/expand-cell-selection-down.js +29 -33
- package/dist/cell-selection/expand-cell-selection-end.d.ts +5 -2
- package/dist/cell-selection/expand-cell-selection-end.js +30 -34
- package/dist/cell-selection/expand-cell-selection-start.d.ts +5 -2
- package/dist/cell-selection/expand-cell-selection-start.js +29 -33
- package/dist/cell-selection/expand-cell-selection-up.d.ts +5 -2
- package/dist/cell-selection/expand-cell-selection-up.js +29 -33
- package/dist/cell-selection/full-width-start-end-index.js +3 -3
- package/dist/cell-selection/get-root-cell.d.ts +5 -1
- package/dist/cell-selection/get-root-cell.js +77 -79
- package/dist/cell-selection/is-bottom-rect.js +5 -5
- package/dist/cell-selection/is-center-col-rect.d.ts +5 -2
- package/dist/cell-selection/is-center-col-rect.js +5 -3
- package/dist/cell-selection/is-center-rect.js +3 -3
- package/dist/cell-selection/is-end-rect.d.ts +5 -2
- package/dist/cell-selection/is-end-rect.js +2 -2
- package/dist/cell-selection/is-overlapping-rect.js +6 -4
- package/dist/cell-selection/is-start-rect.d.ts +5 -2
- package/dist/cell-selection/is-start-rect.js +2 -2
- package/dist/cell-selection/is-top-rect.js +2 -2
- package/dist/cell-selection/is-within-selection-rect.js +1 -1
- package/dist/cell-selection/split-cell-selection-rect.d.ts +12 -6
- package/dist/cell-selection/split-cell-selection-rect.js +53 -47
- package/dist/cell-selection/update-additive-cell-selection.d.ts +5 -2
- package/dist/cell-selection/update-additive-cell-selection.js +16 -17
- package/dist/cell-selection/use-edge-scroll.d.ts +8 -6
- package/dist/cell-selection/use-edge-scroll.js +65 -63
- package/dist/cells/cell-default.d.ts +5 -1
- package/dist/cells/cell-default.js +5 -5
- package/dist/cells/cell-editor.d.ts +4 -2
- package/dist/cells/cell-editor.js +129 -92
- package/dist/cells/cell.d.ts +16 -3
- package/dist/cells/cell.js +56 -27
- package/dist/column-manager/branch-lookup-context.d.ts +3 -1
- package/dist/column-manager/branch.d.ts +17 -9
- package/dist/column-manager/branch.js +64 -46
- package/dist/column-manager/column-manager.d.ts +57 -8
- package/dist/column-manager/column-manager.js +8 -8
- package/dist/column-manager/context.d.ts +1 -1
- package/dist/column-manager/label.d.ts +10 -2
- package/dist/column-manager/label.js +11 -12
- package/dist/column-manager/leaf.d.ts +10 -2
- package/dist/column-manager/leaf.js +61 -49
- package/dist/column-manager/move-handle.d.ts +14 -6
- package/dist/column-manager/move-handle.js +52 -48
- package/dist/column-manager/panel.d.ts +10 -1
- package/dist/column-manager/root.d.ts +7 -3
- package/dist/column-manager/root.js +4 -1
- package/dist/column-manager/use-column-manager.d.ts +6 -3
- package/dist/column-manager/use-column-manager.js +14 -15
- package/dist/column-manager/use-columns-from-context.d.ts +3 -1
- package/dist/column-manager/use-columns-from-context.js +18 -18
- package/dist/column-manager/visibility-checkbox.d.ts +14 -6
- package/dist/column-manager/visibility-checkbox.js +36 -23
- package/dist/context.d.ts +4 -4
- package/dist/filter-tree/branch.d.ts +16 -8
- package/dist/filter-tree/branch.js +23 -13
- package/dist/filter-tree/context.d.ts +16 -16
- package/dist/filter-tree/filter-tree.d.ts +49 -8
- package/dist/filter-tree/filter-tree.js +8 -8
- package/dist/filter-tree/hooks/use-filter-tree.d.ts +35 -29
- package/dist/filter-tree/hooks/use-filter-tree.js +94 -92
- package/dist/filter-tree/hooks/use-tree-item.d.ts +4 -4
- package/dist/filter-tree/hooks/use-tree-item.js +99 -106
- package/dist/filter-tree/inclusion-checkbox.d.ts +14 -6
- package/dist/filter-tree/inclusion-checkbox.js +19 -9
- package/dist/filter-tree/label.d.ts +10 -2
- package/dist/filter-tree/label.js +11 -12
- package/dist/filter-tree/leaf.d.ts +10 -2
- package/dist/filter-tree/leaf.js +15 -5
- package/dist/filter-tree/root.d.ts +23 -7
- package/dist/filter-tree/root.js +51 -23
- package/dist/grid-box/+types.d.ts +11 -11
- package/dist/grid-box/context.d.ts +3 -3
- package/dist/grid-box/grid-box.d.ts +26 -6
- package/dist/grid-box/grid-box.js +6 -6
- package/dist/grid-box/item.d.ts +13 -5
- package/dist/grid-box/item.js +73 -56
- package/dist/grid-box/panel.d.ts +13 -1
- package/dist/grid-box/panel.js +9 -2
- package/dist/grid-box/root.d.ts +11 -5
- package/dist/grid-box/root.js +11 -2
- package/dist/grid-box/use-aggregation-box-items.d.ts +16 -13
- package/dist/grid-box/use-aggregation-box-items.js +56 -57
- package/dist/grid-box/use-column-box-items.d.ts +33 -23
- package/dist/grid-box/use-column-box-items.js +87 -75
- package/dist/grid-box/use-row-group-box-items.d.ts +17 -12
- package/dist/grid-box/use-row-group-box-items.js +120 -123
- package/dist/grid-provider/context.d.ts +4 -2
- package/dist/grid-provider/provider.d.ts +4 -2
- package/dist/grid-provider/use-grid.d.ts +1 -1
- package/dist/grid.d.ts +126 -14
- package/dist/grid.js +14 -14
- package/dist/header/header-cell.d.ts +13 -5
- package/dist/header/header-cell.js +41 -15
- package/dist/header/header-group-cell.d.ts +10 -2
- package/dist/header/header-group-cell.js +26 -8
- package/dist/header/header-row.d.ts +10 -2
- package/dist/header/header-row.js +2 -2
- package/dist/header/header.d.ts +10 -1
- package/dist/header/header.js +11 -2
- package/dist/header/resize-handler.d.ts +15 -6
- package/dist/header/resize-handler.js +131 -122
- package/dist/header/use-drag-move.d.ts +22 -11
- package/dist/header/use-drag-move.js +95 -94
- package/dist/header/use-header-cell-renderer.d.ts +9 -2
- package/dist/header/use-header-cell-renderer.js +25 -29
- package/dist/icons/index.d.ts +92 -1
- package/dist/icons/index.js +92 -1
- package/dist/index.d.ts +22 -5
- package/dist/index.js +22 -5
- package/dist/license.js +174 -174
- package/dist/listbox/context.d.ts +2 -2
- package/dist/listbox/item.d.ts +10 -1
- package/dist/listbox/item.js +23 -19
- package/dist/listbox/panel.d.ts +10 -1
- package/dist/listbox/panel.js +69 -43
- package/dist/listbox/root.d.ts +5 -3
- package/dist/listbox/root.js +7 -7
- package/dist/root/dialog-driver.js +22 -16
- package/dist/root/popover-driver.js +27 -16
- package/dist/root/root.d.ts +7 -3
- package/dist/root/root.js +111 -107
- package/dist/row-data-source-client/+types.d.ts +17 -17
- package/dist/row-data-source-client/built-ins/avg.js +3 -4
- package/dist/row-data-source-client/built-ins/built-ins.d.ts +16 -16
- package/dist/row-data-source-client/built-ins/built-ins.js +16 -16
- package/dist/row-data-source-client/built-ins/count.js +3 -5
- package/dist/row-data-source-client/built-ins/first.js +1 -1
- package/dist/row-data-source-client/built-ins/group.js +1 -1
- package/dist/row-data-source-client/built-ins/last.js +1 -1
- package/dist/row-data-source-client/built-ins/max.js +9 -13
- package/dist/row-data-source-client/built-ins/min.js +9 -13
- package/dist/row-data-source-client/built-ins/sum.js +8 -10
- package/dist/row-data-source-client/filter/+types.d.ts +35 -13
- package/dist/row-data-source-client/filter/compute-filtered-rows.d.ts +16 -2
- package/dist/row-data-source-client/filter/compute-filtered-rows.js +102 -102
- package/dist/row-data-source-client/pivots/create-agg-model.d.ts +8 -4
- package/dist/row-data-source-client/pivots/create-agg-model.js +8 -9
- package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.d.ts +6 -1
- package/dist/row-data-source-client/pivots/create-pivot-columns-from-paths.js +42 -46
- package/dist/row-data-source-client/pivots/create-pivot-columns.d.ts +6 -1
- package/dist/row-data-source-client/pivots/create-pivot-columns.js +16 -17
- package/dist/row-data-source-client/pivots/create-pivot-tree.d.ts +7 -1
- package/dist/row-data-source-client/pivots/create-pivot-tree.js +19 -19
- package/dist/row-data-source-client/tree/client-tree.d.ts +19 -13
- package/dist/row-data-source-client/tree/client-tree.js +64 -67
- package/dist/row-data-source-client/tree/evaluator-aggregation.d.ts +4 -1
- package/dist/row-data-source-client/tree/evaluator-aggregation.js +6 -6
- package/dist/row-data-source-client/tree/evaluator-group.d.ts +4 -1
- package/dist/row-data-source-client/tree/evaluator-group.js +6 -7
- package/dist/row-data-source-client/tree/traverse.d.ts +5 -1
- package/dist/row-data-source-client/tree/traverse.js +15 -18
- package/dist/row-data-source-client/use-client-data-source-paginated.d.ts +9 -5
- package/dist/row-data-source-client/use-client-data-source-paginated.js +566 -551
- package/dist/row-data-source-client/use-client-data-source.d.ts +9 -5
- package/dist/row-data-source-client/use-client-data-source.js +696 -661
- package/dist/row-data-source-client/use-client-tree-data-source.d.ts +9 -5
- package/dist/row-data-source-client/use-client-tree-data-source.js +523 -512
- package/dist/row-data-source-server/async-tree/+types.async-tree.d.ts +36 -33
- package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.d.ts +4 -1
- package/dist/row-data-source-server/async-tree/apply-delete-action-to-tree.js +18 -22
- package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.d.ts +4 -1
- package/dist/row-data-source-server/async-tree/apply-set-action-to-tree.js +17 -25
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-unique.js +18 -18
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-are-valid.js +9 -10
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.d.ts +4 -1
- package/dist/row-data-source-server/async-tree/check-set-action-item-keys-fit.js +13 -14
- package/dist/row-data-source-server/async-tree/check-set-action-item-kinds.js +9 -10
- package/dist/row-data-source-server/async-tree/get-parent-node-by-path.d.ts +4 -1
- package/dist/row-data-source-server/async-tree/get-parent-node-by-path.js +13 -13
- package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.d.ts +4 -1
- package/dist/row-data-source-server/async-tree/is-set-action-a-no-op-on-node.js +1 -1
- package/dist/row-data-source-server/async-tree/make-async-tree.js +14 -14
- package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.d.ts +3 -1
- package/dist/row-data-source-server/async-tree/maybe-apply-parent-remove-self.js +6 -6
- package/dist/row-data-source-server/async-tree/maybe-apply-resize.d.ts +5 -1
- package/dist/row-data-source-server/async-tree/maybe-apply-resize.js +11 -14
- package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.d.ts +4 -1
- package/dist/row-data-source-server/async-tree/maybe-apply-set-action-items.js +42 -46
- package/dist/row-data-source-server/range-tree/range-tree.d.ts +28 -28
- package/dist/row-data-source-server/range-tree/range-tree.js +49 -48
- package/dist/row-data-source-server/use-server-data-source.d.ts +11 -2
- package/dist/row-data-source-server/use-server-data-source.js +688 -675
- package/dist/row-data-source-server/utils/get-node-depth.js +7 -7
- package/dist/row-data-source-server/utils/get-node-path.js +7 -7
- package/dist/row-data-source-server/utils/get-request-id.js +3 -4
- package/dist/rows/row/context.d.ts +2 -2
- package/dist/rows/row/row.d.ts +16 -3
- package/dist/rows/row/row.js +19 -4
- package/dist/rows/row/use-row-context-value.d.ts +5 -2
- package/dist/rows/row/use-row-context-value.js +23 -26
- package/dist/rows/row-detail-row.d.ts +4 -2
- package/dist/rows/row-detail-row.js +147 -124
- package/dist/rows/row-full-width.d.ts +12 -4
- package/dist/rows/row-full-width.js +35 -7
- package/dist/rows/rows-container.d.ts +10 -1
- package/dist/rows/rows-container.js +12 -3
- package/dist/rows/rows-sections.d.ts +30 -3
- package/dist/rows/rows-sections.js +42 -10
- package/dist/rows/scrollers/native-scroller.d.ts +3 -1
- package/dist/rows/scrollers/native-scroller.js +17 -13
- package/dist/sort-manager/+types.d.ts +14 -7
- package/dist/sort-manager/context.d.ts +4 -4
- package/dist/sort-manager/hooks/use-sort-manager.d.ts +9 -9
- package/dist/sort-manager/hooks/use-sort-manager.js +45 -49
- package/dist/sort-manager/hooks/use-sort-row-item.d.ts +57 -46
- package/dist/sort-manager/hooks/use-sort-row-item.js +126 -131
- package/dist/sort-manager/hooks/use-sortable-column-items.d.ts +6 -3
- package/dist/sort-manager/hooks/use-sortable-column-items.js +10 -10
- package/dist/sort-manager/root.d.ts +7 -1
- package/dist/sort-manager/root.js +10 -10
- package/dist/sort-manager/sort-add.d.ts +13 -5
- package/dist/sort-manager/sort-add.js +8 -8
- package/dist/sort-manager/sort-apply.d.ts +12 -4
- package/dist/sort-manager/sort-apply.js +16 -16
- package/dist/sort-manager/sort-cancel.d.ts +12 -4
- package/dist/sort-manager/sort-cancel.js +19 -19
- package/dist/sort-manager/sort-clear.d.ts +12 -4
- package/dist/sort-manager/sort-clear.js +15 -16
- package/dist/sort-manager/sort-column-select.d.ts +14 -6
- package/dist/sort-manager/sort-column-select.js +22 -14
- package/dist/sort-manager/sort-direction-select.d.ts +14 -6
- package/dist/sort-manager/sort-direction-select.js +27 -19
- package/dist/sort-manager/sort-manager.d.ts +93 -12
- package/dist/sort-manager/sort-manager.js +12 -12
- package/dist/sort-manager/sort-remove.d.ts +12 -4
- package/dist/sort-manager/sort-remove.js +8 -8
- package/dist/sort-manager/sort-row.d.ts +10 -2
- package/dist/sort-manager/sort-row.js +4 -1
- package/dist/sort-manager/sort-rows.d.ts +10 -1
- package/dist/sort-manager/sort-rows.js +1 -1
- package/dist/sort-manager/sort-value-select.d.ts +15 -7
- package/dist/sort-manager/sort-value-select.js +28 -19
- package/dist/sort-manager/utils/sort-item-to-sort-model.d.ts +4 -1
- package/dist/sort-manager/utils/sort-item-to-sort-model.js +46 -49
- package/dist/sort-manager/utils/sort-model-to-sort-items.d.ts +4 -1
- package/dist/sort-manager/utils/sort-model-to-sort-items.js +36 -44
- package/dist/state/+types.d.ts +43 -29
- package/dist/state/api/column-autosize.d.ts +4 -2
- package/dist/state/api/column-autosize.js +62 -63
- package/dist/state/api/column-by-id.js +4 -4
- package/dist/state/api/column-field.js +17 -20
- package/dist/state/api/column-from-index.js +4 -4
- package/dist/state/api/column-group-toggle.js +8 -8
- package/dist/state/api/column-index.js +5 -5
- package/dist/state/api/column-move.js +48 -46
- package/dist/state/api/column-resize.js +9 -7
- package/dist/state/api/column-update.d.ts +4 -2
- package/dist/state/api/column-update.js +23 -23
- package/dist/state/api/dialog-frame.d.ts +8 -4
- package/dist/state/api/dialog-frame.js +11 -12
- package/dist/state/api/edit-begin.d.ts +4 -2
- package/dist/state/api/edit-begin.js +71 -84
- package/dist/state/api/edit-end.d.ts +4 -2
- package/dist/state/api/edit-end.js +38 -41
- package/dist/state/api/edit-is-cell-active.d.ts +4 -2
- package/dist/state/api/edit-is-cell-active.js +17 -24
- package/dist/state/api/edit-update.d.ts +4 -2
- package/dist/state/api/edit-update.js +74 -85
- package/dist/state/api/event-listeners.d.ts +12 -3
- package/dist/state/api/event-listeners.js +16 -17
- package/dist/state/api/export-csv.js +33 -35
- package/dist/state/api/export-data-rect.js +21 -21
- package/dist/state/api/focus-cell.d.ts +4 -2
- package/dist/state/api/focus-cell.js +110 -109
- package/dist/state/api/popover-frame.d.ts +8 -4
- package/dist/state/api/popover-frame.js +11 -12
- package/dist/state/api/position-from-element.js +5 -6
- package/dist/state/api/row-by-id.js +3 -3
- package/dist/state/api/row-by-index.js +11 -6
- package/dist/state/api/row-detail-is-expanded.d.ts +3 -1
- package/dist/state/api/row-detail-is-expanded.js +4 -4
- package/dist/state/api/row-detail-rendered-height.d.ts +4 -2
- package/dist/state/api/row-detail-rendered-height.js +10 -12
- package/dist/state/api/row-detail-toggle.js +26 -30
- package/dist/state/api/row-group-apply-expansions.d.ts +3 -1
- package/dist/state/api/row-group-apply-expansions.js +15 -17
- package/dist/state/api/row-group-column-index.d.ts +3 -1
- package/dist/state/api/row-group-column-index.js +14 -12
- package/dist/state/api/row-group-is-expanded.d.ts +3 -1
- package/dist/state/api/row-group-is-expanded.js +11 -13
- package/dist/state/api/row-group-toggle.js +5 -5
- package/dist/state/api/row-handle-select.d.ts +4 -2
- package/dist/state/api/row-handle-select.js +36 -40
- package/dist/state/api/row-select-all.js +14 -15
- package/dist/state/api/row-select.d.ts +4 -2
- package/dist/state/api/row-select.js +30 -33
- package/dist/state/api/row-selected.js +10 -11
- package/dist/state/api/scroll-into-view.d.ts +4 -2
- package/dist/state/api/scroll-into-view.js +47 -47
- package/dist/state/api/sort-for-column.js +6 -7
- package/dist/state/api/use-row-drag.js +22 -24
- package/dist/state/helpers/cell-row-group.d.ts +5 -1
- package/dist/state/helpers/cell-row-group.js +18 -16
- package/dist/state/helpers/column-add-row-group.d.ts +18 -7
- package/dist/state/helpers/column-add-row-group.js +71 -66
- package/dist/state/helpers/column-layout.d.ts +7 -1
- package/dist/state/helpers/column-layout.js +60 -60
- package/dist/state/helpers/column-marker.d.ts +8 -4
- package/dist/state/helpers/column-marker.js +38 -34
- package/dist/state/helpers/column-view.d.ts +21 -15
- package/dist/state/helpers/column-view.js +56 -32
- package/dist/state/helpers/edit-on-change.d.ts +18 -10
- package/dist/state/helpers/edit-on-change.js +25 -25
- package/dist/state/helpers/empty-row-data-source.js +16 -16
- package/dist/state/helpers/get-data-rect.d.ts +20 -10
- package/dist/state/helpers/get-data-rect.js +67 -62
- package/dist/state/helpers/get-full-width-callback.d.ts +5 -1
- package/dist/state/helpers/get-full-width-callback.js +5 -6
- package/dist/state/helpers/get-span-callback.d.ts +6 -1
- package/dist/state/helpers/get-span-callback.js +15 -18
- package/dist/state/helpers/resolve-column.d.ts +6 -2
- package/dist/state/helpers/resolve-column.js +23 -23
- package/dist/state/helpers/row-layout/get-focus-criteria.d.ts +15 -12
- package/dist/state/helpers/row-layout/get-focus-criteria.js +57 -56
- package/dist/state/helpers/row-layout/row-layout.d.ts +15 -9
- package/dist/state/helpers/row-layout/row-layout.js +387 -401
- package/dist/state/use-lytenyte.js +567 -528
- package/dist/tree-view/branch/branch.d.ts +19 -11
- package/dist/tree-view/branch/branch.js +106 -54
- package/dist/tree-view/branch/use-branch-keys.d.ts +5 -1
- package/dist/tree-view/branch/use-branch-keys.js +71 -74
- package/dist/tree-view/context.d.ts +21 -17
- package/dist/tree-view/hooks/use-tree-view-paths.d.ts +7 -1
- package/dist/tree-view/hooks/use-tree-view-paths.js +5 -5
- package/dist/tree-view/index.d.ts +35 -7
- package/dist/tree-view/index.js +7 -7
- package/dist/tree-view/leaf.d.ts +10 -2
- package/dist/tree-view/leaf.js +30 -21
- package/dist/tree-view/navigation/get-all-ids.js +3 -3
- package/dist/tree-view/navigation/get-first-node.js +3 -3
- package/dist/tree-view/navigation/get-last-node.js +3 -3
- package/dist/tree-view/navigation/get-next-node.js +6 -8
- package/dist/tree-view/navigation/get-prev-node.js +6 -8
- package/dist/tree-view/panel/make-handle-navigation.js +23 -31
- package/dist/tree-view/panel/make-handle-selection.js +68 -77
- package/dist/tree-view/panel/make-handle-typeahead.js +34 -40
- package/dist/tree-view/panel/panel.d.ts +10 -1
- package/dist/tree-view/panel/panel.js +40 -20
- package/dist/tree-view/panel/use-tree-navigation.js +64 -52
- package/dist/tree-view/root.d.ts +20 -14
- package/dist/tree-view/root.js +53 -55
- package/dist/tree-view/utils/get-focusable-nodes.js +4 -2
- package/dist/tree-view/utils/get-focused-node.js +11 -11
- package/dist/tree-view/utils/get-ids-between-nodes.d.ts +5 -1
- package/dist/tree-view/utils/get-ids-between-nodes.js +10 -11
- package/dist/tree-view/utils/get-panel.js +5 -5
- package/dist/tree-view/utils/get-parent-node.js +6 -7
- package/dist/tree-view/utils/get-sibling-branches.js +8 -10
- package/dist/tree-view/utils/get-tree-node-id.js +1 -1
- package/dist/tree-view/utils/is-branch-node.js +1 -1
- package/dist/tree-view/utils/is-leaf-node.js +1 -1
- package/dist/tree-view/utils/is-tree-node-disabled.js +1 -1
- package/dist/tree-view/utils/select-node.d.ts +5 -1
- package/dist/tree-view/utils/select-node.js +8 -11
- package/dist/tree-view/utils/toggle-all-selections.js +4 -6
- package/dist/tree-view/utils/toggle-selection.js +15 -18
- package/dist/tree-view/virtualized/force-sync-scrolling.d.ts +3 -1
- package/dist/tree-view/virtualized/force-sync-scrolling.js +24 -18
- package/dist/tree-view/virtualized/get-virtual-tree-paths.d.ts +3 -1
- package/dist/tree-view/virtualized/get-virtual-tree-paths.js +11 -12
- package/dist/tree-view/virtualized/make-virtual-tree.d.ts +26 -21
- package/dist/tree-view/virtualized/make-virtual-tree.js +79 -85
- package/dist/tree-view/virtualized/use-flattened-tree.d.ts +17 -8
- package/dist/tree-view/virtualized/use-flattened-tree.js +30 -31
- package/dist/tree-view/virtualized/use-row-start-and-end.d.ts +6 -1
- package/dist/tree-view/virtualized/use-row-start-and-end.js +21 -23
- package/dist/tree-view/virtualized/use-virtualized-tree.d.ts +21 -15
- package/dist/tree-view/virtualized/use-virtualized-tree.js +103 -90
- package/dist/utils/cycle-sorts.js +12 -14
- package/dist/viewport/begin-editing.d.ts +6 -2
- package/dist/viewport/begin-editing.js +9 -13
- package/dist/viewport/viewport.d.ts +10 -1
- package/dist/viewport/viewport.js +93 -70
- package/package.json +7 -7
|
@@ -2,144 +2,139 @@ import { useMemo } from "react";
|
|
|
2
2
|
import { useSortableColumnItems } from "./use-sortable-column-items.js";
|
|
3
3
|
import { itemsWithIdToMap } from "@1771technologies/lytenyte-js-utils";
|
|
4
4
|
export function useSortRowItems(sortItems, setSortItems, grid, pivotMode) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
const columnSelected = columnItem;
|
|
32
|
-
const column = lookup.get(item.columnId);
|
|
33
|
-
let sortOptions;
|
|
34
|
-
if (!column)
|
|
35
|
-
sortOptions = [];
|
|
36
|
-
else if (column?.type === "number")
|
|
37
|
-
sortOptions = sortValuesForNumber;
|
|
38
|
-
else if (column?.type === "date")
|
|
39
|
-
sortOptions = sortValuesForDateAndDateTime;
|
|
40
|
-
else
|
|
41
|
-
sortOptions = sortValuesString;
|
|
42
|
-
const sortSelected = sortOptions.find((v) => v.value === item.sortOn) ?? null;
|
|
43
|
-
const sortOnSelect = (sortOn) => {
|
|
44
|
-
if (!sortOn)
|
|
45
|
-
return;
|
|
46
|
-
setSortItems((prev) => {
|
|
47
|
-
const v = { ...prev[i] };
|
|
48
|
-
v.sortOn = sortOn.value;
|
|
49
|
-
const next = [...prev];
|
|
50
|
-
next.splice(i, 1, v);
|
|
51
|
-
return next;
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
const sortDirectionOptions = sortDirectionValues;
|
|
55
|
-
const sortDirectionSelected = item.sortDirection === "ascending"
|
|
56
|
-
? { label: "Asc", value: "ascending" }
|
|
57
|
-
: { label: "Desc", value: "descending" };
|
|
58
|
-
const sortDirectionOnSelect = (item) => {
|
|
59
|
-
if (!item)
|
|
60
|
-
return;
|
|
61
|
-
setSortItems((prev) => {
|
|
62
|
-
const v = { ...prev[i] };
|
|
63
|
-
v.sortDirection = item.value;
|
|
64
|
-
const next = [...prev];
|
|
65
|
-
next.splice(i, 1, v);
|
|
66
|
-
return next;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
const onDelete = () => {
|
|
70
|
-
setSortItems((prev) => {
|
|
71
|
-
const next = [...prev];
|
|
72
|
-
next.splice(i, 1);
|
|
73
|
-
if (!next.length) {
|
|
74
|
-
return [{ sortDirection: "ascending", isCustom: false }];
|
|
75
|
-
}
|
|
76
|
-
return next;
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const onAdd = () => {
|
|
80
|
-
setSortItems((prev) => {
|
|
81
|
-
const next = [...prev];
|
|
82
|
-
next.splice(i + 1, 0, { sortDirection: "ascending", isCustom: false });
|
|
83
|
-
return next;
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
const maxSortCount = columnItems.length;
|
|
87
|
-
return {
|
|
88
|
-
index: i,
|
|
89
|
-
isCustom: item.isCustom,
|
|
90
|
-
columnItem,
|
|
91
|
-
columnOptions,
|
|
92
|
-
columnSelected,
|
|
93
|
-
columnOnSelect,
|
|
94
|
-
sortOptions,
|
|
95
|
-
sortSelected,
|
|
96
|
-
sortOnSelect,
|
|
97
|
-
sortDirectionOptions,
|
|
98
|
-
sortDirectionSelected,
|
|
99
|
-
sortDirectionOnSelect,
|
|
100
|
-
canAdd: maxSortCount > sortItems.length,
|
|
101
|
-
onAdd,
|
|
102
|
-
onDelete,
|
|
103
|
-
};
|
|
5
|
+
const columnItems = useSortableColumnItems(grid, pivotMode);
|
|
6
|
+
const pivotColumns = grid.state.columnPivotColumns.useValue();
|
|
7
|
+
const columns = grid.state.columns.useValue();
|
|
8
|
+
const lookup = useMemo(() => {
|
|
9
|
+
return itemsWithIdToMap(pivotMode ? pivotColumns : columns);
|
|
10
|
+
}, [columns, pivotColumns, pivotMode]);
|
|
11
|
+
const unselectedSortedColumns = useMemo(() => {
|
|
12
|
+
const selected = new Set(sortItems.map((c) => c.columnId).filter((c) => c != null));
|
|
13
|
+
return columnItems.filter((c) => !selected.has(c.value));
|
|
14
|
+
}, [columnItems, sortItems]);
|
|
15
|
+
const sortRows = useMemo(() => {
|
|
16
|
+
return sortItems.map((item, i) => {
|
|
17
|
+
const columnItem = columnItems.find((s) => item.columnId === s.value) ?? null;
|
|
18
|
+
const columnOptions = columnItem
|
|
19
|
+
? [columnItem, ...unselectedSortedColumns]
|
|
20
|
+
: unselectedSortedColumns;
|
|
21
|
+
// Handle select
|
|
22
|
+
const columnOnSelect = (column) => {
|
|
23
|
+
setSortItems((prev) => {
|
|
24
|
+
const v = { ...prev[i] };
|
|
25
|
+
v.columnId = column?.value;
|
|
26
|
+
const next = [...prev];
|
|
27
|
+
next.splice(i, 1, v);
|
|
28
|
+
return next;
|
|
104
29
|
});
|
|
105
|
-
|
|
106
|
-
|
|
30
|
+
};
|
|
31
|
+
const columnSelected = columnItem;
|
|
32
|
+
const column = lookup.get(item.columnId);
|
|
33
|
+
let sortOptions;
|
|
34
|
+
if (!column) sortOptions = [];
|
|
35
|
+
else if (column?.type === "number") sortOptions = sortValuesForNumber;
|
|
36
|
+
else if (column?.type === "date") sortOptions = sortValuesForDateAndDateTime;
|
|
37
|
+
else sortOptions = sortValuesString;
|
|
38
|
+
const sortSelected = sortOptions.find((v) => v.value === item.sortOn) ?? null;
|
|
39
|
+
const sortOnSelect = (sortOn) => {
|
|
40
|
+
if (!sortOn) return;
|
|
41
|
+
setSortItems((prev) => {
|
|
42
|
+
const v = { ...prev[i] };
|
|
43
|
+
v.sortOn = sortOn.value;
|
|
44
|
+
const next = [...prev];
|
|
45
|
+
next.splice(i, 1, v);
|
|
46
|
+
return next;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const sortDirectionOptions = sortDirectionValues;
|
|
50
|
+
const sortDirectionSelected =
|
|
51
|
+
item.sortDirection === "ascending"
|
|
52
|
+
? { label: "Asc", value: "ascending" }
|
|
53
|
+
: { label: "Desc", value: "descending" };
|
|
54
|
+
const sortDirectionOnSelect = (item) => {
|
|
55
|
+
if (!item) return;
|
|
56
|
+
setSortItems((prev) => {
|
|
57
|
+
const v = { ...prev[i] };
|
|
58
|
+
v.sortDirection = item.value;
|
|
59
|
+
const next = [...prev];
|
|
60
|
+
next.splice(i, 1, v);
|
|
61
|
+
return next;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const onDelete = () => {
|
|
65
|
+
setSortItems((prev) => {
|
|
66
|
+
const next = [...prev];
|
|
67
|
+
next.splice(i, 1);
|
|
68
|
+
if (!next.length) {
|
|
69
|
+
return [{ sortDirection: "ascending", isCustom: false }];
|
|
70
|
+
}
|
|
71
|
+
return next;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const onAdd = () => {
|
|
75
|
+
setSortItems((prev) => {
|
|
76
|
+
const next = [...prev];
|
|
77
|
+
next.splice(i + 1, 0, { sortDirection: "ascending", isCustom: false });
|
|
78
|
+
return next;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const maxSortCount = columnItems.length;
|
|
82
|
+
return {
|
|
83
|
+
index: i,
|
|
84
|
+
isCustom: item.isCustom,
|
|
85
|
+
columnItem,
|
|
86
|
+
columnOptions,
|
|
87
|
+
columnSelected,
|
|
88
|
+
columnOnSelect,
|
|
89
|
+
sortOptions,
|
|
90
|
+
sortSelected,
|
|
91
|
+
sortOnSelect,
|
|
92
|
+
sortDirectionOptions,
|
|
93
|
+
sortDirectionSelected,
|
|
94
|
+
sortDirectionOnSelect,
|
|
95
|
+
canAdd: maxSortCount > sortItems.length,
|
|
96
|
+
onAdd,
|
|
97
|
+
onDelete,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
}, [columnItems, lookup, setSortItems, sortItems, unselectedSortedColumns]);
|
|
101
|
+
return sortRows;
|
|
107
102
|
}
|
|
108
103
|
const sortValuesForNumber = [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
{ label: "Values", value: "values" },
|
|
105
|
+
{ label: "Absolute", value: "values_absolute" },
|
|
106
|
+
{ label: "Nulls First", value: "values_nulls_first" },
|
|
107
|
+
{ label: "Nulls First, Absolute", value: "values_nulls_first_absolute" },
|
|
113
108
|
];
|
|
114
109
|
const sortValuesForDateAndDateTime = [
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
{ label: "Values", value: "values" },
|
|
111
|
+
{ label: "Nulls First", value: "values_nulls_first" },
|
|
117
112
|
];
|
|
118
113
|
const sortValuesString = [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
114
|
+
{ label: "Values", value: "values" },
|
|
115
|
+
{ label: "Insensitive", value: "values_insensitive" },
|
|
116
|
+
{ label: "Insensitive, Ignore Punctuation", value: "value_insensitive_ignore" },
|
|
117
|
+
{ label: "Insensitive, Trim", value: "value_insensitive_trim" },
|
|
118
|
+
{ label: "Insensitive, Ignore Punctuation, Trim", value: "value_insensitive_ignore_trim" },
|
|
119
|
+
{ label: "Ignore Punctuation", value: "values_ignore_punctuation" },
|
|
120
|
+
{ label: "Ignore Punctuation, Trim", value: "values_ignore_punctuation_trim" },
|
|
121
|
+
{ label: "Trim Whitespace", value: "values_trim" },
|
|
122
|
+
{ label: "Nulls First", value: "values_nulls_first" },
|
|
123
|
+
{ label: "Nulls First, Insensitive", value: "values_nulls_first_insensitive" },
|
|
124
|
+
{ label: "Nulls First, Trim", value: "values_nulls_first_trim" },
|
|
125
|
+
{ label: "Nulls First, Ignore Punctuation", value: "values_nulls_first_ignore" },
|
|
126
|
+
{ label: "Nulls First, Insensitive, Trim", value: "values_nulls_first_insensitive_trim" },
|
|
127
|
+
{
|
|
128
|
+
label: "Nulls First, Insensitive, Ignore Punctuation",
|
|
129
|
+
value: "values_nulls_insensitive_first_ignore",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: "Nulls First, Insensitive, Ignore Punctuation, Trim",
|
|
133
|
+
value: "values_nulls_first_insensitive_ignore_trim",
|
|
134
|
+
},
|
|
135
|
+
{ label: "Nulls First, Ignore Punctuation, Trim", value: "values_nulls_first_ignore_trim" },
|
|
141
136
|
];
|
|
142
137
|
const sortDirectionValues = [
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
{ label: "Asc", value: "ascending" },
|
|
139
|
+
{ label: "Desc", value: "descending" },
|
|
145
140
|
];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Grid } from "../../+types";
|
|
2
|
-
export declare function useSortableColumnItems(
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare function useSortableColumnItems(
|
|
3
|
+
grid: Grid<any>,
|
|
4
|
+
pivotMode: boolean,
|
|
5
|
+
): {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
5
8
|
}[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
export function useSortableColumnItems(grid, pivotMode) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
const columns = grid.state.columns.useValue();
|
|
4
|
+
const pivotColumns = grid.state.columnPivotColumns.useValue();
|
|
5
|
+
const base = grid.state.columnBase.useValue();
|
|
6
|
+
const candidateColumns = useMemo(() => {
|
|
7
|
+
const candidates = pivotMode ? pivotColumns : columns;
|
|
8
|
+
return candidates.filter((c) => c.uiHints?.sortable ?? base.uiHints?.sortable);
|
|
9
|
+
}, [base.uiHints?.sortable, columns, pivotColumns, pivotMode]);
|
|
10
|
+
return useMemo(() => {
|
|
11
|
+
return candidateColumns.map((c) => ({ label: c.name ?? c.id, value: c.id }));
|
|
12
|
+
}, [candidateColumns]);
|
|
13
13
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { type PropsWithChildren } from "react";
|
|
2
2
|
import { type SortManagerContext } from "./context";
|
|
3
|
-
export declare function Root({
|
|
3
|
+
export declare function Root({
|
|
4
|
+
sortItems,
|
|
5
|
+
setSortItems,
|
|
6
|
+
grid,
|
|
7
|
+
mode,
|
|
8
|
+
children,
|
|
9
|
+
}: PropsWithChildren<SortManagerContext>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { context } from "./context";
|
|
4
|
-
export function Root({ sortItems, setSortItems, grid, mode, children
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
export function Root({ sortItems, setSortItems, grid, mode, children }) {
|
|
5
|
+
const value = useMemo(() => {
|
|
6
|
+
return {
|
|
7
|
+
sortItems,
|
|
8
|
+
setSortItems,
|
|
9
|
+
grid,
|
|
10
|
+
mode,
|
|
11
|
+
};
|
|
12
|
+
}, [grid, mode, setSortItems, sortItems]);
|
|
13
|
+
return _jsx(context.Provider, { value: value, children: children });
|
|
14
14
|
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
|
|
2
2
|
export interface SortAddProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
readonly as?: SlotComponent<{
|
|
4
|
+
onAdd: () => void;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
}>;
|
|
7
7
|
}
|
|
8
|
-
export declare const SortAdd: import("react").ForwardRefExoticComponent<
|
|
8
|
+
export declare const SortAdd: import("react").ForwardRefExoticComponent<
|
|
9
|
+
Omit<
|
|
10
|
+
import("react").ClassAttributes<HTMLButtonElement> &
|
|
11
|
+
import("react").ButtonHTMLAttributes<HTMLButtonElement> &
|
|
12
|
+
SortAddProps,
|
|
13
|
+
"ref"
|
|
14
|
+
> &
|
|
15
|
+
import("react").RefAttributes<HTMLDivElement>
|
|
16
|
+
>;
|
|
@@ -3,12 +3,12 @@ import { useSlot } from "@1771technologies/lytenyte-react-hooks";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useSortRowCtx } from "./context";
|
|
5
5
|
export const SortAdd = forwardRef(function SortAdd({ as: as, ...props }, forwarded) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const row = useSortRowCtx();
|
|
7
|
+
const renderer = useSlot({
|
|
8
|
+
props: [typeof as !== "function" ? { onClick: row.onAdd, disabled: !row.canAdd } : {}, props],
|
|
9
|
+
ref: forwarded,
|
|
10
|
+
slot: as ?? _jsx("button", { children: "+" }),
|
|
11
|
+
state: { onAdd: row.onAdd, disabled: !row.canAdd },
|
|
12
|
+
});
|
|
13
|
+
return renderer;
|
|
14
14
|
});
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
|
|
2
2
|
export interface SortApplyProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
readonly as?: SlotComponent<{
|
|
4
|
+
onApply: () => void;
|
|
5
|
+
}>;
|
|
6
6
|
}
|
|
7
|
-
export declare const SortApply: import("react").ForwardRefExoticComponent<
|
|
7
|
+
export declare const SortApply: import("react").ForwardRefExoticComponent<
|
|
8
|
+
Omit<
|
|
9
|
+
import("react").ClassAttributes<HTMLButtonElement> &
|
|
10
|
+
import("react").ButtonHTMLAttributes<HTMLButtonElement> &
|
|
11
|
+
SortApplyProps,
|
|
12
|
+
"ref"
|
|
13
|
+
> &
|
|
14
|
+
import("react").RefAttributes<HTMLDivElement>
|
|
15
|
+
>;
|
|
@@ -5,20 +5,20 @@ import { useSortManagerCtx } from "./context";
|
|
|
5
5
|
import { itemsWithIdToMap } from "@1771technologies/lytenyte-js-utils";
|
|
6
6
|
import { sortItemsToSortModel } from "./utils/sort-item-to-sort-model";
|
|
7
7
|
export const SortApply = forwardRef(function SortApply({ as, ...props }, forwarded) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
const ctx = useSortManagerCtx();
|
|
9
|
+
const onApply = useEvent(() => {
|
|
10
|
+
const lookup = itemsWithIdToMap(
|
|
11
|
+
ctx.mode ? ctx.grid.state.columnPivotColumns.get() : ctx.grid.state.columns.get(),
|
|
12
|
+
);
|
|
13
|
+
const model = sortItemsToSortModel(ctx.sortItems, lookup);
|
|
14
|
+
if (ctx.mode) ctx.grid.state.columnPivotModel.set((prev) => ({ ...prev, sort: model }));
|
|
15
|
+
else ctx.grid.state.sortModel.set(model);
|
|
16
|
+
});
|
|
17
|
+
const renderer = useSlot({
|
|
18
|
+
props: [typeof as !== "function" ? { onClick: onApply } : {}, props],
|
|
19
|
+
ref: forwarded,
|
|
20
|
+
slot: as ?? _jsx("button", {}),
|
|
21
|
+
state: { onApply },
|
|
22
|
+
});
|
|
23
|
+
return renderer;
|
|
24
24
|
});
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
|
|
2
2
|
export interface SortCancelProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
readonly as?: SlotComponent<{
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
}>;
|
|
6
6
|
}
|
|
7
|
-
export declare const SortCancel: import("react").ForwardRefExoticComponent<
|
|
7
|
+
export declare const SortCancel: import("react").ForwardRefExoticComponent<
|
|
8
|
+
Omit<
|
|
9
|
+
import("react").ClassAttributes<HTMLButtonElement> &
|
|
10
|
+
import("react").ButtonHTMLAttributes<HTMLButtonElement> &
|
|
11
|
+
SortCancelProps,
|
|
12
|
+
"ref"
|
|
13
|
+
> &
|
|
14
|
+
import("react").RefAttributes<HTMLDivElement>
|
|
15
|
+
>;
|
|
@@ -5,23 +5,23 @@ import { useSortManagerCtx } from "./context";
|
|
|
5
5
|
import { sortModelToSortItems } from "./utils/sort-model-to-sort-items";
|
|
6
6
|
import { itemsWithIdToMap } from "@1771technologies/lytenyte-js-utils";
|
|
7
7
|
export const SortCancel = forwardRef(function SortCancel({ as, ...props }, forwarded) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
const ctx = useSortManagerCtx();
|
|
9
|
+
const onCancel = useEvent(() => {
|
|
10
|
+
const model = ctx.mode
|
|
11
|
+
? ctx.grid.state.columnPivotModel.get().sorts
|
|
12
|
+
: ctx.grid.state.sortModel.get();
|
|
13
|
+
const lookup = itemsWithIdToMap(
|
|
14
|
+
ctx.mode ? ctx.grid.state.columnPivotColumns.get() : ctx.grid.state.columns.get(),
|
|
15
|
+
);
|
|
16
|
+
const state = sortModelToSortItems(model, lookup);
|
|
17
|
+
if (!state.length) ctx.setSortItems([{ isCustom: false, sortDirection: "ascending" }]);
|
|
18
|
+
else ctx.setSortItems(state);
|
|
19
|
+
});
|
|
20
|
+
const renderer = useSlot({
|
|
21
|
+
props: [typeof as !== "function" ? { onClick: onCancel } : {}, props],
|
|
22
|
+
ref: forwarded,
|
|
23
|
+
slot: as ?? _jsx("button", {}),
|
|
24
|
+
state: { onCancel },
|
|
25
|
+
});
|
|
26
|
+
return renderer;
|
|
27
27
|
});
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
|
|
2
2
|
export interface SortClearProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
readonly as?: SlotComponent<{
|
|
4
|
+
onClear: () => void;
|
|
5
|
+
}>;
|
|
6
6
|
}
|
|
7
|
-
export declare const SortClear: import("react").ForwardRefExoticComponent<
|
|
7
|
+
export declare const SortClear: import("react").ForwardRefExoticComponent<
|
|
8
|
+
Omit<
|
|
9
|
+
import("react").ClassAttributes<HTMLButtonElement> &
|
|
10
|
+
import("react").ButtonHTMLAttributes<HTMLButtonElement> &
|
|
11
|
+
SortClearProps,
|
|
12
|
+
"ref"
|
|
13
|
+
> &
|
|
14
|
+
import("react").RefAttributes<HTMLDivElement>
|
|
15
|
+
>;
|
|
@@ -3,20 +3,19 @@ import { useEvent, useSlot } from "@1771technologies/lytenyte-react-hooks";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useSortManagerCtx } from "./context";
|
|
5
5
|
export const SortClear = forwardRef(function SortClear({ as, ...props }, forwarded) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return renderer;
|
|
6
|
+
const ctx = useSortManagerCtx();
|
|
7
|
+
const onClear = useEvent(() => {
|
|
8
|
+
if (ctx.mode) {
|
|
9
|
+
ctx.grid.state.columnPivotModel.set((prev) => ({ ...prev, sorts: [] }));
|
|
10
|
+
} else {
|
|
11
|
+
ctx.grid.state.sortModel.set([]);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const renderer = useSlot({
|
|
15
|
+
props: [typeof as !== "function" ? { onClick: onClear } : {}, props],
|
|
16
|
+
ref: forwarded,
|
|
17
|
+
slot: as ?? _jsx("button", {}),
|
|
18
|
+
state: { onClear },
|
|
19
|
+
});
|
|
20
|
+
return renderer;
|
|
22
21
|
});
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { type SlotComponent } from "@1771technologies/lytenyte-react-hooks";
|
|
2
2
|
import type { Option } from "./+types";
|
|
3
3
|
export interface SortColumnSelectProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
readonly as?: SlotComponent<{
|
|
5
|
+
options: Option[];
|
|
6
|
+
onSelect: (v: Option | null) => void;
|
|
7
|
+
value: Option | null;
|
|
8
|
+
}>;
|
|
9
9
|
}
|
|
10
|
-
export declare const SortColumnSelect: import("react").ForwardRefExoticComponent<
|
|
10
|
+
export declare const SortColumnSelect: import("react").ForwardRefExoticComponent<
|
|
11
|
+
Omit<
|
|
12
|
+
import("react").ClassAttributes<HTMLDivElement> &
|
|
13
|
+
import("react").HTMLAttributes<HTMLDivElement> &
|
|
14
|
+
SortColumnSelectProps,
|
|
15
|
+
"ref"
|
|
16
|
+
> &
|
|
17
|
+
import("react").RefAttributes<HTMLSelectElement>
|
|
18
|
+
>;
|
|
@@ -3,18 +3,26 @@ import { useSlot } from "@1771technologies/lytenyte-react-hooks";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useSortRowCtx } from "./context";
|
|
5
5
|
export const SortColumnSelect = forwardRef(function SortColumnSelect({ as, ...props }, forwarded) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
const row = useSortRowCtx();
|
|
7
|
+
const el = _jsxs("select", {
|
|
8
|
+
"aria-label": "Select column to sort",
|
|
9
|
+
value: row.columnItem?.value ?? "",
|
|
10
|
+
onChange: (e) => {
|
|
11
|
+
const item = row.columnOptions.find((c) => c.value === e.target.value);
|
|
12
|
+
row.columnOnSelect(item ?? null);
|
|
13
|
+
},
|
|
14
|
+
children: [
|
|
15
|
+
_jsx("option", { value: "", children: "Select..." }),
|
|
16
|
+
row.columnOptions.map((c) => {
|
|
17
|
+
return _jsx("option", { value: c.value, children: c.label }, c.value);
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
const renderer = useSlot({
|
|
22
|
+
props: [props],
|
|
23
|
+
ref: forwarded,
|
|
24
|
+
slot: as ?? el,
|
|
25
|
+
state: { options: row.columnOptions, onSelect: row.columnOnSelect, value: row.columnSelected },
|
|
26
|
+
});
|
|
27
|
+
return renderer;
|
|
20
28
|
});
|