@nocopypaste/vue-grid 0.6.0 → 0.8.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.
Files changed (113) hide show
  1. package/AGENTS.md +33 -24
  2. package/CHANGELOG.md +44 -0
  3. package/README.md +214 -79
  4. package/agent/api.json +68 -10
  5. package/agent/api.md +17 -7
  6. package/agent/grid-config.schema.json +15 -11
  7. package/dist/agent/api.js +66 -10
  8. package/dist/agent/requirements.js +1 -0
  9. package/dist/agent/requirements.js.map +1 -1
  10. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +583 -522
  11. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  12. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +4 -3
  13. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +58 -53
  15. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +50 -49
  17. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +151 -146
  19. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +44 -43
  21. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +12 -10
  23. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +62 -57
  25. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +59 -58
  27. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +62 -55
  29. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +1 -1
  31. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +60 -59
  33. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +27 -26
  35. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +12 -11
  37. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  38. package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js +37 -30
  39. package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/dist/composables/useDataSource.js +21 -19
  41. package/dist/composables/useDataSource.js.map +1 -1
  42. package/dist/composables/useGridExport.js +22 -7
  43. package/dist/composables/useGridExport.js.map +1 -1
  44. package/dist/composables/useGridMenus.js +41 -41
  45. package/dist/composables/useGridMenus.js.map +1 -1
  46. package/dist/composables/useRowGrouping.js +103 -74
  47. package/dist/composables/useRowGrouping.js.map +1 -1
  48. package/dist/composables/useServerGroups.js +106 -0
  49. package/dist/composables/useServerGroups.js.map +1 -0
  50. package/dist/composables/useStatusBar.js +9 -0
  51. package/dist/composables/useStatusBar.js.map +1 -1
  52. package/dist/core/grouping.js +41 -24
  53. package/dist/core/grouping.js.map +1 -1
  54. package/dist/features/export.js.map +1 -1
  55. package/dist/features/index.js +12 -10
  56. package/dist/features/index.js.map +1 -1
  57. package/dist/features/serverGrouping.js +9 -0
  58. package/dist/features/serverGrouping.js.map +1 -0
  59. package/dist/index.js +7 -6
  60. package/dist/internal/context.js.map +1 -1
  61. package/dist/internal/features.js.map +1 -1
  62. package/dist/internal/messages.js +20 -0
  63. package/dist/internal/messages.js.map +1 -0
  64. package/dist/internal/print.js +51 -0
  65. package/dist/internal/print.js.map +1 -0
  66. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +31 -30
  67. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +28 -27
  69. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  70. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +22 -21
  71. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +37 -36
  73. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  74. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +16 -15
  75. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +19 -18
  77. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  78. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +21 -20
  79. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  80. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +21 -20
  81. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +18 -17
  83. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  84. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +35 -34
  85. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  86. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +19 -18
  87. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/types/agent/requirements.d.ts +1 -1
  89. package/dist/types/components/VGrid.vue.d.ts +45 -9
  90. package/dist/types/components/VGridColumnMenu.vue.d.ts +4 -5
  91. package/dist/types/components/VGridMenu.vue.d.ts +1 -1
  92. package/dist/types/components/VGridPagination.vue.d.ts +8 -3
  93. package/dist/types/components/VGridSearch.vue.d.ts +2 -2
  94. package/dist/types/composables/useDataSource.d.ts +33 -2
  95. package/dist/types/composables/useGridExport.d.ts +4 -1
  96. package/dist/types/composables/useGridMenus.d.ts +3 -1
  97. package/dist/types/composables/useRowGrouping.d.ts +12 -1
  98. package/dist/types/composables/useServerGroups.d.ts +37 -0
  99. package/dist/types/composables/useStatusBar.d.ts +7 -0
  100. package/dist/types/core/grouping.d.ts +26 -0
  101. package/dist/types/features/export.d.ts +2 -1
  102. package/dist/types/features/index.d.ts +2 -1
  103. package/dist/types/features/serverGrouping.d.ts +9 -0
  104. package/dist/types/index.d.ts +1 -1
  105. package/dist/types/internal/context.d.ts +5 -1
  106. package/dist/types/internal/features.d.ts +2 -1
  107. package/dist/types/internal/messages.d.ts +16 -0
  108. package/dist/types/internal/print.d.ts +16 -0
  109. package/dist/types/renderers/parts/CopyButton.vue.d.ts +1 -3
  110. package/dist/types/types.d.ts +305 -1
  111. package/llms-full.txt +264 -110
  112. package/llms.txt +1 -1
  113. package/package.json +1 -1
@@ -2,6 +2,7 @@ import { type Component, type Ref } from 'vue';
2
2
  import { type RowGroup } from '../core/grouping';
3
3
  import type { GridContext } from '../internal/context';
4
4
  import type { ColumnDef, RowKey, SortState } from '../types';
5
+ import type { ServerGroups } from './useServerGroups';
5
6
  import type { SubRowsSnapshot } from './useVirtualRows';
