@mantine-vue/table 2.4.0 → 3.1.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/lib/types.d.ts CHANGED
@@ -6,6 +6,7 @@ import { type MVT_AggregationFns } from './fns/aggregationFns';
6
6
  import { type MVT_FilterFns } from './fns/filterFns';
7
7
  import { type MVT_SortingFns } from './fns/sortingFns';
8
8
  import { type MVT_Icons } from './icons';
9
+ import type { MVT_ColumnServerGroupingOptions, MVT_ServerGroupingExpandedState, MVT_ServerGroupingOptions, MVT_ServerGroupingSelectAllState, MVT_ServerGroupingTableApi } from './server-grouping/serverGrouping.types';
9
10
  export type { MVT_Icons };
10
11
  /**
11
12
  * A Vue renderable node. Used for
@@ -120,6 +121,31 @@ export interface MVT_Localization {
120
121
  goToNextPage: string;
121
122
  goToPreviousPage: string;
122
123
  grab: string;
124
+ /** Optional (falls back to English) shown while a server-grouping level loads. */
125
+ loading?: string;
126
+ /** Optional (falls back to English) server-grouping load failure message. */
127
+ errorLoadingData?: string;
128
+ /** Optional (falls back to English) retry button of a failed server-grouping level. */
129
+ retry?: string;
130
+ /** Optional (falls back to English) group-by toolbar button label. */
131
+ groupBy?: string;
132
+ /** Optional (falls back to English) clear-grouping menu action. */
133
+ clearGrouping?: string;
134
+ /** Optional (falls back to English) empty group-by menu message. */
135
+ noGroupableColumns?: string;
136
+ /** Optional (falls back to English) reorder grouping level up. */
137
+ moveUp?: string;
138
+ /** Optional (falls back to English) reorder grouping level down. */
139
+ moveDown?: string;
140
+ /** Optional (falls back to English) select every record matching the filters. */
141
+ selectAllMatching?: string;
142
+ /** Optional (falls back to English) shown while a query selection is active. */
143
+ allMatchingRecordsSelected?: string;
144
+ /**
145
+ * Optional (falls back to English) selection count without a total — used
146
+ * while server grouping is active, where the row count refers to groups.
147
+ */
148
+ selectedCountRowsSelected?: string;
123
149
  groupByColumn: string;
124
150
  groupedBy: string;
125
151
  hideAll: string;
