@nocopypaste/vue-grid 0.0.0-stage → 0.2.0
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/AGENTS.md +285 -0
- package/CHANGELOG.md +31 -0
- package/README.md +881 -2
- package/agent/api.json +2336 -0
- package/agent/api.md +632 -0
- package/agent/grid-config.schema.json +609 -0
- package/dist/agent/api.js +2301 -0
- package/dist/agent/api.js.map +1 -0
- package/dist/agent/index.js +8 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/requirements.js +57 -0
- package/dist/agent/requirements.js.map +1 -0
- package/dist/agent/validate.js +181 -0
- package/dist/agent/validate.js.map +1 -0
- package/dist/base.css +1 -0
- package/dist/components/VGrid.js +6 -0
- package/dist/components/VGrid.js.map +1 -0
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +759 -0
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridCell.js +6 -0
- package/dist/components/VGridCell.js.map +1 -0
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +167 -0
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridCheckbox.js +6 -0
- package/dist/components/VGridCheckbox.js.map +1 -0
- package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridColumnMenu.js +6 -0
- package/dist/components/VGridColumnMenu.js.map +1 -0
- package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridFilterInput.js +6 -0
- package/dist/components/VGridFilterInput.js.map +1 -0
- package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +89 -0
- package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridFilterPanel.js +6 -0
- package/dist/components/VGridFilterPanel.js.map +1 -0
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +248 -0
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridFilterPopover.js +6 -0
- package/dist/components/VGridFilterPopover.js.map +1 -0
- package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridGroupRow.js +6 -0
- package/dist/components/VGridGroupRow.js.map +1 -0
- package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridHeader.js +6 -0
- package/dist/components/VGridHeader.js.map +1 -0
- package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridMenu.js +6 -0
- package/dist/components/VGridMenu.js.map +1 -0
- package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +133 -0
- package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridPagination.js +6 -0
- package/dist/components/VGridPagination.js.map +1 -0
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +102 -0
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridPinnedRows.js +6 -0
- package/dist/components/VGridPinnedRows.js.map +1 -0
- package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridResizeHandle.js +6 -0
- package/dist/components/VGridResizeHandle.js.map +1 -0
- package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridRows.js +6 -0
- package/dist/components/VGridRows.js.map +1 -0
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +178 -0
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridSearch.js +6 -0
- package/dist/components/VGridSearch.js.map +1 -0
- package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridTotalCell.js +6 -0
- package/dist/components/VGridTotalCell.js.map +1 -0
- package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composables/useColumnDrag.js +79 -0
- package/dist/composables/useColumnDrag.js.map +1 -0
- package/dist/composables/useColumnResize.js +68 -0
- package/dist/composables/useColumnResize.js.map +1 -0
- package/dist/composables/useDataSource.js +47 -0
- package/dist/composables/useDataSource.js.map +1 -0
- package/dist/composables/useGridFilters.js +125 -0
- package/dist/composables/useGridFilters.js.map +1 -0
- package/dist/composables/useGridKeyboard.js +111 -0
- package/dist/composables/useGridKeyboard.js.map +1 -0
- package/dist/composables/useGridMenus.js +214 -0
- package/dist/composables/useGridMenus.js.map +1 -0
- package/dist/composables/useGridSelection.js +75 -0
- package/dist/composables/useGridSelection.js.map +1 -0
- package/dist/composables/usePinnedOffsets.js +61 -0
- package/dist/composables/usePinnedOffsets.js.map +1 -0
- package/dist/composables/usePinnedRows.js +58 -0
- package/dist/composables/usePinnedRows.js.map +1 -0
- package/dist/composables/useScrollEdges.js +27 -0
- package/dist/composables/useScrollEdges.js.map +1 -0
- package/dist/composables/useSubRows.js +101 -0
- package/dist/composables/useSubRows.js.map +1 -0
- package/dist/composables/useTotals.js +30 -0
- package/dist/composables/useTotals.js.map +1 -0
- package/dist/composables/useVirtualRows.js +160 -0
- package/dist/composables/useVirtualRows.js.map +1 -0
- package/dist/core/aggregate.js +39 -0
- package/dist/core/aggregate.js.map +1 -0
- package/dist/core/columns.js +106 -0
- package/dist/core/columns.js.map +1 -0
- package/dist/core/filter.js +218 -0
- package/dist/core/filter.js.map +1 -0
- package/dist/core/helpers.js +7 -0
- package/dist/core/helpers.js.map +1 -0
- package/dist/core/pagination.js +25 -0
- package/dist/core/pagination.js.map +1 -0
- package/dist/core/patch.js +41 -0
- package/dist/core/patch.js.map +1 -0
- package/dist/core/selection.js +15 -0
- package/dist/core/selection.js.map +1 -0
- package/dist/core/sort.js +36 -0
- package/dist/core/sort.js.map +1 -0
- package/dist/core/storage.js +36 -0
- package/dist/core/storage.js.map +1 -0
- package/dist/core/value.js +19 -0
- package/dist/core/value.js.map +1 -0
- package/dist/core/virtual.js +83 -0
- package/dist/core/virtual.js.map +1 -0
- package/dist/core.css +1 -0
- package/dist/features/aggregation.js +11 -0
- package/dist/features/aggregation.js.map +1 -0
- package/dist/features/columnGroups.js +9 -0
- package/dist/features/columnGroups.js.map +1 -0
- package/dist/features/columnPinning.js +11 -0
- package/dist/features/columnPinning.js.map +1 -0
- package/dist/features/columnReorder.js +12 -0
- package/dist/features/columnReorder.js.map +1 -0
- package/dist/features/columnResizing.js +11 -0
- package/dist/features/columnResizing.js.map +1 -0
- package/dist/features/columnVisibility.js +9 -0
- package/dist/features/columnVisibility.js.map +1 -0
- package/dist/features/filtering.js +13 -0
- package/dist/features/filtering.js.map +1 -0
- package/dist/features/index.js +38 -0
- package/dist/features/index.js.map +1 -0
- package/dist/features/keyboardNavigation.js +9 -0
- package/dist/features/keyboardNavigation.js.map +1 -0
- package/dist/features/menus.js +11 -0
- package/dist/features/menus.js.map +1 -0
- package/dist/features/pagination.js +9 -0
- package/dist/features/pagination.js.map +1 -0
- package/dist/features/rowPinning.js +11 -0
- package/dist/features/rowPinning.js.map +1 -0
- package/dist/features/selection.js +11 -0
- package/dist/features/selection.js.map +1 -0
- package/dist/features/serverData.js +9 -0
- package/dist/features/serverData.js.map +1 -0
- package/dist/features/sorting.js +9 -0
- package/dist/features/sorting.js.map +1 -0
- package/dist/features/subGrids.js +9 -0
- package/dist/features/subGrids.js.map +1 -0
- package/dist/features/virtualScrolling.js +9 -0
- package/dist/features/virtualScrolling.js.map +1 -0
- package/dist/index.js +67 -0
- package/dist/internal/RenderSlot.js +6 -0
- package/dist/internal/RenderSlot.js.map +1 -0
- package/dist/internal/anchor.js +41 -0
- package/dist/internal/anchor.js.map +1 -0
- package/dist/internal/clipboard.js +11 -0
- package/dist/internal/clipboard.js.map +1 -0
- package/dist/internal/context.js +11 -0
- package/dist/internal/context.js.map +1 -0
- package/dist/internal/dev.js +8 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/features.js +9 -0
- package/dist/internal/features.js.map +1 -0
- package/dist/internal/supports.js +10 -0
- package/dist/internal/supports.js.map +1 -0
- package/dist/internal/touchHold.js +43 -0
- package/dist/internal/touchHold.js.map +1 -0
- package/dist/registry/plugin.js +25 -0
- package/dist/registry/plugin.js.map +1 -0
- package/dist/registry/registry.js +15 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/renderers/ActionButtonCell.js +6 -0
- package/dist/renderers/ActionButtonCell.js.map +1 -0
- package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ActionsMenuCell.js +6 -0
- package/dist/renderers/ActionsMenuCell.js.map +1 -0
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/BooleanCell.js +6 -0
- package/dist/renderers/BooleanCell.js.map +1 -0
- package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ButtonGroupCell.js +6 -0
- package/dist/renderers/ButtonGroupCell.js.map +1 -0
- package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ChangeCell.js +6 -0
- package/dist/renderers/ChangeCell.js.map +1 -0
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/CheckboxCell.js +6 -0
- package/dist/renderers/CheckboxCell.js.map +1 -0
- package/dist/renderers/CheckboxCell.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/renderers/CheckboxCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ChipCell.js +6 -0
- package/dist/renderers/ChipCell.js.map +1 -0
- package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/CodeCell.js +6 -0
- package/dist/renderers/CodeCell.js.map +1 -0
- package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/CopyCell.js +6 -0
- package/dist/renderers/CopyCell.js.map +1 -0
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/CurrencyCell.js +6 -0
- package/dist/renderers/CurrencyCell.js.map +1 -0
- package/dist/renderers/CurrencyCell.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/renderers/CurrencyCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/DateCell.js +6 -0
- package/dist/renderers/DateCell.js.map +1 -0
- package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/DateTimeCell.js +6 -0
- package/dist/renderers/DateTimeCell.js.map +1 -0
- package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/DetailsCell.js +6 -0
- package/dist/renderers/DetailsCell.js.map +1 -0
- package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/EditCell.js +6 -0
- package/dist/renderers/EditCell.js.map +1 -0
- package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/IconCell.js +6 -0
- package/dist/renderers/IconCell.js.map +1 -0
- package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/IconToggleCell.js +6 -0
- package/dist/renderers/IconToggleCell.js.map +1 -0
- package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ImageCell.js +6 -0
- package/dist/renderers/ImageCell.js.map +1 -0
- package/dist/renderers/ImageCell.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/renderers/ImageCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/JsonCell.js +6 -0
- package/dist/renderers/JsonCell.js.map +1 -0
- package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/JsonTreeCell.js +6 -0
- package/dist/renderers/JsonTreeCell.js.map +1 -0
- package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/JsonTreeNode.js +6 -0
- package/dist/renderers/JsonTreeNode.js.map +1 -0
- package/dist/renderers/JsonTreeNode.vue_vue_type_script_setup_true_lang.js +80 -0
- package/dist/renderers/JsonTreeNode.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/LinkCell.js +6 -0
- package/dist/renderers/LinkCell.js.map +1 -0
- package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ListCell.js +6 -0
- package/dist/renderers/ListCell.js.map +1 -0
- package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/MultiLineCell.js +6 -0
- package/dist/renderers/MultiLineCell.js.map +1 -0
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +102 -0
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/NumberCell.js +6 -0
- package/dist/renderers/NumberCell.js.map +1 -0
- package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/RadioCell.js +6 -0
- package/dist/renderers/RadioCell.js.map +1 -0
- package/dist/renderers/RadioCell.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/renderers/RadioCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/StatusCell.js +6 -0
- package/dist/renderers/StatusCell.js.map +1 -0
- package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/SwitchCell.js +6 -0
- package/dist/renderers/SwitchCell.js.map +1 -0
- package/dist/renderers/SwitchCell.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/renderers/SwitchCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/TextCell.js +6 -0
- package/dist/renderers/TextCell.js.map +1 -0
- package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/ToggleTextCell.js +6 -0
- package/dist/renderers/ToggleTextCell.js.map +1 -0
- package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/format.js +142 -0
- package/dist/renderers/format.js.map +1 -0
- package/dist/renderers/index.js +188 -0
- package/dist/renderers/index.js.map +1 -0
- package/dist/renderers/options.js +17 -0
- package/dist/renderers/options.js.map +1 -0
- package/dist/renderers/parts/CopyButton.js +6 -0
- package/dist/renderers/parts/CopyButton.js.map +1 -0
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/parts/NumberValue.js +6 -0
- package/dist/renderers/parts/NumberValue.js.map +1 -0
- package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/parts/ValueBadge.js +6 -0
- package/dist/renderers/parts/ValueBadge.js.map +1 -0
- package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/renderers/parts/icons.js +27 -0
- package/dist/renderers/parts/icons.js.map +1 -0
- package/dist/renderers/parts/routerLink.js +9 -0
- package/dist/renderers/parts/routerLink.js.map +1 -0
- package/dist/renderers/parts/useToggleControl.js +15 -0
- package/dist/renderers/parts/useToggleControl.js.map +1 -0
- package/dist/renderers/text.js +10 -0
- package/dist/renderers/text.js.map +1 -0
- package/dist/renderers.css +1 -0
- package/dist/theme.css +1 -0
- package/dist/types/agent/index.d.ts +50 -0
- package/dist/types/agent/requirements.d.ts +17 -0
- package/dist/types/agent/validate.d.ts +33 -0
- package/dist/types/components/VGrid.vue.d.ts +205 -0
- package/dist/types/components/VGridCell.vue.d.ts +19 -0
- package/dist/types/components/VGridCheckbox.vue.d.ts +14 -0
- package/dist/types/components/VGridColumnMenu.vue.d.ts +22 -0
- package/dist/types/components/VGridFilterInput.vue.d.ts +17 -0
- package/dist/types/components/VGridFilterPanel.vue.d.ts +20 -0
- package/dist/types/components/VGridFilterPopover.vue.d.ts +12 -0
- package/dist/types/components/VGridGroupRow.vue.d.ts +3 -0
- package/dist/types/components/VGridHeader.vue.d.ts +26 -0
- package/dist/types/components/VGridMenu.vue.d.ts +42 -0
- package/dist/types/components/VGridPagination.vue.d.ts +27 -0
- package/dist/types/components/VGridPinnedRows.vue.d.ts +15 -0
- package/dist/types/components/VGridResizeHandle.vue.d.ts +8 -0
- package/dist/types/components/VGridRows.vue.d.ts +28 -0
- package/dist/types/components/VGridSearch.vue.d.ts +22 -0
- package/dist/types/components/VGridTotalCell.vue.d.ts +13 -0
- package/dist/types/composables/useColumnDrag.d.ts +26 -0
- package/dist/types/composables/useColumnResize.d.ts +29 -0
- package/dist/types/composables/useDataSource.d.ts +39 -0
- package/dist/types/composables/useGridFilters.d.ts +45 -0
- package/dist/types/composables/useGridKeyboard.d.ts +16 -0
- package/dist/types/composables/useGridMenus.d.ts +55 -0
- package/dist/types/composables/useGridSelection.d.ts +27 -0
- package/dist/types/composables/usePinnedOffsets.d.ts +22 -0
- package/dist/types/composables/usePinnedRows.d.ts +26 -0
- package/dist/types/composables/useScrollEdges.d.ts +8 -0
- package/dist/types/composables/useSubRows.d.ts +38 -0
- package/dist/types/composables/useTotals.d.ts +17 -0
- package/dist/types/composables/useVirtualRows.d.ts +72 -0
- package/dist/types/core/aggregate.d.ts +9 -0
- package/dist/types/core/columns.d.ts +35 -0
- package/dist/types/core/filter.d.ts +85 -0
- package/dist/types/core/helpers.d.ts +3 -0
- package/dist/types/core/pagination.d.ts +3 -0
- package/dist/types/core/patch.d.ts +23 -0
- package/dist/types/core/selection.d.ts +8 -0
- package/dist/types/core/sort.d.ts +10 -0
- package/dist/types/core/storage.d.ts +6 -0
- package/dist/types/core/value.d.ts +6 -0
- package/dist/types/core/virtual.d.ts +72 -0
- package/dist/types/features/aggregation.d.ts +8 -0
- package/dist/types/features/columnGroups.d.ts +7 -0
- package/dist/types/features/columnPinning.d.ts +7 -0
- package/dist/types/features/columnReorder.d.ts +7 -0
- package/dist/types/features/columnResizing.d.ts +8 -0
- package/dist/types/features/columnVisibility.d.ts +7 -0
- package/dist/types/features/filtering.d.ts +7 -0
- package/dist/types/features/index.d.ts +20 -0
- package/dist/types/features/keyboardNavigation.d.ts +10 -0
- package/dist/types/features/menus.d.ts +8 -0
- package/dist/types/features/pagination.d.ts +8 -0
- package/dist/types/features/rowPinning.d.ts +8 -0
- package/dist/types/features/selection.d.ts +6 -0
- package/dist/types/features/serverData.d.ts +6 -0
- package/dist/types/features/sorting.d.ts +6 -0
- package/dist/types/features/subGrids.d.ts +6 -0
- package/dist/types/features/virtualScrolling.d.ts +8 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/internal/RenderSlot.d.ts +6 -0
- package/dist/types/internal/anchor.d.ts +18 -0
- package/dist/types/internal/clipboard.d.ts +2 -0
- package/dist/types/internal/context.d.ts +123 -0
- package/dist/types/internal/dev.d.ts +1 -0
- package/dist/types/internal/features.d.ts +22 -0
- package/dist/types/internal/supports.d.ts +11 -0
- package/dist/types/internal/touchHold.d.ts +19 -0
- package/dist/types/registry/plugin.d.ts +18 -0
- package/dist/types/registry/registry.d.ts +18 -0
- package/dist/types/renderers/ActionButtonCell.vue.d.ts +10 -0
- package/dist/types/renderers/ActionsMenuCell.vue.d.ts +10 -0
- package/dist/types/renderers/BooleanCell.vue.d.ts +6 -0
- package/dist/types/renderers/ButtonGroupCell.vue.d.ts +10 -0
- package/dist/types/renderers/ChangeCell.vue.d.ts +6 -0
- package/dist/types/renderers/CheckboxCell.vue.d.ts +10 -0
- package/dist/types/renderers/ChipCell.vue.d.ts +6 -0
- package/dist/types/renderers/CodeCell.vue.d.ts +6 -0
- package/dist/types/renderers/CopyCell.vue.d.ts +10 -0
- package/dist/types/renderers/CurrencyCell.vue.d.ts +10 -0
- package/dist/types/renderers/DateCell.vue.d.ts +6 -0
- package/dist/types/renderers/DateTimeCell.vue.d.ts +6 -0
- package/dist/types/renderers/DetailsCell.vue.d.ts +6 -0
- package/dist/types/renderers/EditCell.vue.d.ts +10 -0
- package/dist/types/renderers/IconCell.vue.d.ts +6 -0
- package/dist/types/renderers/IconToggleCell.vue.d.ts +10 -0
- package/dist/types/renderers/ImageCell.vue.d.ts +6 -0
- package/dist/types/renderers/JsonCell.vue.d.ts +6 -0
- package/dist/types/renderers/JsonTreeCell.vue.d.ts +6 -0
- package/dist/types/renderers/JsonTreeNode.vue.d.ts +14 -0
- package/dist/types/renderers/LinkCell.vue.d.ts +10 -0
- package/dist/types/renderers/ListCell.vue.d.ts +10 -0
- package/dist/types/renderers/MultiLineCell.vue.d.ts +10 -0
- package/dist/types/renderers/NumberCell.vue.d.ts +12 -0
- package/dist/types/renderers/RadioCell.vue.d.ts +10 -0
- package/dist/types/renderers/StatusCell.vue.d.ts +10 -0
- package/dist/types/renderers/SwitchCell.vue.d.ts +10 -0
- package/dist/types/renderers/TextCell.vue.d.ts +10 -0
- package/dist/types/renderers/ToggleTextCell.vue.d.ts +10 -0
- package/dist/types/renderers/format.d.ts +27 -0
- package/dist/types/renderers/index.d.ts +132 -0
- package/dist/types/renderers/options.d.ts +325 -0
- package/dist/types/renderers/parts/CopyButton.vue.d.ts +16 -0
- package/dist/types/renderers/parts/NumberValue.vue.d.ts +12 -0
- package/dist/types/renderers/parts/ValueBadge.vue.d.ts +7 -0
- package/dist/types/renderers/parts/icons.d.ts +21 -0
- package/dist/types/renderers/parts/routerLink.d.ts +7 -0
- package/dist/types/renderers/parts/useToggleControl.d.ts +12 -0
- package/dist/types/renderers/text.d.ts +3 -0
- package/dist/types/types.d.ts +383 -0
- package/dist/vue-grid.css +1 -0
- package/llms-full.txt +1806 -0
- package/llms.txt +23 -0
- package/package.json +74 -4
package/README.md
CHANGED
|
@@ -1,3 +1,882 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nocopypaste/vue-grid
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A data grid for Vue 3 built on **CSS Grid** — with real `subgrid` sub-rows, pinned columns, column
|
|
4
|
+
reorder/visibility with persistence, selection, virtual scrolling, pagination, a pluggable
|
|
5
|
+
**cell-renderer registry** for 3rd-party addons, and a theme you customise with **CSS variables**.
|
|
6
|
+
|
|
7
|
+
- Vue `^3.5` peer dependency, zero runtime dependencies, fully typed (`<VGrid generic="T">`).
|
|
8
|
+
- Plain CSS in `@layer vue-grid` — your CSS / Tailwind utilities override it without `!important`.
|
|
9
|
+
Published minified (Lightning CSS, no transpiling).
|
|
10
|
+
- Built for big data: virtual scrolling with sub-grids and detail rows, cell-level partial updates,
|
|
11
|
+
a GPU-animated change highlight — see [Performance](#performance).
|
|
12
|
+
- Safe with untrusted row data: no `v-html` / `innerHTML` anywhere. Link renderers allow only
|
|
13
|
+
http(s), mailto and tel, and URLs are checked after the cleanup browsers apply (so `java\tscript:`
|
|
14
|
+
is caught). Value maps ignore inherited keys, and saved state is validated.
|
|
15
|
+
|
|
16
|
+
**New here? Start with the [examples cookbook](../../docs/examples.md)** — runnable snippets for every
|
|
17
|
+
feature. This README is the API reference.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm i @nocopypaste/vue-grid
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The package is built for a bundler (Vite, webpack, Rollup, esbuild, or a framework built on one),
|
|
26
|
+
like Vue's own `esm-bundler` build. Dev-only warnings are wrapped in
|
|
27
|
+
`process.env.NODE_ENV !== 'production'`, which the bundler replaces, so they disappear from
|
|
28
|
+
production builds. Loading the files straight in a browser (an import map or CDN `<script>`, no
|
|
29
|
+
build step) throws `process is not defined`. If you must do that, define it first:
|
|
30
|
+
`<script>window.process = { env: { NODE_ENV: 'production' } }</script>`.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
// main.ts
|
|
34
|
+
import { createApp } from 'vue'
|
|
35
|
+
import { createVueGrid } from '@nocopypaste/vue-grid'
|
|
36
|
+
import '@nocopypaste/vue-grid/style.css'
|
|
37
|
+
|
|
38
|
+
createApp(App)
|
|
39
|
+
.use(createVueGrid({ locale: 'en-US', currency: 'EUR' })) // optional: app-wide defaults
|
|
40
|
+
.mount('#app')
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref } from 'vue'
|
|
48
|
+
import {
|
|
49
|
+
VGrid,
|
|
50
|
+
createColumnHelper,
|
|
51
|
+
currencyRenderer,
|
|
52
|
+
dateTimeRenderer,
|
|
53
|
+
numberRenderer,
|
|
54
|
+
columnPinningFeature,
|
|
55
|
+
sortingFeature,
|
|
56
|
+
statusRenderer,
|
|
57
|
+
type SortState,
|
|
58
|
+
} from '@nocopypaste/vue-grid'
|
|
59
|
+
|
|
60
|
+
interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
|
|
61
|
+
|
|
62
|
+
const rows = ref<Order[]>([/* … */])
|
|
63
|
+
const sort = ref<SortState | null>(null)
|
|
64
|
+
|
|
65
|
+
const col = createColumnHelper<Order>()
|
|
66
|
+
const columns = [
|
|
67
|
+
col({ key: 'id', header: '#', renderer: numberRenderer, width: 'min-content', pinned: 'left' }),
|
|
68
|
+
col({ key: 'customer', header: 'Customer', field: 'customer.name', sortable: true, width: 'minmax(10rem, 1fr)' }),
|
|
69
|
+
col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
|
|
70
|
+
col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
|
|
71
|
+
col({ key: 'placedAt', header: 'Placed', renderer: dateTimeRenderer }),
|
|
72
|
+
]
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<VGrid
|
|
77
|
+
v-model:sort="sort"
|
|
78
|
+
:rows="rows"
|
|
79
|
+
:columns="columns"
|
|
80
|
+
row-key="id"
|
|
81
|
+
:features="[sortingFeature, columnPinningFeature]"
|
|
82
|
+
sort-mode="client"
|
|
83
|
+
style="height: 480px"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`createColumnHelper<T>()` is optional; it types each column's `rendererOptions` from its renderer.
|
|
89
|
+
|
|
90
|
+
## Features: everything optional
|
|
91
|
+
|
|
92
|
+
Out of the box `<VGrid>` is a plain, read-only table: columns with any renderer and any width,
|
|
93
|
+
saved column state (`storage`), detail rows, tabbable controls and theming. Everything else is
|
|
94
|
+
an opt-in feature:
|
|
95
|
+
|
|
96
|
+
| Feature | Turns on |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
|
|
99
|
+
| `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
|
|
100
|
+
| `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
|
|
101
|
+
| `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
|
|
102
|
+
| `selectionFeature` | `selectable` (multi or single), `v-model:selected`, `selection-mode`, `is-row-selectable`, select-all, Space to select |
|
|
103
|
+
| `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
|
|
104
|
+
| `menusFeature` | The header right-click menu (`header-menu`) and body-cell menus (`context-menu`); without it the browser's menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it |
|
|
105
|
+
| `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
|
|
106
|
+
| `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored |
|
|
107
|
+
| `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
|
|
108
|
+
| `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
|
|
109
|
+
| `keyboardNavigationFeature` | The ARIA grid pattern: one Tab stop, arrow keys / Home / End / PageUp / PageDown between cells, Enter, Space to select, →/← to expand, Alt+←/→ to move a column. Without it the grid is an ARIA `table` with its controls in the Tab order |
|
|
110
|
+
| `columnResizingFeature` | Drag a header edge to resize (mouse, pen, touch), double-click it to fit the content, ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation); `minWidth` / `maxWidth` bound it, `resizable: false` opts out; widths in `columnState.widths`, persisted with `storage`; Fit width / Reset width in the header menu |
|
|
111
|
+
| `columnGroupsFeature` | Grouped column headers: columns with the same `group` share a header cell in a sticky row above theirs; groups follow reordering, hiding, resizing and pinning (a pin boundary splits a group) |
|
|
112
|
+
| `rowPinningFeature` | `v-model:pinned-rows` / `pinRow()`: rows that stay in view above or below the body, plus `pinned-top-rows` / `pinned-bottom-rows` for rows that aren't in the data |
|
|
113
|
+
| `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// per grid
|
|
117
|
+
<VGrid :features="[sortingFeature, filteringFeature]" … />
|
|
118
|
+
|
|
119
|
+
// or for every grid in the app (merged with each grid's own list)
|
|
120
|
+
app.use(createVueGrid({ features: [sortingFeature, filteringFeature] }))
|
|
121
|
+
app.use(createVueGrid({ features: allFeatures })) // all of them
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Only the features you import reach your bundle. Without its feature, an option does nothing:
|
|
125
|
+
a `sortable` column is a plain header and `data-source` is never called. In development a warning
|
|
126
|
+
names the feature to add. A grid reads `features` once, when it is created; to change them,
|
|
127
|
+
re-create it (for example with a `:key`).
|
|
128
|
+
|
|
129
|
+
## Tree-shaking: import only what you use
|
|
130
|
+
|
|
131
|
+
The package is ESM, one file per module, with `sideEffects` limited to CSS — bundlers keep only
|
|
132
|
+
what you import.
|
|
133
|
+
|
|
134
|
+
- **Features are opt-in** (see above).
|
|
135
|
+
- **Renderers are opt-in.** `<VGrid>` bundles just the default `text` renderer. Use others either
|
|
136
|
+
- **per column** (recommended, smallest bundle, typed options): `renderer: currencyRenderer`, or
|
|
137
|
+
- **by name**, after registering them: `createVueGrid({ renderers: [currencyRenderer, statusRenderer] })`
|
|
138
|
+
or `<VGrid :renderers="[…]">`, then `renderer: 'currency'`. `allRenderers` registers every built-in.
|
|
139
|
+
An unregistered name renders as plain text and logs a dev warning saying how to register it.
|
|
140
|
+
- **Components and helpers** (`VGridPagination`, `VGridColumnMenu`, `VGridMenu`, `sortRows`, …) are
|
|
141
|
+
only bundled when imported.
|
|
142
|
+
- **CSS**: `@nocopypaste/vue-grid/style.css` has everything. Pick parts instead:
|
|
143
|
+
|
|
144
|
+
| File | What | gzip |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
|
|
147
|
+
| `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.2 kB |
|
|
148
|
+
| `core.css` | `base.css` + `theme.css` | 5.0 kB |
|
|
149
|
+
| `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
|
|
150
|
+
| `style.css` | All of the above | 6.5 kB |
|
|
151
|
+
|
|
152
|
+
For a fully custom look, import only `base.css` (and `renderers.css` if you use renderers)
|
|
153
|
+
and style the `.vg-*` classes yourself. See [Theming](#theming).
|
|
154
|
+
|
|
155
|
+
| Import (minified / gzip, Vue excluded) | Initial chunk |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `VGrid` (no features) | 37.2 kB / 13.2 kB |
|
|
158
|
+
| `VGrid` + `sortingFeature` | 38.0 kB / 13.5 kB |
|
|
159
|
+
| `VGrid` + `filteringFeature` | 40.9 kB / 14.5 kB |
|
|
160
|
+
| `VGrid` + `serverDataFeature` | 38.6 kB / 13.8 kB |
|
|
161
|
+
| `VGrid` + `paginationFeature` | 37.4 kB / 13.2 kB |
|
|
162
|
+
| `VGrid` + `selectionFeature` | 39.6 kB / 14.0 kB |
|
|
163
|
+
| `VGrid` + `subGridsFeature` | 39.5 kB / 14.0 kB |
|
|
164
|
+
| `VGrid` + `menusFeature` | 47.7 kB / 16.8 kB |
|
|
165
|
+
| `VGrid` + `columnReorderFeature` | 40.9 kB / 14.5 kB |
|
|
166
|
+
| `VGrid` + `columnPinningFeature` | 39.5 kB / 14.1 kB |
|
|
167
|
+
| `VGrid` + `virtualScrollingFeature` | 43.0 kB / 15.5 kB |
|
|
168
|
+
| `VGrid` + `columnVisibilityFeature` | 37.4 kB / 13.2 kB |
|
|
169
|
+
| `VGrid` + `keyboardNavigationFeature` | 39.6 kB / 14.0 kB |
|
|
170
|
+
| `VGrid` + `columnResizingFeature` | 40.1 kB / 14.3 kB |
|
|
171
|
+
| `VGrid` + `columnGroupsFeature` | 38.8 kB / 13.8 kB |
|
|
172
|
+
| `VGrid` + `rowPinningFeature` | 42.4 kB / 14.7 kB |
|
|
173
|
+
| `VGrid` + `aggregationFeature` | 42.7 kB / 14.8 kB |
|
|
174
|
+
| `VGrid` + `allFeatures` + `VGridSearch` | 81.0 kB / 28.1 kB |
|
|
175
|
+
| `VGrid` + `currencyRenderer` | 38.5 kB / 13.6 kB |
|
|
176
|
+
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 41.6 kB / 14.7 kB |
|
|
177
|
+
| `sortRows` only | 0.7 kB / 0.5 kB |
|
|
178
|
+
| everything | 124.1 kB / 40.4 kB |
|
|
179
|
+
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 57.5 kB / 15.4 kB |
|
|
180
|
+
|
|
181
|
+
With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
|
|
182
|
+
chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
183
|
+
`paginationFeature`, the pager is one too. Measured with esbuild (`--bundle --minify --splitting`,
|
|
184
|
+
`process.env.NODE_ENV` set to `production`, which also drops the dev warnings).
|
|
185
|
+
|
|
186
|
+
## `<VGrid>` API
|
|
187
|
+
|
|
188
|
+
### Props
|
|
189
|
+
|
|
190
|
+
| Prop | Type | Default | |
|
|
191
|
+
|---|---|---|---|
|
|
192
|
+
| `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
|
|
193
|
+
| `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
|
|
194
|
+
| `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | — | Server rows: the grid calls it whenever sort, filters or page change. Needs `serverDataFeature`. See [Server data](#server-data). |
|
|
195
|
+
| `columns` | `ColumnDef<T>[]` | — | See below. |
|
|
196
|
+
| `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
|
|
197
|
+
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
|
|
198
|
+
| `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
|
|
199
|
+
| `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
|
|
200
|
+
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
|
|
201
|
+
| `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
|
|
202
|
+
| `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
|
|
203
|
+
| `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a *Clear filters* button, when filters hide every row. |
|
|
204
|
+
| `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
|
|
205
|
+
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
|
|
206
|
+
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
|
|
207
|
+
| `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
|
|
208
|
+
| `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
|
|
209
|
+
| `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
|
|
210
|
+
| `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
|
|
211
|
+
| `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
|
|
212
|
+
| `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
|
|
213
|
+
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next three). |
|
|
214
|
+
| `v-model:selected` | `RowKey[]` | `[]` | |
|
|
215
|
+
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
|
|
216
|
+
| `isRowSelectable` | `(row) => boolean` | — | |
|
|
217
|
+
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
|
|
218
|
+
| `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null` | Top-level rows pinned above / below the body. Needs `rowPinningFeature` (as do the next two). See [Pinned rows and totals](#pinned-rows-and-totals). |
|
|
219
|
+
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
|
|
220
|
+
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
|
|
221
|
+
| `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
|
|
222
|
+
| `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
|
|
223
|
+
| `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
|
|
224
|
+
| `rowClass` | `(row, index) => ClassValue` | — | |
|
|
225
|
+
| `highlightedRows` | `RowKey[]` | — | |
|
|
226
|
+
| `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
|
|
227
|
+
| `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
|
|
228
|
+
| `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
|
|
229
|
+
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
|
|
230
|
+
| `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
|
|
231
|
+
| `emptyText` | `string` | `'No data to show.'` | |
|
|
232
|
+
| `ariaLabel` | `string` | — | |
|
|
233
|
+
| `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
|
|
234
|
+
| `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
|
|
235
|
+
| `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
|
|
236
|
+
|
|
237
|
+
### Events
|
|
238
|
+
|
|
239
|
+
`row-click(row, event)` · `cell-click({ row, rowKey, column, value, event })` (columns with `clickable: true`) ·
|
|
240
|
+
`cell-action({ name, payload, row, rowKey, column })` (from renderers) · `sub-rows-error({ row, error })` · `context-action({ name, item, row, rowKey, column, value })` · `header-action({ name, item, column })` ·
|
|
241
|
+
`query-change(query: GridQuery)` (sort + filters + page as one object, on mount and on every real change) ·
|
|
242
|
+
`load-error(error)` (a `dataSource` call failed) ·
|
|
243
|
+
plus the `update:*` events of every `v-model`.
|
|
244
|
+
|
|
245
|
+
Clicks on links, buttons and inputs inside a cell never trigger `row-click`.
|
|
246
|
+
|
|
247
|
+
### Slots
|
|
248
|
+
|
|
249
|
+
`cell-<key>` (`{ row, value, rowKey, rowIndex, depth, column }`) · `header-<key>` (`{ column }`) ·
|
|
250
|
+
`total-<key>` (`{ value, column }`, a cell of the totals row) · `detail` (`{ row, rowKey, depth }`) ·
|
|
251
|
+
`toolbar` (`{ columns, columnState, setColumnState, filters, setFilters, clearFilters, activeFilterCount }`) ·
|
|
252
|
+
`empty` · `loading` · `sub-rows-loading` (`{ row }`).
|
|
253
|
+
|
|
254
|
+
### Exposed methods
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
const grid = ref<VGridExposed>()
|
|
258
|
+
grid.value?.scrollToTop() / scrollToRow(key) / expandAll() / collapseAll() / setColumnState(state)
|
|
259
|
+
grid.value?.patchLoadedRows([{ id: 'c2', city: 'Niš' }]) // field updates for lazy children and dataSource rows
|
|
260
|
+
grid.value?.setFilters({ columns: { city: { type: 'text', op: 'contains', value: 'nis' } } })
|
|
261
|
+
grid.value?.clearFilters() / openFilter('city') / reload() // reload: re-run the dataSource query
|
|
262
|
+
grid.value?.reloadSubRows('c2') // forget lazily loaded children (of one row, or all): they load again
|
|
263
|
+
grid.value?.pinRow(42, 'top') // pin a row above the body ('bottom' below it, null to unpin): rowPinningFeature
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`reload()` also forgets lazily loaded children, as does passing a different `load-sub-rows`
|
|
267
|
+
function. With `selection-mode="cascade"`, children that load under a selected parent arrive
|
|
268
|
+
selected.
|
|
269
|
+
|
|
270
|
+
### Partial updates
|
|
271
|
+
|
|
272
|
+
Changing part of the data re-renders only what changed — the table is never rebuilt:
|
|
273
|
+
|
|
274
|
+
- **Reactive rows** (`reactive()` / `ref()`): assign the field — `row.city = 'Niš'` — and only that
|
|
275
|
+
cell re-renders.
|
|
276
|
+
- **Immutable rows** (e.g. a `shallowRef` holding a large list): replace the changed rows and keep
|
|
277
|
+
the others' identity. `patchRows(rows, patches, rowKey)` does exactly that for a batch of
|
|
278
|
+
patches by key; only the patched rows re-render, and a batch that changes nothing returns the
|
|
279
|
+
same array.
|
|
280
|
+
- **Lazily loaded children** live in the grid's cache: use `grid.patchLoadedRows(patches)`.
|
|
281
|
+
|
|
282
|
+
Mutating a field in place under a `shallowRef` is not observed — assign a new array (`patchRows`)
|
|
283
|
+
or use reactive rows.
|
|
284
|
+
|
|
285
|
+
**Change highlight.** `<VGrid flash>` briefly tints cells whose value changes (not on first render,
|
|
286
|
+
not when a re-fetched row has equal values); `flash="direction"` tints numbers green when they rise
|
|
287
|
+
and red when they fall. Columns override with `flash: false | true | 'direction'`. It's a CSS
|
|
288
|
+
animation — tune it with `--vg-flash-color`, `--vg-flash-up`, `--vg-flash-down`,
|
|
289
|
+
`--vg-flash-duration`. With `prefers-reduced-motion` the tint is held briefly instead of fading.
|
|
290
|
+
The tint is a `::after` layer under the cell's content that fades with `opacity`, which browsers
|
|
291
|
+
animate on the compositor (GPU): a busy live feed costs the main thread about a sixth of what a
|
|
292
|
+
`background-color` animation would.
|
|
293
|
+
|
|
294
|
+
### `ColumnDef<T>`
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
{
|
|
298
|
+
key: string // unique; used by sort, column state and slot names
|
|
299
|
+
header?: string; headerTooltip?: string
|
|
300
|
+
field?: string // dot path, defaults to key
|
|
301
|
+
value?: (row) => unknown // computed value, wins over field
|
|
302
|
+
renderer?: RendererDefinition | string | Component // currencyRenderer (tree-shakeable), a registered name, or a component; default text
|
|
303
|
+
rendererOptions?: object // typed from the renderer
|
|
304
|
+
width?: string // any grid track: 'auto' (default), '8rem', '1fr', 'minmax(8rem, 2fr)', 'min-content'
|
|
305
|
+
minWidth?: string // combined into minmax(minWidth, width); also the resize minimum
|
|
306
|
+
maxWidth?: string // resize maximum (columnResizingFeature)
|
|
307
|
+
resizable?: boolean // can the user resize it (columnResizingFeature, default true)
|
|
308
|
+
group?: string // header group label (columnGroupsFeature)
|
|
309
|
+
align?: 'start' | 'center' | 'end'
|
|
310
|
+
sortable?: boolean; sortValue?: (row) => unknown; sortFn?: (a, b) => number
|
|
311
|
+
pinned?: 'left' | 'right'; pinnable?: boolean // needs columnPinningFeature; pinnable: can the header menu change it (default true)
|
|
312
|
+
hidden?: boolean; hideable?: boolean // need columnVisibilityFeature
|
|
313
|
+
reorderable?: boolean // needs columnReorderFeature (default true)
|
|
314
|
+
clickable?: boolean
|
|
315
|
+
flash?: boolean | 'direction' // change highlight for this column (overrides the grid's `flash`)
|
|
316
|
+
filterable?: boolean // funnel button in the header (and an input in the filter row)
|
|
317
|
+
filter?: 'text' | 'number' | 'date' | 'boolean' | 'set'
|
|
318
|
+
| { type?, options?: FilterOption[] | ((search, { signal }) => Promise<FilterOption[]>), placeholder? }
|
|
319
|
+
filterValue?: (row) => unknown // value filters compare (default: the cell value)
|
|
320
|
+
filterFn?: (row, filter) => boolean // replaces the built-in matching for this column
|
|
321
|
+
filterComponent?: Component // custom popover body: props { modelValue, column }, emits update:modelValue
|
|
322
|
+
searchable?: boolean // included in the quick search (default true for visible columns)
|
|
323
|
+
aggregate?: 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values, rows) => unknown) // totals row (aggregationFeature)
|
|
324
|
+
cellClass?: ClassValue | ((row) => ClassValue); headerClass?: ClassValue
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Sub-grids (CSS `subgrid`)
|
|
329
|
+
|
|
330
|
+
```vue
|
|
331
|
+
<VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(row) => row.children" selectable />
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Expanded children render inside a `.vg-subgrid` element that spans every column and uses
|
|
335
|
+
`grid-template-columns: subgrid` — so each child cell sits exactly in its parent's column, at any
|
|
336
|
+
depth. Children reuse the parent's columns: reorder, hide and pin apply automatically. The first
|
|
337
|
+
column is indented per depth (`--vg-subgrid-indent`), rows get `aria-level`, the grid becomes a
|
|
338
|
+
`treegrid`. With `loadSubRows` children are fetched on first expand.
|
|
339
|
+
|
|
340
|
+
Need children with a **different** set of columns? Put another `<VGrid>` in the `#detail` slot.
|
|
341
|
+
|
|
342
|
+
## Column menu, reorder, persistence
|
|
343
|
+
|
|
344
|
+
```vue
|
|
345
|
+
<VGrid :rows :columns row-key="id" storage="orders-grid" :features="[columnVisibilityFeature, columnReorderFeature]">
|
|
346
|
+
<!-- the picker hides columns (columnVisibilityFeature); dragging headers needs columnReorderFeature -->
|
|
347
|
+
<template #toolbar="{ columnState, setColumnState }">
|
|
348
|
+
<VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
|
|
349
|
+
</template>
|
|
350
|
+
</VGrid>
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
With `columnReorderFeature`, drag a header to move it (mouse or pen; on a touch screen hold it for half a second first, see [Touch](#touch-phones-and-tablets)), or focus a header and press
|
|
354
|
+
**Alt+←/→**. Pinned columns only move within their pin group. Stored state is reconciled with the
|
|
355
|
+
current column definitions (unknown keys dropped, new columns appended).
|
|
356
|
+
|
|
357
|
+
## Context menus
|
|
358
|
+
|
|
359
|
+
Menus use the **Popover API** (top layer — never clipped by the grid's scroll container; Esc and
|
|
360
|
+
outside click close them) and **CSS anchor positioning** (`position-anchor` + `position-area` +
|
|
361
|
+
`position-try-fallbacks`): they flip to stay on screen and follow their anchor while the grid
|
|
362
|
+
scrolls. No JS positioning, except a small fallback for browsers without anchor positioning.
|
|
363
|
+
|
|
364
|
+
### Body cells
|
|
365
|
+
|
|
366
|
+
```vue
|
|
367
|
+
<VGrid
|
|
368
|
+
:rows :columns row-key="id"
|
|
369
|
+
:context-menu="({ row, column, value }) => column.key === 'link' ? [] : [
|
|
370
|
+
{ name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
|
|
371
|
+
{ name: 'open', label: `Open #${row.id}` },
|
|
372
|
+
{ separator: true },
|
|
373
|
+
{ name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
|
|
374
|
+
]"
|
|
375
|
+
@context-action="({ name, row, column, value }) => run(name, row)"
|
|
376
|
+
/>
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Right-click opens the menu at the pointer; the **ContextMenu** key or **Shift+F10** opens it under the
|
|
380
|
+
focused cell. Return `[]`/`null` to keep the browser's native menu for that cell. Items:
|
|
381
|
+
`{ name, label, disabled?, tone?, icon?, hint? }` or `{ separator: true }`. Arrow keys, Home/End and
|
|
382
|
+
typeahead move through items; focus returns to the cell on close.
|
|
383
|
+
|
|
384
|
+
### Column headers
|
|
385
|
+
|
|
386
|
+
Right-clicking a header opens a built-in menu: **Sort ascending / descending / Clear sort** (sortable
|
|
387
|
+
columns), **Pin left / Pin right / Unpin**, **Move left / right**, **Hide column**, **Reset columns**.
|
|
388
|
+
Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide column `columnVisibilityFeature`. Runtime pins are stored in column state (`columnState.pinned`) and persisted with `storage`.
|
|
389
|
+
|
|
390
|
+
```vue
|
|
391
|
+
<!-- extend (or replace) the built-in items; custom items emit header-action -->
|
|
392
|
+
<VGrid :header-menu="({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]"
|
|
393
|
+
@header-action="({ name, column }) => …" />
|
|
394
|
+
<VGrid :header-menu="false" /> <!-- off -->
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Columns opt out with `pinnable: false`, `reorderable: false`, `hideable: false`.
|
|
398
|
+
|
|
399
|
+
### `VGridMenu` for your own triggers
|
|
400
|
+
|
|
401
|
+
The same component powers the `actions-menu` renderer and is exported for add-ons:
|
|
402
|
+
|
|
403
|
+
```vue
|
|
404
|
+
<button popovertarget="row-menu" :style="{ 'anchor-name': '--row-menu' }">⋮</button>
|
|
405
|
+
<VGridMenu id="row-menu" anchor-name="--row-menu" :items="items" @select="(item) => …" />
|
|
406
|
+
<!-- or imperatively: menuRef.value.openAt(element | { x, y }) -->
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Filtering
|
|
410
|
+
|
|
411
|
+
```vue
|
|
412
|
+
<script setup lang="ts">
|
|
413
|
+
import { VGrid, VGridSearch, filteringFeature, numberRenderer, statusRenderer, type FilterState } from '@nocopypaste/vue-grid'
|
|
414
|
+
|
|
415
|
+
const filters = ref<FilterState | null>(null)
|
|
416
|
+
const columns = [
|
|
417
|
+
{ key: 'player', header: 'Player', filterable: true }, // text
|
|
418
|
+
{ key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
|
|
419
|
+
{ key: 'status', header: 'Status', filterable: true, renderer: statusRenderer },// value list
|
|
420
|
+
{ key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
|
|
421
|
+
]
|
|
422
|
+
</script>
|
|
423
|
+
|
|
424
|
+
<template>
|
|
425
|
+
<VGrid v-model:filters="filters" :rows :columns row-key="id" :features="[filteringFeature]"
|
|
426
|
+
filter-row filter-storage="bets-filters">
|
|
427
|
+
<template #toolbar="{ activeFilterCount, clearFilters }">
|
|
428
|
+
<VGridSearch />
|
|
429
|
+
<button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }} filters</button>
|
|
430
|
+
</template>
|
|
431
|
+
</VGrid>
|
|
432
|
+
</template>
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
- **Header funnel.** Each `filterable` column gets a funnel button. It is hidden until you hover the
|
|
436
|
+
header (on devices that can hover) and stays visible while a filter is active. It opens a
|
|
437
|
+
popover through the Popover API and CSS anchor positioning, and the popover holds an editor for
|
|
438
|
+
the column's type:
|
|
439
|
+
|
|
440
|
+
| Type | Editor | Operators |
|
|
441
|
+
|---|---|---|
|
|
442
|
+
| `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
|
|
443
|
+
| `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
|
|
444
|
+
| `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
|
|
445
|
+
| `boolean` | radio group | any, yes, no, empty |
|
|
446
|
+
| `set` | searchable checkbox list with counts | (the selected values) |
|
|
447
|
+
| `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
|
|
448
|
+
|
|
449
|
+
The type comes from `filter`, else from the renderer (number, currency, change → `number`;
|
|
450
|
+
date, datetime → `date`; boolean, checkbox, switch → `boolean`; status, chip → `set`), else
|
|
451
|
+
`text`.
|
|
452
|
+
- **Filter row** (`filter-row`). An inline input under each header that accepts shorthand:
|
|
453
|
+
`>10`, `>=10`, `5..20`, `-5..-1`, open ranges `5..` / `..20`, `!=3`, a decimal comma (`1,5`),
|
|
454
|
+
and `>2026-01-01` or `2026-01-01..2026-03-31` for dates; plain text for text columns. Input that
|
|
455
|
+
doesn't parse sets no filter. Boolean columns get a select; value-list and custom columns get a
|
|
456
|
+
button that opens the popover.
|
|
457
|
+
- **Quick search.** `<VGridSearch>` inside the `#toolbar` slot drives that grid's search. Anywhere
|
|
458
|
+
else, bind it with `v-model` to `filters.search`. The search matches any visible column that is
|
|
459
|
+
not marked `searchable: false`.
|
|
460
|
+
- **Matching** is case- and accent-insensitive (`nis` finds *Niš*). Dates compare by calendar day
|
|
461
|
+
in the grid's `timeZone`; a date-only string (`2026-01-05`) is that calendar day in every time
|
|
462
|
+
zone, for filtering and for the `date` renderer. Column filters combine with AND, and then the
|
|
463
|
+
search must match too. Saved filters for columns that no longer exist are ignored.
|
|
464
|
+
- **Long value lists** render their first 300 values; a search narrows the rest.
|
|
465
|
+
- **Trees.** A row shows when it matches, when a descendant matches (so the path stays visible), or
|
|
466
|
+
when an ancestor matched (so a matching group keeps its children). Select-all and cascade only
|
|
467
|
+
touch rows that are visible.
|
|
468
|
+
- **Value lists from a backend.** Pass `filter: { type: 'set', options: (search, { signal }) => fetch(…) }`.
|
|
469
|
+
The list is fetched when the popover opens and again on every search (debounced). Superseded
|
|
470
|
+
requests are cancelled.
|
|
471
|
+
- The header menu has **Filter… / Clear filter / Clear all filters** items. When filters hide
|
|
472
|
+
every row, the grid shows `noMatchText` with a *Clear filters* button.
|
|
473
|
+
|
|
474
|
+
The model is plain JSON, so you can store it, put it in the URL or send it to an API as is:
|
|
475
|
+
|
|
476
|
+
```ts
|
|
477
|
+
interface FilterState { columns: Record<string, ColumnFilter>; search?: string }
|
|
478
|
+
type ColumnFilter =
|
|
479
|
+
| { type: 'text'; op: 'contains' | 'notContains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'empty' | 'notEmpty'; value?: string }
|
|
480
|
+
| { type: 'number'; op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'; value?: number | null; to?: number | null }
|
|
481
|
+
| { type: 'date'; op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'; value?: string; to?: string } // YYYY-MM-DD
|
|
482
|
+
| { type: 'boolean'; value: boolean | null }
|
|
483
|
+
| { type: 'set'; values: string[] } // '' stands for blank cells
|
|
484
|
+
| { type: 'custom'; value: unknown }
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
The matchers are exported too, for use on a server or in tests: `matchesFilter`,
|
|
488
|
+
`parseQuickFilter`, `filterTree`, `isFilterActive`, `activeFilterCount`, `foldText`.
|
|
489
|
+
|
|
490
|
+
**Custom filter.** A `filterComponent` gets `{ modelValue, column }` and emits
|
|
491
|
+
`update:modelValue` with a filter (or `undefined` to clear it). Pair it with `filterFn(row, filter)`.
|
|
492
|
+
|
|
493
|
+
## Server data
|
|
494
|
+
|
|
495
|
+
Two ways to connect sorting, filtering and paging to a backend.
|
|
496
|
+
|
|
497
|
+
**1. `dataSource`: the grid fetches.** You give it a function. The grid calls it on mount and
|
|
498
|
+
whenever sort, filters, page or page size change. It does not sort, filter or slice the rows
|
|
499
|
+
itself; it shows exactly what the function returns.
|
|
500
|
+
|
|
501
|
+
```vue
|
|
502
|
+
<script setup lang="ts">
|
|
503
|
+
import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
|
|
504
|
+
|
|
505
|
+
const fetchBets: DataSource<Bet> = async (query, { signal }) => {
|
|
506
|
+
// query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
|
|
507
|
+
const res = await fetch('/api/bets', { method: 'POST', body: JSON.stringify(query), signal })
|
|
508
|
+
if (!res.ok) throw new Error(res.statusText)
|
|
509
|
+
return res.json() // { rows: Bet[], total?: number }
|
|
510
|
+
}
|
|
511
|
+
</script>
|
|
512
|
+
|
|
513
|
+
<template>
|
|
514
|
+
<VGrid ref="grid" :data-source="fetchBets" :columns row-key="id" pagination filter-row @load-error="toast"
|
|
515
|
+
:features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" />
|
|
516
|
+
</template>
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
- **Cancellation.** A new query aborts the previous request through `signal`, and a late response
|
|
520
|
+
from a superseded request is ignored, so fast typing never shows stale rows.
|
|
521
|
+
- **States.** The grid shows a progress bar while loading. If the function throws, it shows
|
|
522
|
+
*Couldn't load the rows.* with a *Retry* button and emits `load-error`.
|
|
523
|
+
- **Paging.** `pagination` adds the pager and sends `page` / `pageSize`; return `total` so the
|
|
524
|
+
pager knows how many pages there are. Without `pagination`, `pageSize` is `null` (fetch
|
|
525
|
+
everything). The page resets to 1 when sort or filters change.
|
|
526
|
+
- `grid.reload()` re-runs the current query, and `grid.patchLoadedRows(patches)` updates fields of
|
|
527
|
+
rows that are already loaded without a refetch.
|
|
528
|
+
|
|
529
|
+
**2. `@query-change`: you fetch.** Keep `rows` under your control, set `sort-mode="controlled"`
|
|
530
|
+
and `filter-mode="controlled"`, and handle one event. The grid emits the combined query on mount
|
|
531
|
+
and on every change, and skips duplicates:
|
|
532
|
+
|
|
533
|
+
```vue
|
|
534
|
+
<VGrid :rows="rows" :columns row-key="id" :loading="loading" :features="[sortingFeature, filteringFeature]"
|
|
535
|
+
sort-mode="controlled" filter-mode="controlled" @query-change="load" />
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
Use this when the data comes from a store, a WebSocket or a GraphQL client that you already manage.
|
|
539
|
+
|
|
540
|
+
## Pagination
|
|
541
|
+
|
|
542
|
+
`pagination` gives you a built-in pager under the grid. With client rows it slices the sorted and
|
|
543
|
+
filtered rows; with a `dataSource` it requests pages.
|
|
544
|
+
|
|
545
|
+
```vue
|
|
546
|
+
<VGrid :rows :columns row-key="id" :features="[paginationFeature]" :pagination="{ pageSizes: [10, 25, 50] }" v-model:page="page" v-model:page-size="pageSize" />
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
Or place the standalone component yourself and feed the grid one page at a time:
|
|
550
|
+
|
|
551
|
+
```vue
|
|
552
|
+
<VGrid v-model:sort="sort" :rows="pageRows" :columns row-key="id" :loading="loading" :features="[sortingFeature]" />
|
|
553
|
+
<VGridPagination v-model:page="page" v-model:page-size="pageSize" :total="total" :page-sizes="[10, 25, 50]" />
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
## Pinned rows and totals
|
|
557
|
+
|
|
558
|
+
Rows that stay in view while the body scrolls: a totals row (`aggregationFeature`) and rows pinned
|
|
559
|
+
above or below the body (`rowPinningFeature`).
|
|
560
|
+
|
|
561
|
+
```vue
|
|
562
|
+
<script setup lang="ts">
|
|
563
|
+
const columns = [
|
|
564
|
+
col({ key: 'player', aggregate: 'count' }),
|
|
565
|
+
col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
|
|
566
|
+
col({ key: 'odds', renderer: numberRenderer, aggregate: 'avg' }),
|
|
567
|
+
col({ key: 'placedAt', renderer: dateRenderer, aggregate: 'max' }),
|
|
568
|
+
]
|
|
569
|
+
const pinned = ref<PinnedRowsState>({ top: [42] })
|
|
570
|
+
</script>
|
|
571
|
+
|
|
572
|
+
<template>
|
|
573
|
+
<VGrid :rows="bets" :columns="columns" row-key="id" totals v-model:pinned-rows="pinned" />
|
|
574
|
+
</template>
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
- **Totals.** `totals` (or `totals="bottom"`) adds a totals row at the bottom; `totals="top"`
|
|
578
|
+
puts it under the header. Each column with an `aggregate` shows it with the column's own
|
|
579
|
+
renderer (so a currency column sums to a currency), `count` as a plain number; the first column
|
|
580
|
+
shows `totals-label` (`'Total'`) unless it has an aggregate. `sum` / `avg` skip values that
|
|
581
|
+
aren't numbers, `min` / `max` compare numbers, dates and strings, and a function gets the
|
|
582
|
+
column's values and the rows. The totals cover the top-level rows that pass the filters, on
|
|
583
|
+
every page (child rows aren't counted), and follow live data. With server data the grid only
|
|
584
|
+
has the current page: pass the server's totals as `aggregates` (`{ stake: 125000 }`), which
|
|
585
|
+
wins over computed values. The `total-<key>` slot renders a cell of the row yourself.
|
|
586
|
+
- **Pinned rows.** `v-model:pinned-rows` (`{ top, bottom }`, row keys, in display order) or
|
|
587
|
+
`grid.pinRow(key, 'top' | 'bottom' | null)` pins top-level rows. They leave the body, stay put
|
|
588
|
+
while it scrolls, and aren't filtered, sorted or paged; selection, row clicks and context menus
|
|
589
|
+
still work on them. Pin from your own context menu: `@context-action` → `pinRow(rowKey, …)`.
|
|
590
|
+
- **Extra rows.** `pinned-top-rows` / `pinned-bottom-rows` show rows that aren't part of `rows`
|
|
591
|
+
(a target, last year's figures) — no checkbox, not counted in the totals.
|
|
592
|
+
|
|
593
|
+
Each section is one sticky `subgrid` container, so its rows share the grid's columns, follow
|
|
594
|
+
resizing, reordering and pinned columns, and need no measuring of their own. Keyboard navigation
|
|
595
|
+
moves through them like any row, and a focused row scrolls clear of them (`scroll-padding`).
|
|
596
|
+
With virtual scrolling, `aria-rowindex` / `aria-rowcount` count them. Style them with
|
|
597
|
+
`.vg-pinned-top`, `.vg-pinned-bottom`, `.vg-row-pinned`, `.vg-row-total` and the
|
|
598
|
+
`--vg-total-row-bg` / `--vg-total-row-font-weight` tokens.
|
|
599
|
+
|
|
600
|
+
## Virtual scrolling
|
|
601
|
+
|
|
602
|
+
```vue
|
|
603
|
+
<VGrid :rows="tenThousandRows" :columns row-key="id" :features="[virtualScrollingFeature]"
|
|
604
|
+
:virtual="{ rowHeight: 40 }" style="height: 600px" />
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
Rows have a fixed height; only the visible window plus `overscan` is rendered.
|
|
608
|
+
|
|
609
|
+
Sub-grids and detail rows work in virtual mode too. The DOM keeps the same CSS grid / `subgrid`
|
|
610
|
+
structure as without it: expanded children stay inside their parent's `subgrid` container (lined up
|
|
611
|
+
with its columns), and at every level the rows out of view are replaced by spacers, so an expanded
|
|
612
|
+
tree of tens of thousands of rows still renders about a screenful.
|
|
613
|
+
|
|
614
|
+
- **Data rows** (children too) have `rowHeight`.
|
|
615
|
+
- **Detail rows** can be any height. They're measured once rendered; until then
|
|
616
|
+
`virtual.detailHeight` is the estimate (default 4 × `rowHeight`).
|
|
617
|
+
- **Lazy children** (`load-sub-rows`) are requested only for expanded rows in view, once a scroll
|
|
618
|
+
has settled, so flying past expanded rows doesn't fire their requests.
|
|
619
|
+
- **The view holds still** when rows above it change height (a detail row measured, children
|
|
620
|
+
loaded): the grid keeps the first row in view where it was. It does this itself, the same in every
|
|
621
|
+
browser, so virtual grids set `overflow-anchor: none` (browser scroll anchoring doesn't work
|
|
622
|
+
reliably in a CSS grid like this one — Firefox doesn't anchor in it at all).
|
|
623
|
+
- `scrollToRow(key)` reaches child rows too; `aria-rowcount` / `aria-rowindex` count every
|
|
624
|
+
rendered row (data, detail and loading / error rows).
|
|
625
|
+
|
|
626
|
+
## Performance
|
|
627
|
+
|
|
628
|
+
What the grid does for you, and what helps on your side. The repository README lists the
|
|
629
|
+
measurements.
|
|
630
|
+
|
|
631
|
+
**Many rows.** Above a few hundred rows, turn on `virtualScrollingFeature` and give the grid a
|
|
632
|
+
fixed height. Without it, every row is in the DOM, and restyling or relayout (resizing the window,
|
|
633
|
+
switching density) touches every cell. Tips:
|
|
634
|
+
|
|
635
|
+
- Keep `rowHeight` exact and cell content to one line (e.g. `rendererOptions: { ellipsis: true }`).
|
|
636
|
+
- Set `detailHeight` close to your typical detail row: rows that render near their estimate settle
|
|
637
|
+
without visible correction.
|
|
638
|
+
- Raise `overscan` (default 6) only if fast scrolling shows blank rows on slow devices.
|
|
639
|
+
|
|
640
|
+
**Changing data.** Re-render only what changed:
|
|
641
|
+
|
|
642
|
+
- Reactive rows: assign the field (`row.status = 'Won'`); only that cell re-renders.
|
|
643
|
+
- Large immutable lists (`shallowRef`): `patchRows(rows, patches, rowKey)` replaces just the patched
|
|
644
|
+
rows, and a batch that changes nothing returns the same array.
|
|
645
|
+
- Lazily loaded children live in the grid: use `grid.patchLoadedRows(patches)`.
|
|
646
|
+
- For a live feed, batch patches per animation frame rather than per message.
|
|
647
|
+
|
|
648
|
+
**Filtering and sorting** are built for large client-side data:
|
|
649
|
+
|
|
650
|
+
- Filtering is one pass over the tree. Date filters reuse one formatter per time zone, and text
|
|
651
|
+
matching has an ASCII fast path.
|
|
652
|
+
- Value lists are counted once per column, and long lists render 300 values with a search to
|
|
653
|
+
narrow them.
|
|
654
|
+
- Sorting computes each row's value once, with a shared collator.
|
|
655
|
+
- For much larger data, or data that lives on a server, use `data-source` (server mode).
|
|
656
|
+
|
|
657
|
+
**Lazy children** (`load-sub-rows`) are requested when an expanded row renders. Without virtual
|
|
658
|
+
scrolling that is every expanded row. With it, only expanded rows on screen, and only once a scroll
|
|
659
|
+
settles, so `expandAll()` on thousands of lazy rows sends a screenful of requests, not thousands.
|
|
660
|
+
|
|
661
|
+
**Motion** stays on the compositor: the change highlight (`flash`) fades an `opacity` layer, the
|
|
662
|
+
resize handle grows with `transform`, and spinners and progress bars use `transform`. Row
|
|
663
|
+
highlights appear instantly and fade out over `--vg-transition`.
|
|
664
|
+
|
|
665
|
+
**Bundle.** Import only the features and renderers you use. Everything else is tree-shaken, and
|
|
666
|
+
the filter popover, filter-row editors and pager are separate chunks loaded on first use.
|
|
667
|
+
|
|
668
|
+
## Keyboard
|
|
669
|
+
|
|
670
|
+
Without `keyboardNavigationFeature` the grid is an ARIA `table`. The scroll area is one Tab stop,
|
|
671
|
+
and the grid's own controls (sort buttons, expanders, checkboxes, filter buttons) follow in the
|
|
672
|
+
normal Tab order.
|
|
673
|
+
|
|
674
|
+
With `keyboardNavigationFeature` it is an ARIA `grid` (`treegrid` with sub-grids). The grid is one tab stop. Arrow keys move between cells (header, rows, sub-grid rows, detail rows),
|
|
675
|
+
`Home`/`End`, `Ctrl+Home`/`Ctrl+End`, `PageUp`/`PageDown`; `ContextMenu` / `Shift+F10` opens the context menu. `Enter` sorts a header or activates the
|
|
676
|
+
cell's control; `Space` toggles row selection; `→`/`←` on a tree cell expands/collapses; `Alt+←/→` on a
|
|
677
|
+
header moves the column; `Alt+Shift+←/→` on a header resizes it (with `columnResizingFeature`).
|
|
678
|
+
|
|
679
|
+
## Touch, phones and tablets
|
|
680
|
+
|
|
681
|
+
- **Layout.** The grid scrolls its columns inside its own frame at any width; it doesn't widen
|
|
682
|
+
the page, also inside flex and grid layouts (`.vg-root` has `min-width: 0`). If you wrap it in
|
|
683
|
+
your own element inside a flex or grid layout, give that element `min-width: 0` too, or it
|
|
684
|
+
grows to the columns' width. The toolbar wraps, and on narrow screens the pager drops its
|
|
685
|
+
« / » buttons (page 1 and the last page stay).
|
|
686
|
+
- **Swipes scroll** the grid, also when they start on a header (except on a column's narrow
|
|
687
|
+
resize edge).
|
|
688
|
+
- **Hold a header** (about half a second) to pick the column up, then drag it to reorder
|
|
689
|
+
(`columnReorderFeature`). Release it without moving to open the header menu (`menusFeature`).
|
|
690
|
+
- **Hold a body cell**, then release, to open its `context-menu`. This works on iOS, which fires no
|
|
691
|
+
`contextmenu` event; the browser's own long-press menu is suppressed while the grid's menu
|
|
692
|
+
takes over.
|
|
693
|
+
- Inputs (filters, search, pager) are 16 px on touch screens so iOS Safari doesn't zoom in, and
|
|
694
|
+
row hover tints only apply where there is a real hover (a tapped row doesn't stay tinted).
|
|
695
|
+
|
|
696
|
+
## Built-in renderers
|
|
697
|
+
|
|
698
|
+
Screenshots of every renderer are in the repository README's
|
|
699
|
+
[renderer gallery](../../README.md#29-cell-renderers).
|
|
700
|
+
|
|
701
|
+
**Display**
|
|
702
|
+
|
|
703
|
+
| Name | Options |
|
|
704
|
+
|---|---|
|
|
705
|
+
| `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
|
|
706
|
+
| `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
|
|
707
|
+
| `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
|
|
708
|
+
| `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
|
|
709
|
+
| `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
|
|
710
|
+
| `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
|
|
711
|
+
| `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
|
|
712
|
+
| `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
|
|
713
|
+
| `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
|
|
714
|
+
| `multi-line` | `lines` (builder; default: the value array), `boldLines`, `ellipsis`, `target`, `placeholder`; each line: `{ text, href, to, tone, fill, bold, muted, tooltip, trend, action, badge }` |
|
|
715
|
+
| `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
|
|
716
|
+
| `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
|
|
717
|
+
| `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
|
|
718
|
+
| `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
|
|
719
|
+
| `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
|
|
720
|
+
| `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
|
|
721
|
+
| `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
|
|
722
|
+
| `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
|
|
723
|
+
|
|
724
|
+
**Actions and editing** — editable renderers are *controlled*: they show the data and emit the requested
|
|
725
|
+
change; your `@cell-action` handler updates the row.
|
|
726
|
+
|
|
727
|
+
| Name | Options → emits |
|
|
728
|
+
|---|---|
|
|
729
|
+
| `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
|
|
730
|
+
| `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
|
|
731
|
+
| `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
|
|
732
|
+
| `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
|
|
733
|
+
| `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
|
|
734
|
+
| `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
|
|
735
|
+
| `radio` | same + `name` → `select` (payload: the row key) |
|
|
736
|
+
| `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
|
|
737
|
+
|
|
738
|
+
```vue
|
|
739
|
+
<VGrid :rows="rows" :columns="[{ key: 'web', renderer: 'switch' }]" row-key="id"
|
|
740
|
+
@cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)" />
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
Values option callbacks receive `(value, row)`. The component of every renderer is exported too
|
|
744
|
+
(`TextCell`, `CurrencyCell`, …) for composition.
|
|
745
|
+
|
|
746
|
+
## Writing a cell renderer (addons)
|
|
747
|
+
|
|
748
|
+
A renderer is a component plus a small definition. See
|
|
749
|
+
[`@nocopypaste/vue-grid-renderer-template`](../cell-renderer-template) for a complete, publishable example.
|
|
750
|
+
|
|
751
|
+
```vue
|
|
752
|
+
<!-- RatingCell.vue -->
|
|
753
|
+
<script setup lang="ts">
|
|
754
|
+
import type { CellRendererEmits, CellRendererProps } from '@nocopypaste/vue-grid'
|
|
755
|
+
const props = defineProps<CellRendererProps<unknown, number, { max?: number }>>()
|
|
756
|
+
const emit = defineEmits<CellRendererEmits>()
|
|
757
|
+
</script>
|
|
758
|
+
<template>
|
|
759
|
+
<button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">{{ n <= value ? '★' : '☆' }}</button>
|
|
760
|
+
</template>
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
```ts
|
|
764
|
+
import { defineCellRenderer } from '@nocopypaste/vue-grid'
|
|
765
|
+
declare module '@nocopypaste/vue-grid' {
|
|
766
|
+
interface CellRendererRegistry { rating: { max?: number } } // typed `renderer: 'rating'`
|
|
767
|
+
}
|
|
768
|
+
export const ratingRenderer = defineCellRenderer<{ max?: number }>({
|
|
769
|
+
name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
|
|
770
|
+
})
|
|
771
|
+
// app.use(createVueGrid({ renderers: [ratingRenderer] })) or <VGrid :renderers="[ratingRenderer]">
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
Renderer props: `value`, `row`, `rowKey`, `rowIndex`, `depth`, `column`, `options` (defaults merged
|
|
775
|
+
with `rendererOptions`). Emit `action(name, payload)`; the grid re-emits it as `cell-action` with the
|
|
776
|
+
row and column. `useGridContext()` gives `{ locale, currency, timeZone }`. Lookup order:
|
|
777
|
+
a definition or component on the column → `:renderers` → plugin → `text` (the only renderer built in).
|
|
778
|
+
|
|
779
|
+
## Theming
|
|
780
|
+
|
|
781
|
+
Override any token on `:root`, a wrapper, or the grid itself:
|
|
782
|
+
|
|
783
|
+
```css
|
|
784
|
+
.brand-grid {
|
|
785
|
+
--vg-color-accent: #db2777;
|
|
786
|
+
--vg-color-header-bg: #fdf2f8;
|
|
787
|
+
--vg-radius: 1rem;
|
|
788
|
+
--vg-cell-padding-x: 1.25rem;
|
|
789
|
+
--vg-font-family: Georgia, serif;
|
|
790
|
+
}
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
| Group | Tokens |
|
|
794
|
+
|---|---|
|
|
795
|
+
| Type | `--vg-font-family` `--vg-font-size` `--vg-line-height` `--vg-header-font-size` `--vg-header-font-weight` `--vg-header-letter-spacing` `--vg-header-text-transform` |
|
|
796
|
+
| Colour | `--vg-color-text` `-text-muted` `-surface` `-surface-raised` `-header-bg` `-header-text` `-border` `-border-strong` `-row-hover` `-row-selected` `-row-highlight` `-accent` `-accent-contrast` `-focus-ring` `-success` `-danger` `-warning` `-info` `-neutral` |
|
|
797
|
+
| Space & shape | `--vg-cell-padding-x/y` `--vg-header-padding-x/y` `--vg-gap` `--vg-radius` `--vg-radius-sm` `--vg-radius-pill` `--vg-border-width` `--vg-row-border` `--vg-header-border` `--vg-outer-border` `--vg-select-column-width` `--vg-expander-size` |
|
|
798
|
+
| Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
|
|
799
|
+
| Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
|
|
800
|
+
| Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
|
|
801
|
+
|
|
802
|
+
Motion stays on the compositor (`transform`, `opacity`) wherever layout would otherwise animate.
|
|
803
|
+
Row highlights (hover, selection) appear at once and fade out over `--vg-transition`, so the grid
|
|
804
|
+
responds the moment the pointer arrives.
|
|
805
|
+
|
|
806
|
+
Colours use `light-dark()`: set `color-scheme: light dark` on `html` to follow the OS, or
|
|
807
|
+
`color-scheme: dark` to force dark. Stable class names (`.vg-header-cell`, `.vg-cell`, `.vg-row`,
|
|
808
|
+
`.vg-subgrid`, `.vg-pin-left`, …) and the `ui` prop are there for anything tokens don't cover.
|
|
809
|
+
|
|
810
|
+
### Bring your own theme
|
|
811
|
+
|
|
812
|
+
The tokens above come from `theme.css`, which is optional. Import `base.css` instead and the grid
|
|
813
|
+
keeps its structure (columns, sub-grid alignment, sticky header and pins, tree indent, anchored
|
|
814
|
+
menus and popovers) with none of the default look. Then style the classes yourself:
|
|
815
|
+
|
|
816
|
+
```ts
|
|
817
|
+
import '@nocopypaste/vue-grid/base.css'
|
|
818
|
+
import './my-grid-theme.css'
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
```css
|
|
822
|
+
/* my-grid-theme.css — unlayered, or in your own layer after `vue-grid` */
|
|
823
|
+
.vg-viewport { border: 1px solid #ddd; }
|
|
824
|
+
.vg-header-cell { padding: 0.5rem 0.75rem; background: #fafafa; font-weight: 600; }
|
|
825
|
+
.vg-cell { padding: 0.5rem 0.75rem; border-top: 1px solid #eee; }
|
|
826
|
+
.vg-row:hover > .vg-cell { background: #f5f5f5; }
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
Base only gives sticky header and pinned cells the system `Canvas` background, so content doesn't
|
|
830
|
+
show through them; everything else (colours, spacing, borders, fonts, focus rings, animation) is
|
|
831
|
+
yours. The structural tokens `--vg-select-column-width`, `--vg-expander-size`,
|
|
832
|
+
`--vg-subgrid-indent`, `--vg-z-*` and `--vg-menu-gap` live in `base.css` and can be overridden
|
|
833
|
+
the same way. `renderers.css` reads the theme's colour tokens; define them (or skip the file) when
|
|
834
|
+
you drop `theme.css`.
|
|
835
|
+
|
|
836
|
+
## For coding agents
|
|
837
|
+
|
|
838
|
+
[`AGENTS.md`](AGENTS.md) is the short guide for AI coding agents (rules, which feature and
|
|
839
|
+
renderer for what, recipes, pitfalls); [`llms.txt`](llms.txt) and `llms-full.txt` follow the
|
|
840
|
+
llms.txt convention. The API reference is generated from the sources into
|
|
841
|
+
[`agent/api.md`](agent/api.md) and `agent/api.json`, with a
|
|
842
|
+
[JSON Schema](agent/grid-config.schema.json) of a grid config. To check a config:
|
|
843
|
+
|
|
844
|
+
```ts
|
|
845
|
+
import { validateGridConfig } from '@nocopypaste/vue-grid/agent'
|
|
846
|
+
|
|
847
|
+
const { ok, diagnostics } = validateGridConfig({
|
|
848
|
+
rowKey: 'id',
|
|
849
|
+
features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
|
|
850
|
+
renderers: [], // registered renderer names / definitions
|
|
851
|
+
columns: [{ key: 'total', renderer: 'currency', sortable: true, widht: '8rem' }],
|
|
852
|
+
})
|
|
853
|
+
// error columns[0].widht Columns have no option `widht`. Did you mean `width`?
|
|
854
|
+
// warning columns[0].renderer Renderer name `currency` isn't registered … pass `renderer: currencyRenderer`
|
|
855
|
+
// warning props.sortMode Sortable columns, but sorting is controlled … add `sort-mode="client"`
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
`@nocopypaste/vue-grid/agent` is a separate entry: apps that don't import it never bundle it. The
|
|
859
|
+
[`@nocopypaste/vue-grid-mcp`](../vue-grid-mcp) MCP server serves the same to agents as tools, and the
|
|
860
|
+
[Claude Code plugin](../../plugins/vue-grid) adds a skill with the full workflow.
|
|
861
|
+
|
|
862
|
+
## Browser support
|
|
863
|
+
|
|
864
|
+
Evergreen browsers: CSS `subgrid`, `light-dark()`, `@layer`, the Popover API and `<dialog>`
|
|
865
|
+
(Chrome/Edge 123+, Firefox 125+, Safari 17.5+).
|
|
866
|
+
|
|
867
|
+
**CSS first, JS only as a fallback.** Everything the browser can do in CSS / HTML is done there; a
|
|
868
|
+
small JS fallback runs only when a feature check (`CSS.supports`) says the browser can't:
|
|
869
|
+
|
|
870
|
+
| Behaviour | Done with | JS fallback when unsupported |
|
|
871
|
+
|---|---|---|
|
|
872
|
+
| Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
|
|
873
|
+
| Hiding a popover once its anchor scrolls out of view | `position-visibility: anchor-visible` | IntersectionObserver (e.g. Firefox 159) |
|
|
874
|
+
| Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
|
|
875
|
+
| Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
|
|
876
|
+
| Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
|
|
877
|
+
| Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
|
|
878
|
+
| Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
|
|
879
|
+
| Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
|
|
880
|
+
|
|
881
|
+
What stays in JS is what CSS can't express: data (sorting, selection, expansion state), keyboard
|
|
882
|
+
navigation, column drag, virtual scrolling and lazy loading.
|