6
7
  export interface RowGroupingOptions<T> {
7
8
  /** The `group-by` model: column keys, outermost first. */
@@ -18,16 +19,20 @@ export interface RowGroupingOptions<T> {
18
19
  /** Cascading selection: a group selects its rows' descendants too, through `walk`. */
19
20
  cascade: () => boolean;
20
21
  walk: (rows: readonly T[], visit: (row: T) => void) => void;
22
+ /** Server grouping feature: groups from the data source, loaded on expand, selected by query. */
23
+ server?: ServerGroups<T>;
21
24
  }
22
25
  /**
23
26
  * The row grouping feature: groups the rows by the `group-by` columns, keeps which groups are
24
27
  * expanded (relative to `groups-expanded`, so new groups follow the default; changing the grouped
25
28
  * 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.
29
+ * group rows. With server data whose source returns groups, the groups come from the server and
30
+ * each one's contents load when it expands. Without the feature none of this is bundled.
27
31
  */
28
32
  export declare function useRowGrouping<T>(opts: RowGroupingOptions<T>): {
29
33
  by: import("vue").ComputedRef<ColumnDef<T, import("..").RendererName>[]>;
30
34
  active: import("vue").ComputedRef<boolean>;
35
+ server: import("vue").ComputedRef<boolean>;
31
36
  groups: import("vue").ComputedRef<RowGroup<T>[]>;
32
37
  isGroup: (row: unknown) => boolean;
33
38
  isExpanded: (key: RowKey) => boolean;
@@ -47,4 +52,10 @@ export declare function useRowGrouping<T>(opts: RowGroupingOptions<T>): {
47
52
  clear: () => void;
48
53
  any: () => boolean;
49
54
  };
55
+ /** A group's rows (export, print): server groups' loaded ones. */
56
+ rowsIn: (group: RowGroup<T>) => T[];
57
+ /** Rows of the selected server groups. */
58
+ selectedGroupCount: import("vue").ComputedRef<number>;
59
+ allServerState: import("vue").ComputedRef<"some" | "none" | "all">;
60
+ toggleAllServer: () => void | undefined;
50
61
  };
@@ -0,0 +1,37 @@
1
+ import { type Ref } from 'vue';
2
+ import { type RowGroup } from '../core/grouping';
3
+ import type { ColumnDef, RowKey } from '../types';
4
+ import type { DataSourceResult, GroupPath, ServerGroup } from './useDataSource';
5
+ import type { SubRowEntry } from './useSubRows';
6
+ export interface ServerGroupsOptions<T> {
7
+ /** The top-level groups the data source returned for a grouped query; undefined: it sent rows. */
8
+ top: () => readonly ServerGroup[] | undefined;
9
+ /** A group's contents: its sub-groups or (at the last level) its rows. */
10
+ load: (path: GroupPath, signal: AbortSignal) => Promise<DataSourceResult<T>>;
11
+ /** Groups selected by query (`v-model:selected-groups`). */
12
+ selectedGroups: Ref<GroupPath[]>;
13
+ selected: Ref<RowKey[]>;
14
+ getKey: (row: T) => RowKey;
15
+ onError: (error: unknown) => void;
16
+ }
17
+ /**
18
+ * The server grouping feature: groups from the data source, each one's contents loaded when it
19
+ * expands (cached, with loading / error states), and groups selected by query, without their rows.
20
+ * The row grouping feature calls in here for groups that came from the server.
21
+ */
22
+ export declare function useServerGroups<T>(opts: ServerGroupsOptions<T>): {
23
+ groups: (by: readonly ColumnDef<T>[]) => RowGroup<T>[] | undefined;
24
+ children: (group: RowGroup<T>) => T[] | undefined;
25
+ state: (group: RowGroup<T>) => SubRowEntry | undefined;
26
+ ensure: (group: RowGroup<T>, by: readonly ColumnDef<T>[]) => void;
27
+ retry: (group: RowGroup<T>, by: readonly ColumnDef<T>[]) => void;
28
+ track: () => undefined;
29
+ locked: (row: any) => boolean;
30
+ checkState: (group: RowGroup<T>) => "all" | "some" | "none";
31
+ toggle: (group: RowGroup<T>) => void;
32
+ selectedCount: (each: (visit: (g: RowGroup<T>) => void) => void) => number;
33
+ allState: (top: readonly RowGroup<T>[]) => "all" | "some" | "none";
34
+ toggleAll: (top: readonly RowGroup<T>[]) => void;
35
+ rowsIn: (group: RowGroup<T>) => T[];
36
+ };
37
+ export type ServerGroups<T> = ReturnType<typeof useServerGroups<T>>;
@@ -38,6 +38,13 @@ export interface UseStatusBarOptions<T> {
38
38
  */
39
39
  export declare function useStatusBar<T>(opts: UseStatusBarOptions<T>): {
40
40
  enabled: import("vue").ComputedRef<boolean>;
41
+ /** Which items show (each on unless `false`). */
42
+ show: import("vue").ComputedRef<{
43
+ rows: boolean;
44
+ selected: boolean;
45
+ filters: boolean;
46
+ clear: boolean;
47
+ }>;
41
48
  canClear: boolean;
42
49
  scope: import("vue").ComputedRef<StatusBarScope>;
43
50
  };
@@ -21,6 +21,18 @@ export interface RowGroup<T = any> {
21
21
  readonly children: readonly (RowGroup<T> | T)[];
22
22
  /** Aggregates of the group's rows, by column key (columns with an `aggregate`). */
23
23
  readonly aggregates: Readonly<Record<string, unknown>>;
24
+ /** How many rows it holds: `rows.length`, or the server's count (server data). */
25
+ readonly count: number;
26
+ /** The grouped columns' values from the top: `[{ key: 'status', value: 'Won' }, …]`. */
27
+ readonly path: readonly {
28
+ key: string;
29
+ value: unknown;
30
+ }[];
31
+ /**
32
+ * A group from the server (row grouping with server data): `rows` and `children` are empty and
33
+ * its contents load when it expands.
34
+ */
35
+ readonly server?: boolean;
24
36
  }
25
37
  /** A row of the grid is a group row, not a row of the data. */
26
38
  export declare function isRowGroup(row: unknown): row is RowGroup;
@@ -44,6 +56,20 @@ export interface GroupRowsOptions<T> {
44
56
  * sorted descending by that column.
45
57
  */
46
58
  export declare function groupRows<T>(rows: readonly T[], opts: GroupRowsOptions<T>): RowGroup<T>[];
59
+ /** The key of the group at a path (`[{ key: 'status', value: 'Won' }, …]`), as its group row has it. */
60
+ export declare function pathKey(path: readonly {
61
+ key: string;
62
+ value: unknown;
63
+ }[]): string;
64
+ /**
65
+ * Group rows for groups the server sent (row grouping with server data), at one level: their
66
+ * contents load when they expand. `parent` is the group they are inside (none at the top).
67
+ */
68
+ export declare function serverGroups<T>(groups: readonly {
69
+ value: unknown;
70
+ count: number;
71
+ aggregates?: Record<string, unknown>;
72
+ }[], column: ColumnDef<T>, parent?: RowGroup<T>): RowGroup<T>[];
47
73
  /** Pre-order walk over groups and their sub-groups (not their rows). */
48
74
  export declare function walkGroups<T>(groups: readonly (RowGroup<T> | T)[], visit: (group: RowGroup<T>) => void): void;
49
75
  /** Row keys of every group in the tree. */
@@ -2,7 +2,8 @@ import type { ExportFeature } from '../types';
2
2
  /**
3
3
  * CSV and Excel export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a
4
4
  * CSV file, `grid.getCsv()` returns the text, `grid.exportXlsx()` / `grid.getXlsx()` write an Excel
5
- * workbook with typed cells (the writer loads on demand), `grid.copyRows()` copies rows as
5
+ * workbook with typed cells (the writer loads on demand), `grid.print()` prints every matching row
6
+ * as a table with the header on each page, `grid.copyRows()` copies rows as
6
7
  * tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed.
7
8
  * Columns can set `exportValue` and `exportable: false`. Without it those methods only warn.
8
9
  */
@@ -14,10 +14,11 @@ import { rowGroupingFeature } from './rowGrouping';
14
14
  import { rowPinningFeature } from './rowPinning';
15
15
  import { selectionFeature } from './selection';
16
16
  import { serverDataFeature } from './serverData';
17
+ import { serverGroupingFeature } from './serverGrouping';
17
18
  import { sortingFeature } from './sorting';
18
19
  import { statusBarFeature } from './statusBar';
19
20
  import { subGridsFeature } from './subGrids';
20
21
  import { virtualScrollingFeature } from './virtualScrolling';
21
- export { aggregationFeature, columnGroupsFeature, columnPinningFeature, columnReorderFeature, columnResizingFeature, columnVisibilityFeature, exportFeature, filteringFeature, keyboardNavigationFeature, menusFeature, paginationFeature, rowGroupingFeature, rowPinningFeature, selectionFeature, serverDataFeature, sortingFeature, statusBarFeature, subGridsFeature, virtualScrollingFeature, };
22
+ export { aggregationFeature, columnGroupsFeature, columnPinningFeature, columnReorderFeature, columnResizingFeature, columnVisibilityFeature, exportFeature, filteringFeature, keyboardNavigationFeature, menusFeature, paginationFeature, rowGroupingFeature, rowPinningFeature, selectionFeature, serverDataFeature, serverGroupingFeature, sortingFeature, statusBarFeature, subGridsFeature, virtualScrollingFeature, };
22
23
  /** Every built-in feature, for apps that want them all: `createVueGrid({ features: allFeatures })`. */
23
24
  export declare const allFeatures: readonly GridFeature[];
@@ -0,0 +1,9 @@
1
+ import type { ServerGroupingFeature } from '../types';
2
+ /**
3
+ * Row grouping with server data: with `group-by` and a `data-source`, the query carries `groupBy` and
4
+ * `groupPath`, the server answers with groups (value, count, aggregates), and each group's contents
5
+ * load when it expands. A group's checkbox selects it by query (`v-model:selected-groups`), without
6
+ * loading its rows. Needs the row grouping and server data features too. Without it, a grouped
7
+ * server grid groups only the rows it has loaded.
8
+ */
9
+ export declare const serverGroupingFeature: ServerGroupingFeature;
@@ -14,7 +14,7 @@ export { groupRows, isRowGroup, type RowGroup, type GroupRowsOptions } from './c
14
14
  export { toCsv, toDelimited, plainText, guardFormula, type ToCsvOptions } from './core/csv';
15
15
  export { toXlsx, type ToXlsxOptions, type XlsxFormat } from './core/xlsx';
16
16
  export { patchRows, type RowPatches, type PatchRowsOptions } from './core/patch';
17
- export type { DataSource, DataSourceResult, GridQuery } from './composables/useDataSource';
17
+ export type { DataSource, DataSourceResult, GridQuery, GroupPath, ServerGroup, } from './composables/useDataSource';
18
18
  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';
19
19
  export { localStorageAdapter } from './core/storage';
20
20
  export { pageItems, type PageItem } from './core/pagination';
@@ -1,5 +1,5 @@
1
1
  import { type Component, type ComputedRef, type InjectionKey, type Slots } from 'vue';
2
- import type { Align, CellRendererDefinition, ClassValue, ColumnDef, FlashMode, GridPart, RowKey } from '../types';
2
+ import type { Align, CellRendererDefinition, ClassValue, ColumnDef, FlashMode, GridMessages, GridPart, GridParts, RowKey } from '../types';
3
3
  import type { ColumnFilter, FilterState, FilterType } from '../core/filter';
4
4
  import type { SelectionSummary } from '../core/selection';
5
5
  import type { SubRowEntry } from '../composables/useSubRows';
@@ -24,6 +24,10 @@ export interface ResolvedColumn {
24
24
  export interface GridContext {
25
25
  columns: ComputedRef<ResolvedColumn[]>;
26
26
  slots: Slots;
27
+ /** Built-in text (the grid's over the app's); each use keeps its English default. */
28
+ messages: ComputedRef<GridMessages>;
29
+ /** Built-in parts; a part is on unless `false`. */
30
+ parts: ComputedRef<GridParts>;
27
31
  ui: ComputedRef<Partial<Record<GridPart, ClassValue>>>;
28
32
  getKey(row: any): RowKey;
29
33
  /**
@@ -1,4 +1,4 @@
1
- import type { AggregationFeature, ExportFeature, RowGroupingFeature, RowPinningFeature, ColumnGroupsFeature, ColumnPinningFeature, ColumnResizingFeature, ColumnReorderFeature, ColumnVisibilityFeature, FilteringFeature, KeyboardNavigationFeature, GridFeature, MenusFeature, PaginationFeature, SelectionFeature, ServerDataFeature, SortingFeature, StatusBarFeature, SubGridsFeature, VirtualScrollingFeature } from '../types';
1
+ import type { AggregationFeature, ExportFeature, RowGroupingFeature, RowPinningFeature, ColumnGroupsFeature, ColumnPinningFeature, ColumnResizingFeature, ColumnReorderFeature, ColumnVisibilityFeature, FilteringFeature, KeyboardNavigationFeature, GridFeature, MenusFeature, PaginationFeature, SelectionFeature, ServerDataFeature, ServerGroupingFeature, SortingFeature, StatusBarFeature, SubGridsFeature, VirtualScrollingFeature } from '../types';
2
2
  /** The features a grid has, by name. */
3
3
  export interface FeatureSet {
4
4
  sorting?: SortingFeature;
@@ -20,6 +20,7 @@ export interface FeatureSet {
20
20
  rowGrouping?: RowGroupingFeature;
21
21
  export?: ExportFeature;
22
22
  statusBar?: StatusBarFeature;
23
+ serverGrouping?: ServerGroupingFeature;
23
24
  }
24
25
  /** Merges feature lists (app-wide, then per grid); a later entry with the same name wins. */
25
26
  export declare function resolveFeatures(...lists: (readonly GridFeature[] | undefined)[]): FeatureSet;
@@ -0,0 +1,16 @@
1
+ import { type ComputedRef, type InjectionKey } from 'vue';
2
+ import type { GridMessages, GridParts } from '../types';
3
+ /** A grid's messages and parts: its own props over `createVueGrid` config. */
4
+ export declare const MESSAGES_KEY: InjectionKey<ComputedRef<GridMessages>>;
5
+ export declare const PARTS_KEY: InjectionKey<ComputedRef<GridParts>>;
6
+ /**
7
+ * The built-in text in effect: the nearest grid's, else the app's (`createVueGrid({ messages })`),
8
+ * for components used on their own (`<VGridPagination>`, `<VGridSearch>`…). Each caller keeps its
9
+ * English default next to the text (`m.value.retry ?? 'Retry'`), so unused features' text
10
+ * tree-shakes away with them.
11
+ */
12
+ export declare function useMessages(): ComputedRef<GridMessages>;
13
+ /** The built-in parts in effect (each `true` unless turned off). */
14
+ export declare function useParts(): ComputedRef<GridParts>;
15
+ /** Is a part on? Parts are on unless set to `false`. */
16
+ export declare const partOn: (parts: GridParts, name: keyof GridParts) => boolean;
@@ -0,0 +1,16 @@
1
+ import type { Align } from '../types';
2
+ /** A table to print: text cells, with the header repeated on every page. */
3
+ export interface PrintTable {
4
+ title?: string;
5
+ header?: readonly string[];
6
+ body: readonly (readonly string[])[];
7
+ /** A last, bold line (the totals row). */
8
+ footer?: readonly string[];
9
+ align: readonly Align[];
10
+ landscape?: boolean;
11
+ }
12
+ /**
13
+ * Prints a table from a hidden frame: the browser's print dialog, with a real `<table>` (so the
14
+ * header repeats on each page), built with DOM calls only. Resolves when printing is over.
15
+ */
16
+ export declare function printTable(t: PrintTable): Promise<void>;
@@ -9,8 +9,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
9
9
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
10
  onCopied?: ((text: string) => any) | undefined;
11
11
  onFailed?: ((text: string) => any) | undefined;
12
- }>, {
13
- label: string;
14
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
13
  declare const _default: typeof __VLS_export;
16
14
  export default _default;
@@ -359,6 +359,12 @@ export interface VGridExposed {
359
359
  exportXlsx(options?: XlsxExportOptions & {
360
360
  filename?: string;
361
361
  }): Promise<void>;
362
+ /**
363
+ * Prints the rows as a table (the browser's print dialog): the filtered, sorted rows on every page
364
+ * (not just those in view), as the cells show them, the header repeated on each printed page,
365
+ * numbers right-aligned, the totals in bold. Resolves when printing is over. Export feature.
366
+ */
367
+ print(options?: PrintOptions): Promise<void>;
362
368
  /**
363
369
  * Copies rows to the clipboard as tab-separated text (pastes as cells into spreadsheets): the
364
370
  * selected rows by default, as displayed, no header. Resolves `false` if nothing was copied.
@@ -393,6 +399,13 @@ export interface XlsxExportOptions extends Omit<ExportOptions, 'delimiter' | 'gu
393
399
  /** The sheet's name (31 characters at most). Default `Sheet1`. */
394
400
  sheetName?: string;
395
401
  }
402
+ /** Options of `print` (export feature): which rows and columns, as for exports, plus the page. */
403
+ export interface PrintOptions extends Omit<ExportOptions, 'delimiter' | 'guard' | 'values'> {
404
+ /** A heading above the table, also the document title (some browsers print it in the page header). */
405
+ title?: string;
406
+ /** Landscape pages, for wide grids. Default: the browser's setting. */
407
+ landscape?: boolean;
408
+ }
396
409
  /** Something was copied to the clipboard (export feature): rows (`copyRows`, Ctrl+C) or one cell. */
397
410
  export interface CopyEvent<T = any> {
398
411
  kind: 'rows' | 'cell';
@@ -400,6 +413,20 @@ export interface CopyEvent<T = any> {
400
413
  rows: readonly T[];
401
414
  columns: readonly ColumnDef<T>[];
402
415
  }
416
+ /** The built-in pager's options (`pagination` prop, pagination feature). */
417
+ export interface PaginationOptions {
418
+ /** Page-size choices: a selector appears when there are any. */
419
+ pageSizes?: number[];
420
+ /** Page buttons on each side of the current one. Default `1`. */
421
+ siblings?: number;
422
+ /**
423
+ * The "1–25 of 240" text, with `{from}`, `{to}` and `{total}`; `''` hides it. Default:
424
+ * `messages.pageSummary`, else `{from}–{to} of {total}`.
425
+ */
426
+ summary?: string;
427
+ /** The first and last page buttons (« »). Default `true`. */
428
+ firstLast?: boolean;
429
+ }
403
430
  /** An aggregate the status bar can show for the selected rows. */
404
431
  export type StatusBarAggregate = 'sum' | 'avg' | 'min' | 'max';
405
432
  /** The `status-bar` prop's options (status bar feature). */
@@ -411,6 +438,14 @@ export interface StatusBarOptions {
411
438
  summary?: string[];
412
439
  /** What to show for each `summary` column. Default `['sum', 'avg']`. */
413
440
  aggregates?: StatusBarAggregate[];
441
+ /** The row count (`84 of 200 rows`). Default `true`. */
442
+ rows?: boolean;
443
+ /** The selected count. Default `true`. */
444
+ selected?: boolean;
445
+ /** The active filter count. Default `true`. */
446
+ filters?: boolean;
447
+ /** The Clear button next to the filter count. Default `true`. */
448
+ clear?: boolean;
414
449
  }
415
450
  /** One `summary` column of the status bar: its aggregates over the selected rows. */
416
451
  export interface StatusBarSummary {
@@ -539,7 +574,11 @@ export interface StatusBarFeature {
539
574
  /** The status bar's default content. */
540
575
  StatusBar: Component;
541
576
  }
542
- export type GridFeature = StatusBarFeature | ExportFeature | RowGroupingFeature | AggregationFeature | RowPinningFeature | ColumnGroupsFeature | ColumnResizingFeature | KeyboardNavigationFeature | ColumnVisibilityFeature | VirtualScrollingFeature | ColumnReorderFeature | ColumnPinningFeature | SortingFeature | FilteringFeature | ServerDataFeature | PaginationFeature | SelectionFeature | SubGridsFeature | MenusFeature;
577
+ export interface ServerGroupingFeature {
578
+ readonly feature: 'serverGrouping';
579
+ useServerGroups: typeof import('./composables/useServerGroups').useServerGroups;
580
+ }
581
+ export type GridFeature = ServerGroupingFeature | StatusBarFeature | ExportFeature | RowGroupingFeature | AggregationFeature | RowPinningFeature | ColumnGroupsFeature | ColumnResizingFeature | KeyboardNavigationFeature | ColumnVisibilityFeature | VirtualScrollingFeature | ColumnReorderFeature | ColumnPinningFeature | SortingFeature | FilteringFeature | ServerDataFeature | PaginationFeature | SelectionFeature | SubGridsFeature | MenusFeature;
543
582
  export type GridFeatureName = GridFeature['feature'];
544
583
  export interface VueGridConfig {
545
584
  /** Renderers every grid can use by name (`renderer: 'currency'`); `allRenderers` for all of them. */
@@ -554,4 +593,269 @@ export interface VueGridConfig {
554
593
  timeZone?: string;
555
594
  /** Default density: `compact`, `cozy` (default) or `comfortable`. */
556
595
  density?: Density;
596
+ /** Built-in text for every grid (translations, wording); a grid's own `messages` win. */
597
+ messages?: GridMessages;
598
+ /** Built-in parts to turn off in every grid; a grid's own `parts` win. */
599
+ parts?: GridParts;
600
+ }
601
+ /**
602
+ * Every built-in text of the grid, its menus, filters, pager, status bar and renderers: set the
603
+ * ones you need, the rest stay English. Functions get the values that go into the text. App-wide in
604
+ * `createVueGrid({ messages })`, per grid with `:messages`. Props that name a text (`empty-text`,
605
+ * `no-match-text`, `totals-label`, a renderer's `label`…) still win.
606
+ */
607
+ export interface GridMessages {
608
+ /** Default `Loading…`. */
609
+ loading?: string;
610
+ /** No rows at all. Default `No data to show.` */
611
+ empty?: string;
612
+ /** No row passes the filters. Default `No rows match the current filters.` */
613
+ noMatch?: string;
614
+ /** The button next to `noMatch`. Default `Clear filters`. */
615
+ clearFilters?: string;
616
+ /** A server request failed. Default `Couldn't load the rows.` */
617
+ loadError?: string;
618
+ /** Added when the rows from before stay on screen. Default `These are from before.` */
619
+ staleRows?: string;
620
+ /** Default `Retry`. */
621
+ retry?: string;
622
+ /** A row's lazy children failed to load. Default `Could not load rows.` */
623
+ subRowsError?: string;
624
+ /** The totals row's label. Default `Total`. */
625
+ total?: string;
626
+ /** A group of rows with no value. Default `(blank)`. */
627
+ blank?: string;
628
+ /** A group row's count, for screen readers. Default `` `${count} rows` ``. */
629
+ groupRowCount?: (count: number) => string;
630
+ /** Default `Select all rows`. */
631
+ selectAllRows?: string;
632
+ /** Default `Select row`. */
633
+ selectRow?: string;
634
+ /** Default `Select group`. */
635
+ selectGroup?: string;
636
+ /** Default `` `All ${count} rows on this page are selected.` `` */
637
+ pageSelected?: (count: number) => string;
638
+ /** Default `` `Select all ${total} rows` `` */
639
+ selectAllMatching?: (total: number) => string;
640
+ /** Default `` `All ${total} rows are selected.` `` */
641
+ allSelected?: (total: number) => string;
642
+ /** Default `Clear selection`. */
643
+ clearSelection?: string;
644
+ /** Default `Expand row`. */
645
+ expandRow?: string;
646
+ /** Default `Collapse row`. */
647
+ collapseRow?: string;
648
+ /** Default `Expand group`. */
649
+ expandGroup?: string;
650
+ /** Default `Collapse group`. */
651
+ collapseGroup?: string;
652
+ /** A header menu's name for screen readers. Default `` `${column} column` `` */
653
+ columnMenu?: (column: string) => string;
654
+ /** The cell menu's name for screen readers. Default `Row actions`. */
655
+ rowActions?: string;
656
+ /** Default `Sort ascending`. */
657
+ sortAscending?: string;
658
+ /** Default `Sort descending`. */
659
+ sortDescending?: string;
660
+ /** Default `Clear sort`. */
661
+ clearSort?: string;
662
+ /** The header menu item that opens the column's filter. Default `Filter…`. */
663
+ filterMenu?: string;
664
+ /** Default `Clear filter`. */
665
+ clearFilter?: string;
666
+ /** Default `Clear all filters`. */
667
+ clearAllFilters?: string;
668
+ /** Default `` `Group by ${column}` `` */
669
+ groupBy?: (column: string) => string;
670
+ /** Default `Ungroup`. */
671
+ ungroup?: string;
672
+ /** Default `Ungroup all`. */
673
+ ungroupAll?: string;
674
+ /** Default `Pin left`. */
675
+ pinLeft?: string;
676
+ /** Default `Pin right`. */
677
+ pinRight?: string;
678
+ /** Default `Unpin`. */
679
+ unpin?: string;
680
+ /** Default `Move left`. */
681
+ moveLeft?: string;
682
+ /** Default `Move right`. */
683
+ moveRight?: string;
684
+ /** Default `Fit width`. */
685
+ fitWidth?: string;
686
+ /** Default `Reset width`. */
687
+ resetWidth?: string;
688
+ /** Default `Hide column`. */
689
+ hideColumn?: string;
690
+ /** Default `Reset columns`. */
691
+ resetColumns?: string;
692
+ /** A column's resize grip. Default `` `Resize ${column}` `` */
693
+ resizeColumn?: (column: string) => string;
694
+ /** `<VGridColumnMenu>`'s button. Default `Columns`. */
695
+ columns?: string;
696
+ /** `<VGridColumnMenu>`'s search. Default `Filter columns…`. */
697
+ filterColumns?: string;
698
+ /** Default `No matching columns`. */
699
+ noMatchingColumns?: string;
700
+ /** `<VGridMenu>`'s button, when it has no label. Default `Menu`. */
701
+ menu?: string;
702
+ /** A header's filter button. Default `` `Filter ${column}` `` */
703
+ filterColumn?: (column: string) => string;
704
+ /** A header's filter button while its filter is on. Default `` `Filter ${column} (active)` `` */
705
+ filterColumnActive?: (column: string) => string;
706
+ /** The filter row's placeholder. Default `Filter…`. */
707
+ filterPlaceholder?: string;
708
+ /** A filter row cell showing a filter it can't edit. Default `` `Filter ${column}: ${summary}` `` */
709
+ filterSummary?: (column: string, summary: string) => string;
710
+ /** A filter made in the popover, in the filter row. Default `Custom`. */
711
+ customFilter?: string;
712
+ /** Values ticked in a value list. Default `` `${count} selected` `` */
713
+ valuesSelected?: (count: number) => string;
714
+ /** The condition select of a filter. Default `` `${column}: condition` `` */
715
+ filterCondition?: (column: string) => string;
716
+ /** A filter's value input. Default `Value` (labelled `` `${column}: value` ``). */
717
+ filterValue?: string;
718
+ /** A range filter's first input. Default `` `${column}: from` `` */
719
+ filterFrom?: (column: string) => string;
720
+ /** A range filter's second input. Default `` `${column}: to` `` */
721
+ filterTo?: (column: string) => string;
722
+ /** Default `Contains`. */
723
+ opContains?: string;
724
+ /** Default `Does not contain`. */
725
+ opNotContains?: string;
726
+ /** Default `Equals`. */
727
+ opEquals?: string;
728
+ /** Default `Does not equal`. */
729
+ opNotEquals?: string;
730
+ /** Default `Starts with`. */
731
+ opStartsWith?: string;
732
+ /** Default `Ends with`. */
733
+ opEndsWith?: string;
734
+ /** Default `Is empty`. */
735
+ opEmpty?: string;
736
+ /** Default `Is not empty`. */
737
+ opNotEmpty?: string;
738
+ /** Default `Between`. */
739
+ opBetween?: string;
740
+ /** Date filters. Default `On`. */
741
+ opOn?: string;
742
+ /** Date filters. Default `Before`. */
743
+ opBefore?: string;
744
+ /** Date filters. Default `After`. */
745
+ opAfter?: string;
746
+ /** Yes / no filters. Default `Any`. */
747
+ any?: string;
748
+ /** Yes / no filters. Default `Yes`. */
749
+ yes?: string;
750
+ /** Yes / no filters. Default `No`. */
751
+ no?: string;
752
+ /** Yes / no filters, and a value list's empty value. Default `Empty`. */
753
+ emptyValue?: string;
754
+ /** A value list's entry for empty values. Default `(Blanks)`. */
755
+ blanks?: string;
756
+ /** A value list's search. Default `Search values`. */
757
+ searchValues?: string;
758
+ /** A value list's "tick all". Default `All`. */
759
+ all?: string;
760
+ /** A value list's "tick all" while searching. Default `All shown`. */
761
+ allShown?: string;
762
+ /** Values a long list leaves out. Default `` `${count} more — search to narrow the list` `` */
763
+ moreValues?: (count: number) => string;
764
+ /** Default `No matching values`. */
765
+ noMatchingValues?: string;
766
+ /** `<VGridSearch>`'s placeholder. Default `Search…`. */
767
+ searchPlaceholder?: string;
768
+ /** `<VGridSearch>`'s name for screen readers. Default `Search rows`. */
769
+ searchLabel?: string;
770
+ /** Default `Pagination`. */
771
+ pagination?: string;
772
+ /** Default `Rows per page`. */
773
+ rowsPerPage?: string;
774
+ /** A page size option. Default `` `${size} / page` `` */
775
+ pageSize?: (size: number) => string;
776
+ /** Default `` `${from}–${to} of ${total}` `` (numbers formatted for the locale). */
777
+ pageSummary?: (from: string, to: string, total: string) => string;
778
+ /** Default `First page`. */
779
+ firstPage?: string;
780
+ /** Default `Previous page`. */
781
+ previousPage?: string;
782
+ /** Default `Next page`. */
783
+ nextPage?: string;
784
+ /** Default `Last page`. */
785
+ lastPage?: string;
786
+ /** Default `` `Page ${page}` `` */
787
+ page?: (page: number) => string;
788
+ /** The status bar's name for screen readers. Default `Grid status`. */
789
+ statusBar?: string;
790
+ /** Default `` `${shown} of ${total} rows` `` while filtered, else `` `${shown} rows` `` (`1 row`). */
791
+ rowCount?: (shown: string, total: string | undefined, count: number) => string;
792
+ /** Default `` `${count} selected` `` (`All ${count} selected` with all matching rows). */
793
+ selectedCount?: (count: string, all: boolean) => string;
794
+ /** Default `` `${count} filters` `` (`1 filter`). */
795
+ filterCount?: (count: number) => string;
796
+ /** The status bar's button. Default `Clear`. */
797
+ clear?: string;
798
+ /** Default `Sum`. */
799
+ sum?: string;
800
+ /** Default `Average`. */
801
+ average?: string;
802
+ /** Default `Min`. */
803
+ min?: string;
804
+ /** Default `Max`. */
805
+ max?: string;
806
+ /** `json`'s button. Default `View`. */
807
+ view?: string;
808
+ /** Dialogs and popovers. Default `Close`. */
809
+ close?: string;
810
+ /** `copy`'s button. Default `Copy` (`` `Copy ${title}` `` with a `title`). */
811
+ copy?: string;
812
+ /** Announced after copying. Default `Copied`. */
813
+ copied?: string;
814
+ /** `actions-menu`'s button. Default `Actions`. */
815
+ actions?: string;
816
+ /** `details`' button. Default `Details`. */
817
+ details?: string;
818
+ /** `json-tree`'s toggle. Default `More info`. */
819
+ moreInfo?: string;
820
+ /** `list`'s toggle. Default `` `+${count} more` `` */
821
+ moreItems?: (count: number) => string;
822
+ /** `list`'s toggle when open. Default `Show less`. */
823
+ showLess?: string;
824
+ /** `change` and `multi-line` trends, for screen readers. Default `Increased`. */
825
+ increased?: string;
826
+ /** Default `Decreased`. */
827
+ decreased?: string;
828
+ /** `icon-toggle`'s name when it has no label. Default `Toggle`. */
829
+ toggle?: string;
830
+ /** `edit`'s button, before the column name. Default `Edit`. */
831
+ edit?: string;
832
+ }
833
+ /**
834
+ * Built-in parts a feature adds, each on by default: set one to `false` to leave it out (a slot can
835
+ * replace some instead). App-wide in `createVueGrid({ parts })`, per grid with `:parts`. A column's
836
+ * own options (`resizable`, `reorderable`, `filterable`…) work as before.
837
+ */
838
+ export interface GridParts {
839
+ /** The thin bar at the top of the grid while loading. */
840
+ progressBar?: boolean;
841
+ /** Server data: the notice above the rows when a request fails while rows are shown (`#load-error`). */
842
+ loadErrorNotice?: boolean;
843
+ /** The Retry buttons of load errors and of lazy children that failed. */
844
+ retry?: boolean;
845
+ /** The Clear filters button next to the no-match message (`#no-match`). */
846
+ clearFiltersButton?: boolean;
847
+ /** Selection: the select-all checkbox in the header. */
848
+ selectAll?: boolean;
849
+ /** Selection with server data: the "Select all N rows" banner (`#select-all-banner`). */
850
+ selectAllBanner?: boolean;
851
+ /** Filtering: the funnel buttons in `filterable` headers (the filter row and search still work). */
852
+ filterButtons?: boolean;
853
+ /** Column resizing: the grips on header edges (the header menu's Fit / Reset width stay). */
854
+ resizeGrips?: boolean;
855
+ /** Column reordering: dragging headers (Alt+←/→ and the header menu still move columns). */
856
+ headerDrag?: boolean;
857
+ /** Export: Ctrl/⌘+C copying in the grid. */
858
+ copyShortcut?: boolean;
859
+ /** Row grouping: the row count on group rows. */
860
+ groupCounts?: boolean;
557
861
  }