@@ -220,7 +246,9 @@ export type MVT_TableInstance<TData extends MVT_RowData> = {
220
246
  setShowColumnFilters: MVT_SetState<boolean>;
221
247
  setShowGlobalFilter: MVT_SetState<boolean>;
222
248
  setShowToolbarDropZone: MVT_SetState<boolean>;
223
- } & Omit<Table<TData>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getBottomRows' | 'getCenterLeafColumns' | 'getCenterRows' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getHeaderGroups' | 'getLeftLeafColumns' | 'getPaginationRowModel' | 'getPreFilteredRowModel' | 'getPrePaginationRowModel' | 'getRightLeafColumns' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'getTopRows' | 'options'>;
249
+ /** @internal server-grouping engine, present when `serverGrouping.provider` is set */
250
+ _serverGrouping?: unknown;
251
+ } & MVT_ServerGroupingTableApi<TData> & Omit<Table<TData>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getBottomRows' | 'getCenterLeafColumns' | 'getCenterRows' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getHeaderGroups' | 'getLeftLeafColumns' | 'getPaginationRowModel' | 'getPreFilteredRowModel' | 'getPrePaginationRowModel' | 'getRightLeafColumns' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'getTopRows' | 'options'>;
224
252
  export type MVT_DefinedTableOptions<TData extends MVT_RowData> = {
225
253
  icons: MVT_Icons;
226
254
  localization: MVT_Localization;
@@ -242,6 +270,8 @@ export type MVT_TableState<TData extends MVT_RowData> = Prettify<{
242
270
  isFullScreen: boolean;
243
271
  isLoading: boolean;
244
272
  isSaving: boolean;
273
+ serverGroupingExpanded: MVT_ServerGroupingExpandedState;
274
+ serverGroupingSelectAll: MVT_ServerGroupingSelectAllState;
245
275
  showAlertBanner: boolean;
246
276
  showColumnFilters: boolean;
247
277
  showGlobalFilter: boolean;
@@ -250,7 +280,7 @@ export type MVT_TableState<TData extends MVT_RowData> = Prettify<{
250
280
  showSkeletons: boolean;
251
281
  showToolbarDropZone: boolean;
252
282
  } & TableState>;
253
- export type MVT_ColumnDef<TData extends MVT_RowData, TValue = unknown> = {
283
+ export type MVT_ColumnDef<TData extends MVT_RowData, TValue = unknown, TGroup = unknown> = {
254
284
  /**
255
285
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
256
286
  * Specify a function here to point to the correct property in the data object.
@@ -449,6 +479,7 @@ export type MVT_ColumnDef<TData extends MVT_RowData, TValue = unknown> = {
449
479
  onSelectFilterMode: (filterMode: MVT_FilterOption) => void;
450
480
  table: MVT_TableInstance<TData>;
451
481
  }) => MVT_Node;
482
+ serverGrouping?: MVT_ColumnServerGroupingOptions<TGroup>;
452
483
  sortingFn?: MVT_SortingFn<TData>;
453
484
  visibleInShowHideMenu?: boolean;
454
485
  } & Omit<ColumnDef<TData, TValue>, 'accessorKey' | 'aggregatedCell' | 'aggregationFn' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'>;
@@ -794,6 +825,8 @@ export type MVT_TableOptions<TData extends MVT_RowData> = {
794
825
  onHoveredColumnChange?: OnChangeFn<null | Partial<MVT_Column<TData>>>;
795
826
  onHoveredRowChange?: OnChangeFn<null | Partial<MVT_Row<TData>>>;
796
827
  onIsFullScreenChange?: OnChangeFn<boolean>;
828
+ onServerGroupingExpandedChange?: OnChangeFn<MVT_ServerGroupingExpandedState>;
829
+ onServerGroupingSelectAllChange?: OnChangeFn<MVT_ServerGroupingSelectAllState>;
797
830
  onShowAlertBannerChange?: OnChangeFn<boolean>;
798
831
  onShowColumnFiltersChange?: OnChangeFn<boolean>;
799
832
  onShowGlobalFilterChange?: OnChangeFn<boolean>;
@@ -880,6 +913,7 @@ export type MVT_TableOptions<TData extends MVT_RowData> = {
880
913
  }) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>) | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>;
881
914
  selectAllMode?: 'all' | 'page';
882
915
  selectDisplayMode?: 'checkbox' | 'radio' | 'switch';
916
+ serverGrouping?: MVT_ServerGroupingOptions<TData, any, any, any>;
883
917
  /**
884
918
  * Manage state externally any way you want, then pass it back into MVT.
885
919
  */
@@ -1,6 +1,18 @@
1
+ import { type CSSProperties } from 'vue';
1
2
  import { type MantineTheme } from '@mantine-vue/core';
2
3
  import { type MantineShade } from '../types';
3
4
  export declare const parseCSSVarId: (id: string) => string;
5
+ /**
6
+ * Width/flex styles that bind a cell to its column's live size variables, so
7
+ * custom cells (server-grouping group rows, …) stay aligned with the root
8
+ * table while columns are resized or reordered.
9
+ */
10
+ export declare const getMVT_ColumnWidthStyles: ({ columnId, grow, layoutMode, minSize, }: {
11
+ columnId: string;
12
+ grow?: boolean | number;
13
+ layoutMode?: "grid" | "grid-no-grow" | "semantic";
14
+ minSize?: number;
15
+ }) => CSSProperties;
4
16
  export declare const getPrimaryShade: (theme: MantineTheme) => number;
5
17
  export declare const getPrimaryColor: (theme: MantineTheme, shade?: MantineShade) => string;
6
18
  export declare function dataVariable(name: string, value: boolean | number | string | undefined): {
package/locales/en.cjs CHANGED
@@ -2,12 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/locales/en.ts
3
3
  var MVT_Localization_EN = {
4
4
  actions: "Actions",
5
+ allMatchingRecordsSelected: "All records matching the current filters are selected",
5
6
  and: "and",
6
7
  cancel: "Cancel",
7
8
  changeFilterMode: "Change filter mode",
8
9
  changeSearchMode: "Change search mode",
9
10
  clearFilter: "Clear filter",
10
11
  clearSearch: "Clear search",
12
+ clearGrouping: "Clear grouping",
11
13
  clearSelection: "Clear selection",
12
14
  clearSort: "Clear sort",
13
15
  clickToCopy: "Click to copy",
@@ -18,6 +20,7 @@ var MVT_Localization_EN = {
18
20
  copiedToClipboard: "Copied to clipboard",
19
21
  dropToGroupBy: "Drop to group by {column}",
20
22
  edit: "Edit",
23
+ errorLoadingData: "Error loading data",
21
24
  expand: "Expand",
22
25
  expandAll: "Expand all",
23
26
  filterArrIncludes: "Includes",
@@ -50,13 +53,18 @@ var MVT_Localization_EN = {
50
53
  goToNextPage: "Go to next page",
51
54
  goToPreviousPage: "Go to previous page",
52
55
  grab: "Grab",
56
+ groupBy: "Group by",
53
57
  groupByColumn: "Group by {column}",
54
58
  groupedBy: "Grouped by ",
55
59
  hideAll: "Hide all",
56
60
  hideColumn: "Hide {column} column",
61
+ loading: "Loading…",
57
62
  max: "Max",
58
63
  min: "Min",
59
64
  move: "Move",
65
+ moveDown: "Move down",
66
+ moveUp: "Move up",
67
+ noGroupableColumns: "No groupable columns",
60
68
  noRecordsToDisplay: "No records to display",
61
69
  noResultsFound: "No results found",
62
70
  of: "of",
@@ -66,6 +74,7 @@ var MVT_Localization_EN = {
66
74
  pinToRight: "Pin to right",
67
75
  resetColumnSize: "Reset column size",
68
76
  resetOrder: "Reset order",
77
+ retry: "Retry",
69
78
  rowActions: "Row Actions",
70
79
  rowNumber: "#",
71
80
  rowNumbers: "Row Numbers",
@@ -73,7 +82,9 @@ var MVT_Localization_EN = {
73
82
  save: "Save",
74
83
  search: "Search",
75
84
  selectedCountOfRowCountRowsSelected: "{selectedCount} of {rowCount} row(s) selected",
85
+ selectedCountRowsSelected: "{selectedCount} row(s) selected",
76
86
  select: "Select",
87
+ selectAllMatching: "Select all matching records",
77
88
  showAll: "Show all",
78
89
  showAllColumns: "Show all columns",
79
90
  showHideColumns: "Show/Hide columns",
package/locales/en.mjs CHANGED
@@ -1,12 +1,14 @@
1
1
  //#region src/locales/en.ts
2
2
  var MVT_Localization_EN = {
3
3
  actions: "Actions",
4
+ allMatchingRecordsSelected: "All records matching the current filters are selected",
4
5
  and: "and",
5
6
  cancel: "Cancel",
6
7
  changeFilterMode: "Change filter mode",
7
8
  changeSearchMode: "Change search mode",
8
9
  clearFilter: "Clear filter",
9
10
  clearSearch: "Clear search",
11
+ clearGrouping: "Clear grouping",
10
12
  clearSelection: "Clear selection",
11
13
  clearSort: "Clear sort",
12
14
  clickToCopy: "Click to copy",
@@ -17,6 +19,7 @@ var MVT_Localization_EN = {
17
19
  copiedToClipboard: "Copied to clipboard",
18
20
  dropToGroupBy: "Drop to group by {column}",
19
21
  edit: "Edit",
22
+ errorLoadingData: "Error loading data",
20
23
  expand: "Expand",
21
24
  expandAll: "Expand all",
22
25
  filterArrIncludes: "Includes",
@@ -49,13 +52,18 @@ var MVT_Localization_EN = {
49
52
  goToNextPage: "Go to next page",
50
53
  goToPreviousPage: "Go to previous page",
51
54
  grab: "Grab",
55
+ groupBy: "Group by",
52
56
  groupByColumn: "Group by {column}",
53
57
  groupedBy: "Grouped by ",
54
58
  hideAll: "Hide all",
55
59
  hideColumn: "Hide {column} column",
60
+ loading: "Loading…",
56
61
  max: "Max",
57
62
  min: "Min",
58
63
  move: "Move",
64
+ moveDown: "Move down",
65
+ moveUp: "Move up",
66
+ noGroupableColumns: "No groupable columns",
59
67
  noRecordsToDisplay: "No records to display",
60
68
  noResultsFound: "No results found",
61
69
  of: "of",
@@ -65,6 +73,7 @@ var MVT_Localization_EN = {
65
73
  pinToRight: "Pin to right",
66
74
  resetColumnSize: "Reset column size",
67
75
  resetOrder: "Reset order",
76
+ retry: "Retry",
68
77
  rowActions: "Row Actions",
69
78
  rowNumber: "#",
70
79
  rowNumbers: "Row Numbers",
@@ -72,7 +81,9 @@ var MVT_Localization_EN = {
72
81
  save: "Save",
73
82
  search: "Search",
74
83
  selectedCountOfRowCountRowsSelected: "{selectedCount} of {rowCount} row(s) selected",
84
+ selectedCountRowsSelected: "{selectedCount} row(s) selected",
75
85
  select: "Select",
86
+ selectAllMatching: "Select all matching records",
76
87
  showAll: "Show all",
77
88
  showAllColumns: "Show all columns",
78
89
  showHideColumns: "Show/Hide columns",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine-vue/table",
3
- "version": "2.4.0",
3
+ "version": "3.1.0",
4
4
  "description": "A fully featured Vue 3 implementation of TanStack Vue Table",
5
5
  "keywords": [
6
6
  "data grid",
@@ -65,9 +65,9 @@
65
65
  "vue": "^3.5.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@mantine-vue/core": "2.4.0",
69
- "@mantine-vue/dates": "2.4.0",
70
- "@mantine-vue/hooks": "2.4.0",
68
+ "@mantine-vue/core": "3.1.0",
69
+ "@mantine-vue/dates": "3.1.0",
70
+ "@mantine-vue/hooks": "3.1.0",
71
71
  "@tabler/icons-vue": ">=3.0.0",
72
72
  "@tanstack/match-sorter-utils": ">=8.7",
73
73
  "@tanstack/vue-table": ">=8.20",
package/styles.css CHANGED
@@ -210,6 +210,66 @@
210
210
  ._paginator-container-alert-banner_1k7ch_33 {
211
211
  position: relative !important;
212
212
  }
213
+ ._group-row_u9zpp_1 {
214
+ background-color: var(--mantine-color-gray-0);
215
+ }
216
+ [data-mantine-color-scheme='dark'] ._group-row_u9zpp_1 {
217
+ background-color: var(--mantine-color-dark-6);
218
+ }
219
+ ._group-row_u9zpp_1 {
220
+ width: 100%;
221
+ }
222
+
223
+ /* grid layout modes (used when column resizing is enabled) */
224
+ ._row-grid_u9zpp_7 {
225
+ display: flex;
226
+ }
227
+
228
+ ._group-cell_u9zpp_11 {
229
+ white-space: nowrap;
230
+ }
231
+
232
+ ._aggregate-cell_u9zpp_15 {
233
+ font-weight: 600;
234
+ }
235
+
236
+ ._expand-spacer_u9zpp_19 {
237
+ display: inline-block;
238
+ width: calc(1.625rem * var(--mantine-scale));
239
+ }
240
+
241
+ ._aux-row_u9zpp_24 {
242
+ background-color: transparent;
243
+ }
244
+
245
+ ._aux-cell_u9zpp_28 {
246
+ padding-block: calc(0.375rem * var(--mantine-scale));
247
+ }
248
+
249
+ ._pagination_u9zpp_32 {
250
+ justify-content: flex-start;
251
+ }
252
+
253
+ ._pagesize_u9zpp_36 {
254
+ width: calc(5rem * var(--mantine-scale));
255
+ }
256
+
257
+ ._groupby-control_u9zpp_40 {
258
+ align-items: center;
259
+ flex-wrap: wrap;
260
+ }
261
+
262
+ ._groupby-active-row_u9zpp_45 {
263
+ display: flex;
264
+ align-items: center;
265
+ gap: calc(0.25rem * var(--mantine-scale));
266
+ padding: calc(0.125rem * var(--mantine-scale)) calc(0.625rem * var(--mantine-scale));
267
+ }
268
+
269
+ ._groupby-active-label_u9zpp_52 {
270
+ flex: 1;
271
+ min-width: calc(5rem * var(--mantine-scale));
272
+ }
213
273
  ._symbol_1b3vj_1 {
214
274
  font-size: var(--mantine-font-size-xl);
215
275
  text-align: center;
package/styles.layer.css CHANGED
@@ -211,6 +211,66 @@
211
211
  ._paginator-container-alert-banner_1k7ch_33 {
212
212
  position: relative !important;
213
213
  }
214
+ ._group-row_u9zpp_1 {
215
+ background-color: var(--mantine-color-gray-0);
216
+ }
217
+ [data-mantine-color-scheme='dark'] ._group-row_u9zpp_1 {
218
+ background-color: var(--mantine-color-dark-6);
219
+ }
220
+ ._group-row_u9zpp_1 {
221
+ width: 100%;
222
+ }
223
+
224
+ /* grid layout modes (used when column resizing is enabled) */
225
+ ._row-grid_u9zpp_7 {
226
+ display: flex;
227
+ }
228
+
229
+ ._group-cell_u9zpp_11 {
230
+ white-space: nowrap;
231
+ }
232
+
233
+ ._aggregate-cell_u9zpp_15 {
234
+ font-weight: 600;
235
+ }
236
+
237
+ ._expand-spacer_u9zpp_19 {
238
+ display: inline-block;
239
+ width: calc(1.625rem * var(--mantine-scale));
240
+ }
241
+
242
+ ._aux-row_u9zpp_24 {
243
+ background-color: transparent;
244
+ }
245
+
246
+ ._aux-cell_u9zpp_28 {
247
+ padding-block: calc(0.375rem * var(--mantine-scale));
248
+ }
249
+
250
+ ._pagination_u9zpp_32 {
251
+ justify-content: flex-start;
252
+ }
253
+
254
+ ._pagesize_u9zpp_36 {
255
+ width: calc(5rem * var(--mantine-scale));
256
+ }
257
+
258
+ ._groupby-control_u9zpp_40 {
259
+ align-items: center;
260
+ flex-wrap: wrap;
261
+ }
262
+
263
+ ._groupby-active-row_u9zpp_45 {
264
+ display: flex;
265
+ align-items: center;
266
+ gap: calc(0.25rem * var(--mantine-scale));
267
+ padding: calc(0.125rem * var(--mantine-scale)) calc(0.625rem * var(--mantine-scale));
268
+ }
269
+
270
+ ._groupby-active-label_u9zpp_52 {
271
+ flex: 1;
272
+ min-width: calc(5rem * var(--mantine-scale));
273
+ }
214
274
  ._symbol_1b3vj_1 {
215
275
  font-size: var(--mantine-font-size-xl);
216
276
  text-align: center;