@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,157 @@
|
|
|
1
|
+
import { onUnmounted, watch } from "vue";
|
|
2
|
+
export function useNuGridWheelSmoothing(containerRef, options = {}) {
|
|
3
|
+
const {
|
|
4
|
+
threshold = 100,
|
|
5
|
+
maxVelocityPxPerSec = 1e4,
|
|
6
|
+
maxVelocityPxPerSecTouchpad,
|
|
7
|
+
touchpadDeltaThreshold = 20,
|
|
8
|
+
stopOnInactivityMs = 70,
|
|
9
|
+
smoothingFactor = 0.35,
|
|
10
|
+
minStepPx = 1,
|
|
11
|
+
adaptive = true
|
|
12
|
+
} = options;
|
|
13
|
+
let pendingX = 0;
|
|
14
|
+
let pendingY = 0;
|
|
15
|
+
let rafId = null;
|
|
16
|
+
let lastFlushTime = null;
|
|
17
|
+
let inactivityTimer = null;
|
|
18
|
+
let velocityEwma = 0;
|
|
19
|
+
let isTouchpad = false;
|
|
20
|
+
const clampByVelocity = (delta, allowed) => {
|
|
21
|
+
if (allowed <= 0) return 0;
|
|
22
|
+
const absDelta = Math.abs(delta);
|
|
23
|
+
if (absDelta <= allowed) return delta;
|
|
24
|
+
return Math.sign(delta) * allowed;
|
|
25
|
+
};
|
|
26
|
+
const flushScroll = () => {
|
|
27
|
+
rafId = null;
|
|
28
|
+
const now = performance.now();
|
|
29
|
+
const dtMs = lastFlushTime ? now - lastFlushTime : 16;
|
|
30
|
+
lastFlushTime = now;
|
|
31
|
+
const dtSec = dtMs / 1e3;
|
|
32
|
+
const currentVelocity = dtSec > 0 ? Math.max(Math.abs(pendingX), Math.abs(pendingY)) / dtSec : 0;
|
|
33
|
+
velocityEwma = adaptive ? 0.2 * currentVelocity + 0.8 * velocityEwma : velocityEwma;
|
|
34
|
+
const resolveAdaptive = () => {
|
|
35
|
+
const effectiveMaxVelocity = isTouchpad && maxVelocityPxPerSecTouchpad !== void 0 ? maxVelocityPxPerSecTouchpad : maxVelocityPxPerSec;
|
|
36
|
+
if (!adaptive) {
|
|
37
|
+
return {
|
|
38
|
+
smoothing: smoothingFactor,
|
|
39
|
+
minStep: minStepPx,
|
|
40
|
+
velocityCap: effectiveMaxVelocity
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (velocityEwma < 800) {
|
|
44
|
+
return {
|
|
45
|
+
smoothing: 0.55,
|
|
46
|
+
minStep: 0.5,
|
|
47
|
+
velocityCap: effectiveMaxVelocity
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (velocityEwma < 2200) {
|
|
51
|
+
return {
|
|
52
|
+
smoothing: 0.4,
|
|
53
|
+
minStep: 1,
|
|
54
|
+
velocityCap: effectiveMaxVelocity
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (velocityEwma < 8e3) {
|
|
58
|
+
return {
|
|
59
|
+
smoothing: 0.32,
|
|
60
|
+
minStep: 1.5,
|
|
61
|
+
velocityCap: effectiveMaxVelocity * 0.85
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
smoothing: 0.45,
|
|
66
|
+
minStep: 1.5,
|
|
67
|
+
velocityCap: effectiveMaxVelocity
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
const adaptiveParams = resolveAdaptive();
|
|
71
|
+
const allowedDelta = adaptiveParams.velocityCap * dtSec;
|
|
72
|
+
const el = containerRef.value;
|
|
73
|
+
if (!el) {
|
|
74
|
+
pendingX = 0;
|
|
75
|
+
pendingY = 0;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const applyX = clampByVelocity(pendingX, allowedDelta);
|
|
79
|
+
const applyY = clampByVelocity(pendingY, allowedDelta);
|
|
80
|
+
const applyWithSmoothing = (pending, apply) => {
|
|
81
|
+
if (apply === 0 || pending === 0) return 0;
|
|
82
|
+
const softened = pending * adaptiveParams.smoothing;
|
|
83
|
+
const signedMin = Math.sign(pending) * adaptiveParams.minStep;
|
|
84
|
+
const target = Math.abs(softened) < Math.abs(signedMin) ? signedMin : softened;
|
|
85
|
+
return Math.abs(target) > Math.abs(apply) ? apply : target;
|
|
86
|
+
};
|
|
87
|
+
const finalX = applyWithSmoothing(pendingX, applyX);
|
|
88
|
+
const finalY = applyWithSmoothing(pendingY, applyY);
|
|
89
|
+
if (finalX !== 0 || finalY !== 0) {
|
|
90
|
+
el.scrollBy({ left: finalX, top: finalY });
|
|
91
|
+
pendingX -= finalX;
|
|
92
|
+
pendingY -= finalY;
|
|
93
|
+
}
|
|
94
|
+
if ((pendingX !== 0 || pendingY !== 0) && rafId === null) {
|
|
95
|
+
rafId = requestAnimationFrame(flushScroll);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const resetInactivityTimer = () => {
|
|
99
|
+
if (inactivityTimer) {
|
|
100
|
+
clearTimeout(inactivityTimer);
|
|
101
|
+
}
|
|
102
|
+
inactivityTimer = setTimeout(() => {
|
|
103
|
+
pendingX = 0;
|
|
104
|
+
pendingY = 0;
|
|
105
|
+
lastFlushTime = null;
|
|
106
|
+
if (rafId !== null) {
|
|
107
|
+
cancelAnimationFrame(rafId);
|
|
108
|
+
rafId = null;
|
|
109
|
+
}
|
|
110
|
+
}, stopOnInactivityMs);
|
|
111
|
+
};
|
|
112
|
+
const scheduleFlush = () => {
|
|
113
|
+
if (rafId === null) {
|
|
114
|
+
rafId = requestAnimationFrame(flushScroll);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const handleWheel = (event) => {
|
|
118
|
+
const el = containerRef.value;
|
|
119
|
+
if (!el) return;
|
|
120
|
+
if (event.deltaMode !== 0) return;
|
|
121
|
+
const magnitude = Math.max(Math.abs(event.deltaY), Math.abs(event.deltaX));
|
|
122
|
+
if (magnitude < threshold) return;
|
|
123
|
+
isTouchpad = maxVelocityPxPerSecTouchpad !== void 0 && magnitude < touchpadDeltaThreshold;
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
pendingY += event.deltaY;
|
|
126
|
+
pendingX += event.deltaX;
|
|
127
|
+
scheduleFlush();
|
|
128
|
+
resetInactivityTimer();
|
|
129
|
+
};
|
|
130
|
+
const addListener = (el) => {
|
|
131
|
+
if (!el) return;
|
|
132
|
+
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
133
|
+
};
|
|
134
|
+
const removeListener = (el) => {
|
|
135
|
+
if (!el) return;
|
|
136
|
+
el.removeEventListener("wheel", handleWheel);
|
|
137
|
+
};
|
|
138
|
+
watch(
|
|
139
|
+
() => containerRef.value,
|
|
140
|
+
(el, prev) => {
|
|
141
|
+
if (prev && prev !== el) removeListener(prev);
|
|
142
|
+
addListener(el);
|
|
143
|
+
},
|
|
144
|
+
{ immediate: true }
|
|
145
|
+
);
|
|
146
|
+
onUnmounted(() => {
|
|
147
|
+
removeListener(containerRef.value);
|
|
148
|
+
if (rafId !== null) {
|
|
149
|
+
cancelAnimationFrame(rafId);
|
|
150
|
+
rafId = null;
|
|
151
|
+
}
|
|
152
|
+
if (inactivityTimer) {
|
|
153
|
+
clearTimeout(inactivityTimer);
|
|
154
|
+
inactivityTimer = null;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { NuGridCellEditorEmits, NuGridCellEditorProps } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Shared composable for building custom NuGrid cell editors
|
|
5
|
+
*
|
|
6
|
+
* This composable provides:
|
|
7
|
+
* - Keyboard event handling (Enter, Escape, Arrow keys, Tab)
|
|
8
|
+
* - Focus management (with scroll settling)
|
|
9
|
+
* - Blur handling (navigation-aware)
|
|
10
|
+
* - Manual focus trigger (for custom focus logic)
|
|
11
|
+
* - Custom focus callback support (for complex components)
|
|
12
|
+
*
|
|
13
|
+
* @example Basic usage
|
|
14
|
+
* ```vue
|
|
15
|
+
* <script setup>
|
|
16
|
+
* const props = defineProps<NuGridCellEditorProps>()
|
|
17
|
+
* const emit = defineEmits<NuGridCellEditorEmits>()
|
|
18
|
+
* const inputRef = ref(null)
|
|
19
|
+
*
|
|
20
|
+
* const { handleKeydown, handleBlur } = useNuGridCellEditor(props, emit, inputRef)
|
|
21
|
+
* </script>
|
|
22
|
+
*
|
|
23
|
+
* <template>
|
|
24
|
+
* <USelect
|
|
25
|
+
* ref="inputRef"
|
|
26
|
+
* :model-value="modelValue"
|
|
27
|
+
* @blur="handleBlur"
|
|
28
|
+
* @keydown="handleKeydown"
|
|
29
|
+
* />
|
|
30
|
+
* </template>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Custom focus callback for complex components
|
|
34
|
+
* ```vue
|
|
35
|
+
* <script setup>
|
|
36
|
+
* const props = defineProps<NuGridCellEditorProps>()
|
|
37
|
+
* const emit = defineEmits<NuGridCellEditorEmits>()
|
|
38
|
+
* const editorRef = ref(null)
|
|
39
|
+
*
|
|
40
|
+
* // Custom focus logic for a complex editor component
|
|
41
|
+
* const customFocus = () => {
|
|
42
|
+
* editorRef.value?.openDropdown()
|
|
43
|
+
* editorRef.value?.selectAll()
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* const { handleKeydown, handleBlur } = useNuGridCellEditor(
|
|
47
|
+
* props,
|
|
48
|
+
* emit,
|
|
49
|
+
* editorRef,
|
|
50
|
+
* customFocus
|
|
51
|
+
* )
|
|
52
|
+
* </script>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example Manual focus control
|
|
56
|
+
* ```vue
|
|
57
|
+
* <script setup>
|
|
58
|
+
* const props = defineProps<NuGridCellEditorProps>()
|
|
59
|
+
* const emit = defineEmits<NuGridCellEditorEmits>()
|
|
60
|
+
* const inputRef = ref(null)
|
|
61
|
+
*
|
|
62
|
+
* const { handleKeydown, handleBlur, focusInput } = useNuGridCellEditor(props, emit, inputRef)
|
|
63
|
+
*
|
|
64
|
+
* // Manually trigger focus after some async operation
|
|
65
|
+
* async function loadDataAndFocus() {
|
|
66
|
+
* await fetchData()
|
|
67
|
+
* focusInput()
|
|
68
|
+
* }
|
|
69
|
+
* </script>
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function useNuGridCellEditor(props: NuGridCellEditorProps, emit: NuGridCellEditorEmits, inputRef: Ref<any>, customFocusCallback?: () => void): {
|
|
73
|
+
/**
|
|
74
|
+
* Handle keyboard events for navigation and editing control
|
|
75
|
+
*/
|
|
76
|
+
handleKeydown: (e: KeyboardEvent) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Handle blur events (navigation-aware)
|
|
79
|
+
*/
|
|
80
|
+
handleBlur: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Manually trigger focus on the input element
|
|
83
|
+
* Useful for custom focus logic or after async operations
|
|
84
|
+
*/
|
|
85
|
+
focusInput: () => void;
|
|
86
|
+
/**
|
|
87
|
+
* Schedule navigation to another cell
|
|
88
|
+
* Emits stop-editing with direction, which is throttled by the scroll processing lock
|
|
89
|
+
*/
|
|
90
|
+
scheduleNavigation: (direction: "up" | "down" | "next" | "previous") => void;
|
|
91
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { nextTick, onMounted, watch } from "vue";
|
|
2
|
+
export function useNuGridCellEditor(props, emit, inputRef, customFocusCallback) {
|
|
3
|
+
function scheduleNavigation(direction) {
|
|
4
|
+
emit("update:isNavigating", true);
|
|
5
|
+
emit("stop-editing", direction);
|
|
6
|
+
}
|
|
7
|
+
function focusInput() {
|
|
8
|
+
nextTick(() => {
|
|
9
|
+
if (customFocusCallback) {
|
|
10
|
+
customFocusCallback();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (inputRef.value?.inputRef) {
|
|
14
|
+
inputRef.value.inputRef.focus({ preventScroll: true });
|
|
15
|
+
} else if (inputRef.value?.focus) {
|
|
16
|
+
inputRef.value.focus({ preventScroll: true });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
watch(
|
|
21
|
+
() => props.shouldFocus,
|
|
22
|
+
(shouldFocus) => {
|
|
23
|
+
if (shouldFocus) {
|
|
24
|
+
focusInput();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{ immediate: true }
|
|
28
|
+
);
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
if (props.shouldFocus) {
|
|
31
|
+
focusInput();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
function handleBlur() {
|
|
35
|
+
if (!props.isNavigating) {
|
|
36
|
+
emit("stop-editing");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function handleKeydown(e) {
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
if (e.key === "Enter") {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
emit("stop-editing");
|
|
44
|
+
} else if (e.key === "Escape") {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
emit("cancel-editing");
|
|
47
|
+
} else if (e.key === "ArrowUp") {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
if (e.metaKey || e.ctrlKey) return;
|
|
50
|
+
scheduleNavigation("up");
|
|
51
|
+
} else if (e.key === "ArrowDown") {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
if (e.metaKey || e.ctrlKey) return;
|
|
54
|
+
scheduleNavigation("down");
|
|
55
|
+
} else if (e.key === "Tab") {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
scheduleNavigation(e.shiftKey ? "previous" : "next");
|
|
58
|
+
} else if (e.key === "PageUp" || e.key === "PageDown") {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
/**
|
|
64
|
+
* Handle keyboard events for navigation and editing control
|
|
65
|
+
*/
|
|
66
|
+
handleKeydown,
|
|
67
|
+
/**
|
|
68
|
+
* Handle blur events (navigation-aware)
|
|
69
|
+
*/
|
|
70
|
+
handleBlur,
|
|
71
|
+
/**
|
|
72
|
+
* Manually trigger focus on the input element
|
|
73
|
+
* Useful for custom focus logic or after async operations
|
|
74
|
+
*/
|
|
75
|
+
focusInput,
|
|
76
|
+
/**
|
|
77
|
+
* Schedule navigation to another cell
|
|
78
|
+
* Emits stop-editing with direction, which is throttled by the scroll processing lock
|
|
79
|
+
*/
|
|
80
|
+
scheduleNavigation
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { TableData } from '@nuxt/ui';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
import type { NuGridCellType } from '../types/cells.js';
|
|
4
|
+
/**
|
|
5
|
+
* Cell type registry for managing cell types
|
|
6
|
+
* Provides centralized registration, lookup, and merging of cell types
|
|
7
|
+
*/
|
|
8
|
+
export declare class NuGridCellTypeRegistry {
|
|
9
|
+
private cellTypes;
|
|
10
|
+
private builtInTypes;
|
|
11
|
+
private typeCache;
|
|
12
|
+
private editorCache;
|
|
13
|
+
private rendererCache;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Register a cell type
|
|
17
|
+
* If a cell type with the same name already exists, it will be replaced
|
|
18
|
+
*/
|
|
19
|
+
register(cellType: NuGridCellType): void;
|
|
20
|
+
/**
|
|
21
|
+
* Register multiple cell types at once
|
|
22
|
+
*/
|
|
23
|
+
registerAll(cellTypes: NuGridCellType[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get a cell type by name
|
|
26
|
+
* Returns undefined if not found
|
|
27
|
+
* Uses cache for performance
|
|
28
|
+
*/
|
|
29
|
+
get(name: string): NuGridCellType | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Get editor for a cell type (cached)
|
|
32
|
+
*/
|
|
33
|
+
getEditor(name: string): NuGridCellType['editor'];
|
|
34
|
+
/**
|
|
35
|
+
* Get renderer for a cell type (cached)
|
|
36
|
+
*/
|
|
37
|
+
getRenderer(name: string): NuGridCellType['renderer'];
|
|
38
|
+
/**
|
|
39
|
+
* Check if a cell type is registered
|
|
40
|
+
*/
|
|
41
|
+
has(name: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Get all registered cell types
|
|
44
|
+
*/
|
|
45
|
+
getAll(): NuGridCellType[];
|
|
46
|
+
/**
|
|
47
|
+
* Set built-in cell types
|
|
48
|
+
* These are merged with custom cell types, with custom types taking precedence
|
|
49
|
+
*/
|
|
50
|
+
setBuiltInTypes(cellTypes: NuGridCellType[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Merge custom cell types with built-in types
|
|
53
|
+
* Custom types override built-in types with the same name
|
|
54
|
+
* New custom types are added
|
|
55
|
+
*/
|
|
56
|
+
mergeCellTypes(customTypes?: NuGridCellType[]): NuGridCellType[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Global cell type registry instance
|
|
60
|
+
*/
|
|
61
|
+
declare const globalRegistry: NuGridCellTypeRegistry;
|
|
62
|
+
/**
|
|
63
|
+
* Composable for accessing the cell type registry
|
|
64
|
+
* Provides reactive access to cell types
|
|
65
|
+
* Optimized for performance with caching
|
|
66
|
+
*/
|
|
67
|
+
export declare function useNuGridCellTypeRegistry<T extends TableData = TableData>(customTypes?: Ref<NuGridCellType<T>[] | undefined>): {
|
|
68
|
+
registry: NuGridCellTypeRegistry;
|
|
69
|
+
cellTypes: import("vue").ComputedRef<NuGridCellType<T>[]>;
|
|
70
|
+
getCellType: (name: string) => NuGridCellType<T> | undefined;
|
|
71
|
+
getDefaultEditor: (cellDataType: string) => NuGridCellType["editor"];
|
|
72
|
+
getRenderer: (cellDataType: string) => NuGridCellType["renderer"];
|
|
73
|
+
getFilter: (cellDataType: string) => NuGridCellType["filter"];
|
|
74
|
+
getFilterFn: (cellDataType: string) => NuGridCellType<T>["filterFn"];
|
|
75
|
+
getKeyboardHandler: (cellDataType: string) => NuGridCellType<T>["keyboardHandler"];
|
|
76
|
+
getValidation: (cellDataType: string) => NuGridCellType<T>["validation"];
|
|
77
|
+
getFormatter: (cellDataType: string) => NuGridCellType<T>["formatter"];
|
|
78
|
+
getColumnMenuItems: (cellDataType: string) => NuGridCellType<T>["columnMenuItems"];
|
|
79
|
+
getDefaultCellRenderer: (cellDataType: string) => NuGridCellType<T>["defaultCellRenderer"];
|
|
80
|
+
isFilteringEnabled: (cellDataType: string) => boolean;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Export the global registry for direct access if needed
|
|
84
|
+
*/
|
|
85
|
+
export { globalRegistry as nuGridCellTypeRegistry };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { builtInCellTypes } from "../cell-types/index.js";
|
|
3
|
+
export class NuGridCellTypeRegistry {
|
|
4
|
+
cellTypes = /* @__PURE__ */ new Map();
|
|
5
|
+
builtInTypes = [];
|
|
6
|
+
// Cache for cell type lookups to improve performance
|
|
7
|
+
typeCache = /* @__PURE__ */ new Map();
|
|
8
|
+
// Cache for cell type properties to avoid repeated lookups
|
|
9
|
+
editorCache = /* @__PURE__ */ new Map();
|
|
10
|
+
rendererCache = /* @__PURE__ */ new Map();
|
|
11
|
+
constructor() {
|
|
12
|
+
if (builtInCellTypes && Array.isArray(builtInCellTypes)) {
|
|
13
|
+
this.setBuiltInTypes(builtInCellTypes);
|
|
14
|
+
} else {
|
|
15
|
+
console.warn(
|
|
16
|
+
"[NuGrid] builtInCellTypes is not available or not an array. Cell types may not be registered."
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Register a cell type
|
|
22
|
+
* If a cell type with the same name already exists, it will be replaced
|
|
23
|
+
*/
|
|
24
|
+
register(cellType) {
|
|
25
|
+
this.cellTypes.set(cellType.name, cellType);
|
|
26
|
+
this.typeCache.delete(cellType.name);
|
|
27
|
+
this.editorCache.delete(cellType.name);
|
|
28
|
+
this.rendererCache.delete(cellType.name);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Register multiple cell types at once
|
|
32
|
+
*/
|
|
33
|
+
registerAll(cellTypes) {
|
|
34
|
+
for (const cellType of cellTypes) {
|
|
35
|
+
this.register(cellType);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a cell type by name
|
|
40
|
+
* Returns undefined if not found
|
|
41
|
+
* Uses cache for performance
|
|
42
|
+
*/
|
|
43
|
+
get(name) {
|
|
44
|
+
if (this.typeCache.has(name)) {
|
|
45
|
+
return this.typeCache.get(name);
|
|
46
|
+
}
|
|
47
|
+
const cellType = this.cellTypes.get(name);
|
|
48
|
+
this.typeCache.set(name, cellType);
|
|
49
|
+
return cellType;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get editor for a cell type (cached)
|
|
53
|
+
*/
|
|
54
|
+
getEditor(name) {
|
|
55
|
+
if (this.editorCache.has(name)) {
|
|
56
|
+
return this.editorCache.get(name);
|
|
57
|
+
}
|
|
58
|
+
const cellType = this.get(name);
|
|
59
|
+
const editor = cellType?.editor;
|
|
60
|
+
this.editorCache.set(name, editor);
|
|
61
|
+
return editor;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get renderer for a cell type (cached)
|
|
65
|
+
*/
|
|
66
|
+
getRenderer(name) {
|
|
67
|
+
if (this.rendererCache.has(name)) {
|
|
68
|
+
return this.rendererCache.get(name);
|
|
69
|
+
}
|
|
70
|
+
const cellType = this.get(name);
|
|
71
|
+
const renderer = cellType?.renderer;
|
|
72
|
+
this.rendererCache.set(name, renderer);
|
|
73
|
+
return renderer;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if a cell type is registered
|
|
77
|
+
*/
|
|
78
|
+
has(name) {
|
|
79
|
+
return this.cellTypes.has(name);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get all registered cell types
|
|
83
|
+
*/
|
|
84
|
+
getAll() {
|
|
85
|
+
return Array.from(this.cellTypes.values());
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Set built-in cell types
|
|
89
|
+
* These are merged with custom cell types, with custom types taking precedence
|
|
90
|
+
*/
|
|
91
|
+
setBuiltInTypes(cellTypes) {
|
|
92
|
+
if (!Array.isArray(cellTypes)) {
|
|
93
|
+
console.warn("setBuiltInTypes: cellTypes must be an array");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.builtInTypes = cellTypes;
|
|
97
|
+
for (const cellType of cellTypes) {
|
|
98
|
+
if (!this.cellTypes.has(cellType.name)) {
|
|
99
|
+
this.register(cellType);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Merge custom cell types with built-in types
|
|
105
|
+
* Custom types override built-in types with the same name
|
|
106
|
+
* New custom types are added
|
|
107
|
+
*/
|
|
108
|
+
mergeCellTypes(customTypes) {
|
|
109
|
+
if (!customTypes || customTypes.length === 0) {
|
|
110
|
+
return this.builtInTypes;
|
|
111
|
+
}
|
|
112
|
+
const customTypeMap = new Map(customTypes.map((t) => [t.name, t]));
|
|
113
|
+
const mergedTypes = this.builtInTypes.map(
|
|
114
|
+
(builtIn) => customTypeMap.get(builtIn.name) || builtIn
|
|
115
|
+
);
|
|
116
|
+
for (const custom of customTypes) {
|
|
117
|
+
if (!this.builtInTypes.some((b) => b.name === custom.name)) {
|
|
118
|
+
mergedTypes.push(custom);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return mergedTypes;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const globalRegistry = new NuGridCellTypeRegistry();
|
|
125
|
+
export function useNuGridCellTypeRegistry(customTypes) {
|
|
126
|
+
const registry = globalRegistry;
|
|
127
|
+
const customTypeMap = computed(() => {
|
|
128
|
+
if (!customTypes?.value) return null;
|
|
129
|
+
return new Map(customTypes.value.map((t) => [t.name, t]));
|
|
130
|
+
});
|
|
131
|
+
const cellTypes = computed(() => {
|
|
132
|
+
if (customTypes?.value) {
|
|
133
|
+
return registry.mergeCellTypes(customTypes.value);
|
|
134
|
+
}
|
|
135
|
+
return registry.getAll();
|
|
136
|
+
});
|
|
137
|
+
const getCellType = (name) => {
|
|
138
|
+
const customMap = customTypeMap.value;
|
|
139
|
+
if (customMap) {
|
|
140
|
+
const custom = customMap.get(name);
|
|
141
|
+
if (custom) return custom;
|
|
142
|
+
}
|
|
143
|
+
return registry.get(name);
|
|
144
|
+
};
|
|
145
|
+
const getDefaultEditor = (cellDataType) => {
|
|
146
|
+
return registry.getEditor(cellDataType);
|
|
147
|
+
};
|
|
148
|
+
const getRenderer = (cellDataType) => {
|
|
149
|
+
return registry.getRenderer(cellDataType);
|
|
150
|
+
};
|
|
151
|
+
const getFilter = (cellDataType) => {
|
|
152
|
+
const cellType = getCellType(cellDataType);
|
|
153
|
+
return cellType?.filter;
|
|
154
|
+
};
|
|
155
|
+
const getFilterFn = (cellDataType) => {
|
|
156
|
+
const cellType = getCellType(cellDataType);
|
|
157
|
+
return cellType?.filterFn;
|
|
158
|
+
};
|
|
159
|
+
const getKeyboardHandler = (cellDataType) => {
|
|
160
|
+
const cellType = getCellType(cellDataType);
|
|
161
|
+
return cellType?.keyboardHandler;
|
|
162
|
+
};
|
|
163
|
+
const getValidation = (cellDataType) => {
|
|
164
|
+
const cellType = getCellType(cellDataType);
|
|
165
|
+
return cellType?.validation;
|
|
166
|
+
};
|
|
167
|
+
const getFormatter = (cellDataType) => {
|
|
168
|
+
const cellType = getCellType(cellDataType);
|
|
169
|
+
return cellType?.formatter;
|
|
170
|
+
};
|
|
171
|
+
const getColumnMenuItems = (cellDataType) => {
|
|
172
|
+
const cellType = getCellType(cellDataType);
|
|
173
|
+
return cellType?.columnMenuItems;
|
|
174
|
+
};
|
|
175
|
+
const getDefaultCellRenderer = (cellDataType) => {
|
|
176
|
+
const cellType = getCellType(cellDataType);
|
|
177
|
+
return cellType?.defaultCellRenderer;
|
|
178
|
+
};
|
|
179
|
+
const isFilteringEnabled = (cellDataType) => {
|
|
180
|
+
const cellType = getCellType(cellDataType);
|
|
181
|
+
if (cellType?.enableFiltering !== void 0) {
|
|
182
|
+
return cellType.enableFiltering;
|
|
183
|
+
}
|
|
184
|
+
return !!cellType?.filter;
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
187
|
+
registry,
|
|
188
|
+
cellTypes,
|
|
189
|
+
getCellType,
|
|
190
|
+
getDefaultEditor,
|
|
191
|
+
getRenderer,
|
|
192
|
+
getFilter,
|
|
193
|
+
getFilterFn,
|
|
194
|
+
getKeyboardHandler,
|
|
195
|
+
getValidation,
|
|
196
|
+
getFormatter,
|
|
197
|
+
getColumnMenuItems,
|
|
198
|
+
getDefaultCellRenderer,
|
|
199
|
+
isFilteringEnabled
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export { globalRegistry as nuGridCellTypeRegistry };
|