@nocopypaste/vue-grid 0.2.0 → 0.3.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.
Files changed (97) hide show
  1. package/AGENTS.md +70 -5
  2. package/CHANGELOG.md +49 -0
  3. package/README.md +199 -34
  4. package/agent/api.json +130 -13
  5. package/agent/api.md +26 -10
  6. package/agent/grid-config.schema.json +50 -5
  7. package/dist/agent/api.js +121 -13
  8. package/dist/agent/requirements.js +12 -3
  9. package/dist/agent/requirements.js.map +1 -1
  10. package/dist/agent/validate.js +6 -2
  11. package/dist/agent/validate.js.map +1 -1
  12. package/dist/base.css +1 -1
  13. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +498 -414
  14. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js +7 -2
  18. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/VGridGroupCells.js +6 -0
  20. package/dist/components/VGridGroupCells.js.map +1 -0
  21. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +181 -0
  22. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -0
  23. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +69 -56
  24. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/VGridSelectionBanner.js +6 -0
  26. package/dist/components/VGridSelectionBanner.js.map +1 -0
  27. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +33 -0
  28. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -0
  29. package/dist/composables/useGridExport.js +135 -0
  30. package/dist/composables/useGridExport.js.map +1 -0
  31. package/dist/composables/useGridKeyboard.js +5 -1
  32. package/dist/composables/useGridKeyboard.js.map +1 -1
  33. package/dist/composables/useGridMenus.js +21 -1
  34. package/dist/composables/useGridMenus.js.map +1 -1
  35. package/dist/composables/useGridSelection.js +113 -50
  36. package/dist/composables/useGridSelection.js.map +1 -1
  37. package/dist/composables/useRowGrouping.js +103 -0
  38. package/dist/composables/useRowGrouping.js.map +1 -0
  39. package/dist/composables/useVirtualRows.js +5 -5
  40. package/dist/composables/useVirtualRows.js.map +1 -1
  41. package/dist/core/csv.js +28 -0
  42. package/dist/core/csv.js.map +1 -0
  43. package/dist/core/grouping.js +66 -0
  44. package/dist/core/grouping.js.map +1 -0
  45. package/dist/core.css +1 -1
  46. package/dist/features/export.js +9 -0
  47. package/dist/features/export.js.map +1 -0
  48. package/dist/features/index.js +25 -21
  49. package/dist/features/index.js.map +1 -1
  50. package/dist/features/rowGrouping.js +11 -0
  51. package/dist/features/rowGrouping.js.map +1 -0
  52. package/dist/features/selection.js +5 -3
  53. package/dist/features/selection.js.map +1 -1
  54. package/dist/index.js +55 -51
  55. package/dist/internal/anchor.js +20 -21
  56. package/dist/internal/anchor.js.map +1 -1
  57. package/dist/internal/clipboard.js +8 -2
  58. package/dist/internal/clipboard.js.map +1 -1
  59. package/dist/internal/context.js.map +1 -1
  60. package/dist/internal/features.js.map +1 -1
  61. package/dist/internal/supports.js +2 -2
  62. package/dist/internal/supports.js.map +1 -1
  63. package/dist/renderers/index.js +94 -83
  64. package/dist/renderers/index.js.map +1 -1
  65. package/dist/renderers/plainText.js +34 -0
  66. package/dist/renderers/plainText.js.map +1 -0
  67. package/dist/theme.css +1 -1
  68. package/dist/types/agent/requirements.d.ts +1 -1
  69. package/dist/types/components/VGrid.vue.d.ts +42 -4
  70. package/dist/types/components/VGridCheckbox.vue.d.ts +2 -2
  71. package/dist/types/components/VGridGroupCells.vue.d.ts +14 -0
  72. package/dist/types/components/VGridMenu.vue.d.ts +2 -2
  73. package/dist/types/components/VGridPagination.vue.d.ts +1 -1
  74. package/dist/types/components/VGridSelectionBanner.vue.d.ts +18 -0
  75. package/dist/types/composables/useGridExport.d.ts +49 -0
  76. package/dist/types/composables/useGridMenus.d.ts +8 -0
  77. package/dist/types/composables/useGridSelection.d.ts +26 -2
  78. package/dist/types/composables/useRowGrouping.d.ts +50 -0
  79. package/dist/types/composables/useVirtualRows.d.ts +2 -0
  80. package/dist/types/core/csv.d.ts +25 -0
  81. package/dist/types/core/grouping.d.ts +51 -0
  82. package/dist/types/features/export.d.ts +8 -0
  83. package/dist/types/features/index.d.ts +3 -1
  84. package/dist/types/features/rowGrouping.d.ts +8 -0
  85. package/dist/types/features/selection.d.ts +3 -1
  86. package/dist/types/index.d.ts +2 -0
  87. package/dist/types/internal/anchor.d.ts +10 -2
  88. package/dist/types/internal/clipboard.d.ts +5 -1
  89. package/dist/types/internal/context.d.ts +8 -1
  90. package/dist/types/internal/features.d.ts +3 -1
  91. package/dist/types/internal/supports.d.ts +0 -5
  92. package/dist/types/renderers/plainText.d.ts +17 -0
  93. package/dist/types/types.d.ts +81 -3
  94. package/dist/vue-grid.css +1 -1
  95. package/llms-full.txt +295 -49
  96. package/llms.txt +1 -1
  97. package/package.json +1 -1
