@nu-grid/nuxt 0.1.1
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/LICENSE.md +21 -0
- package/README.md +261 -0
- package/dist/module.d.mts +13 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +52 -0
- package/dist/runtime/cell-types/action-menu/ActionMenuRenderer.d.vue.ts +12 -0
- package/dist/runtime/cell-types/action-menu/ActionMenuRenderer.vue +123 -0
- package/dist/runtime/cell-types/action-menu/ActionMenuRenderer.vue.d.ts +12 -0
- package/dist/runtime/cell-types/action-menu/index.d.ts +8 -0
- package/dist/runtime/cell-types/action-menu/index.js +28 -0
- package/dist/runtime/cell-types/boolean/BooleanEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/boolean/BooleanEditor.vue +32 -0
- package/dist/runtime/cell-types/boolean/BooleanEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/boolean/BooleanFilter.d.vue.ts +7 -0
- package/dist/runtime/cell-types/boolean/BooleanFilter.vue +42 -0
- package/dist/runtime/cell-types/boolean/BooleanFilter.vue.d.ts +7 -0
- package/dist/runtime/cell-types/boolean/BooleanRenderer.d.vue.ts +13 -0
- package/dist/runtime/cell-types/boolean/BooleanRenderer.vue +23 -0
- package/dist/runtime/cell-types/boolean/BooleanRenderer.vue.d.ts +13 -0
- package/dist/runtime/cell-types/boolean/index.d.ts +8 -0
- package/dist/runtime/cell-types/boolean/index.js +31 -0
- package/dist/runtime/cell-types/currency/CurrencyEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/currency/CurrencyEditor.vue +40 -0
- package/dist/runtime/cell-types/currency/CurrencyEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/currency/CurrencyFilter.d.vue.ts +7 -0
- package/dist/runtime/cell-types/currency/CurrencyFilter.vue +76 -0
- package/dist/runtime/cell-types/currency/CurrencyFilter.vue.d.ts +7 -0
- package/dist/runtime/cell-types/currency/index.d.ts +6 -0
- package/dist/runtime/cell-types/currency/index.js +42 -0
- package/dist/runtime/cell-types/date/DateEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/date/DateEditor.vue +42 -0
- package/dist/runtime/cell-types/date/DateEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/date/DateFilter.d.vue.ts +7 -0
- package/dist/runtime/cell-types/date/DateFilter.vue +58 -0
- package/dist/runtime/cell-types/date/DateFilter.vue.d.ts +7 -0
- package/dist/runtime/cell-types/date/index.d.ts +6 -0
- package/dist/runtime/cell-types/date/index.js +13 -0
- package/dist/runtime/cell-types/index.d.ts +17 -0
- package/dist/runtime/cell-types/index.js +34 -0
- package/dist/runtime/cell-types/lookup/LookupEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/lookup/LookupEditor.vue +291 -0
- package/dist/runtime/cell-types/lookup/LookupEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/lookup/LookupRenderer.d.vue.ts +8 -0
- package/dist/runtime/cell-types/lookup/LookupRenderer.vue +43 -0
- package/dist/runtime/cell-types/lookup/LookupRenderer.vue.d.ts +8 -0
- package/dist/runtime/cell-types/lookup/index.d.ts +36 -0
- package/dist/runtime/cell-types/lookup/index.js +50 -0
- package/dist/runtime/cell-types/number/NumberEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/number/NumberEditor.vue +34 -0
- package/dist/runtime/cell-types/number/NumberEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/number/NumberFilter.d.vue.ts +7 -0
- package/dist/runtime/cell-types/number/NumberFilter.vue +66 -0
- package/dist/runtime/cell-types/number/NumberFilter.vue.d.ts +7 -0
- package/dist/runtime/cell-types/number/index.d.ts +6 -0
- package/dist/runtime/cell-types/number/index.js +13 -0
- package/dist/runtime/cell-types/rating/RatingEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/rating/RatingEditor.vue +219 -0
- package/dist/runtime/cell-types/rating/RatingEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/rating/RatingFilter.d.vue.ts +7 -0
- package/dist/runtime/cell-types/rating/RatingFilter.vue +74 -0
- package/dist/runtime/cell-types/rating/RatingFilter.vue.d.ts +7 -0
- package/dist/runtime/cell-types/rating/RatingRenderer.d.vue.ts +10 -0
- package/dist/runtime/cell-types/rating/RatingRenderer.vue +75 -0
- package/dist/runtime/cell-types/rating/RatingRenderer.vue.d.ts +10 -0
- package/dist/runtime/cell-types/rating/index.d.ts +6 -0
- package/dist/runtime/cell-types/rating/index.js +67 -0
- package/dist/runtime/cell-types/selection/SelectionEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/selection/SelectionEditor.vue +42 -0
- package/dist/runtime/cell-types/selection/SelectionEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/selection/SelectionRenderer.d.vue.ts +14 -0
- package/dist/runtime/cell-types/selection/SelectionRenderer.vue +25 -0
- package/dist/runtime/cell-types/selection/SelectionRenderer.vue.d.ts +14 -0
- package/dist/runtime/cell-types/selection/index.d.ts +8 -0
- package/dist/runtime/cell-types/selection/index.js +36 -0
- package/dist/runtime/cell-types/text/TextEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/text/TextEditor.vue +70 -0
- package/dist/runtime/cell-types/text/TextEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/text/TextFilter.d.vue.ts +7 -0
- package/dist/runtime/cell-types/text/TextFilter.vue +50 -0
- package/dist/runtime/cell-types/text/TextFilter.vue.d.ts +7 -0
- package/dist/runtime/cell-types/text/TextareaEditor.d.vue.ts +15 -0
- package/dist/runtime/cell-types/text/TextareaEditor.vue +100 -0
- package/dist/runtime/cell-types/text/TextareaEditor.vue.d.ts +15 -0
- package/dist/runtime/cell-types/text/index.d.ts +10 -0
- package/dist/runtime/cell-types/text/index.js +16 -0
- package/dist/runtime/cell-types/text/textarea.d.ts +13 -0
- package/dist/runtime/cell-types/text/textarea.js +13 -0
- package/dist/runtime/components/NuGrid.d.vue.ts +96 -0
- package/dist/runtime/components/NuGrid.vue +651 -0
- package/dist/runtime/components/NuGrid.vue.d.ts +96 -0
- package/dist/runtime/components/NuGridCellCheckbox.d.vue.ts +24 -0
- package/dist/runtime/components/NuGridCellCheckbox.vue +105 -0
- package/dist/runtime/components/NuGridCellCheckbox.vue.d.ts +24 -0
- package/dist/runtime/components/NuGridGroup.d.vue.ts +20 -0
- package/dist/runtime/components/NuGridGroup.vue +650 -0
- package/dist/runtime/components/NuGridGroup.vue.d.ts +20 -0
- package/dist/runtime/components/NuGridLazyCell.d.vue.ts +62 -0
- package/dist/runtime/components/NuGridLazyCell.vue +133 -0
- package/dist/runtime/components/NuGridLazyCell.vue.d.ts +62 -0
- package/dist/runtime/components/_internal/NuGridAddRow.d.vue.ts +36 -0
- package/dist/runtime/components/_internal/NuGridAddRow.vue +144 -0
- package/dist/runtime/components/_internal/NuGridAddRow.vue.d.ts +36 -0
- package/dist/runtime/components/_internal/NuGridBase.d.vue.ts +20 -0
- package/dist/runtime/components/_internal/NuGridBase.vue +1172 -0
- package/dist/runtime/components/_internal/NuGridBase.vue.d.ts +20 -0
- package/dist/runtime/components/_internal/NuGridCellContent.d.vue.ts +9 -0
- package/dist/runtime/components/_internal/NuGridCellContent.vue +202 -0
- package/dist/runtime/components/_internal/NuGridCellContent.vue.d.ts +9 -0
- package/dist/runtime/components/_internal/NuGridColumnMenu.d.vue.ts +25 -0
- package/dist/runtime/components/_internal/NuGridColumnMenu.vue +391 -0
- package/dist/runtime/components/_internal/NuGridColumnMenu.vue.d.ts +25 -0
- package/dist/runtime/components/_internal/NuGridGroup.d.vue.ts +20 -0
- package/dist/runtime/components/_internal/NuGridGroup.vue +650 -0
- package/dist/runtime/components/_internal/NuGridGroup.vue.d.ts +20 -0
- package/dist/runtime/components/_internal/NuGridGroupCheckbox.d.vue.ts +22 -0
- package/dist/runtime/components/_internal/NuGridGroupCheckbox.vue +132 -0
- package/dist/runtime/components/_internal/NuGridGroupCheckbox.vue.d.ts +22 -0
- package/dist/runtime/components/_internal/NuGridHeaderSortButton.d.vue.ts +31 -0
- package/dist/runtime/components/_internal/NuGridHeaderSortButton.vue +61 -0
- package/dist/runtime/components/_internal/NuGridHeaderSortButton.vue.d.ts +31 -0
- package/dist/runtime/components/_internal/NuGridPaging.d.vue.ts +3 -0
- package/dist/runtime/components/_internal/NuGridPaging.vue +65 -0
- package/dist/runtime/components/_internal/NuGridPaging.vue.d.ts +3 -0
- package/dist/runtime/components/_internal/NuGridRow.d.vue.ts +40 -0
- package/dist/runtime/components/_internal/NuGridRow.vue +645 -0
- package/dist/runtime/components/_internal/NuGridRow.vue.d.ts +40 -0
- package/dist/runtime/components/_internal/NuGridSplitGroup.d.vue.ts +20 -0
- package/dist/runtime/components/_internal/NuGridSplitGroup.vue +735 -0
- package/dist/runtime/components/_internal/NuGridSplitGroup.vue.d.ts +20 -0
- package/dist/runtime/components/_internal/NuGridTooltip.d.vue.ts +3 -0
- package/dist/runtime/components/_internal/NuGridTooltip.vue +36 -0
- package/dist/runtime/components/_internal/NuGridTooltip.vue.d.ts +3 -0
- package/dist/runtime/composables/_internal/index.d.ts +31 -0
- package/dist/runtime/composables/_internal/index.js +28 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/index.d.ts +5 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/index.js +9 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardCellTypeDispatch.d.ts +18 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardCellTypeDispatch.js +53 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardEditingTriggers.d.ts +12 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardEditingTriggers.js +53 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardNavigation.d.ts +9 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardNavigation.js +35 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardSetup.d.ts +33 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/useKeyboardSetup.js +111 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/usePagingKeyboard.d.ts +11 -0
- package/dist/runtime/composables/_internal/keyboard-handlers/usePagingKeyboard.js +67 -0
- package/dist/runtime/composables/_internal/useNuGridActionMenu.d.ts +15 -0
- package/dist/runtime/composables/_internal/useNuGridActionMenu.js +137 -0
- package/dist/runtime/composables/_internal/useNuGridAddRow.d.ts +39 -0
- package/dist/runtime/composables/_internal/useNuGridAddRow.js +735 -0
- package/dist/runtime/composables/_internal/useNuGridAnimation.d.ts +33 -0
- package/dist/runtime/composables/_internal/useNuGridAnimation.js +178 -0
- package/dist/runtime/composables/_internal/useNuGridAutosize.d.ts +14 -0
- package/dist/runtime/composables/_internal/useNuGridAutosize.js +161 -0
- package/dist/runtime/composables/_internal/useNuGridCellEditing.d.ts +15 -0
- package/dist/runtime/composables/_internal/useNuGridCellEditing.js +1243 -0
- package/dist/runtime/composables/_internal/useNuGridColumnDragDrop.d.ts +8 -0
- package/dist/runtime/composables/_internal/useNuGridColumnDragDrop.js +148 -0
- package/dist/runtime/composables/_internal/useNuGridColumnPinning.d.ts +15 -0
- package/dist/runtime/composables/_internal/useNuGridColumnPinning.js +44 -0
- package/dist/runtime/composables/_internal/useNuGridColumnResize.d.ts +22 -0
- package/dist/runtime/composables/_internal/useNuGridColumnResize.js +427 -0
- package/dist/runtime/composables/_internal/useNuGridCore.d.ts +62 -0
- package/dist/runtime/composables/_internal/useNuGridCore.js +359 -0
- package/dist/runtime/composables/_internal/useNuGridExcel.d.ts +60 -0
- package/dist/runtime/composables/_internal/useNuGridExcel.js +35 -0
- package/dist/runtime/composables/_internal/useNuGridFocus.d.ts +15 -0
- package/dist/runtime/composables/_internal/useNuGridFocus.js +1378 -0
- package/dist/runtime/composables/_internal/useNuGridGroupSelection.d.ts +13 -0
- package/dist/runtime/composables/_internal/useNuGridGroupSelection.js +38 -0
- package/dist/runtime/composables/_internal/useNuGridGrouping.d.ts +28 -0
- package/dist/runtime/composables/_internal/useNuGridGrouping.js +211 -0
- package/dist/runtime/composables/_internal/useNuGridInteractionRouter.d.ts +9 -0
- package/dist/runtime/composables/_internal/useNuGridInteractionRouter.js +441 -0
- package/dist/runtime/composables/_internal/useNuGridInteractions.d.ts +10 -0
- package/dist/runtime/composables/_internal/useNuGridInteractions.js +36 -0
- package/dist/runtime/composables/_internal/useNuGridKeyboardNavigation.d.ts +54 -0
- package/dist/runtime/composables/_internal/useNuGridKeyboardNavigation.js +407 -0
- package/dist/runtime/composables/_internal/useNuGridPaging.d.ts +76 -0
- package/dist/runtime/composables/_internal/useNuGridPaging.js +147 -0
- package/dist/runtime/composables/_internal/useNuGridRowDragDrop.d.ts +68 -0
- package/dist/runtime/composables/_internal/useNuGridRowDragDrop.js +295 -0
- package/dist/runtime/composables/_internal/useNuGridRowSelection.d.ts +14 -0
- package/dist/runtime/composables/_internal/useNuGridRowSelection.js +214 -0
- package/dist/runtime/composables/_internal/useNuGridScroll.d.ts +110 -0
- package/dist/runtime/composables/_internal/useNuGridScroll.js +463 -0
- package/dist/runtime/composables/_internal/useNuGridScrollState.d.ts +32 -0
- package/dist/runtime/composables/_internal/useNuGridScrollState.js +60 -0
- package/dist/runtime/composables/_internal/useNuGridScrollbars.d.ts +24 -0
- package/dist/runtime/composables/_internal/useNuGridScrollbars.js +69 -0
- package/dist/runtime/composables/_internal/useNuGridStatePersistence.d.ts +27 -0
- package/dist/runtime/composables/_internal/useNuGridStatePersistence.js +243 -0
- package/dist/runtime/composables/_internal/useNuGridTooltip.d.ts +41 -0
- package/dist/runtime/composables/_internal/useNuGridTooltip.js +304 -0
- package/dist/runtime/composables/_internal/useNuGridUI.d.ts +3283 -0
- package/dist/runtime/composables/_internal/useNuGridUI.js +58 -0
- package/dist/runtime/composables/_internal/useNuGridVirtualization.d.ts +75 -0
- package/dist/runtime/composables/_internal/useNuGridVirtualization.js +534 -0
- package/dist/runtime/composables/_internal/useNuGridWheelSmoothing.d.ts +25 -0
- package/dist/runtime/composables/_internal/useNuGridWheelSmoothing.js +157 -0
- package/dist/runtime/composables/index.d.ts +3 -0
- package/dist/runtime/composables/index.js +2 -0
- package/dist/runtime/composables/useNuGridCellEditor.d.ts +91 -0
- package/dist/runtime/composables/useNuGridCellEditor.js +82 -0
- package/dist/runtime/composables/useNuGridCellTypeRegistry.d.ts +85 -0
- package/dist/runtime/composables/useNuGridCellTypeRegistry.js +202 -0
- package/dist/runtime/config/_internal/index.d.ts +5 -0
- package/dist/runtime/config/_internal/index.js +2 -0
- package/dist/runtime/config/_internal/options-defaults.d.ts +121 -0
- package/dist/runtime/config/_internal/options-defaults.js +121 -0
- package/dist/runtime/config/_internal/prop-utils.d.ts +54 -0
- package/dist/runtime/config/_internal/prop-utils.js +21 -0
- package/dist/runtime/config/config.d.ts +44 -0
- package/dist/runtime/config/config.js +18 -0
- package/dist/runtime/config/index.d.ts +2 -0
- package/dist/runtime/config/index.js +2 -0
- package/dist/runtime/config/presets.d.ts +15 -0
- package/dist/runtime/config/presets.js +58 -0
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/plugin.d.ts +5 -0
- package/dist/runtime/plugin.js +10 -0
- package/dist/runtime/themes/index.d.ts +56 -0
- package/dist/runtime/themes/index.js +68 -0
- package/dist/runtime/themes/nuGridTheme.d.ts +329 -0
- package/dist/runtime/themes/nuGridTheme.js +236 -0
- package/dist/runtime/themes/nuGridThemeCompact.d.ts +331 -0
- package/dist/runtime/themes/nuGridThemeCompact.js +236 -0
- package/dist/runtime/types/_internal/action-menu.d.ts +55 -0
- package/dist/runtime/types/_internal/action-menu.js +0 -0
- package/dist/runtime/types/_internal/cell-editing.d.ts +75 -0
- package/dist/runtime/types/_internal/cell-editing.js +0 -0
- package/dist/runtime/types/_internal/composable-returns.d.ts +52 -0
- package/dist/runtime/types/_internal/composable-returns.js +0 -0
- package/dist/runtime/types/_internal/config.d.ts +16 -0
- package/dist/runtime/types/_internal/config.js +0 -0
- package/dist/runtime/types/_internal/contexts/add-row.d.ts +25 -0
- package/dist/runtime/types/_internal/contexts/add-row.js +0 -0
- package/dist/runtime/types/_internal/contexts/animation.d.ts +24 -0
- package/dist/runtime/types/_internal/contexts/animation.js +0 -0
- package/dist/runtime/types/_internal/contexts/core.d.ts +24 -0
- package/dist/runtime/types/_internal/contexts/core.js +0 -0
- package/dist/runtime/types/_internal/contexts/drag.d.ts +13 -0
- package/dist/runtime/types/_internal/contexts/drag.js +0 -0
- package/dist/runtime/types/_internal/contexts/focus.d.ts +11 -0
- package/dist/runtime/types/_internal/contexts/focus.js +0 -0
- package/dist/runtime/types/_internal/contexts/grouping.d.ts +9 -0
- package/dist/runtime/types/_internal/contexts/grouping.js +0 -0
- package/dist/runtime/types/_internal/contexts/index.d.ts +15 -0
- package/dist/runtime/types/_internal/contexts/index.js +0 -0
- package/dist/runtime/types/_internal/contexts/interaction-router.d.ts +5 -0
- package/dist/runtime/types/_internal/contexts/interaction-router.js +0 -0
- package/dist/runtime/types/_internal/contexts/multi-row.d.ts +40 -0
- package/dist/runtime/types/_internal/contexts/multi-row.js +0 -0
- package/dist/runtime/types/_internal/contexts/paging.d.ts +39 -0
- package/dist/runtime/types/_internal/contexts/paging.js +0 -0
- package/dist/runtime/types/_internal/contexts/performance.d.ts +15 -0
- package/dist/runtime/types/_internal/contexts/performance.js +0 -0
- package/dist/runtime/types/_internal/contexts/resize.d.ts +12 -0
- package/dist/runtime/types/_internal/contexts/resize.js +0 -0
- package/dist/runtime/types/_internal/contexts/row-interactions.d.ts +12 -0
- package/dist/runtime/types/_internal/contexts/row-interactions.js +0 -0
- package/dist/runtime/types/_internal/contexts/scroll-state.d.ts +21 -0
- package/dist/runtime/types/_internal/contexts/scroll-state.js +0 -0
- package/dist/runtime/types/_internal/contexts/ui-config.d.ts +21 -0
- package/dist/runtime/types/_internal/contexts/ui-config.js +0 -0
- package/dist/runtime/types/_internal/contexts/virtualization.d.ts +16 -0
- package/dist/runtime/types/_internal/contexts/virtualization.js +0 -0
- package/dist/runtime/types/_internal/drag-drop.d.ts +48 -0
- package/dist/runtime/types/_internal/drag-drop.js +0 -0
- package/dist/runtime/types/_internal/focus.d.ts +68 -0
- package/dist/runtime/types/_internal/focus.js +0 -0
- package/dist/runtime/types/_internal/grouping.d.ts +48 -0
- package/dist/runtime/types/_internal/grouping.js +0 -0
- package/dist/runtime/types/_internal/index.d.ts +37 -0
- package/dist/runtime/types/_internal/index.js +2 -0
- package/dist/runtime/types/_internal/interaction-router.d.ts +176 -0
- package/dist/runtime/types/_internal/interaction-router.js +39 -0
- package/dist/runtime/types/_internal/props.d.ts +28 -0
- package/dist/runtime/types/_internal/props.js +0 -0
- package/dist/runtime/types/_internal/resize.d.ts +37 -0
- package/dist/runtime/types/_internal/resize.js +0 -0
- package/dist/runtime/types/_internal/row-interactions.d.ts +15 -0
- package/dist/runtime/types/_internal/row-interactions.js +0 -0
- package/dist/runtime/types/_internal/row-selection.d.ts +27 -0
- package/dist/runtime/types/_internal/row-selection.js +0 -0
- package/dist/runtime/types/_internal/states.d.ts +24 -0
- package/dist/runtime/types/_internal/states.js +0 -0
- package/dist/runtime/types/_internal/sticky-headers.d.ts +10 -0
- package/dist/runtime/types/_internal/sticky-headers.js +0 -0
- package/dist/runtime/types/_internal/validation.d.ts +54 -0
- package/dist/runtime/types/_internal/validation.js +0 -0
- package/dist/runtime/types/_internal/virtualization.d.ts +114 -0
- package/dist/runtime/types/_internal/virtualization.js +0 -0
- package/dist/runtime/types/action-menu.d.ts +62 -0
- package/dist/runtime/types/action-menu.js +0 -0
- package/dist/runtime/types/autosize.d.ts +8 -0
- package/dist/runtime/types/autosize.js +0 -0
- package/dist/runtime/types/cells.d.ts +292 -0
- package/dist/runtime/types/cells.js +5 -0
- package/dist/runtime/types/column.d.ts +248 -0
- package/dist/runtime/types/column.js +0 -0
- package/dist/runtime/types/config.d.ts +35 -0
- package/dist/runtime/types/config.js +0 -0
- package/dist/runtime/types/drag-drop.d.ts +92 -0
- package/dist/runtime/types/drag-drop.js +0 -0
- package/dist/runtime/types/events.d.ts +164 -0
- package/dist/runtime/types/events.js +1 -0
- package/dist/runtime/types/focus.d.ts +50 -0
- package/dist/runtime/types/focus.js +0 -0
- package/dist/runtime/types/grouping.d.ts +7 -0
- package/dist/runtime/types/grouping.js +0 -0
- package/dist/runtime/types/index.d.ts +15 -0
- package/dist/runtime/types/index.js +0 -0
- package/dist/runtime/types/option-groups.d.ts +624 -0
- package/dist/runtime/types/option-groups.js +0 -0
- package/dist/runtime/types/props.d.ts +418 -0
- package/dist/runtime/types/props.js +0 -0
- package/dist/runtime/types/resize.d.ts +14 -0
- package/dist/runtime/types/resize.js +0 -0
- package/dist/runtime/types/row-interactions.d.ts +11 -0
- package/dist/runtime/types/row-interactions.js +0 -0
- package/dist/runtime/types/row-selection.d.ts +48 -0
- package/dist/runtime/types/row-selection.js +0 -0
- package/dist/runtime/types/row.d.ts +7 -0
- package/dist/runtime/types/row.js +0 -0
- package/dist/runtime/types/sort-icon.d.ts +35 -0
- package/dist/runtime/types/sort-icon.js +0 -0
- package/dist/runtime/types/states.d.ts +17 -0
- package/dist/runtime/types/states.js +0 -0
- package/dist/runtime/types/sticky-headers.d.ts +6 -0
- package/dist/runtime/types/sticky-headers.js +0 -0
- package/dist/runtime/types/tanstack-table.d.ts +126 -0
- package/dist/runtime/types/theme.d.ts +22 -0
- package/dist/runtime/types/theme.js +0 -0
- package/dist/runtime/types/validation.d.ts +94 -0
- package/dist/runtime/types/validation.js +0 -0
- package/dist/runtime/utils/columnHelper.d.ts +208 -0
- package/dist/runtime/utils/columnHelper.js +23 -0
- package/dist/runtime/utils/excelExport.d.ts +63 -0
- package/dist/runtime/utils/excelExport.js +297 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +2 -0
- package/dist/runtime/utils/standardSchema.d.ts +77 -0
- package/dist/runtime/utils/standardSchema.js +141 -0
- package/dist/types.d.mts +3 -0
- package/package.json +117 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { markRaw, ref, toRaw, toRef } from "vue";
|
|
2
|
+
export function useNuGridRowDragDrop(tableApi, data, options, tableRef, emit, eventEmitter) {
|
|
3
|
+
const draggedRowId = ref(null);
|
|
4
|
+
const draggedRowData = ref(null);
|
|
5
|
+
const dropTargetRowId = ref(null);
|
|
6
|
+
const dropPosition = ref("after");
|
|
7
|
+
const dragSourceGridId = ref(null);
|
|
8
|
+
const isDraggingOutside = ref(false);
|
|
9
|
+
function isRowDraggable(_row) {
|
|
10
|
+
if (!options.value.enabled) return false;
|
|
11
|
+
const sortingState = tableApi.getState().sorting;
|
|
12
|
+
if (sortingState && sortingState.length > 0) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function handleRowDragStart(e, row) {
|
|
18
|
+
if (!isRowDraggable(row)) return;
|
|
19
|
+
document.body.classList.add("is-dragging-row");
|
|
20
|
+
const dataId = row.original.id;
|
|
21
|
+
draggedRowId.value = dataId;
|
|
22
|
+
draggedRowData.value = row.original;
|
|
23
|
+
dragSourceGridId.value = options.value.gridId || null;
|
|
24
|
+
isDraggingOutside.value = false;
|
|
25
|
+
if (e.dataTransfer) {
|
|
26
|
+
e.dataTransfer.effectAllowed = "move";
|
|
27
|
+
const rows = tableApi.getRowModel().rows;
|
|
28
|
+
const rowIndex = rows.findIndex((r) => r.id === row.id);
|
|
29
|
+
const dragData = {
|
|
30
|
+
rowId: dataId,
|
|
31
|
+
// Use data ID, not row model ID
|
|
32
|
+
rowData: row.original,
|
|
33
|
+
gridId: options.value.gridId,
|
|
34
|
+
originalIndex: rowIndex
|
|
35
|
+
};
|
|
36
|
+
e.dataTransfer.setData("application/json", JSON.stringify(dragData));
|
|
37
|
+
const target = e.target;
|
|
38
|
+
const rowElement = target.closest("[data-row-id]");
|
|
39
|
+
if (rowElement) {
|
|
40
|
+
const scrollContainer = rowElement.closest("[data-nugrid-scroll]") || tableRef.value;
|
|
41
|
+
const containerRect = scrollContainer?.getBoundingClientRect();
|
|
42
|
+
const rowRect = rowElement.getBoundingClientRect();
|
|
43
|
+
const visibleLeft = Math.max(rowRect.left, containerRect?.left ?? rowRect.left);
|
|
44
|
+
const visibleRight = Math.min(rowRect.right, containerRect?.right ?? rowRect.right);
|
|
45
|
+
const visibleWidth = visibleRight - visibleLeft;
|
|
46
|
+
const scrollOffset = visibleLeft - rowRect.left;
|
|
47
|
+
const wrapper = document.createElement("div");
|
|
48
|
+
wrapper.style.position = "absolute";
|
|
49
|
+
wrapper.style.top = "-9999px";
|
|
50
|
+
wrapper.style.left = "-9999px";
|
|
51
|
+
wrapper.style.width = `${visibleWidth}px`;
|
|
52
|
+
wrapper.style.height = `${rowRect.height}px`;
|
|
53
|
+
wrapper.style.overflow = "hidden";
|
|
54
|
+
wrapper.style.opacity = "0.9";
|
|
55
|
+
wrapper.style.backgroundColor = "var(--color-elevated)";
|
|
56
|
+
wrapper.style.borderRadius = "6px";
|
|
57
|
+
wrapper.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
58
|
+
const clone = rowElement.cloneNode(true);
|
|
59
|
+
clone.style.position = "relative";
|
|
60
|
+
clone.style.left = `-${scrollOffset}px`;
|
|
61
|
+
clone.style.width = `${rowElement.offsetWidth}px`;
|
|
62
|
+
clone.style.margin = "0";
|
|
63
|
+
wrapper.appendChild(clone);
|
|
64
|
+
document.body.appendChild(wrapper);
|
|
65
|
+
const offsetX = e.clientX - visibleLeft;
|
|
66
|
+
const offsetY = e.clientY - rowRect.top;
|
|
67
|
+
e.dataTransfer.setDragImage(wrapper, offsetX, offsetY);
|
|
68
|
+
requestAnimationFrame(() => {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
wrapper.remove();
|
|
71
|
+
}, 0);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function handleRowDragOver(e, row) {
|
|
77
|
+
const types = e.dataTransfer?.types;
|
|
78
|
+
const typesArray = types ? Array.from(types) : [];
|
|
79
|
+
const hasDragData = typesArray.includes("application/json");
|
|
80
|
+
if (!hasDragData && !draggedRowId.value) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const dataId = row.original.id;
|
|
84
|
+
if (draggedRowId.value === dataId) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
if (e.dataTransfer) {
|
|
89
|
+
e.dataTransfer.dropEffect = "move";
|
|
90
|
+
}
|
|
91
|
+
const target = e.currentTarget;
|
|
92
|
+
if (target) {
|
|
93
|
+
const rect = target.getBoundingClientRect();
|
|
94
|
+
const mouseY = e.clientY;
|
|
95
|
+
const rowMiddle = rect.top + rect.height / 2;
|
|
96
|
+
dropPosition.value = mouseY < rowMiddle ? "before" : "after";
|
|
97
|
+
}
|
|
98
|
+
dropTargetRowId.value = dataId;
|
|
99
|
+
isDraggingOutside.value = false;
|
|
100
|
+
}
|
|
101
|
+
function handleRowDrop(e, row) {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
try {
|
|
104
|
+
const dragDataStr = e.dataTransfer?.getData("application/json");
|
|
105
|
+
if (!dragDataStr) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const dragData = JSON.parse(dragDataStr);
|
|
109
|
+
const sourceGridId = dragData.gridId;
|
|
110
|
+
const targetGridId = options.value.gridId;
|
|
111
|
+
const draggedRowIdFromData = dragData.rowId;
|
|
112
|
+
if (sourceGridId !== targetGridId && !options.value.allowCrossGrid) {
|
|
113
|
+
handleRowDragEnd();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const rows = tableApi.getRowModel().rows;
|
|
117
|
+
const targetDataId = row.original?.id;
|
|
118
|
+
const targetIndex = rows.findIndex((r) => r.original.id === targetDataId);
|
|
119
|
+
const isCrossGrid = sourceGridId !== targetGridId;
|
|
120
|
+
if (isCrossGrid) {
|
|
121
|
+
if (targetIndex !== -1 && emit) {
|
|
122
|
+
let insertIndex = targetIndex;
|
|
123
|
+
if (dropPosition.value === "after") {
|
|
124
|
+
insertIndex = targetIndex + 1;
|
|
125
|
+
}
|
|
126
|
+
const event = {
|
|
127
|
+
row: dragData.rowData,
|
|
128
|
+
originalIndex: dragData.originalIndex,
|
|
129
|
+
newIndex: insertIndex,
|
|
130
|
+
sourceGridId,
|
|
131
|
+
targetGridId,
|
|
132
|
+
positionChange: insertIndex - dragData.originalIndex,
|
|
133
|
+
groupChanged: false,
|
|
134
|
+
// Cross-grid doesn't track groups
|
|
135
|
+
gridChanged: true,
|
|
136
|
+
dropPosition: dropPosition.value
|
|
137
|
+
};
|
|
138
|
+
if (eventEmitter?.rowDragged) {
|
|
139
|
+
eventEmitter.rowDragged(event);
|
|
140
|
+
}
|
|
141
|
+
emit?.("rowDragged", event);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
const effectiveDraggedRowId = draggedRowId.value || draggedRowIdFromData;
|
|
145
|
+
const targetRow = row;
|
|
146
|
+
const targetDataId2 = targetRow.original?.id;
|
|
147
|
+
let groupingField = "";
|
|
148
|
+
const groupingState = tableApi.getState().grouping;
|
|
149
|
+
let sourceGroup;
|
|
150
|
+
let targetGroup;
|
|
151
|
+
if (groupingState && groupingState.length > 0) {
|
|
152
|
+
groupingField = groupingState[0];
|
|
153
|
+
}
|
|
154
|
+
const newData = [...data.value];
|
|
155
|
+
const draggedDataIndex = newData.findIndex((item) => item.id === effectiveDraggedRowId);
|
|
156
|
+
const targetDataIndex = newData.findIndex((item) => item.id === targetDataId2);
|
|
157
|
+
if (draggedDataIndex !== -1 && targetDataIndex !== -1) {
|
|
158
|
+
const movedItem = newData[draggedDataIndex];
|
|
159
|
+
const movedItemPayload = toRaw(newData[draggedDataIndex]);
|
|
160
|
+
if (groupingField && movedItem) {
|
|
161
|
+
sourceGroup = String(movedItem[groupingField] ?? "");
|
|
162
|
+
}
|
|
163
|
+
if (groupingField && targetRow?.original) {
|
|
164
|
+
targetGroup = String(targetRow.original[groupingField] ?? "");
|
|
165
|
+
}
|
|
166
|
+
newData.splice(draggedDataIndex, 1);
|
|
167
|
+
if (movedItem) {
|
|
168
|
+
let insertIndex = targetDataIndex;
|
|
169
|
+
if (dropPosition.value === "after") {
|
|
170
|
+
if (draggedDataIndex >= targetDataIndex) {
|
|
171
|
+
insertIndex = targetDataIndex + 1;
|
|
172
|
+
} else {
|
|
173
|
+
insertIndex = targetDataIndex;
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
if (draggedDataIndex < targetDataIndex) {
|
|
177
|
+
insertIndex = targetDataIndex - 1;
|
|
178
|
+
} else {
|
|
179
|
+
insertIndex = targetDataIndex;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
newData.splice(insertIndex, 0, movedItem);
|
|
183
|
+
if (groupingField && sourceGroup !== targetGroup && options.value.allowCrossGroup) {
|
|
184
|
+
;
|
|
185
|
+
movedItem[groupingField] = targetGroup;
|
|
186
|
+
}
|
|
187
|
+
if (options.value.sortOrderField) {
|
|
188
|
+
newData.forEach((item, index) => {
|
|
189
|
+
;
|
|
190
|
+
item[options.value.sortOrderField] = index;
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
data.value = newData;
|
|
194
|
+
const event = {
|
|
195
|
+
row: movedItemPayload,
|
|
196
|
+
// Use snapshot, not stale reference
|
|
197
|
+
originalIndex: draggedDataIndex,
|
|
198
|
+
newIndex: insertIndex,
|
|
199
|
+
sourceGridId,
|
|
200
|
+
targetGridId,
|
|
201
|
+
sourceGroup,
|
|
202
|
+
targetGroup,
|
|
203
|
+
positionChange: insertIndex - draggedDataIndex,
|
|
204
|
+
groupChanged: sourceGroup !== targetGroup,
|
|
205
|
+
gridChanged: sourceGridId !== targetGridId,
|
|
206
|
+
dropPosition: dropPosition.value
|
|
207
|
+
};
|
|
208
|
+
if (eventEmitter?.rowDragged) {
|
|
209
|
+
eventEmitter.rowDragged(event);
|
|
210
|
+
}
|
|
211
|
+
emit?.("rowDragged", event);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
} catch (error) {
|
|
216
|
+
console.error("Error handling row drop:", error);
|
|
217
|
+
}
|
|
218
|
+
handleRowDragEnd();
|
|
219
|
+
}
|
|
220
|
+
function handleRowDragEnd() {
|
|
221
|
+
draggedRowId.value = null;
|
|
222
|
+
draggedRowData.value = null;
|
|
223
|
+
dropTargetRowId.value = null;
|
|
224
|
+
dropPosition.value = "after";
|
|
225
|
+
dragSourceGridId.value = null;
|
|
226
|
+
isDraggingOutside.value = false;
|
|
227
|
+
document.body.classList.remove("is-dragging-row");
|
|
228
|
+
document.body.classList.remove("is-dragging-row-outside");
|
|
229
|
+
}
|
|
230
|
+
function handleRowDragLeave(e) {
|
|
231
|
+
const relatedTarget = e.relatedTarget;
|
|
232
|
+
if (!relatedTarget || !(relatedTarget instanceof HTMLElement) || !tableRef.value?.contains(relatedTarget)) {
|
|
233
|
+
isDraggingOutside.value = true;
|
|
234
|
+
dropTargetRowId.value = null;
|
|
235
|
+
document.body.classList.add("is-dragging-row-outside");
|
|
236
|
+
document.body.classList.remove("is-dragging-row");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function handleRowDragEnter() {
|
|
240
|
+
if (document.body.classList.contains("is-dragging-row-outside")) {
|
|
241
|
+
document.body.classList.remove("is-dragging-row-outside");
|
|
242
|
+
document.body.classList.add("is-dragging-row");
|
|
243
|
+
}
|
|
244
|
+
isDraggingOutside.value = false;
|
|
245
|
+
}
|
|
246
|
+
function rowDragProps(row) {
|
|
247
|
+
const dataId = row.original.id;
|
|
248
|
+
const isDragging = draggedRowId.value === dataId;
|
|
249
|
+
const isDropTarget = dropTargetRowId.value === dataId;
|
|
250
|
+
const isDropBefore = isDropTarget && dropPosition.value === "before";
|
|
251
|
+
const isDropAfter = isDropTarget && dropPosition.value === "after";
|
|
252
|
+
return {
|
|
253
|
+
"data-dragging": isDragging ? "true" : "false",
|
|
254
|
+
"data-drop-target": isDropTarget ? "true" : "false",
|
|
255
|
+
"data-drop-position": isDropTarget ? dropPosition.value : void 0,
|
|
256
|
+
"class": [
|
|
257
|
+
isDragging && "opacity-60",
|
|
258
|
+
isDropBefore && "border-t-[3px] border-t-blue-500/80 bg-blue-500/[0.08] transition-all duration-200",
|
|
259
|
+
isDropAfter && "border-b-[3px] border-b-blue-500/80 bg-blue-500/[0.08] transition-all duration-200"
|
|
260
|
+
].filter(Boolean).join(" "),
|
|
261
|
+
"onDragover": (e) => handleRowDragOver(e, row),
|
|
262
|
+
"onDrop": (e) => handleRowDrop(e, row),
|
|
263
|
+
"onDragend": handleRowDragEnd,
|
|
264
|
+
"onDragleave": handleRowDragLeave,
|
|
265
|
+
"onDragenter": handleRowDragEnter
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function rowDragHandleProps(row) {
|
|
269
|
+
const draggable = isRowDraggable(row);
|
|
270
|
+
return {
|
|
271
|
+
draggable,
|
|
272
|
+
class: draggable ? "cursor-grab active:cursor-grabbing" : "cursor-not-allowed opacity-30",
|
|
273
|
+
onDragstart: (e) => draggable && handleRowDragStart(e, row)
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
return toRef({
|
|
277
|
+
draggedRowId,
|
|
278
|
+
draggedRowData,
|
|
279
|
+
dropTargetRowId,
|
|
280
|
+
dropPosition,
|
|
281
|
+
dragSourceGridId,
|
|
282
|
+
isDraggingOutside,
|
|
283
|
+
...markRaw({
|
|
284
|
+
handleRowDragStart,
|
|
285
|
+
handleRowDragOver,
|
|
286
|
+
handleRowDrop,
|
|
287
|
+
handleRowDragEnd,
|
|
288
|
+
handleRowDragLeave,
|
|
289
|
+
handleRowDragEnter,
|
|
290
|
+
isRowDraggable,
|
|
291
|
+
rowDragHandleProps,
|
|
292
|
+
rowDragProps
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TableData } from '@nuxt/ui';
|
|
2
|
+
import type { VisibilityState } from '@tanstack/vue-table';
|
|
3
|
+
import type { Ref } from 'vue';
|
|
4
|
+
import type { NuGridRowSelectionMode, UseNuGridRowSelectionReturn } from '../../types/_internal/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Composable for managing row selection in NuGrid.
|
|
7
|
+
* Handles creating the selection column and determining if multi-selection is enabled.
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: The selection column is created at instantiation and cannot be added later.
|
|
10
|
+
* If rowSelectionMode is initially false/undefined and later changed to enabled,
|
|
11
|
+
* an error will be thrown. To start with a hidden selection column, use:
|
|
12
|
+
* { mode: 'multi', hidden: true }
|
|
13
|
+
*/
|
|
14
|
+
export declare function useNuGridRowSelection<T extends TableData>(rowSelectionMode: Ref<NuGridRowSelectionMode<T>>, columnVisibilityState?: Ref<VisibilityState>): UseNuGridRowSelectionReturn<T>;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { computed, h, ref, watch } from "vue";
|
|
2
|
+
import NuGridCellCheckbox from "../../components/NuGridCellCheckbox.vue";
|
|
3
|
+
import { getDefaults } from "../../config/_internal/index.js";
|
|
4
|
+
import { nuGridCellTypeRegistry } from "../useNuGridCellTypeRegistry.js";
|
|
5
|
+
const selectionDefaults = getDefaults("selection");
|
|
6
|
+
const selectionTotalsCache = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function createSelectionColumn(modeRef, enabledRef, rowSelectionEnabledRef, columnDef) {
|
|
8
|
+
const defaultColumn = {
|
|
9
|
+
id: "__selection",
|
|
10
|
+
size: 48,
|
|
11
|
+
minSize: 48,
|
|
12
|
+
maxSize: 48,
|
|
13
|
+
enableResizing: false,
|
|
14
|
+
enableSorting: false,
|
|
15
|
+
enableHiding: false,
|
|
16
|
+
enableColumnFilter: false,
|
|
17
|
+
enableGrouping: false,
|
|
18
|
+
enableReordering: false,
|
|
19
|
+
enablePinning: false,
|
|
20
|
+
enableEditing: true,
|
|
21
|
+
enableFocusing: true,
|
|
22
|
+
cellDataType: "selection",
|
|
23
|
+
editor: nuGridCellTypeRegistry.getEditor("selection"),
|
|
24
|
+
accessorFn: (_row, _index) => {
|
|
25
|
+
return false;
|
|
26
|
+
},
|
|
27
|
+
// Header reactively checks the current mode to show/hide "select all" checkbox
|
|
28
|
+
header: ({ table }) => {
|
|
29
|
+
if (modeRef.value !== "multi") {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
const typedTable = table;
|
|
33
|
+
const coreRows = table.getCoreRowModel().rows;
|
|
34
|
+
const rowSelection = table.getState().rowSelection;
|
|
35
|
+
let totalCount = 0;
|
|
36
|
+
let selectedCount = 0;
|
|
37
|
+
const cached = selectionTotalsCache.get(typedTable);
|
|
38
|
+
if (cached && cached.lastCoreRows === coreRows && cached.lastSelectionState === rowSelection) {
|
|
39
|
+
totalCount = cached.totalCount;
|
|
40
|
+
selectedCount = cached.selectedCount;
|
|
41
|
+
} else {
|
|
42
|
+
for (const row of coreRows) {
|
|
43
|
+
if (row.getCanSelect()) {
|
|
44
|
+
totalCount++;
|
|
45
|
+
if (rowSelection[row.id]) {
|
|
46
|
+
selectedCount++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
selectionTotalsCache.set(typedTable, {
|
|
51
|
+
lastCoreRows: coreRows,
|
|
52
|
+
lastSelectionState: rowSelection,
|
|
53
|
+
totalCount,
|
|
54
|
+
selectedCount
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const isAllSelected = totalCount > 0 && selectedCount === totalCount;
|
|
58
|
+
const isSomeSelected = selectedCount > 0 && selectedCount < totalCount;
|
|
59
|
+
return h(NuGridCellCheckbox, {
|
|
60
|
+
"modelValue": isSomeSelected ? "indeterminate" : isAllSelected,
|
|
61
|
+
"onUpdate:modelValue": (value) => table.toggleAllPageRowsSelected(!!value),
|
|
62
|
+
"interactive": enabledRef.value,
|
|
63
|
+
"disabled": !enabledRef.value,
|
|
64
|
+
"aria-label": "Select all"
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
// Store enabled ref in meta for cell renderer to access
|
|
68
|
+
// Using 'any' type assertion because ColumnMeta is user-defined in TanStack Table
|
|
69
|
+
meta: {
|
|
70
|
+
selectionEnabled: true,
|
|
71
|
+
// Default value, actual check uses enabledRef
|
|
72
|
+
enabledRef,
|
|
73
|
+
// Pass the ref so cell renderer can access current value
|
|
74
|
+
rowSelectionEnabledRef
|
|
75
|
+
// Pass the ref so cell renderer can check per-row selection
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
...defaultColumn,
|
|
80
|
+
...columnDef
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function isNuGridRowSelectOptions(value) {
|
|
84
|
+
return typeof value === "object" && value !== null;
|
|
85
|
+
}
|
|
86
|
+
function parseRowSelectionMode(mode) {
|
|
87
|
+
if (mode === void 0 || mode === false) return null;
|
|
88
|
+
if (mode === true || mode === "multi")
|
|
89
|
+
return {
|
|
90
|
+
mode: selectionDefaults.mode,
|
|
91
|
+
hidden: selectionDefaults.hidden,
|
|
92
|
+
enabled: selectionDefaults.enabled
|
|
93
|
+
};
|
|
94
|
+
if (mode === "single")
|
|
95
|
+
return {
|
|
96
|
+
mode: "single",
|
|
97
|
+
hidden: selectionDefaults.hidden,
|
|
98
|
+
enabled: selectionDefaults.enabled
|
|
99
|
+
};
|
|
100
|
+
if (isNuGridRowSelectOptions(mode)) {
|
|
101
|
+
return {
|
|
102
|
+
mode: mode.mode ?? selectionDefaults.mode,
|
|
103
|
+
hidden: mode.hidden ?? selectionDefaults.hidden,
|
|
104
|
+
enabled: mode.enabled ?? selectionDefaults.enabled,
|
|
105
|
+
rowSelectionEnabled: mode.rowSelectionEnabled,
|
|
106
|
+
columnDef: mode.columnDef
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
export function useNuGridRowSelection(rowSelectionMode, columnVisibilityState) {
|
|
112
|
+
const initialOptions = parseRowSelectionMode(rowSelectionMode.value);
|
|
113
|
+
const wasCreatedAtInstantiation = ref(initialOptions !== null);
|
|
114
|
+
const parsedOptions = computed(() => {
|
|
115
|
+
return parseRowSelectionMode(rowSelectionMode.value);
|
|
116
|
+
});
|
|
117
|
+
const isCurrentlyConfigured = computed(() => {
|
|
118
|
+
return parsedOptions.value !== null;
|
|
119
|
+
});
|
|
120
|
+
const hasSelectionColumn = computed(() => {
|
|
121
|
+
return wasCreatedAtInstantiation.value;
|
|
122
|
+
});
|
|
123
|
+
const normalizedMode = computed(() => {
|
|
124
|
+
if (parsedOptions.value) {
|
|
125
|
+
return parsedOptions.value.mode ?? "multi";
|
|
126
|
+
}
|
|
127
|
+
if (wasCreatedAtInstantiation.value) {
|
|
128
|
+
return "multi";
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
});
|
|
132
|
+
const isHidden = computed(() => {
|
|
133
|
+
if (!isCurrentlyConfigured.value && wasCreatedAtInstantiation.value) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
return parsedOptions.value?.hidden ?? false;
|
|
137
|
+
});
|
|
138
|
+
const isInteractive = computed(() => {
|
|
139
|
+
if (!isCurrentlyConfigured.value) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return parsedOptions.value?.enabled ?? true;
|
|
143
|
+
});
|
|
144
|
+
const rowSelectionEnabled = computed(() => {
|
|
145
|
+
if (!isCurrentlyConfigured.value) {
|
|
146
|
+
return void 0;
|
|
147
|
+
}
|
|
148
|
+
return parsedOptions.value?.rowSelectionEnabled;
|
|
149
|
+
});
|
|
150
|
+
const enableMultiRowSelection = computed(() => {
|
|
151
|
+
return normalizedMode.value !== "single";
|
|
152
|
+
});
|
|
153
|
+
const enableRowSelection = computed(() => {
|
|
154
|
+
if (!isInteractive.value) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
const rowSelectionFn = rowSelectionEnabled.value;
|
|
158
|
+
if (rowSelectionFn) {
|
|
159
|
+
return (row) => rowSelectionFn(row);
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
});
|
|
163
|
+
const selectionColumn = wasCreatedAtInstantiation.value ? createSelectionColumn(
|
|
164
|
+
normalizedMode,
|
|
165
|
+
isInteractive,
|
|
166
|
+
rowSelectionEnabled,
|
|
167
|
+
// Type assertion needed because NuGridRowSelectOptions.columnDef defaults to SelectionColumnDef<TableData>
|
|
168
|
+
// but we need SelectionColumnDef<T>. At runtime, if columnDef is provided, it will be compatible.
|
|
169
|
+
initialOptions?.columnDef
|
|
170
|
+
) : null;
|
|
171
|
+
function prependSelectionColumn(columns) {
|
|
172
|
+
if (!selectionColumn) return columns;
|
|
173
|
+
return [selectionColumn, ...columns];
|
|
174
|
+
}
|
|
175
|
+
watch(
|
|
176
|
+
rowSelectionMode,
|
|
177
|
+
(newValue) => {
|
|
178
|
+
const newOptions = parseRowSelectionMode(newValue);
|
|
179
|
+
if (newOptions !== null && !wasCreatedAtInstantiation.value) {
|
|
180
|
+
throw new Error(
|
|
181
|
+
'Cannot enable row selection after grid instantiation. Row selection must be configured when the grid is created. To start with a hidden selection column, use: { mode: "multi", hidden: true }'
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{ flush: "sync" }
|
|
186
|
+
);
|
|
187
|
+
if (columnVisibilityState) {
|
|
188
|
+
watch(
|
|
189
|
+
isHidden,
|
|
190
|
+
(hidden) => {
|
|
191
|
+
if (hasSelectionColumn.value) {
|
|
192
|
+
columnVisibilityState.value = {
|
|
193
|
+
...columnVisibilityState.value,
|
|
194
|
+
__selection: !hidden
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{ immediate: true }
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
isEnabled: isCurrentlyConfigured,
|
|
203
|
+
hasSelectionColumn,
|
|
204
|
+
normalizedMode,
|
|
205
|
+
enableMultiRowSelection,
|
|
206
|
+
enableRowSelection,
|
|
207
|
+
selectionColumn,
|
|
208
|
+
prependSelectionColumn,
|
|
209
|
+
isHidden,
|
|
210
|
+
isInteractive,
|
|
211
|
+
rowSelectionEnabled,
|
|
212
|
+
parsedOptions
|
|
213
|
+
};
|
|
214
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { TableData } from '@nuxt/ui';
|
|
2
|
+
import type { Table } from '@tanstack/vue-table';
|
|
3
|
+
import type { Primitive } from 'reka-ui';
|
|
4
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
5
|
+
export interface ScrollToCellOptions {
|
|
6
|
+
/** The cell element to scroll to */
|
|
7
|
+
cellElement: HTMLElement;
|
|
8
|
+
/** The scroll container element (used for vertical scrolling) */
|
|
9
|
+
scrollContainer: HTMLElement;
|
|
10
|
+
/** Optional separate container for horizontal scrolling (if different from scrollContainer) */
|
|
11
|
+
horizontalScrollContainer?: HTMLElement;
|
|
12
|
+
/** The table element (for finding headers) */
|
|
13
|
+
tableElement: HTMLElement | null;
|
|
14
|
+
/** The row index being scrolled to */
|
|
15
|
+
rowIndex: number;
|
|
16
|
+
/** The column index being scrolled to */
|
|
17
|
+
columnIndex: number;
|
|
18
|
+
/** Sticky header height (for virtualized grids) */
|
|
19
|
+
virtualizedStickyHeight?: number;
|
|
20
|
+
/** Scroll behavior - 'instant' for immediate, 'smooth' for animated */
|
|
21
|
+
behavior?: 'instant' | 'smooth';
|
|
22
|
+
/** Vertical padding around the cell */
|
|
23
|
+
verticalPadding?: number;
|
|
24
|
+
/** Whether to look for headers above when scrolling */
|
|
25
|
+
includeHeadersAbove?: boolean;
|
|
26
|
+
/** Whether to skip horizontal scrolling (useful for row focus mode) */
|
|
27
|
+
skipHorizontalScroll?: boolean;
|
|
28
|
+
/** Whether this is vertical-only navigation (up/down keys) - enables extra optimizations */
|
|
29
|
+
verticalOnly?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Scroll manager for NuGrid with performance optimizations
|
|
33
|
+
* Uses requestAnimationFrame for better timing and cancellation support
|
|
34
|
+
*/
|
|
35
|
+
export declare class NuGridScrollManager {
|
|
36
|
+
private pendingScrollFrame;
|
|
37
|
+
private pendingResolve;
|
|
38
|
+
private isProcessing;
|
|
39
|
+
private tableApi;
|
|
40
|
+
private pinnedLeftWidth;
|
|
41
|
+
private pinnedRightWidth;
|
|
42
|
+
private visibleColumns;
|
|
43
|
+
private cumulativeWidthsFromRight;
|
|
44
|
+
private cachedTableElement;
|
|
45
|
+
private cachedHeaderElement;
|
|
46
|
+
private isHeaderSticky;
|
|
47
|
+
private dimensionCache;
|
|
48
|
+
constructor(tableApi: Table<any>, pinnedLeftWidth: ComputedRef<number>, pinnedRightWidth: ComputedRef<number>, visibleColumns: ComputedRef<any[]>, cumulativeWidthsFromRight: ComputedRef<number[]>);
|
|
49
|
+
/**
|
|
50
|
+
* Cancel any pending scroll operation
|
|
51
|
+
*/
|
|
52
|
+
cancelPending(clearProcessing?: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Check if a scroll operation is currently being processed
|
|
55
|
+
*/
|
|
56
|
+
get isProcessingScroll(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Set the processing state
|
|
59
|
+
*/
|
|
60
|
+
setProcessing(value: boolean): void;
|
|
61
|
+
/**
|
|
62
|
+
* Invalidate the sticky header cache
|
|
63
|
+
* Call this if the table structure changes (e.g., headers added/removed)
|
|
64
|
+
*/
|
|
65
|
+
invalidateHeaderCache(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Invalidate dimension cache
|
|
68
|
+
* Call this when container size might have changed
|
|
69
|
+
*/
|
|
70
|
+
invalidateDimensionCache(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get or compute container dimensions with caching
|
|
73
|
+
* Cache is valid for 30000ms (30 seconds) - invalidated manually on keyup
|
|
74
|
+
*/
|
|
75
|
+
private getCachedDimensions;
|
|
76
|
+
/**
|
|
77
|
+
* Update cached sticky header information if table element changed
|
|
78
|
+
* This avoids expensive querySelector and getComputedStyle calls on every scroll
|
|
79
|
+
*/
|
|
80
|
+
private updateStickyHeaderCache;
|
|
81
|
+
/**
|
|
82
|
+
* Return the sticky header height, reusing cached lookups when possible
|
|
83
|
+
*/
|
|
84
|
+
getStickyHeaderHeight(tableElement: HTMLElement | null, virtualizedStickyHeight?: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Scroll horizontally to the start/end of the scroll container
|
|
87
|
+
*/
|
|
88
|
+
scrollToHorizontalEdge(scrollContainer: HTMLElement, direction: 'start' | 'end', behavior?: ScrollBehavior): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Scroll vertically to the top/bottom of the scroll container
|
|
91
|
+
*/
|
|
92
|
+
scrollToVerticalEdge(scrollContainer: HTMLElement, direction: 'start' | 'end', behavior?: ScrollBehavior): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Scroll to make a cell visible with performance optimizations
|
|
95
|
+
* Returns a promise that resolves when scrolling is complete
|
|
96
|
+
*/
|
|
97
|
+
scrollToCell(options: ScrollToCellOptions): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Composable for managing scroll operations with performance optimizations
|
|
101
|
+
*/
|
|
102
|
+
export declare function useNuGridScroll<T extends TableData>(tableApi: Table<T>, rootRef?: Ref<InstanceType<typeof Primitive> | null | undefined> | null): {
|
|
103
|
+
scrollManager: NuGridScrollManager;
|
|
104
|
+
pinnedLeftWidth: ComputedRef<number>;
|
|
105
|
+
pinnedRightWidth: ComputedRef<number>;
|
|
106
|
+
visibleColumns: ComputedRef<import("@tanstack/table-core").Column<T, unknown>[]>;
|
|
107
|
+
verticalScrollContainer: ComputedRef<HTMLElement | null>;
|
|
108
|
+
horizontalScrollContainer: ComputedRef<HTMLElement | null>;
|
|
109
|
+
updateScrollContainerCache: () => void;
|
|
110
|
+
};
|