@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,735 @@
|
|
|
1
|
+
import { createRow } from "@tanstack/table-core";
|
|
2
|
+
import { computed, isRef, nextTick, onUnmounted, ref, shallowRef, watch } from "vue";
|
|
3
|
+
export const ADD_ROW_FLAG = "__nugridAddNewRow";
|
|
4
|
+
function resolvePosition(addNewRow) {
|
|
5
|
+
if (!addNewRow) {
|
|
6
|
+
return "none";
|
|
7
|
+
}
|
|
8
|
+
if (addNewRow === true) {
|
|
9
|
+
return "bottom";
|
|
10
|
+
}
|
|
11
|
+
return addNewRow.position ?? "bottom";
|
|
12
|
+
}
|
|
13
|
+
function isAddRowRecord(record) {
|
|
14
|
+
return !!record?.[ADD_ROW_FLAG];
|
|
15
|
+
}
|
|
16
|
+
function createAddRowRecord(groupingValues, uniqueSuffix) {
|
|
17
|
+
const idSuffix = uniqueSuffix ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
18
|
+
const base = groupingValues ? { ...groupingValues } : {};
|
|
19
|
+
base[ADD_ROW_FLAG] = true;
|
|
20
|
+
if (base.id === void 0) {
|
|
21
|
+
base.id = `add-new-${idSuffix}`;
|
|
22
|
+
}
|
|
23
|
+
return base;
|
|
24
|
+
}
|
|
25
|
+
export function useNuGridAddRow(options) {
|
|
26
|
+
const addRowPosition = computed(() => resolvePosition(options.props.addNewRow));
|
|
27
|
+
const showAddNewRow = computed(() => addRowPosition.value !== "none");
|
|
28
|
+
const addNewText = computed(() => {
|
|
29
|
+
const addNewRow = options.props.addNewRow;
|
|
30
|
+
if (typeof addNewRow === "object" && addNewRow.addNewText) {
|
|
31
|
+
return addNewRow.addNewText;
|
|
32
|
+
}
|
|
33
|
+
return "Click here to add";
|
|
34
|
+
});
|
|
35
|
+
const addRowDraft = ref(null);
|
|
36
|
+
const addRowRow = shallowRef(null);
|
|
37
|
+
const groupAddRowDrafts = shallowRef(/* @__PURE__ */ new Map());
|
|
38
|
+
const groupAddRowRows = shallowRef(/* @__PURE__ */ new Map());
|
|
39
|
+
const addRowTransitioning = ref(false);
|
|
40
|
+
const isFinalizing = ref(false);
|
|
41
|
+
const finalizingRowId = ref(null);
|
|
42
|
+
let unregisterPointer = null;
|
|
43
|
+
function getCurrentEditingValue(editingValue, fallbackValue) {
|
|
44
|
+
const isRef2 = editingValue && typeof editingValue === "object" && "value" in editingValue;
|
|
45
|
+
return isRef2 ? editingValue.value ?? fallbackValue : editingValue ?? fallbackValue;
|
|
46
|
+
}
|
|
47
|
+
function stopEventPropagation() {
|
|
48
|
+
return {
|
|
49
|
+
handled: true,
|
|
50
|
+
stop: true,
|
|
51
|
+
preventDefault: true,
|
|
52
|
+
stopPropagation: true
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
let unregisterCellClick = null;
|
|
56
|
+
function collectGroupRows(rows, all) {
|
|
57
|
+
rows.forEach((row) => {
|
|
58
|
+
if (row.getIsGrouped?.()) {
|
|
59
|
+
all.push(row);
|
|
60
|
+
if (row.subRows?.length) {
|
|
61
|
+
collectGroupRows(row.subRows, all);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function resetAddRowRow() {
|
|
67
|
+
addRowDraft.value = null;
|
|
68
|
+
addRowRow.value = null;
|
|
69
|
+
}
|
|
70
|
+
function resetAddRow(row) {
|
|
71
|
+
if (!isAddRowRow(row)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (options.groupingState.value.length) {
|
|
75
|
+
const parentId = row.parentId;
|
|
76
|
+
if (parentId) {
|
|
77
|
+
groupAddRowDrafts.value.delete(parentId);
|
|
78
|
+
groupAddRowRows.value.delete(parentId);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
resetAddRowRow();
|
|
82
|
+
}
|
|
83
|
+
refreshAddRows();
|
|
84
|
+
}
|
|
85
|
+
function resetGroupedAddRows() {
|
|
86
|
+
groupAddRowDrafts.value = /* @__PURE__ */ new Map();
|
|
87
|
+
groupAddRowRows.value = /* @__PURE__ */ new Map();
|
|
88
|
+
}
|
|
89
|
+
function ensureAddRowRow() {
|
|
90
|
+
if (addRowRow.value) {
|
|
91
|
+
if (addRowDraft.value) {
|
|
92
|
+
if (addRowRow.value.original !== addRowDraft.value) {
|
|
93
|
+
const id2 = addRowDraft.value.id ?? `add-new-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
94
|
+
const rowIndex2 = options.rows.value.length;
|
|
95
|
+
addRowRow.value = createRow(
|
|
96
|
+
options.table,
|
|
97
|
+
id2,
|
|
98
|
+
addRowDraft.value,
|
|
99
|
+
rowIndex2,
|
|
100
|
+
0,
|
|
101
|
+
void 0,
|
|
102
|
+
void 0
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return addRowRow.value;
|
|
107
|
+
}
|
|
108
|
+
const draft = addRowDraft.value ?? createAddRowRecord();
|
|
109
|
+
addRowDraft.value = draft;
|
|
110
|
+
const id = draft.id ?? `add-new-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
111
|
+
const rowIndex = options.rows.value.length;
|
|
112
|
+
addRowRow.value = createRow(
|
|
113
|
+
options.table,
|
|
114
|
+
id,
|
|
115
|
+
draft,
|
|
116
|
+
rowIndex,
|
|
117
|
+
0,
|
|
118
|
+
void 0,
|
|
119
|
+
void 0
|
|
120
|
+
);
|
|
121
|
+
return addRowRow.value;
|
|
122
|
+
}
|
|
123
|
+
const orderedRows = computed(() => {
|
|
124
|
+
if (!showAddNewRow.value || addRowPosition.value === "none") {
|
|
125
|
+
return options.rows.value;
|
|
126
|
+
}
|
|
127
|
+
if (options.groupingState.value.length) {
|
|
128
|
+
return options.rows.value;
|
|
129
|
+
}
|
|
130
|
+
const addRow = ensureAddRowRow();
|
|
131
|
+
if (addRowPosition.value === "top") {
|
|
132
|
+
return [addRow, ...options.rows.value];
|
|
133
|
+
}
|
|
134
|
+
return [...options.rows.value, addRow];
|
|
135
|
+
});
|
|
136
|
+
function resolveGroupingFns() {
|
|
137
|
+
if (!options.groupingFns) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
return isRef(options.groupingFns) ? options.groupingFns.value : options.groupingFns;
|
|
141
|
+
}
|
|
142
|
+
function findEditingRow(editingCell, useOrderedRows = true) {
|
|
143
|
+
const groupingFns = resolveGroupingFns();
|
|
144
|
+
const rowsList = useOrderedRows ? groupingFns?.navigableRows?.value ?? orderedRows.value : groupingFns?.navigableRows?.value ?? options.rows.value;
|
|
145
|
+
return rowsList.find((r) => r.id === editingCell.rowId);
|
|
146
|
+
}
|
|
147
|
+
function focusNewAddRow() {
|
|
148
|
+
nextTick(() => {
|
|
149
|
+
if (options.focusFns?.value && options.cellEditingFns?.value) {
|
|
150
|
+
const groupingFns = resolveGroupingFns();
|
|
151
|
+
const rowsList = groupingFns?.navigableRows?.value ?? orderedRows.value;
|
|
152
|
+
const newAddRow = rowsList.find((r) => isAddRowRow(r));
|
|
153
|
+
if (newAddRow) {
|
|
154
|
+
const firstEditableCell = newAddRow.getVisibleCells().find((c) => options.cellEditingFns?.value?.isCellEditable(newAddRow, c));
|
|
155
|
+
if (firstEditableCell && options.focusFns.value && options.cellEditingFns?.value) {
|
|
156
|
+
options.cellEditingFns.value.startEditing(newAddRow, firstEditableCell);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function resolveGroupingValue(groupRow, columnId) {
|
|
163
|
+
const rowsById = options.table.getRowModel()?.rowsById ?? {};
|
|
164
|
+
let current = groupRow;
|
|
165
|
+
while (current) {
|
|
166
|
+
const value = current.getValue(columnId);
|
|
167
|
+
if (value !== void 0) {
|
|
168
|
+
return value;
|
|
169
|
+
}
|
|
170
|
+
const parentId = current.parentId;
|
|
171
|
+
current = parentId ? rowsById[parentId] : null;
|
|
172
|
+
}
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
function buildGroupingValues(groupRow) {
|
|
176
|
+
const values = {};
|
|
177
|
+
options.groupingState.value.forEach((columnId) => {
|
|
178
|
+
const value = resolveGroupingValue(groupRow, columnId);
|
|
179
|
+
if (value !== void 0) {
|
|
180
|
+
values[columnId] = value;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return values;
|
|
184
|
+
}
|
|
185
|
+
function refreshAddRows() {
|
|
186
|
+
if (!showAddNewRow.value) {
|
|
187
|
+
resetAddRowRow();
|
|
188
|
+
resetGroupedAddRows();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const grouping = options.groupingState.value;
|
|
192
|
+
if (!grouping.length) {
|
|
193
|
+
resetGroupedAddRows();
|
|
194
|
+
if (!addRowDraft.value) {
|
|
195
|
+
resetAddRowRow();
|
|
196
|
+
}
|
|
197
|
+
ensureAddRowRow();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
resetAddRowRow();
|
|
201
|
+
const groupRows = options.table.getSortedRowModel().rows;
|
|
202
|
+
const allGroupRows = [];
|
|
203
|
+
collectGroupRows(groupRows, allGroupRows);
|
|
204
|
+
const nextDrafts = /* @__PURE__ */ new Map();
|
|
205
|
+
const nextRows = /* @__PURE__ */ new Map();
|
|
206
|
+
allGroupRows.forEach((groupRow) => {
|
|
207
|
+
if (!groupRow.getIsGrouped?.() || !groupRow.subRows?.length) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const hasNestedGroups = groupRow.subRows.some((subRow) => subRow.getIsGrouped?.());
|
|
211
|
+
if (hasNestedGroups) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const existingDraft = groupAddRowDrafts.value.get(groupRow.id);
|
|
215
|
+
const draft = existingDraft ?? createAddRowRecord(buildGroupingValues(groupRow));
|
|
216
|
+
nextDrafts.set(groupRow.id, draft);
|
|
217
|
+
const id = draft.id ?? `${groupRow.id}-add-new`;
|
|
218
|
+
const rowIndex = groupRow.subRows?.length ?? 0;
|
|
219
|
+
const depth = groupRow.depth ?? (groupRow.parentId ? 1 : 0);
|
|
220
|
+
const row = createRow(
|
|
221
|
+
options.table,
|
|
222
|
+
id,
|
|
223
|
+
draft,
|
|
224
|
+
rowIndex,
|
|
225
|
+
depth + 1,
|
|
226
|
+
void 0,
|
|
227
|
+
groupRow.id
|
|
228
|
+
);
|
|
229
|
+
nextRows.set(groupRow.id, row);
|
|
230
|
+
});
|
|
231
|
+
groupAddRowDrafts.value = nextDrafts;
|
|
232
|
+
groupAddRowRows.value = nextRows;
|
|
233
|
+
}
|
|
234
|
+
function isAddRowRow(row) {
|
|
235
|
+
return isAddRowRecord(row.original);
|
|
236
|
+
}
|
|
237
|
+
function normalizeValidation(result) {
|
|
238
|
+
if (result === void 0 || result === null) return { valid: true };
|
|
239
|
+
if (typeof result === "boolean") return { valid: result };
|
|
240
|
+
if (typeof result === "string") return { valid: false, message: result };
|
|
241
|
+
if (typeof result === "object" && "valid" in result) {
|
|
242
|
+
return { valid: !!result.valid, message: result.message };
|
|
243
|
+
}
|
|
244
|
+
return { valid: true };
|
|
245
|
+
}
|
|
246
|
+
function validateAddRow(row) {
|
|
247
|
+
const messages = [];
|
|
248
|
+
const cols = options.columns.value;
|
|
249
|
+
cols.forEach((column) => {
|
|
250
|
+
const columnDef = column?.columnDef ?? column;
|
|
251
|
+
if (!columnDef || column?.columns) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (columnDef.showNew === false) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const columnId = column?.id ?? column?.accessorKey ?? columnDef?.id;
|
|
258
|
+
if (!columnId) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const value = row.getValue(columnId);
|
|
262
|
+
const required = typeof columnDef.requiredNew === "function" ? columnDef.requiredNew() : columnDef.requiredNew;
|
|
263
|
+
if (required && (value === void 0 || value === null || value === "")) {
|
|
264
|
+
messages.push(`${columnId} is required`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (columnDef.validateNew) {
|
|
268
|
+
const res = normalizeValidation(columnDef.validateNew(value));
|
|
269
|
+
if (!res.valid) {
|
|
270
|
+
messages.push(res.message || `${columnId} is invalid`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return { success: messages.length === 0, messages };
|
|
275
|
+
}
|
|
276
|
+
function finalizeAddRow(row) {
|
|
277
|
+
if (!isAddRowRow(row)) {
|
|
278
|
+
return { success: true };
|
|
279
|
+
}
|
|
280
|
+
if (isFinalizing.value && finalizingRowId.value === row.id) {
|
|
281
|
+
return { success: true };
|
|
282
|
+
}
|
|
283
|
+
isFinalizing.value = true;
|
|
284
|
+
finalizingRowId.value = row.id;
|
|
285
|
+
const validation = validateAddRow(row);
|
|
286
|
+
if (!validation.success) {
|
|
287
|
+
isFinalizing.value = false;
|
|
288
|
+
finalizingRowId.value = null;
|
|
289
|
+
return validation;
|
|
290
|
+
}
|
|
291
|
+
let newRow = { ...row.original };
|
|
292
|
+
delete newRow[ADD_ROW_FLAG];
|
|
293
|
+
if (options.onAddRowRequested) {
|
|
294
|
+
try {
|
|
295
|
+
const result = options.onAddRowRequested(newRow);
|
|
296
|
+
if (!result.success) {
|
|
297
|
+
isFinalizing.value = false;
|
|
298
|
+
finalizingRowId.value = null;
|
|
299
|
+
return { success: false, messages: result.messages };
|
|
300
|
+
}
|
|
301
|
+
if (result.row) {
|
|
302
|
+
newRow = result.row;
|
|
303
|
+
}
|
|
304
|
+
} catch (error) {
|
|
305
|
+
isFinalizing.value = false;
|
|
306
|
+
finalizingRowId.value = null;
|
|
307
|
+
return {
|
|
308
|
+
success: false,
|
|
309
|
+
messages: [error?.message || "Add row failed"]
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (options.groupingState.value.length) {
|
|
314
|
+
const parentId = row.parentId;
|
|
315
|
+
if (parentId) {
|
|
316
|
+
groupAddRowDrafts.value.delete(parentId);
|
|
317
|
+
groupAddRowRows.value.delete(parentId);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
resetAddRowRow();
|
|
321
|
+
}
|
|
322
|
+
refreshAddRows();
|
|
323
|
+
setTimeout(() => {
|
|
324
|
+
if (finalizingRowId.value === row.id) {
|
|
325
|
+
isFinalizing.value = false;
|
|
326
|
+
finalizingRowId.value = null;
|
|
327
|
+
}
|
|
328
|
+
}, 100);
|
|
329
|
+
return { success: true };
|
|
330
|
+
}
|
|
331
|
+
const addRowState = computed(() => {
|
|
332
|
+
const groupingFns = resolveGroupingFns();
|
|
333
|
+
const editing = options.editingCell?.value;
|
|
334
|
+
if (editing) {
|
|
335
|
+
const rootAddRow = addRowRow.value;
|
|
336
|
+
if (rootAddRow && rootAddRow.id === editing.rowId) {
|
|
337
|
+
return "editing";
|
|
338
|
+
}
|
|
339
|
+
const rowsList = groupingFns?.navigableRows?.value ?? options.rows.value;
|
|
340
|
+
const editingRow = rowsList.find((row) => row.id === editing.rowId);
|
|
341
|
+
if (editingRow && isAddRowRow(editingRow)) {
|
|
342
|
+
return "editing";
|
|
343
|
+
}
|
|
344
|
+
if (groupingFns?.groupRows?.value?.length) {
|
|
345
|
+
for (const groupRow of groupingFns.groupRows.value) {
|
|
346
|
+
const groupAddRow = groupAddRowRows.value.get(groupRow.id);
|
|
347
|
+
if (groupAddRow && groupAddRow.id === editing.rowId) {
|
|
348
|
+
return "editing";
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (addRowTransitioning.value) {
|
|
354
|
+
return "editing";
|
|
355
|
+
}
|
|
356
|
+
const focus = options.focusFns?.value?.focusedCell.value;
|
|
357
|
+
if (focus) {
|
|
358
|
+
let rowsList;
|
|
359
|
+
if (groupingFns?.navigableRows?.value) {
|
|
360
|
+
rowsList = groupingFns.navigableRows.value;
|
|
361
|
+
} else if (showAddNewRow.value && addRowPosition.value !== "none" && !options.groupingState.value.length) {
|
|
362
|
+
const addRow = addRowRow.value;
|
|
363
|
+
if (addRow) {
|
|
364
|
+
if (addRowPosition.value === "top") {
|
|
365
|
+
rowsList = [addRow, ...options.rows.value];
|
|
366
|
+
} else {
|
|
367
|
+
rowsList = [...options.rows.value, addRow];
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
rowsList = options.rows.value;
|
|
371
|
+
}
|
|
372
|
+
} else {
|
|
373
|
+
rowsList = options.rows.value;
|
|
374
|
+
}
|
|
375
|
+
const focusedRow = rowsList[focus.rowIndex];
|
|
376
|
+
if (focusedRow && isAddRowRow(focusedRow)) {
|
|
377
|
+
return "focused";
|
|
378
|
+
}
|
|
379
|
+
if (focusedRow && groupingFns?.groupRows?.value?.length) {
|
|
380
|
+
for (const groupRow of groupingFns.groupRows.value) {
|
|
381
|
+
const groupAddRow = groupAddRowRows.value.get(groupRow.id);
|
|
382
|
+
if (groupAddRow && groupAddRow.id === focusedRow.id) {
|
|
383
|
+
return "focused";
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return "idle";
|
|
389
|
+
});
|
|
390
|
+
if (options.onAddRowStateChange) {
|
|
391
|
+
watch(
|
|
392
|
+
addRowState,
|
|
393
|
+
(next, prev) => {
|
|
394
|
+
if (next !== prev) {
|
|
395
|
+
options.onAddRowStateChange?.(next);
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
{ immediate: true }
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
const isEditingAddRow = () => {
|
|
402
|
+
const editing = options.editingCell?.value;
|
|
403
|
+
if (!editing) return false;
|
|
404
|
+
const rootAddRow = addRowRow.value;
|
|
405
|
+
if (rootAddRow && rootAddRow.id === editing.rowId) {
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
for (const [, groupAddRow] of groupAddRowRows.value) {
|
|
409
|
+
if (groupAddRow.id === editing.rowId) {
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return false;
|
|
414
|
+
};
|
|
415
|
+
if (options.editingCell) {
|
|
416
|
+
watch(
|
|
417
|
+
() => options.editingCell?.value,
|
|
418
|
+
(editing) => {
|
|
419
|
+
if (editing && addRowTransitioning.value) {
|
|
420
|
+
addRowTransitioning.value = false;
|
|
421
|
+
const focusedCell = options.focusFns?.value?.focusedCell;
|
|
422
|
+
if (focusedCell?.value?.suppressOutline) {
|
|
423
|
+
focusedCell.value = { ...focusedCell.value, suppressOutline: false };
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function isCellEditable(row, cell) {
|
|
430
|
+
if (options.props.editing?.enabled === false) {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
const columnDef = cell.column.columnDef;
|
|
434
|
+
const isAddRow = isAddRowRow(row);
|
|
435
|
+
if (isAddRow && columnDef.showNew === false) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
if (isAddRow) {
|
|
439
|
+
const groupingState = options.table.getState().grouping || [];
|
|
440
|
+
if (groupingState.includes(cell.column.id)) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if (columnDef.enableEditing !== void 0) {
|
|
445
|
+
if (typeof columnDef.enableEditing === "function") {
|
|
446
|
+
return columnDef.enableEditing(row);
|
|
447
|
+
}
|
|
448
|
+
return columnDef.enableEditing;
|
|
449
|
+
}
|
|
450
|
+
return true;
|
|
451
|
+
}
|
|
452
|
+
function findClosestEditableCellToLeft(row, clickedCellIndex) {
|
|
453
|
+
const cells = row.getVisibleCells();
|
|
454
|
+
const startIndex = clickedCellIndex !== null ? clickedCellIndex : cells.length;
|
|
455
|
+
for (let i = startIndex - 1; i >= 0; i--) {
|
|
456
|
+
const cell = cells[i];
|
|
457
|
+
if (cell && isCellEditable(row, cell)) {
|
|
458
|
+
return cell;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
function findFirstEditableCellToRight(row, clickedCellIndex) {
|
|
464
|
+
const cells = row.getVisibleCells();
|
|
465
|
+
const startIndex = clickedCellIndex !== null ? clickedCellIndex : -1;
|
|
466
|
+
for (let i = startIndex + 1; i < cells.length; i++) {
|
|
467
|
+
const cell = cells[i];
|
|
468
|
+
if (cell && isCellEditable(row, cell)) {
|
|
469
|
+
return cell;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
const isAnyAddRow = (row) => {
|
|
475
|
+
if (isAddRowRow(row)) return true;
|
|
476
|
+
if (addRowRow.value && addRowRow.value.id === row.id) return true;
|
|
477
|
+
for (const [, groupAddRow] of groupAddRowRows.value) {
|
|
478
|
+
if (groupAddRow.id === row.id) return true;
|
|
479
|
+
}
|
|
480
|
+
return typeof row.id === "string" && row.id.startsWith("add-new-");
|
|
481
|
+
};
|
|
482
|
+
if (options.interactionRouter) {
|
|
483
|
+
unregisterCellClick = options.interactionRouter.registerCellClickHandler({
|
|
484
|
+
id: "add-row-uneditable-click",
|
|
485
|
+
priority: 5,
|
|
486
|
+
// Before focus (10) - intercepts when editing, passes through when not editing
|
|
487
|
+
when: ({ row, event }) => {
|
|
488
|
+
if (event.__addRowFinalizing || isFinalizing.value || finalizingRowId.value === row.id) {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
return isAnyAddRow(row);
|
|
492
|
+
},
|
|
493
|
+
handle: ({ event, row, cell, cellIndex: _cellIndex }) => {
|
|
494
|
+
if (isFinalizing.value || event.__addRowFinalizing || finalizingRowId.value === row.id) {
|
|
495
|
+
;
|
|
496
|
+
event.__addRowFinalizing = true;
|
|
497
|
+
return stopEventPropagation();
|
|
498
|
+
}
|
|
499
|
+
if (isCellEditable(row, cell)) {
|
|
500
|
+
return { handled: false };
|
|
501
|
+
}
|
|
502
|
+
if (addRowState.value === "editing" && !isFinalizing.value && finalizingRowId.value !== row.id) {
|
|
503
|
+
const cellEditingFns = options.cellEditingFns?.value;
|
|
504
|
+
const editingCell = options.editingCell?.value;
|
|
505
|
+
if (cellEditingFns && editingCell && cellEditingFns.editingValue) {
|
|
506
|
+
const editingRow = findEditingRow(editingCell, false);
|
|
507
|
+
if (editingRow && isAddRowRow(editingRow)) {
|
|
508
|
+
const editingCellObj = editingRow.getVisibleCells().find((c) => c.column.id === editingCell.columnId);
|
|
509
|
+
if (editingCellObj) {
|
|
510
|
+
if (isFinalizing.value && finalizingRowId.value === editingRow.id) {
|
|
511
|
+
return stopEventPropagation();
|
|
512
|
+
}
|
|
513
|
+
;
|
|
514
|
+
event.__addRowFinalizing = true;
|
|
515
|
+
const currentValue = cellEditingFns.editingValue?.value ?? editingCellObj.getValue();
|
|
516
|
+
cellEditingFns.stopEditing(editingRow, editingCellObj, currentValue, void 0, {
|
|
517
|
+
restoreFocus: false
|
|
518
|
+
});
|
|
519
|
+
const result = finalizeAddRow(editingRow);
|
|
520
|
+
if (!result.success) {
|
|
521
|
+
const cellEditingFns2 = options.cellEditingFns?.value;
|
|
522
|
+
if (cellEditingFns2) {
|
|
523
|
+
cellEditingFns2.startEditing(editingRow, editingCellObj, currentValue);
|
|
524
|
+
}
|
|
525
|
+
return stopEventPropagation();
|
|
526
|
+
}
|
|
527
|
+
if (options.focusFns?.value) {
|
|
528
|
+
options.focusFns.value.focusedCell.value = null;
|
|
529
|
+
}
|
|
530
|
+
return stopEventPropagation();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return { handled: false };
|
|
535
|
+
}
|
|
536
|
+
return { handled: false };
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
let unregisterCellClickNotEditing = null;
|
|
540
|
+
unregisterCellClickNotEditing = options.interactionRouter.registerCellClickHandler({
|
|
541
|
+
id: "add-row-uneditable-click-not-editing",
|
|
542
|
+
priority: 8,
|
|
543
|
+
// Before focus (10), so we can handle uneditable cells correctly
|
|
544
|
+
when: ({ row }) => isAnyAddRow(row),
|
|
545
|
+
handle: ({ event, row, cell, cellIndex }) => {
|
|
546
|
+
if (isCellEditable(row, cell)) {
|
|
547
|
+
return { handled: false };
|
|
548
|
+
}
|
|
549
|
+
const editingCell = options.editingCell?.value;
|
|
550
|
+
if (editingCell && editingCell.rowId === row.id) {
|
|
551
|
+
return { handled: false };
|
|
552
|
+
}
|
|
553
|
+
let closestEditableCell = findClosestEditableCellToLeft(row, cellIndex);
|
|
554
|
+
if (!closestEditableCell) {
|
|
555
|
+
closestEditableCell = findFirstEditableCellToRight(row, cellIndex);
|
|
556
|
+
}
|
|
557
|
+
if (!closestEditableCell) {
|
|
558
|
+
return { handled: false };
|
|
559
|
+
}
|
|
560
|
+
;
|
|
561
|
+
event.__addRowUneditableClick = true;
|
|
562
|
+
const cellEditingFns = options.cellEditingFns?.value;
|
|
563
|
+
const needsToStopEditing = cellEditingFns && editingCell && (() => {
|
|
564
|
+
const groupingFns = resolveGroupingFns();
|
|
565
|
+
const rowsList = groupingFns?.navigableRows?.value ?? options.rows.value;
|
|
566
|
+
const currentlyEditingRow = rowsList.find((r) => r.id === editingCell.rowId);
|
|
567
|
+
return currentlyEditingRow && isAddRowRow(currentlyEditingRow) && currentlyEditingRow.id !== row.id;
|
|
568
|
+
})();
|
|
569
|
+
if (needsToStopEditing && cellEditingFns && editingCell) {
|
|
570
|
+
const groupingFns = resolveGroupingFns();
|
|
571
|
+
const rowsList = groupingFns?.navigableRows?.value ?? options.rows.value;
|
|
572
|
+
const currentlyEditingRow = rowsList.find((r) => r.id === editingCell.rowId);
|
|
573
|
+
if (currentlyEditingRow) {
|
|
574
|
+
const editingCellObj = currentlyEditingRow.getVisibleCells().find((c) => c.column.id === editingCell.columnId);
|
|
575
|
+
if (editingCellObj) {
|
|
576
|
+
const currentValue = cellEditingFns.editingValue?.value ?? editingCellObj.getValue();
|
|
577
|
+
cellEditingFns.stopEditing(
|
|
578
|
+
currentlyEditingRow,
|
|
579
|
+
editingCellObj,
|
|
580
|
+
currentValue,
|
|
581
|
+
void 0,
|
|
582
|
+
{
|
|
583
|
+
restoreFocus: false
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
nextTick(() => {
|
|
590
|
+
const cells = row.getVisibleCells();
|
|
591
|
+
const targetCellIndex = cells.findIndex((c) => c.id === closestEditableCell.id);
|
|
592
|
+
if (targetCellIndex !== -1 && options.focusFns?.value) {
|
|
593
|
+
const focusFns = options.focusFns.value;
|
|
594
|
+
const groupingFns = resolveGroupingFns();
|
|
595
|
+
const rowsList = groupingFns?.navigableRows?.value ?? options.rows.value;
|
|
596
|
+
const rowIndex = rowsList.findIndex((r) => r.id === row.id);
|
|
597
|
+
if (rowIndex !== -1) {
|
|
598
|
+
focusFns.focusCell(row, rowIndex, targetCellIndex);
|
|
599
|
+
const cellEditingFns2 = options.cellEditingFns?.value;
|
|
600
|
+
if (cellEditingFns2) {
|
|
601
|
+
cellEditingFns2.startEditing(row, closestEditableCell);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
return { handled: true, stop: true };
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
onUnmounted(() => {
|
|
610
|
+
if (unregisterCellClickNotEditing) {
|
|
611
|
+
unregisterCellClickNotEditing();
|
|
612
|
+
unregisterCellClickNotEditing = null;
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
unregisterPointer = options.interactionRouter.registerGlobalPointerHandler({
|
|
616
|
+
id: "nugrid-add-row-transition",
|
|
617
|
+
priority: 1,
|
|
618
|
+
// Before focus-retain (priority 5) to intercept pointerdown
|
|
619
|
+
handle: ({ event }) => {
|
|
620
|
+
const target = event.target;
|
|
621
|
+
const isAddRowElement = target?.closest?.('[data-add-row="true"]');
|
|
622
|
+
if (!isAddRowElement) {
|
|
623
|
+
return { handled: false };
|
|
624
|
+
}
|
|
625
|
+
if (isEditingAddRow()) {
|
|
626
|
+
const cellElement = target?.closest?.("[data-cell-index]");
|
|
627
|
+
const rowElement = target?.closest?.('[data-add-row="true"]');
|
|
628
|
+
if (cellElement && rowElement) {
|
|
629
|
+
const cellIndexAttr = cellElement.getAttribute("data-cell-index");
|
|
630
|
+
const rowId = rowElement.getAttribute("data-row-id");
|
|
631
|
+
if (cellIndexAttr !== null && rowId) {
|
|
632
|
+
const groupingFns = resolveGroupingFns();
|
|
633
|
+
const rowsList = groupingFns?.navigableRows?.value ?? orderedRows.value;
|
|
634
|
+
let row = rowsList.find((r) => r.id === rowId);
|
|
635
|
+
if (!row && rowId.startsWith("add-new-") && showAddNewRow.value && !options.groupingState.value.length) {
|
|
636
|
+
ensureAddRowRow();
|
|
637
|
+
if (addRowRow.value && addRowRow.value.id === rowId) {
|
|
638
|
+
row = addRowRow.value;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (row && isAddRowRow(row)) {
|
|
642
|
+
const cellIndex = Number.parseInt(cellIndexAttr, 10);
|
|
643
|
+
const cells = row.getVisibleCells();
|
|
644
|
+
const cell = cells[cellIndex];
|
|
645
|
+
if (cell && !isCellEditable(row, cell) && addRowState.value === "editing") {
|
|
646
|
+
;
|
|
647
|
+
event.__addRowFinalizing = true;
|
|
648
|
+
event.preventDefault();
|
|
649
|
+
event.stopPropagation();
|
|
650
|
+
const cellEditingFns = options.cellEditingFns?.value;
|
|
651
|
+
const editingCell = options.editingCell?.value;
|
|
652
|
+
if (cellEditingFns && editingCell) {
|
|
653
|
+
const editingRow = findEditingRow(editingCell) ?? row;
|
|
654
|
+
if (editingRow && isAddRowRow(editingRow)) {
|
|
655
|
+
finalizingRowId.value = editingRow.id;
|
|
656
|
+
const editingCellObj = editingRow.getVisibleCells().find((c) => c.column.id === editingCell.columnId);
|
|
657
|
+
if (editingCellObj) {
|
|
658
|
+
const editingValue = cellEditingFns.editingValue;
|
|
659
|
+
const cellValue = editingCellObj.getValue();
|
|
660
|
+
const currentValue = getCurrentEditingValue(editingValue, cellValue);
|
|
661
|
+
const valueToSave = getCurrentEditingValue(editingValue, cellValue);
|
|
662
|
+
cellEditingFns.stopEditing(
|
|
663
|
+
editingRow,
|
|
664
|
+
editingCellObj,
|
|
665
|
+
valueToSave,
|
|
666
|
+
void 0,
|
|
667
|
+
{
|
|
668
|
+
restoreFocus: false
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
if (isFinalizing.value && finalizingRowId.value === editingRow.id) {
|
|
672
|
+
return stopEventPropagation();
|
|
673
|
+
}
|
|
674
|
+
const result = finalizeAddRow(editingRow);
|
|
675
|
+
if (!result.success) {
|
|
676
|
+
isFinalizing.value = false;
|
|
677
|
+
finalizingRowId.value = null;
|
|
678
|
+
if (cellEditingFns) {
|
|
679
|
+
cellEditingFns.startEditing(editingRow, editingCellObj, currentValue);
|
|
680
|
+
}
|
|
681
|
+
return stopEventPropagation();
|
|
682
|
+
} else {
|
|
683
|
+
focusNewAddRow();
|
|
684
|
+
}
|
|
685
|
+
return stopEventPropagation();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
nextTick(() => {
|
|
690
|
+
isFinalizing.value = false;
|
|
691
|
+
finalizingRowId.value = null;
|
|
692
|
+
});
|
|
693
|
+
return stopEventPropagation();
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
addRowTransitioning.value = true;
|
|
699
|
+
event.__addRowCellTransition = true;
|
|
700
|
+
const focusedCell = options.focusFns?.value?.focusedCell;
|
|
701
|
+
if (focusedCell?.value) {
|
|
702
|
+
focusedCell.value = { ...focusedCell.value, suppressOutline: true };
|
|
703
|
+
}
|
|
704
|
+
return { handled: true, stop: true };
|
|
705
|
+
}
|
|
706
|
+
return { handled: false };
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
onUnmounted(() => {
|
|
711
|
+
if (unregisterCellClick) {
|
|
712
|
+
unregisterCellClick();
|
|
713
|
+
unregisterCellClick = null;
|
|
714
|
+
}
|
|
715
|
+
if (unregisterPointer) {
|
|
716
|
+
unregisterPointer();
|
|
717
|
+
unregisterPointer = null;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
return {
|
|
721
|
+
addRowPosition,
|
|
722
|
+
showAddNewRow,
|
|
723
|
+
addNewText,
|
|
724
|
+
refreshAddRows,
|
|
725
|
+
isAddRowRow,
|
|
726
|
+
orderedRows,
|
|
727
|
+
getAddRowRow: () => addRowRow.value,
|
|
728
|
+
getGroupAddRow: (groupId) => groupAddRowRows.value.get(groupId) ?? null,
|
|
729
|
+
finalizeAddRow,
|
|
730
|
+
resetAddRow,
|
|
731
|
+
addRowState,
|
|
732
|
+
isFinalizing,
|
|
733
|
+
finalizingRowId
|
|
734
|
+
};
|
|
735
|
+
}
|