@@ -27,12 +27,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
27
27
  close: typeof close;
28
28
  isOpen: import("vue").Ref<boolean, boolean>;
29
29
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
- close: () => any;
31
30
  select: (item: MenuAction) => any;
31
+ close: () => any;
32
32
  open: () => any;
33
33
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
34
- onClose?: (() => any) | undefined;
35
34
  onSelect?: ((item: MenuAction) => any) | undefined;
35
+ onClose?: (() => any) | undefined;
36
36
  onOpen?: (() => any) | undefined;
37
37
  }>, {
38
38
  label: string;
@@ -19,8 +19,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
19
19
  "onUpdate:page"?: ((value: number) => any) | undefined;
20
20
  "onUpdate:pageSize"?: ((value: number) => any) | undefined;
21
21
  }>, {
22
- ariaLabel: string;
23
22
  summary: string;
23
+ ariaLabel: string;
24
24
  siblings: number;
25
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Server data, every loaded row selected (selection feature): offers to select every row that
3
+ * matches the query, or says that all of them are, with a way back.
4
+ */
5
+ type __VLS_Props = {
6
+ total: number;
7
+ page: number;
8
+ all: boolean;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ clear: () => any;
12
+ selectAll: () => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ onClear?: (() => any) | undefined;
15
+ onSelectAll?: (() => any) | undefined;
16
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,49 @@
1
+ import type { Ref } from 'vue';
2
+ import type { ResolvedColumn } from '../internal/context';
3
+ import type { CellRendererDefinition, ColumnDef, CopyEvent, ExportOptions, FormatContext, RowKey } from '../types';
4
+ export interface GridExportOptions<T> {
5
+ /** The visible columns, resolved (renderer definition and options). */
6
+ columns: () => readonly ResolvedColumn[];
7
+ /** Every column (the `columns` option may name hidden ones). */
8
+ allColumns: () => readonly ColumnDef<T>[];
9
+ /** Resolves a column's renderer (hidden columns). */
10
+ resolve: (col: ColumnDef<T>) => {
11
+ definition?: CellRendererDefinition;
12
+ fallback?: boolean;
13
+ };
14
+ format: () => FormatContext;
15
+ getKey: (row: T) => RowKey;
16
+ /** A group row (row grouping feature): its rows are exported instead. */
17
+ isGroup: (row: T) => boolean;
18
+ /**
19
+ * Top-level rows, sorted: `filtered` (every page, pinned rows included), `all` (filters
20
+ * ignored), or `page` (the rows in the body, groups included).
21
+ */
22
+ rows: (which: 'filtered' | 'all' | 'page') => readonly T[];
23
+ /** Known child rows of a row (sync or loaded), or undefined. */
24
+ children: (row: T) => readonly T[] | undefined;
25
+ /** Filters (if `filtered`) and sorts a level of child rows. */
26
+ prepare: (rows: readonly T[], filtered: boolean) => readonly T[];
27
+ selected: Ref<RowKey[]>;
28
+ /** Rows shown but not in the data (pinned extra rows): a focused cell may be in one. */
29
+ extraRows: () => readonly T[];
30
+ /** The totals row, when there is one: its values by column key and its label. */
31
+ totals: () => {
32
+ values: Record<string, unknown>;
33
+ label: string;
34
+ } | undefined | false;
35
+ onCopy: (event: CopyEvent<T>) => void;
36
+ }
37
+ /**
38
+ * The export feature: the grid's rows as CSV / TSV (`getCsv`, `exportCsv`), copying rows or the
39
+ * focused cell to the clipboard (`copyRows`, Ctrl/⌘+C), with raw or displayed values.
40
+ */
41
+ export declare function useGridExport<T>(opts: GridExportOptions<T>): {
42
+ getCsv: (o?: ExportOptions) => string;
43
+ exportCsv: (o?: ExportOptions & {
44
+ filename?: string;
45
+ bom?: boolean;
46
+ }) => void;
47
+ copyRows: (o?: ExportOptions) => Promise<boolean>;
48
+ onKeyDown: (event: KeyboardEvent) => void;
49
+ };
@@ -30,6 +30,14 @@ export interface GridMenusOptions<T> {
30
30
  headerMenu: () => boolean | ((ctx: HeaderMenuContext<T>) => MenuItem[] | null | undefined);
31
31
  onContextAction: (event: ContextActionEvent<T>) => void;
32
32
  onHeaderAction: (event: HeaderActionEvent<T>) => void;
33
+ /** Group by / Ungroup items; only with the row grouping feature. */
34
+ grouping?: {
35
+ can(column: ColumnDef<T>): boolean;
36
+ isGrouped(key: string): boolean;
37
+ toggle(key: string): void;
38
+ clear(): void;
39
+ any(): boolean;
40
+ };
33
41
  filters?: {
34
42
  isActive(key: string): boolean;
35
43
  anyActive(): boolean;
@@ -1,5 +1,6 @@
1
1
  import { type Ref } from 'vue';
2
2
  import { type SelectionSummary } from '../core/selection';
3
+ import type { GridContext } from '../internal/context';
3
4
  import type { RowKey } from '../types';
4
5
  export interface GridSelectionOptions<T> {
5
6
  selected: Ref<RowKey[]>;
@@ -15,13 +16,36 @@ export interface GridSelectionOptions<T> {
15
16
  visibleChildren: (row: T) => readonly T[];
16
17
  /** Pre-order walk over the visible rows and their known children. */
17
18
  walk: (rows: readonly T[], visit: (row: T) => void) => void;
19
+ /** The body's top level (this page), and the grid's context: the rows on screen, for shift ranges. */
20
+ view: () => {
21
+ rows: readonly T[];
22
+ ctx: GridContext;
23
+ };
24
+ /** The `prune-selection` prop: drop selected keys whose rows are gone from the data. */
25
+ prune: () => boolean;
26
+ /** `v-model:select-all-matching`: every row matching the query counts as selected (server data). */
27
+ allMatching: Ref<boolean>;
28
+ /** Server data: how many rows match the query (the pager's total); undefined with client rows. */
29
+ matchingTotal: () => number | undefined;
30
+ /** Changes when the set of matching rows does (filters, search): "all matching" ends. */
31
+ matchKey: () => string;
18
32
  }
19
- /** Row selection: single or multi, optionally cascading through sub-grids. Only visible rows count. */
33
+ /**
34
+ * Row selection: single or multi, optionally cascading through sub-grids, shift-click ranges,
35
+ * pruning keys whose rows are gone, and (server data) "all matching rows". Only visible rows count.
36
+ */
20
37
  export declare function useGridSelection<T>(opts: GridSelectionOptions<T>): {
21
38
  isRowSelectable: (row: T) => boolean;
22
39
  rowCheckState: (row: T) => SelectionSummary;
23
- toggleRow: (row: T) => void;
40
+ toggleRow: (row: T, range?: boolean) => void;
24
41
  selectableKeys: import("vue").ComputedRef<RowKey[]>;
25
42
  allState: import("vue").ComputedRef<SelectionSummary>;
26
43
  toggleAll: () => void;
44
+ clear: () => void;
45
+ banner: import("vue").ComputedRef<{
46
+ total: number;
47
+ page: number;
48
+ all: boolean;
49
+ } | null>;
50
+ count: import("vue").ComputedRef<number>;
27
51
  };
@@ -0,0 +1,50 @@
1
+ import { type Component, type Ref } from 'vue';
2
+ import { type RowGroup } from '../core/grouping';
3
+ import type { GridContext } from '../internal/context';
4
+ import type { ColumnDef, RowKey, SortState } from '../types';
5
+ import type { SubRowsSnapshot } from './useVirtualRows';
6
+ export interface RowGroupingOptions<T> {
7
+ /** The `group-by` model: column keys, outermost first. */
8
+ groupBy: () => readonly string[] | string | null | undefined;
9
+ setGroupBy: (keys: string[]) => void;
10
+ columns: () => readonly ColumnDef<T>[];
11
+ /** The rows to group: filtered and sorted. */
12
+ rows: () => readonly T[];
13
+ sort: () => SortState | null;
14
+ /** The `groups-expanded` prop: groups start expanded. */
15
+ expandedByDefault: () => boolean;
16
+ /** The selected row keys (a group's checkbox selects its rows). */
17
+ selected: Ref<RowKey[]>;
18
+ /** Cascading selection: a group selects its rows' descendants too, through `walk`. */
19
+ cascade: () => boolean;
20
+ walk: (rows: readonly T[], visit: (row: T) => void) => void;
21
+ }
22
+ /**
23
+ * The row grouping feature: groups the rows by the `group-by` columns, keeps which groups are
24
+ * expanded (relative to `groups-expanded`, so new groups follow the default; changing the grouped
25
+ * columns starts over), and teaches the grid's context, virtual layout and header menu about
26
+ * group rows. Without the feature none of this is bundled.
27
+ */
28
+ export declare function useRowGrouping<T>(opts: RowGroupingOptions<T>): {
29
+ by: import("vue").ComputedRef<ColumnDef<T, import("..").RendererName>[]>;
30
+ active: import("vue").ComputedRef<boolean>;
31
+ groups: import("vue").ComputedRef<RowGroup<T>[]>;
32
+ isGroup: (row: unknown) => boolean;
33
+ isExpanded: (key: RowKey) => boolean;
34
+ toggle: (key: RowKey) => void;
35
+ setAll: (expand: boolean) => void;
36
+ expandedKeys: import("vue").ComputedRef<ReadonlySet<RowKey>>;
37
+ isGrouped: (key: string) => boolean;
38
+ keyOf: (base: (row: T) => RowKey) => (row: T) => RowKey;
39
+ expanded: (base: ReadonlySet<RowKey>) => ReadonlySet<RowKey>;
40
+ tree: (base: ((keyOf: (row: T) => RowKey) => SubRowsSnapshot<T>) | null) => ((keyOf: (row: T) => RowKey) => SubRowsSnapshot<T>) | null;
41
+ preparer: (base: (rows: readonly T[]) => readonly T[]) => (rows: readonly T[]) => readonly T[];
42
+ extend: (ctx: GridContext, GroupCells: Component) => void;
43
+ menu: {
44
+ can: (col: ColumnDef<T>) => boolean;
45
+ isGrouped: (key: string) => boolean;
46
+ toggle: (key: string) => void;
47
+ clear: () => void;
48
+ any: () => boolean;
49
+ };
50
+ };
@@ -19,6 +19,8 @@ export interface VirtualRowsOptions<T> {
19
19
  /** Tree mode: a factory for a snapshot of the sub-row cache; null without sub-grids. */
20
20
  subRows: () => ((keyOf: (row: T) => RowKey) => SubRowsSnapshot<T>) | null;
21
21
  hasDetail: () => boolean;
22
+ /** Rows that never have a detail row (group rows of the row grouping feature). */
23
+ isGroup?: () => ((row: T) => boolean) | undefined;
22
24
  rowExpandable: () => ((row: T) => boolean) | undefined;
23
25
  /** Filters and sorts a child level (its reactive inputs read once per layout pass). */
24
26
  preparer: () => (rows: readonly T[]) => readonly T[];
@@ -0,0 +1,25 @@
1
+ import type { ColumnDef } from '../types';
2
+ /** A value as plain text: dates as ISO 8601, arrays joined with `, `, objects as JSON, empty as ''. */
3
+ export declare function plainText(value: unknown): string;
4
+ /**
5
+ * Spreadsheet formula injection guard: text starting with `=`, `+`, `-`, `@`, tab or CR is run as
6
+ * a formula by Excel / Sheets / LibreOffice, so it gets a leading `'`. Numbers (`-5`, `+3.2`) are
7
+ * left alone.
8
+ */
9
+ export declare function guardFormula(text: string): string;
10
+ /** Joins a table of text into delimited lines, quoting fields that need it (RFC 4180). */
11
+ export declare function toDelimited(table: readonly (readonly string[])[], delimiter?: string, newline?: string): string;
12
+ export interface ToCsvOptions {
13
+ /** Field separator. Default `,`. */
14
+ delimiter?: string;
15
+ /** A first line with the column headers. Default `true`. */
16
+ header?: boolean;
17
+ /** Prefix text that a spreadsheet would run as a formula with `'`. Default `true`. */
18
+ guard?: boolean;
19
+ }
20
+ /**
21
+ * Rows as CSV: one line per row, one field per column (its `exportValue`, else the cell value,
22
+ * as plain text). Columns with `exportable: false` are left out. For the grid's own rows, filters,
23
+ * sort and formatting, use the export feature (`grid.getCsv()`).
24
+ */
25
+ export declare function toCsv<T>(rows: readonly T[], columns: readonly ColumnDef<T>[], options?: ToCsvOptions): string;
@@ -0,0 +1,51 @@
1
+ import type { ColumnDef, RowKey, SortState } from '../types';
2
+ declare const GROUP: unique symbol;
3
+ /**
4
+ * A group of rows (row grouping feature): the rows that share a value in a grouped column. Shown
5
+ * as a group row with its value, its row count and its columns' aggregates; expanding it shows
6
+ * its sub-groups (grouped by the next column) or, at the last level, its rows.
7
+ */
8
+ export interface RowGroup<T = any> {
9
+ readonly [GROUP]: true;
10
+ /** Unique among the grid's rows and groups (the path of group values from the top). */
11
+ readonly key: string;
12
+ /** The grouped column. */
13
+ readonly column: ColumnDef<T>;
14
+ /** The value its rows share (`column.groupValue`, else the cell value). */
15
+ readonly value: unknown;
16
+ /** 0 for top-level groups. */
17
+ readonly level: number;
18
+ /** Every row in the group, sub-groups included, in display order. */
19
+ readonly rows: readonly T[];
20
+ /** Sub-groups, or the rows at the last level. */
21
+ readonly children: readonly (RowGroup<T> | T)[];
22
+ /** Aggregates of the group's rows, by column key (columns with an `aggregate`). */
23
+ readonly aggregates: Readonly<Record<string, unknown>>;
24
+ }
25
+ /** A row of the grid is a group row, not a row of the data. */
26
+ export declare function isRowGroup(row: unknown): row is RowGroup;
27
+ /** Prefix of group keys: keeps them apart from the app's row keys. */
28
+ export declare const GROUP_KEY_PREFIX = "\u001Fvg-group:";
29
+ /** The `children` arrays of groups: already filtered and sorted, so the grid takes them as they are. */
30
+ export declare const groupedLevels: WeakSet<object>;
31
+ /** The value rows are grouped by. */
32
+ export declare function groupValueOf<T>(row: T, column: ColumnDef<T>): unknown;
33
+ export interface GroupRowsOptions<T> {
34
+ /** The grouped columns, outermost first. */
35
+ columns: readonly ColumnDef<T>[];
36
+ /** Every column: the ones with an `aggregate` get group aggregates. */
37
+ allColumns: readonly ColumnDef<T>[];
38
+ /** Groups of the sorted column follow its direction; other groups are ascending. */
39
+ sort?: SortState | null;
40
+ }
41
+ /**
42
+ * Groups rows by one or more columns. The rows keep their order inside each group (pass them
43
+ * filtered and sorted); groups are ordered by value (blank last), descending when the grid is
44
+ * sorted descending by that column.
45
+ */
46
+ export declare function groupRows<T>(rows: readonly T[], opts: GroupRowsOptions<T>): RowGroup<T>[];
47
+ /** Pre-order walk over groups and their sub-groups (not their rows). */
48
+ export declare function walkGroups<T>(groups: readonly (RowGroup<T> | T)[], visit: (group: RowGroup<T>) => void): void;
49
+ /** Row keys of every group in the tree. */
50
+ export declare function groupKeys(groups: readonly RowGroup[]): RowKey[];
51
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { ExportFeature } from '../types';
2
+ /**
3
+ * CSV export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file,
4
+ * `grid.getCsv()` returns the text, `grid.copyRows()` copies rows as tab-separated text, and
5
+ * Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed. Columns can set
6
+ * `exportValue` and `exportable: false`. Without it those methods only warn.
7
+ */
8
+ export declare const exportFeature: ExportFeature;
@@ -5,16 +5,18 @@ import { columnPinningFeature } from './columnPinning';
5
5
  import { columnResizingFeature } from './columnResizing';
6
6
  import { columnReorderFeature } from './columnReorder';
7
7
  import { columnVisibilityFeature } from './columnVisibility';
8
+ import { exportFeature } from './export';
8
9
  import { filteringFeature } from './filtering';
9
10
  import { keyboardNavigationFeature } from './keyboardNavigation';
10
11
  import { menusFeature } from './menus';
11
12
  import { paginationFeature } from './pagination';
13
+ import { rowGroupingFeature } from './rowGrouping';
12
14
  import { rowPinningFeature } from './rowPinning';
13
15
  import { selectionFeature } from './selection';
14
16
  import { serverDataFeature } from './serverData';
15
17
  import { sortingFeature } from './sorting';
16
18
  import { subGridsFeature } from './subGrids';
17
19
  import { virtualScrollingFeature } from './virtualScrolling';
18
- export { aggregationFeature, columnGroupsFeature, columnPinningFeature, columnReorderFeature, columnResizingFeature, columnVisibilityFeature, filteringFeature, keyboardNavigationFeature, menusFeature, paginationFeature, rowPinningFeature, selectionFeature, serverDataFeature, sortingFeature, subGridsFeature, virtualScrollingFeature, };
20
+ export { aggregationFeature, columnGroupsFeature, columnPinningFeature, columnReorderFeature, columnResizingFeature, columnVisibilityFeature, exportFeature, filteringFeature, keyboardNavigationFeature, menusFeature, paginationFeature, rowGroupingFeature, rowPinningFeature, selectionFeature, serverDataFeature, sortingFeature, subGridsFeature, virtualScrollingFeature, };
19
21
  /** Every built-in feature, for apps that want them all: `createVueGrid({ features: allFeatures })`. */
20
22
  export declare const allFeatures: readonly GridFeature[];
@@ -0,0 +1,8 @@
1
+ import type { RowGroupingFeature } from '../types';
2
+ /**
3
+ * Row grouping: `v-model:group-by="['region', 'status']"` groups the rows by those columns into
4
+ * collapsible group rows with their value, row count and the aggregates of columns with an
5
+ * `aggregate`. Columns with `groupable: true` get Group by / Ungroup items in the header menu.
6
+ * Without it, `group-by` is ignored.
7
+ */
8
+ export declare const rowGroupingFeature: RowGroupingFeature;
@@ -1,6 +1,8 @@
1
1
  import type { SelectionFeature } from '../types';
2
2
  /**
3
3
  * Row selection: the `selectable` prop (multi or single), `v-model:selected`, `selection-mode`
4
- * (cascade through sub-grids), `is-row-selectable`, Space on a row and the select-all checkbox.
4
+ * (cascade through sub-grids), `is-row-selectable`, Space on a row, shift-click (or Shift+Space)
5
+ * for a range, the select-all checkbox, `prune-selection`, and with server data a "select all
6
+ * N matching rows" banner (`v-model:select-all-matching`; it loads on demand, its own chunk).
5
7
  */
6
8
  export declare const selectionFeature: SelectionFeature;
@@ -10,6 +10,8 @@ export { getByPath, getCellValue, resolveRowKey, type RowKeyGetter } from './cor
10
10
  export { normalizeColumnState, visibleColumns, moveColumn, moveColumnRelative, setColumnHidden, setColumnPinned, effectivePin, } from './core/columns';
11
11
  export { nextSort, sortRows, compareValues } from './core/sort';
12
12
  export { aggregateRows, aggregateValues } from './core/aggregate';
13
+ export { groupRows, isRowGroup, type RowGroup, type GroupRowsOptions } from './core/grouping';
14
+ export { toCsv, toDelimited, plainText, guardFormula, type ToCsvOptions } from './core/csv';
13
15
  export { patchRows, type RowPatches, type PatchRowsOptions } from './core/patch';
14
16
  export type { DataSource, DataSourceResult, GridQuery } from './composables/useDataSource';
15
17
  export { activeFilterCount, emptyFilters, filterTree, foldText, isFilterActive, localFilterStorage, matchesFilter, parseQuickFilter, setKey, type BooleanFilter, type CustomFilter, type DateFilter, type DateFilterOp, type NumberFilter, type NumberFilterOp, type SetFilter, type TextFilter, type TextFilterOp, } from './core/filter';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Helpers for CSS anchor positioning. Popovers are placed purely in CSS (`position-anchor` +
3
+ * `position-area` + `position-try-fallbacks`); this module only provides unique anchor names and a
4
+ * JS fallback for browsers without anchor positioning.
5
+ */
1
6
  export declare function supportsAnchorPositioning(): boolean;
2
7
  /** A dashed-ident anchor name derived from a Vue `useId()` value. */
3
8
  export declare function anchorNameFor(id: string): string;
@@ -11,8 +16,11 @@ export declare function placeWithoutAnchorSupport(floating: HTMLElement, target:
11
16
  /**
12
17
  * JS fallbacks for an open anchored popover, each only where CSS can't do the job:
13
18
  * - no CSS anchor positioning → place it now and again on scroll / resize, so it follows its anchor;
14
- * - no working `position-visibility: anchor-visible` → hide it (`data-vg-anchor-hidden`) while the
15
- * anchor element is clipped by a scroll container (IntersectionObserver applies ancestor clipping).
19
+ * - hide it (`data-vg-anchor-hidden`) while the anchor element is clipped by a scroll container
20
+ * (IntersectionObserver applies ancestor clipping). Always, next to CSS
21
+ * `position-visibility: anchor-visible`: Firefox 159 only parses an older value, and WebKit
22
+ * (Safari 27) reports support but doesn't hide a popover whose anchor is clipped by the grid's
23
+ * own scroll container — feature detection can't tell.
16
24
  * Returns a cleanup function; call it when the popover closes.
17
25
  */
18
26
  export declare function trackAnchor(floating: HTMLElement, target: AnchorTarget, placement: Placement): () => void;
@@ -1,2 +1,6 @@
1
- /** Writes text to the clipboard. Resolves `false` when the Clipboard API is unavailable or denied. */
1
+ /**
2
+ * Writes text to the clipboard. Uses the Clipboard API, and falls back to `execCommand('copy')`
3
+ * where that API is missing or refused (pages served over plain http, browsers that deny it
4
+ * without a permission). Resolves `false` when neither worked.
5
+ */
2
6
  export declare function copyText(text: string): Promise<boolean>;
@@ -59,6 +59,12 @@ export interface GridContext {
59
59
  values: ComputedRef<Record<string, unknown>>;
60
60
  label: ComputedRef<string>;
61
61
  };
62
+ /** Row grouping feature, with rows grouped: renders the cells of group rows. */
63
+ grouping?: {
64
+ GroupCells: Component;
65
+ isGroup(row: any): boolean;
66
+ };
67
+ /** Rows nest (sub-grids, or grouped rows): the first column has the expander gutter. */
62
68
  treeMode: ComputedRef<boolean>;
63
69
  hasDetail: ComputedRef<boolean>;
64
70
  canExpand(row: any): boolean;
@@ -73,7 +79,8 @@ export interface GridContext {
73
79
  Checkbox: Component | undefined;
74
80
  isRowSelectable(row: any): boolean;
75
81
  rowCheckState(row: any): SelectionSummary;
76
- toggleRow(row: any): void;
82
+ /** `range`: Shift was held — select from the last toggled row to this one. */
83
+ toggleRow(row: any, range?: boolean): void;
77
84
  isHighlighted(key: RowKey): boolean;
78
85
  rowClass(row: any, index: number): ClassValue;
79
86
  rowClickable: ComputedRef<boolean>;
@@ -1,4 +1,4 @@
1
- import type { AggregationFeature, RowPinningFeature, ColumnGroupsFeature, ColumnPinningFeature, ColumnResizingFeature, ColumnReorderFeature, ColumnVisibilityFeature, FilteringFeature, KeyboardNavigationFeature, GridFeature, MenusFeature, PaginationFeature, SelectionFeature, ServerDataFeature, SortingFeature, SubGridsFeature, VirtualScrollingFeature } from '../types';
1
+ import type { AggregationFeature, ExportFeature, RowGroupingFeature, RowPinningFeature, ColumnGroupsFeature, ColumnPinningFeature, ColumnResizingFeature, ColumnReorderFeature, ColumnVisibilityFeature, FilteringFeature, KeyboardNavigationFeature, GridFeature, MenusFeature, PaginationFeature, SelectionFeature, ServerDataFeature, SortingFeature, SubGridsFeature, VirtualScrollingFeature } from '../types';
2
2
  /** The features a grid has, by name. */
3
3
  export interface FeatureSet {
4
4
  sorting?: SortingFeature;
@@ -17,6 +17,8 @@ export interface FeatureSet {
17
17
  columnGroups?: ColumnGroupsFeature;
18
18
  rowPinning?: RowPinningFeature;
19
19
  aggregation?: AggregationFeature;
20
+ rowGrouping?: RowGroupingFeature;
21
+ export?: ExportFeature;
20
22
  }
21
23
  /** Merges feature lists (app-wide, then per grid); a later entry with the same name wins. */
22
24
  export declare function resolveFeatures(...lists: (readonly GridFeature[] | undefined)[]): FeatureSet;
@@ -2,10 +2,5 @@
2
2
  export declare const supportsHas: () => boolean;
3
3
  /** Scroll-state container queries — show pin shadows only while content is scrolled under them. */
4
4
  export declare const supportsScrollState: () => boolean;
5
- /**
6
- * Hiding an anchored popover once its anchor is clipped. Checked via the current value name: engines
7
- * that only parse the old `anchors-visible` (Firefox 159) parse it without hiding anything.
8
- */
9
- export declare const supportsAnchorVisibility: () => boolean;
10
5
  /** Relative colour syntax — picks readable chip text in CSS. */
11
6
  export declare const supportsRelativeColor: () => boolean;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Plain-text forms of renderer values (a definition's `format`): what the cell shows, as text, for
3
+ * copying and exports. They mirror the cell components' own formatting.
4
+ */
5
+ import type { FormatContext } from '../types';
6
+ import { type BooleanOptions, type ChangeOptions, type ChipOptions, type CurrencyOptions, type DateOptions, type DateTimeOptions, type ListOptions, type NumberOptions, type StatusOptions } from './options';
7
+ export declare const numberText: (v: unknown, o: NumberOptions & {
8
+ signed?: boolean;
9
+ }, ctx: FormatContext) => string;
10
+ export declare const currencyText: (v: unknown, o: CurrencyOptions, ctx: FormatContext, row?: unknown) => string;
11
+ export declare function changeText(v: unknown, o: ChangeOptions, ctx: FormatContext): string;
12
+ export declare const dateText: (v: unknown, o: DateOptions, ctx: FormatContext) => string;
13
+ export declare function dateTimeText(v: unknown, o: DateTimeOptions, ctx: FormatContext): string;
14
+ export declare const booleanText: (v: unknown, o: BooleanOptions) => string;
15
+ export declare function statusText(v: unknown, o: StatusOptions, _ctx: FormatContext, row?: unknown): string;
16
+ export declare function chipText(v: unknown, o: ChipOptions, _ctx: FormatContext, row?: unknown): string;
17
+ export declare function listText(v: unknown, o: ListOptions, _ctx: FormatContext, row?: unknown): string;
@@ -151,6 +151,24 @@ export interface ColumnDef<T = any, R extends RendererRef = RendererName> {
151
151
  * the rows. Shown with the column's renderer (`count` as a plain number).
152
152
  */
153
153
  aggregate?: AggregateName | AggregateFn<T>;
154
+ /**
155
+ * The header menu offers Group by / Ungroup for this column (row grouping feature). Any column can
156
+ * be grouped through `v-model:group-by`; this only adds the menu items.
157
+ */
158
+ groupable?: boolean;
159
+ /**
160
+ * The value rows are grouped by (row grouping feature), e.g. `(row) => row.placedAt.slice(0, 7)`
161
+ * for months. Default: the cell value, shown with the column's renderer; a `groupValue` is shown
162
+ * as text (or with the `#group-<key>` slot).
163
+ */
164
+ groupValue?: (row: T) => unknown;
165
+ /**
166
+ * The value exports and copying use (export feature), e.g. a plain id for a link or an object.
167
+ * Wins over the cell value and the renderer's text.
168
+ */
169
+ exportValue?: (row: T) => unknown;
170
+ /** Included in CSV exports and copied rows (export feature)? Default `true`; set `false` on action columns. */
171
+ exportable?: boolean;
154
172
  /** Extra classes for the column's body cells (or a function of the row). */
155
173
  cellClass?: ClassValue | ((row: T) => ClassValue);
156
174
  /** Extra classes for the column's header cell. */
@@ -192,8 +210,12 @@ export interface CellRendererDefinition<O = any> {
192
210
  align?: Align;
193
211
  /** Sort key derived from the cell value (used in client sort mode). */
194
212
  sortValue?: (value: unknown, options: O) => unknown;
195
- /** Plain-text form of the value (tooltips, accessibility, exports). */
196
- format?: (value: unknown, options: O, ctx: FormatContext) => string;
213
+ /**
214
+ * Plain-text form of the value, as the cell shows it: what copying and formatted exports use
215
+ * (export feature). `options` are the column's: resolve `(value, row)` option functions with
216
+ * `row`. Without it the value is copied as is.
217
+ */
218
+ format?: (value: unknown, options: O, ctx: FormatContext, row?: unknown) => string;
197
219
  /** Default filter type for columns using this renderer (default `text`). */
198
220
  filterType?: FilterType;
199
221
  }
@@ -289,6 +311,50 @@ export interface VGridExposed {
289
311
  reloadSubRows(key?: RowKey): void;
290
312
  /** Pins a top-level row above or below the body, or unpins it (`null`). Row pinning feature. */
291
313
  pinRow(key: RowKey, side: 'top' | 'bottom' | null): void;
314
+ /** Clears the selection, "all matching rows" included. Selection feature. */
315
+ clearSelection(): void;
316
+ /** The rows as CSV text: the filtered, sorted rows, visible columns, raw values. Export feature. */
317
+ getCsv(options?: ExportOptions): string;
318
+ /** Downloads the rows as a CSV file (`filename`, default `export.csv`; UTF-8 with a BOM). Export feature. */
319
+ exportCsv(options?: ExportOptions & {
320
+ filename?: string;
321
+ bom?: boolean;
322
+ }): void;
323
+ /**
324
+ * Copies rows to the clipboard as tab-separated text (pastes as cells into spreadsheets): the
325
+ * selected rows by default, as displayed, no header. Resolves `false` if nothing was copied.
326
+ * Export feature.
327
+ */
328
+ copyRows(options?: ExportOptions): Promise<boolean>;
329
+ }
330
+ /** Which rows, columns and values an export or copy takes (export feature). */
331
+ export interface ExportOptions {
332
+ /**
333
+ * `filtered` (default for exports): the rows that pass the filters, sorted, on every page.
334
+ * `all`: filters ignored. `page`: the current page. `selected` (default for `copyRows`).
335
+ */
336
+ rows?: 'filtered' | 'all' | 'page' | 'selected';
337
+ /** Also the known child rows (sub-grids), each after its parent. Default `false`. */
338
+ children?: boolean;
339
+ /** Column keys, in order (hidden columns too). Default: the visible columns without `exportable: false`. */
340
+ columns?: string[];
341
+ /** `raw` (default for exports): the cell values. `formatted` (default for copying): as the cells show them. */
342
+ values?: 'raw' | 'formatted';
343
+ /** A header line. Default `true` for exports, `false` for copying. */
344
+ header?: boolean;
345
+ /** A last line with the totals row (aggregation feature). Default `false`. */
346
+ totals?: boolean;
347
+ /** Field separator. Default `,` for CSV, a tab for copying. */
348
+ delimiter?: string;
349
+ /** Prefix text a spreadsheet would run as a formula (`=…`, `+…`, `@…`) with `'`. Default `true`. */
350
+ guard?: boolean;
351
+ }
352
+ /** Something was copied to the clipboard (export feature): rows (`copyRows`, Ctrl+C) or one cell. */
353
+ export interface CopyEvent<T = any> {
354
+ kind: 'rows' | 'cell';
355
+ text: string;
356
+ rows: readonly T[];
357
+ columns: readonly ColumnDef<T>[];
292
358
  }
293
359
  export interface SortingFeature {
294
360
  readonly feature: 'sorting';
@@ -314,6 +380,8 @@ export interface SelectionFeature {
314
380
  readonly feature: 'selection';
315
381
  useSelection: typeof import('./composables/useGridSelection').useGridSelection;
316
382
  Checkbox: Component;
383
+ /** Server data: the "select all N matching rows" banner. */
384
+ Banner: Component;
317
385
  }
318
386
  export interface SubGridsFeature {
319
387
  readonly feature: 'subGrids';
@@ -370,7 +438,17 @@ export interface AggregationFeature {
370
438
  /** The sticky section the totals row renders in. */
371
439
  PinnedRows: Component;
372
440
  }
373
- export type GridFeature = AggregationFeature | RowPinningFeature | ColumnGroupsFeature | ColumnResizingFeature | KeyboardNavigationFeature | ColumnVisibilityFeature | VirtualScrollingFeature | ColumnReorderFeature | ColumnPinningFeature | SortingFeature | FilteringFeature | ServerDataFeature | PaginationFeature | SelectionFeature | SubGridsFeature | MenusFeature;
441
+ export interface RowGroupingFeature {
442
+ readonly feature: 'rowGrouping';
443
+ useRowGrouping: typeof import('./composables/useRowGrouping').useRowGrouping;
444
+ /** The cells of a group row. */
445
+ GroupCells: Component;
446
+ }
447
+ export interface ExportFeature {
448
+ readonly feature: 'export';
449
+ useExport: typeof import('./composables/useGridExport').useGridExport;
450
+ }
451
+ export type GridFeature = ExportFeature | RowGroupingFeature | AggregationFeature | RowPinningFeature | ColumnGroupsFeature | ColumnResizingFeature | KeyboardNavigationFeature | ColumnVisibilityFeature | VirtualScrollingFeature | ColumnReorderFeature | ColumnPinningFeature | SortingFeature | FilteringFeature | ServerDataFeature | PaginationFeature | SelectionFeature | SubGridsFeature | MenusFeature;
374
452
  export type GridFeatureName = GridFeature['feature'];
375
453
  export interface VueGridConfig {
376
454
  renderers?: CellRendererDefinition[];