@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,8 @@
|
|
|
1
|
+
import type { TableData } from '@nuxt/ui';
|
|
2
|
+
import type { Table } from '@tanstack/vue-table';
|
|
3
|
+
import type { Ref } from 'vue';
|
|
4
|
+
import type { NuGridColumnDragDrop } from '../../types/_internal/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Column drag and drop functionality
|
|
7
|
+
*/
|
|
8
|
+
export declare function useNuGridColumnDragDrop<T extends TableData>(tableApi: Table<T>, columnOrderState: Ref<string[]>, tableRef: Ref<HTMLDivElement | null>): NuGridColumnDragDrop<T>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { markRaw, ref } from "vue";
|
|
2
|
+
export function useNuGridColumnDragDrop(tableApi, columnOrderState, tableRef) {
|
|
3
|
+
const draggedColumnId = ref(null);
|
|
4
|
+
const dropTargetColumnId = ref(null);
|
|
5
|
+
const dropPosition = ref("right");
|
|
6
|
+
const isDraggingOutside = ref(false);
|
|
7
|
+
function handleColumnDragStart(e, columnId) {
|
|
8
|
+
draggedColumnId.value = columnId;
|
|
9
|
+
isDraggingOutside.value = false;
|
|
10
|
+
if (e.dataTransfer) {
|
|
11
|
+
e.dataTransfer.effectAllowed = "move";
|
|
12
|
+
e.dataTransfer.setData("text/plain", columnId);
|
|
13
|
+
}
|
|
14
|
+
document.body.classList.add("is-dragging-column");
|
|
15
|
+
}
|
|
16
|
+
function handleColumnDragOver(e, columnId) {
|
|
17
|
+
const targetColumn = tableApi.getColumn(columnId);
|
|
18
|
+
if (targetColumn && targetColumn.columnDef.enableReordering === false) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!draggedColumnId.value || draggedColumnId.value === columnId) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
if (e.dataTransfer) {
|
|
26
|
+
e.dataTransfer.dropEffect = "move";
|
|
27
|
+
}
|
|
28
|
+
const target = e.currentTarget;
|
|
29
|
+
if (target) {
|
|
30
|
+
const rect = target.getBoundingClientRect();
|
|
31
|
+
const mouseX = e.clientX;
|
|
32
|
+
const columnMidpoint = rect.left + rect.width / 2;
|
|
33
|
+
dropPosition.value = mouseX < columnMidpoint ? "left" : "right";
|
|
34
|
+
}
|
|
35
|
+
dropTargetColumnId.value = columnId;
|
|
36
|
+
isDraggingOutside.value = false;
|
|
37
|
+
}
|
|
38
|
+
function handleColumnDrop(e, columnId) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
const targetColumn = tableApi.getColumn(columnId);
|
|
41
|
+
if (targetColumn && targetColumn.columnDef.enableReordering === false) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!draggedColumnId.value || draggedColumnId.value === columnId) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const currentPinning = tableApi.getState().columnPinning;
|
|
48
|
+
const draggedColId = draggedColumnId.value;
|
|
49
|
+
const isPinnedLeft = currentPinning.left?.includes(draggedColId);
|
|
50
|
+
const isPinnedRight = currentPinning.right?.includes(draggedColId);
|
|
51
|
+
if (isPinnedLeft || isPinnedRight) {
|
|
52
|
+
const newPinning = {
|
|
53
|
+
left: currentPinning.left?.filter((id) => id !== draggedColId) || [],
|
|
54
|
+
right: currentPinning.right?.filter((id) => id !== draggedColId) || []
|
|
55
|
+
};
|
|
56
|
+
tableApi.setColumnPinning(newPinning);
|
|
57
|
+
}
|
|
58
|
+
const allColumns = tableApi.getAllLeafColumns();
|
|
59
|
+
const draggedIndex = allColumns.findIndex((col) => col.id === draggedColumnId.value);
|
|
60
|
+
const targetIndex = allColumns.findIndex((col) => col.id === columnId);
|
|
61
|
+
if (draggedIndex !== -1 && targetIndex !== -1) {
|
|
62
|
+
const newColumnOrder = allColumns.map((col) => col.id).filter((id) => id !== void 0);
|
|
63
|
+
const [removed] = newColumnOrder.splice(draggedIndex, 1);
|
|
64
|
+
if (removed) {
|
|
65
|
+
let insertIndex = targetIndex;
|
|
66
|
+
if (dropPosition.value === "right") {
|
|
67
|
+
insertIndex = targetIndex + 1;
|
|
68
|
+
}
|
|
69
|
+
if (draggedIndex < targetIndex) {
|
|
70
|
+
insertIndex -= 1;
|
|
71
|
+
}
|
|
72
|
+
newColumnOrder.splice(insertIndex, 0, removed);
|
|
73
|
+
columnOrderState.value = newColumnOrder;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
draggedColumnId.value = null;
|
|
77
|
+
dropTargetColumnId.value = null;
|
|
78
|
+
isDraggingOutside.value = false;
|
|
79
|
+
}
|
|
80
|
+
function handleColumnDragEnd() {
|
|
81
|
+
draggedColumnId.value = null;
|
|
82
|
+
dropTargetColumnId.value = null;
|
|
83
|
+
isDraggingOutside.value = false;
|
|
84
|
+
document.body.classList.remove("is-dragging-column");
|
|
85
|
+
document.body.classList.remove("is-dragging-column-outside");
|
|
86
|
+
}
|
|
87
|
+
function handleColumnDragLeave(e) {
|
|
88
|
+
const relatedTarget = e.relatedTarget;
|
|
89
|
+
if (!relatedTarget || !(relatedTarget instanceof HTMLElement) || !tableRef.value?.contains(relatedTarget)) {
|
|
90
|
+
isDraggingOutside.value = true;
|
|
91
|
+
dropTargetColumnId.value = null;
|
|
92
|
+
document.body.classList.add("is-dragging-column-outside");
|
|
93
|
+
document.body.classList.remove("is-dragging-column");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function handleColumnDragEnter() {
|
|
97
|
+
if (isDraggingOutside.value) {
|
|
98
|
+
isDraggingOutside.value = false;
|
|
99
|
+
document.body.classList.remove("is-dragging-column-outside");
|
|
100
|
+
document.body.classList.add("is-dragging-column");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function isHeaderDraggable(header) {
|
|
104
|
+
const columnId = header.column.id;
|
|
105
|
+
const enableReordering = header.column.columnDef.enableReordering;
|
|
106
|
+
if (enableReordering === false) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return !header.isPlaceholder && header.colSpan === 1 && !!columnId;
|
|
110
|
+
}
|
|
111
|
+
function headerDragProps(header) {
|
|
112
|
+
return {
|
|
113
|
+
"data-dragging": draggedColumnId.value === header.column.id ? "true" : "false",
|
|
114
|
+
"data-drop-target": dropTargetColumnId.value === header.column.id ? "true" : "false",
|
|
115
|
+
"data-drop-position": dropTargetColumnId.value === header.column.id ? dropPosition.value : void 0,
|
|
116
|
+
"onDragover": (e) => isHeaderDraggable(header) && handleColumnDragOver(e, header.column.id),
|
|
117
|
+
"onDrop": (e) => isHeaderDraggable(header) && handleColumnDrop(e, header.column.id),
|
|
118
|
+
"onDragend": handleColumnDragEnd,
|
|
119
|
+
"onDragleave": handleColumnDragLeave,
|
|
120
|
+
"onDragenter": handleColumnDragEnter
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function headerDragHandleProps(header) {
|
|
124
|
+
return {
|
|
125
|
+
draggable: isHeaderDraggable(header),
|
|
126
|
+
class: isHeaderDraggable(header) ? "cursor-move" : "",
|
|
127
|
+
onDragstart: (e) => isHeaderDraggable(header) && handleColumnDragStart(e, header.column.id)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const dragFns = {
|
|
131
|
+
draggedColumnId,
|
|
132
|
+
dropTargetColumnId,
|
|
133
|
+
dropPosition,
|
|
134
|
+
isDraggingOutside,
|
|
135
|
+
...markRaw({
|
|
136
|
+
handleColumnDragStart,
|
|
137
|
+
handleColumnDragOver,
|
|
138
|
+
handleColumnDrop,
|
|
139
|
+
handleColumnDragEnd,
|
|
140
|
+
handleColumnDragLeave,
|
|
141
|
+
handleColumnDragEnter,
|
|
142
|
+
isHeaderDraggable,
|
|
143
|
+
headerDragHandleProps,
|
|
144
|
+
headerDragProps
|
|
145
|
+
})
|
|
146
|
+
};
|
|
147
|
+
return dragFns;
|
|
148
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Table } from '@tanstack/vue-table';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
export interface ColumnPinningControls {
|
|
4
|
+
pinColumn: (columnId: string, side: 'left' | 'right') => void;
|
|
5
|
+
unpinColumn: (columnId: string) => void;
|
|
6
|
+
isPinned: (columnId: string) => 'left' | 'right' | false;
|
|
7
|
+
getPinnedColumns: () => {
|
|
8
|
+
left: string[];
|
|
9
|
+
right: string[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Composable for managing column pinning state
|
|
14
|
+
*/
|
|
15
|
+
export declare function useNuGridColumnPinning<T>(tableApi: Ref<Table<T>>): ColumnPinningControls;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export function useNuGridColumnPinning(tableApi) {
|
|
2
|
+
const pinColumn = (columnId, side) => {
|
|
3
|
+
const currentPinning = tableApi.value.getState().columnPinning;
|
|
4
|
+
const newPinning = { ...currentPinning };
|
|
5
|
+
const oppositeSide = side === "left" ? "right" : "left";
|
|
6
|
+
if (newPinning[oppositeSide]) {
|
|
7
|
+
newPinning[oppositeSide] = newPinning[oppositeSide].filter((id) => id !== columnId);
|
|
8
|
+
}
|
|
9
|
+
if (!newPinning[side]) {
|
|
10
|
+
newPinning[side] = [];
|
|
11
|
+
}
|
|
12
|
+
if (!newPinning[side].includes(columnId)) {
|
|
13
|
+
newPinning[side] = [...newPinning[side], columnId];
|
|
14
|
+
}
|
|
15
|
+
tableApi.value.setColumnPinning(newPinning);
|
|
16
|
+
};
|
|
17
|
+
const unpinColumn = (columnId) => {
|
|
18
|
+
const currentPinning = tableApi.value.getState().columnPinning;
|
|
19
|
+
const newPinning = {
|
|
20
|
+
left: currentPinning.left?.filter((id) => id !== columnId) || [],
|
|
21
|
+
right: currentPinning.right?.filter((id) => id !== columnId) || []
|
|
22
|
+
};
|
|
23
|
+
tableApi.value.setColumnPinning(newPinning);
|
|
24
|
+
};
|
|
25
|
+
const isPinned = (columnId) => {
|
|
26
|
+
const pinning = tableApi.value.getState().columnPinning;
|
|
27
|
+
if (pinning.left?.includes(columnId)) return "left";
|
|
28
|
+
if (pinning.right?.includes(columnId)) return "right";
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
const getPinnedColumns = () => {
|
|
32
|
+
const pinning = tableApi.value.getState().columnPinning;
|
|
33
|
+
return {
|
|
34
|
+
left: pinning.left || [],
|
|
35
|
+
right: pinning.right || []
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
pinColumn,
|
|
40
|
+
unpinColumn,
|
|
41
|
+
isPinned,
|
|
42
|
+
getPinnedColumns
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TableData } from '@nuxt/ui';
|
|
2
|
+
import type { Header, Table } from '@tanstack/vue-table';
|
|
3
|
+
import type { NuGridProps } from '../../types/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Column resize functionality with cursor locking
|
|
6
|
+
*/
|
|
7
|
+
export declare function useNuGridColumnResize<T extends TableData>(props: NuGridProps<T>, tableApi: Table<T>): {
|
|
8
|
+
handleResizeStart: (event: MouseEvent | TouchEvent, header: Header<T, any>) => void;
|
|
9
|
+
handleGroupResizeStart: (event: MouseEvent | TouchEvent, header: Header<T, any>) => void;
|
|
10
|
+
handleResizeEnd: () => void;
|
|
11
|
+
resizingGroupId: import("vue").Ref<string | null, string | null>;
|
|
12
|
+
resizingColumnId: import("vue").Ref<string | null, string | null>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Custom resize handler that maintains table width by redistributing size changes
|
|
16
|
+
* to following columns
|
|
17
|
+
*/
|
|
18
|
+
export declare function createMaintainWidthResizeHandler<TData>(header: Header<TData, any>, table: Table<TData>): (event: MouseEvent | TouchEvent) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Custom resize handler for column groups that resizes all leaf columns proportionately
|
|
21
|
+
*/
|
|
22
|
+
export declare function createGroupResizeHandler<TData>(header: Header<TData, any>, table: Table<TData>): (event: MouseEvent | TouchEvent) => void;
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
|
+
function isTouchStartEvent(e) {
|
|
3
|
+
return e.type === "touchstart";
|
|
4
|
+
}
|
|
5
|
+
export function useNuGridColumnResize(props, tableApi) {
|
|
6
|
+
const resizingGroupId = ref(null);
|
|
7
|
+
const resizingColumnId = ref(null);
|
|
8
|
+
function getResizeHandler(header) {
|
|
9
|
+
if (props.layout?.maintainWidth) {
|
|
10
|
+
return createMaintainWidthResizeHandler(header, tableApi);
|
|
11
|
+
}
|
|
12
|
+
return header.getResizeHandler();
|
|
13
|
+
}
|
|
14
|
+
function handleResizeStart(event, header) {
|
|
15
|
+
const resizeHandler = getResizeHandler(header);
|
|
16
|
+
if (resizeHandler) {
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
document.body.classList.add("is-resizing-column");
|
|
19
|
+
resizingColumnId.value = header.column.id;
|
|
20
|
+
resizeHandler(event);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function handleGroupResizeStart(event, header) {
|
|
24
|
+
if (header.colSpan <= 1) {
|
|
25
|
+
return handleResizeStart(event, header);
|
|
26
|
+
}
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
document.body.classList.add("is-resizing-column");
|
|
29
|
+
resizingColumnId.value = null;
|
|
30
|
+
resizingGroupId.value = header.id;
|
|
31
|
+
const resizeHandler = createGroupResizeHandler(header, tableApi);
|
|
32
|
+
resizeHandler(event);
|
|
33
|
+
}
|
|
34
|
+
function handleResizeEnd() {
|
|
35
|
+
document.body.classList.remove("is-resizing-column");
|
|
36
|
+
resizingColumnId.value = null;
|
|
37
|
+
resizingGroupId.value = null;
|
|
38
|
+
}
|
|
39
|
+
if (typeof document !== "undefined") {
|
|
40
|
+
document.addEventListener("mouseup", handleResizeEnd);
|
|
41
|
+
document.addEventListener("touchend", handleResizeEnd);
|
|
42
|
+
}
|
|
43
|
+
onUnmounted(() => {
|
|
44
|
+
if (typeof document !== "undefined") {
|
|
45
|
+
document.removeEventListener("mouseup", handleResizeEnd);
|
|
46
|
+
document.removeEventListener("touchend", handleResizeEnd);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
handleResizeStart,
|
|
51
|
+
handleGroupResizeStart,
|
|
52
|
+
handleResizeEnd,
|
|
53
|
+
resizingGroupId,
|
|
54
|
+
resizingColumnId
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function createMaintainWidthResizeHandler(header, table) {
|
|
58
|
+
return (e) => {
|
|
59
|
+
const column = table.getColumn(header.column.id);
|
|
60
|
+
const canResize = column?.getCanResize();
|
|
61
|
+
if (!column || !canResize) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
;
|
|
65
|
+
e.persist?.();
|
|
66
|
+
if (isTouchStartEvent(e)) {
|
|
67
|
+
if (e.touches && e.touches.length > 1) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const startSize = header.getSize();
|
|
72
|
+
const allColumns = table.getVisibleLeafColumns();
|
|
73
|
+
const currentColumnIndex = allColumns.findIndex((col) => col.id === column.id);
|
|
74
|
+
const followingColumns = allColumns.slice(currentColumnIndex + 1);
|
|
75
|
+
const columnSizingStart = [
|
|
76
|
+
[column.id, column.getSize()],
|
|
77
|
+
...followingColumns.map((col) => [col.id, col.getSize()])
|
|
78
|
+
];
|
|
79
|
+
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
80
|
+
const updateOffset = (eventType, clientXPos) => {
|
|
81
|
+
if (typeof clientXPos !== "number") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const deltaDirection = table.options.columnResizeDirection === "rtl" ? -1 : 1;
|
|
85
|
+
const deltaOffset = (clientXPos - clientX) * deltaDirection;
|
|
86
|
+
const currentSize = column.getSize();
|
|
87
|
+
const desiredSize = Math.max(
|
|
88
|
+
column.columnDef.minSize ?? 20,
|
|
89
|
+
Math.min(startSize + deltaOffset, column.columnDef.maxSize ?? Number.MAX_SAFE_INTEGER)
|
|
90
|
+
);
|
|
91
|
+
const deltaFromCurrent = desiredSize - currentSize;
|
|
92
|
+
let constrainedNewSize = desiredSize;
|
|
93
|
+
if (followingColumns.length > 0 && deltaFromCurrent !== 0) {
|
|
94
|
+
const nextColumn = followingColumns[0];
|
|
95
|
+
if (!nextColumn) {
|
|
96
|
+
constrainedNewSize = currentSize;
|
|
97
|
+
} else {
|
|
98
|
+
const nextColumnResizable = nextColumn.columnDef.enableResizing !== false;
|
|
99
|
+
if (!nextColumnResizable) {
|
|
100
|
+
constrainedNewSize = currentSize;
|
|
101
|
+
} else {
|
|
102
|
+
const nextColumnSize = nextColumn.getSize();
|
|
103
|
+
const nextMinSize = nextColumn.columnDef.minSize ?? 20;
|
|
104
|
+
const nextMaxSize = nextColumn.columnDef.maxSize ?? Number.MAX_SAFE_INTEGER;
|
|
105
|
+
if (deltaFromCurrent > 0) {
|
|
106
|
+
const maxNextCanShrink = Math.max(0, nextColumnSize - nextMinSize);
|
|
107
|
+
if (maxNextCanShrink < 1) {
|
|
108
|
+
constrainedNewSize = currentSize;
|
|
109
|
+
} else {
|
|
110
|
+
constrainedNewSize = Math.min(desiredSize, currentSize + maxNextCanShrink);
|
|
111
|
+
}
|
|
112
|
+
} else if (deltaFromCurrent < 0) {
|
|
113
|
+
const maxNextCanGrow = Math.max(0, nextMaxSize - nextColumnSize);
|
|
114
|
+
if (maxNextCanGrow < 1) {
|
|
115
|
+
constrainedNewSize = currentSize;
|
|
116
|
+
} else {
|
|
117
|
+
constrainedNewSize = Math.max(desiredSize, currentSize - maxNextCanGrow);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const actualDelta = constrainedNewSize - currentSize;
|
|
124
|
+
if (followingColumns.length > 0 && actualDelta !== 0) {
|
|
125
|
+
const resizeMode = table.options.columnResizeMode ?? "onChange";
|
|
126
|
+
const newColumnSizing = {};
|
|
127
|
+
newColumnSizing[column.id] = constrainedNewSize;
|
|
128
|
+
const nextColumn = followingColumns[0];
|
|
129
|
+
if (nextColumn) {
|
|
130
|
+
const nextColumnCurrentSize = nextColumn.getSize();
|
|
131
|
+
const nextColumnNewSize = nextColumnCurrentSize - actualDelta;
|
|
132
|
+
newColumnSizing[nextColumn.id] = nextColumnNewSize;
|
|
133
|
+
}
|
|
134
|
+
table.setColumnSizingInfo((old) => ({
|
|
135
|
+
...old,
|
|
136
|
+
startOffset: clientX,
|
|
137
|
+
startSize,
|
|
138
|
+
deltaOffset: constrainedNewSize - startSize,
|
|
139
|
+
// Store cumulative delta from start
|
|
140
|
+
deltaPercentage: (constrainedNewSize - startSize) / startSize,
|
|
141
|
+
isResizingColumn: column.id,
|
|
142
|
+
columnSizingStart
|
|
143
|
+
}));
|
|
144
|
+
if (resizeMode !== "onEnd" || eventType === "end") {
|
|
145
|
+
table.setColumnSizing((old) => ({
|
|
146
|
+
...old,
|
|
147
|
+
...newColumnSizing
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const onMove = (clientXPos) => updateOffset("move", clientXPos);
|
|
153
|
+
const onEnd = (clientXPos) => {
|
|
154
|
+
updateOffset("end", clientXPos);
|
|
155
|
+
table.setColumnSizingInfo((old) => ({
|
|
156
|
+
...old,
|
|
157
|
+
isResizingColumn: false,
|
|
158
|
+
startOffset: null,
|
|
159
|
+
startSize: null,
|
|
160
|
+
deltaOffset: null,
|
|
161
|
+
deltaPercentage: null,
|
|
162
|
+
columnSizingStart: []
|
|
163
|
+
}));
|
|
164
|
+
};
|
|
165
|
+
const contextDocument = typeof document !== "undefined" ? document : void 0;
|
|
166
|
+
const mouseEvents = {
|
|
167
|
+
moveHandler: (e2) => onMove(e2.clientX),
|
|
168
|
+
upHandler: (e2) => {
|
|
169
|
+
contextDocument?.removeEventListener("mousemove", mouseEvents.moveHandler);
|
|
170
|
+
contextDocument?.removeEventListener("mouseup", mouseEvents.upHandler);
|
|
171
|
+
onEnd(e2.clientX);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const touchEvents = {
|
|
175
|
+
moveHandler: (e2) => {
|
|
176
|
+
if (e2.cancelable) {
|
|
177
|
+
e2.preventDefault();
|
|
178
|
+
e2.stopPropagation();
|
|
179
|
+
}
|
|
180
|
+
onMove(e2.touches[0].clientX);
|
|
181
|
+
return false;
|
|
182
|
+
},
|
|
183
|
+
upHandler: (e2) => {
|
|
184
|
+
contextDocument?.removeEventListener("touchmove", touchEvents.moveHandler);
|
|
185
|
+
contextDocument?.removeEventListener("touchend", touchEvents.upHandler);
|
|
186
|
+
if (e2.cancelable) {
|
|
187
|
+
e2.preventDefault();
|
|
188
|
+
e2.stopPropagation();
|
|
189
|
+
}
|
|
190
|
+
onEnd(e2.touches[0]?.clientX);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
const passiveIfSupported = { passive: false };
|
|
194
|
+
if (isTouchStartEvent(e)) {
|
|
195
|
+
contextDocument?.addEventListener("touchmove", touchEvents.moveHandler, passiveIfSupported);
|
|
196
|
+
contextDocument?.addEventListener("touchend", touchEvents.upHandler, passiveIfSupported);
|
|
197
|
+
} else {
|
|
198
|
+
contextDocument?.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported);
|
|
199
|
+
contextDocument?.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported);
|
|
200
|
+
}
|
|
201
|
+
table.setColumnSizingInfo((old) => ({
|
|
202
|
+
...old,
|
|
203
|
+
startOffset: clientX,
|
|
204
|
+
startSize,
|
|
205
|
+
deltaOffset: 0,
|
|
206
|
+
deltaPercentage: 0,
|
|
207
|
+
isResizingColumn: column.id,
|
|
208
|
+
columnSizingStart
|
|
209
|
+
}));
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export function createGroupResizeHandler(header, table) {
|
|
213
|
+
return (e) => {
|
|
214
|
+
;
|
|
215
|
+
e.persist?.();
|
|
216
|
+
if (isTouchStartEvent(e)) {
|
|
217
|
+
if (e.touches && e.touches.length > 1) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const leafHeaders = header.getLeafHeaders();
|
|
222
|
+
const resizableLeafColumns = [];
|
|
223
|
+
let totalInitialSize = 0;
|
|
224
|
+
for (const leafHeader of leafHeaders) {
|
|
225
|
+
const column = table.getColumn(leafHeader.column.id);
|
|
226
|
+
if (!column || column.columnDef.enableResizing === false) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const size = leafHeader.getSize();
|
|
230
|
+
totalInitialSize += size;
|
|
231
|
+
resizableLeafColumns.push({
|
|
232
|
+
id: column.id,
|
|
233
|
+
initialSize: size,
|
|
234
|
+
minSize: column.columnDef.minSize ?? 20,
|
|
235
|
+
maxSize: column.columnDef.maxSize ?? Number.MAX_SAFE_INTEGER,
|
|
236
|
+
proportion: 0
|
|
237
|
+
// Will be calculated after we know the total
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (resizableLeafColumns.length === 0 || totalInitialSize === 0) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
for (const col of resizableLeafColumns) {
|
|
244
|
+
col.proportion = col.initialSize / totalInitialSize;
|
|
245
|
+
}
|
|
246
|
+
const startGroupSize = totalInitialSize;
|
|
247
|
+
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
248
|
+
const columnSizingStart = resizableLeafColumns.map((col) => [
|
|
249
|
+
col.id,
|
|
250
|
+
col.initialSize
|
|
251
|
+
]);
|
|
252
|
+
const updateOffset = (eventType, clientXPos) => {
|
|
253
|
+
if (typeof clientXPos !== "number") {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const deltaDirection = table.options.columnResizeDirection === "rtl" ? -1 : 1;
|
|
257
|
+
const deltaOffset = (clientXPos - clientX) * deltaDirection;
|
|
258
|
+
const desiredGroupSize = startGroupSize + deltaOffset;
|
|
259
|
+
let minGroupSize = 0;
|
|
260
|
+
let maxGroupSize = 0;
|
|
261
|
+
for (const col of resizableLeafColumns) {
|
|
262
|
+
minGroupSize += col.minSize;
|
|
263
|
+
maxGroupSize += col.maxSize;
|
|
264
|
+
}
|
|
265
|
+
const constrainedGroupSize = Math.max(minGroupSize, Math.min(desiredGroupSize, maxGroupSize));
|
|
266
|
+
const actualDelta = constrainedGroupSize - startGroupSize;
|
|
267
|
+
if (actualDelta === 0 && eventType === "move") {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const newColumnSizing = {};
|
|
271
|
+
const idealSizes = [];
|
|
272
|
+
for (const col of resizableLeafColumns) {
|
|
273
|
+
const idealSize = col.initialSize + actualDelta * col.proportion;
|
|
274
|
+
idealSizes.push(idealSize);
|
|
275
|
+
}
|
|
276
|
+
let overflow = 0;
|
|
277
|
+
const constrainedSizes = [];
|
|
278
|
+
for (let i = 0; i < resizableLeafColumns.length; i++) {
|
|
279
|
+
const col = resizableLeafColumns[i];
|
|
280
|
+
const idealSize = idealSizes[i];
|
|
281
|
+
if (idealSize < col.minSize) {
|
|
282
|
+
constrainedSizes.push(col.minSize);
|
|
283
|
+
overflow += idealSize - col.minSize;
|
|
284
|
+
} else if (idealSize > col.maxSize) {
|
|
285
|
+
constrainedSizes.push(col.maxSize);
|
|
286
|
+
overflow += idealSize - col.maxSize;
|
|
287
|
+
} else {
|
|
288
|
+
constrainedSizes.push(idealSize);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (Math.abs(overflow) > 0.5) {
|
|
292
|
+
for (let iteration = 0; iteration < 3 && Math.abs(overflow) > 0.5; iteration++) {
|
|
293
|
+
const adjustableColumns = [];
|
|
294
|
+
let adjustableTotal = 0;
|
|
295
|
+
for (let i = 0; i < resizableLeafColumns.length; i++) {
|
|
296
|
+
const col = resizableLeafColumns[i];
|
|
297
|
+
const currentSize = constrainedSizes[i];
|
|
298
|
+
if (overflow < 0) {
|
|
299
|
+
if (currentSize > col.minSize) {
|
|
300
|
+
adjustableColumns.push(i);
|
|
301
|
+
adjustableTotal += col.proportion;
|
|
302
|
+
}
|
|
303
|
+
} else {
|
|
304
|
+
if (currentSize < col.maxSize) {
|
|
305
|
+
adjustableColumns.push(i);
|
|
306
|
+
adjustableTotal += col.proportion;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (adjustableColumns.length === 0 || adjustableTotal === 0) {
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
for (const idx of adjustableColumns) {
|
|
314
|
+
const col = resizableLeafColumns[idx];
|
|
315
|
+
const share = col.proportion / adjustableTotal * overflow;
|
|
316
|
+
const newSize = constrainedSizes[idx] + share;
|
|
317
|
+
if (newSize < col.minSize) {
|
|
318
|
+
overflow += newSize - col.minSize;
|
|
319
|
+
constrainedSizes[idx] = col.minSize;
|
|
320
|
+
} else if (newSize > col.maxSize) {
|
|
321
|
+
overflow += newSize - col.maxSize;
|
|
322
|
+
constrainedSizes[idx] = col.maxSize;
|
|
323
|
+
} else {
|
|
324
|
+
constrainedSizes[idx] = newSize;
|
|
325
|
+
overflow -= share;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
for (let i = 0; i < resizableLeafColumns.length; i++) {
|
|
331
|
+
const col = resizableLeafColumns[i];
|
|
332
|
+
newColumnSizing[col.id] = Math.round(constrainedSizes[i]);
|
|
333
|
+
}
|
|
334
|
+
const resizeMode = table.options.columnResizeMode ?? "onChange";
|
|
335
|
+
table.setColumnSizingInfo((old) => ({
|
|
336
|
+
...old,
|
|
337
|
+
startOffset: clientX,
|
|
338
|
+
startSize: startGroupSize,
|
|
339
|
+
deltaOffset: actualDelta,
|
|
340
|
+
deltaPercentage: actualDelta / startGroupSize,
|
|
341
|
+
isResizingColumn: header.id,
|
|
342
|
+
// Use header.id for group identification
|
|
343
|
+
columnSizingStart
|
|
344
|
+
}));
|
|
345
|
+
if (resizeMode !== "onEnd" || eventType === "end") {
|
|
346
|
+
table.setColumnSizing((old) => ({
|
|
347
|
+
...old,
|
|
348
|
+
...newColumnSizing
|
|
349
|
+
}));
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
let rafId = null;
|
|
353
|
+
let pendingClientX = null;
|
|
354
|
+
const onMove = (clientXPos) => {
|
|
355
|
+
if (typeof clientXPos !== "number") return;
|
|
356
|
+
pendingClientX = clientXPos;
|
|
357
|
+
if (rafId !== null) return;
|
|
358
|
+
rafId = requestAnimationFrame(() => {
|
|
359
|
+
rafId = null;
|
|
360
|
+
if (pendingClientX !== null) {
|
|
361
|
+
updateOffset("move", pendingClientX);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
const onEnd = (clientXPos) => {
|
|
366
|
+
if (rafId !== null) {
|
|
367
|
+
cancelAnimationFrame(rafId);
|
|
368
|
+
rafId = null;
|
|
369
|
+
}
|
|
370
|
+
updateOffset("end", clientXPos ?? pendingClientX ?? void 0);
|
|
371
|
+
table.setColumnSizingInfo((old) => ({
|
|
372
|
+
...old,
|
|
373
|
+
isResizingColumn: false,
|
|
374
|
+
startOffset: null,
|
|
375
|
+
startSize: null,
|
|
376
|
+
deltaOffset: null,
|
|
377
|
+
deltaPercentage: null,
|
|
378
|
+
columnSizingStart: []
|
|
379
|
+
}));
|
|
380
|
+
};
|
|
381
|
+
const contextDocument = typeof document !== "undefined" ? document : void 0;
|
|
382
|
+
const mouseEvents = {
|
|
383
|
+
moveHandler: (e2) => onMove(e2.clientX),
|
|
384
|
+
upHandler: (e2) => {
|
|
385
|
+
contextDocument?.removeEventListener("mousemove", mouseEvents.moveHandler);
|
|
386
|
+
contextDocument?.removeEventListener("mouseup", mouseEvents.upHandler);
|
|
387
|
+
onEnd(e2.clientX);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
const touchEvents = {
|
|
391
|
+
moveHandler: (e2) => {
|
|
392
|
+
if (e2.cancelable) {
|
|
393
|
+
e2.preventDefault();
|
|
394
|
+
e2.stopPropagation();
|
|
395
|
+
}
|
|
396
|
+
onMove(e2.touches[0].clientX);
|
|
397
|
+
return false;
|
|
398
|
+
},
|
|
399
|
+
upHandler: (e2) => {
|
|
400
|
+
contextDocument?.removeEventListener("touchmove", touchEvents.moveHandler);
|
|
401
|
+
contextDocument?.removeEventListener("touchend", touchEvents.upHandler);
|
|
402
|
+
if (e2.cancelable) {
|
|
403
|
+
e2.preventDefault();
|
|
404
|
+
e2.stopPropagation();
|
|
405
|
+
}
|
|
406
|
+
onEnd(e2.touches[0]?.clientX);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
const passiveIfSupported = { passive: false };
|
|
410
|
+
if (isTouchStartEvent(e)) {
|
|
411
|
+
contextDocument?.addEventListener("touchmove", touchEvents.moveHandler, passiveIfSupported);
|
|
412
|
+
contextDocument?.addEventListener("touchend", touchEvents.upHandler, passiveIfSupported);
|
|
413
|
+
} else {
|
|
414
|
+
contextDocument?.addEventListener("mousemove", mouseEvents.moveHandler, passiveIfSupported);
|
|
415
|
+
contextDocument?.addEventListener("mouseup", mouseEvents.upHandler, passiveIfSupported);
|
|
416
|
+
}
|
|
417
|
+
table.setColumnSizingInfo((old) => ({
|
|
418
|
+
...old,
|
|
419
|
+
startOffset: clientX,
|
|
420
|
+
startSize: startGroupSize,
|
|
421
|
+
deltaOffset: 0,
|
|
422
|
+
deltaPercentage: 0,
|
|
423
|
+
isResizingColumn: header.id,
|
|
424
|
+
columnSizingStart
|
|
425
|
+
}));
|
|
426
|
+
};
|
|
427
|
+
}
|