@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/cjs/index.cjs +1623 -49
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +1600 -52
- package/esm/index.mjs.map +1 -1
- package/lib/components/MVT_TableSlots.d.ts +28 -0
- package/lib/components/buttons/MVT_EditActionButtons.d.ts +1 -1
- package/lib/components/menus/MVT_ColumnActionMenu.d.ts +1 -1
- package/lib/index.d.mts +7 -0
- package/lib/index.d.ts +7 -0
- package/lib/server-grouping/MVT_ServerGroupingBody.d.ts +24 -0
- package/lib/server-grouping/MVT_ServerGroupingGroupBy.d.ts +45 -0
- package/lib/server-grouping/createServerGroupingProvider.d.ts +39 -0
- package/lib/server-grouping/serverGrouping.types.d.ts +494 -0
- package/lib/server-grouping/serverGrouping.utils.d.ts +31 -0
- package/lib/server-grouping/serverGroupingSelection.d.ts +65 -0
- package/lib/server-grouping/useMVT_ServerGrouping.d.ts +50 -0
- package/lib/types.d.ts +36 -2
- package/lib/utils/style.utils.d.ts +12 -0
- package/locales/en.cjs +11 -0
- package/locales/en.mjs +11 -0
- package/package.json +4 -4
- package/styles.css +60 -0
- package/styles.layer.css +60 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Slots, type VNodeChild } from 'vue';
|
|
2
2
|
import { type MVT_Cell, type MVT_Column, type MVT_InternalFilterOption, type MVT_Node, type MVT_Row, type MVT_RowData, type MVT_TableInstance } from '../types';
|
|
3
|
+
import type { MVT_ServerGroupCellContext, MVT_ServerGroupPathId, MVT_ServerGroupPathItem, MVT_ServerGroupRowContext, MVT_ServerGroupingGroupByContext } from '../server-grouping/serverGrouping.types';
|
|
3
4
|
/**
|
|
4
5
|
* Scoped named slots supported on `<MantineVueTable>`.
|
|
5
6
|
*
|
|
@@ -57,6 +58,33 @@ export interface MVT_TableSlots<TData extends MVT_RowData = MVT_RowData> {
|
|
|
57
58
|
onSelectFilterMode: (filterMode: string) => void;
|
|
58
59
|
table: MVT_TableInstance<TData>;
|
|
59
60
|
}) => VNodeChild;
|
|
61
|
+
/**
|
|
62
|
+
* Replaces the built-in group-by toolbar control entirely (takes precedence
|
|
63
|
+
* over `serverGrouping.groupBy.renderControl`). Use the provided context to
|
|
64
|
+
* build your own UI; disable the default independently via
|
|
65
|
+
* `serverGrouping.groupBy.enabled: false`.
|
|
66
|
+
*/
|
|
67
|
+
serverGroupByControl?: (arg: MVT_ServerGroupingGroupByContext) => VNodeChild;
|
|
68
|
+
serverGroupCell?: (arg: MVT_ServerGroupCellContext) => VNodeChild;
|
|
69
|
+
serverGroupCount?: (arg: MVT_ServerGroupRowContext) => VNodeChild;
|
|
70
|
+
serverGroupEmpty?: (arg: {
|
|
71
|
+
field?: string;
|
|
72
|
+
parentGroup?: MVT_ServerGroupPathItem;
|
|
73
|
+
pathId: MVT_ServerGroupPathId;
|
|
74
|
+
table: MVT_TableInstance<TData>;
|
|
75
|
+
}) => VNodeChild;
|
|
76
|
+
serverGroupError?: (arg: {
|
|
77
|
+
error: unknown;
|
|
78
|
+
pathId: MVT_ServerGroupPathId;
|
|
79
|
+
retry: () => void;
|
|
80
|
+
table: MVT_TableInstance<TData>;
|
|
81
|
+
}) => VNodeChild;
|
|
82
|
+
serverGroupLabel?: (arg: MVT_ServerGroupRowContext) => VNodeChild;
|
|
83
|
+
serverGroupLoading?: (arg: {
|
|
84
|
+
depth: number;
|
|
85
|
+
pathId: MVT_ServerGroupPathId;
|
|
86
|
+
table: MVT_TableInstance<TData>;
|
|
87
|
+
}) => VNodeChild;
|
|
60
88
|
rowActionMenuItems?: (arg: {
|
|
61
89
|
renderedRowIndex?: number;
|
|
62
90
|
row: MVT_Row<TData>;
|
|
@@ -29,5 +29,5 @@ export declare const MVT_EditActionButtons: import("vue").DefineComponent<import
|
|
|
29
29
|
default: string;
|
|
30
30
|
};
|
|
31
31
|
}>> & Readonly<{}>, {
|
|
32
|
-
variant: "
|
|
32
|
+
variant: "icon" | "text";
|
|
33
33
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -37,6 +37,6 @@ export declare const MVT_ColumnActionMenu: import("vue").DefineComponent<import(
|
|
|
37
37
|
required: true;
|
|
38
38
|
};
|
|
39
39
|
}>> & Readonly<{}>, {
|
|
40
|
-
onChange: (opened: boolean) => void;
|
|
41
40
|
opened: boolean;
|
|
41
|
+
onChange: (opened: boolean) => void;
|
|
42
42
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/lib/index.d.mts
CHANGED
|
@@ -55,6 +55,13 @@ export * from './components/toolbar/MVT_ToolbarAlertBanner';
|
|
|
55
55
|
export * from './components/toolbar/MVT_ToolbarDropZone';
|
|
56
56
|
export * from './components/toolbar/MVT_ToolbarInternalButtons';
|
|
57
57
|
export * from './components/toolbar/MVT_TopToolbar';
|
|
58
|
+
export * from './server-grouping/createServerGroupingProvider';
|
|
59
|
+
export * from './server-grouping/MVT_ServerGroupingBody';
|
|
60
|
+
export * from './server-grouping/MVT_ServerGroupingGroupBy';
|
|
61
|
+
export * from './server-grouping/serverGrouping.types';
|
|
62
|
+
export * from './server-grouping/serverGrouping.utils';
|
|
63
|
+
export * from './server-grouping/serverGroupingSelection';
|
|
64
|
+
export * from './server-grouping/useMVT_ServerGrouping';
|
|
58
65
|
export * from './fns/aggregationFns';
|
|
59
66
|
export * from './fns/filterFns';
|
|
60
67
|
export * from './fns/sortingFns';
|
package/lib/index.d.ts
CHANGED
|
@@ -55,6 +55,13 @@ export * from './components/toolbar/MVT_ToolbarAlertBanner';
|
|
|
55
55
|
export * from './components/toolbar/MVT_ToolbarDropZone';
|
|
56
56
|
export * from './components/toolbar/MVT_ToolbarInternalButtons';
|
|
57
57
|
export * from './components/toolbar/MVT_TopToolbar';
|
|
58
|
+
export * from './server-grouping/createServerGroupingProvider';
|
|
59
|
+
export * from './server-grouping/MVT_ServerGroupingBody';
|
|
60
|
+
export * from './server-grouping/MVT_ServerGroupingGroupBy';
|
|
61
|
+
export * from './server-grouping/serverGrouping.types';
|
|
62
|
+
export * from './server-grouping/serverGrouping.utils';
|
|
63
|
+
export * from './server-grouping/serverGroupingSelection';
|
|
64
|
+
export * from './server-grouping/useMVT_ServerGrouping';
|
|
58
65
|
export * from './fns/aggregationFns';
|
|
59
66
|
export * from './fns/filterFns';
|
|
60
67
|
export * from './fns/sortingFns';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type MVT_RowData, type MVT_TableInstance } from '../types';
|
|
3
|
+
/** Renders the server-grouping hierarchy as rows of the root table body. */
|
|
4
|
+
export declare const MVT_ServerGroupingBody: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
table: {
|
|
6
|
+
type: PropType<MVT_TableInstance<MVT_RowData>>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
tableProps: {
|
|
10
|
+
type: PropType<Record<string, any>>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
table: {
|
|
17
|
+
type: PropType<MVT_TableInstance<MVT_RowData>>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
tableProps: {
|
|
21
|
+
type: PropType<Record<string, any>>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type MVT_RowData, type MVT_TableInstance } from '../types';
|
|
3
|
+
import { type MVT_ServerGroupableColumn, type MVT_ServerGroupingGroupByContext } from './serverGrouping.types';
|
|
4
|
+
import { type MVT_ServerGroupingManager } from './useMVT_ServerGrouping';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the columns/fields offered by the group-by toolbar control.
|
|
7
|
+
*
|
|
8
|
+
* With `serverGrouping.groupBy.columns` set, exactly that whitelist is used
|
|
9
|
+
* (entries may be custom descriptors like `'createdAt:month'`). Otherwise
|
|
10
|
+
* every leaf `data` column whose `enableGrouping` is not `false` is offered —
|
|
11
|
+
* display columns and columns with `enableGrouping: false` never appear.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getServerGroupableColumns: (table: MVT_TableInstance<any>) => MVT_ServerGroupableColumn[];
|
|
14
|
+
/** Build the scoped context handed to the group-by slot / render callback. */
|
|
15
|
+
export declare const getServerGroupingGroupByContext: (table: MVT_TableInstance<any>, manager: MVT_ServerGroupingManager<MVT_RowData>) => MVT_ServerGroupingGroupByContext;
|
|
16
|
+
/**
|
|
17
|
+
* Grouping actions for one column's action menu, or `undefined` when the
|
|
18
|
+
* column cannot be grouped by.
|
|
19
|
+
*
|
|
20
|
+
* Uses exactly the same rules as the toolbar "Group by" control: server
|
|
21
|
+
* grouping must be active and driven by the table's `grouping` state, the
|
|
22
|
+
* control must not be disabled, and the column must be offered by
|
|
23
|
+
* {@link getServerGroupableColumns}.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getServerGroupingColumnActions: (table: MVT_TableInstance<any>, columnId: string) => MVT_ServerGroupingGroupByContext | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Built-in group-by toolbar control for server-side grouping. Renders a
|
|
28
|
+
* "Group by" menu (add / reorder / remove / clear levels) plus the active
|
|
29
|
+
* levels as removable pills. Hidden when server grouping is inactive, when
|
|
30
|
+
* `groupBy.enabled` is `false`, or when grouping is a static
|
|
31
|
+
* `serverGrouping.grouping` array (which the control could not change).
|
|
32
|
+
*/
|
|
33
|
+
export declare const MVT_ServerGroupingGroupBy: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
34
|
+
table: {
|
|
35
|
+
type: PropType<MVT_TableInstance<MVT_RowData>>;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
}>, () => string | number | boolean | void | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}> | import("vue").VNodeArrayChildren | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
41
|
+
table: {
|
|
42
|
+
type: PropType<MVT_TableInstance<MVT_RowData>>;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MVT_RowData } from '../types';
|
|
2
|
+
import type { MVT_ServerGroupingContext, MVT_ServerGroupingProvider, MVT_ServerGroupRequest, MVT_ServerRecordRequest } from './serverGrouping.types';
|
|
3
|
+
/**
|
|
4
|
+
* Config for {@link createServerGroupingProvider}. Accepts concise property
|
|
5
|
+
* names (`groups`, `groupId`, `records`, …) in addition to the explicit
|
|
6
|
+
* adapter names of {@link MVT_ServerGroupingProvider} (`getGroups`,
|
|
7
|
+
* `getGroupId`, `getRecords`, …). Explicit names win when both are given.
|
|
8
|
+
*/
|
|
9
|
+
export interface MVT_CreateServerGroupingProviderOptions<TData extends MVT_RowData = MVT_RowData, TGroup = unknown, TGroupResponse = unknown, TRecordResponse = unknown> extends Partial<Omit<MVT_ServerGroupingProvider<TData, TGroup, TGroupResponse, TRecordResponse>, 'loadGroups' | 'loadRecords'>> {
|
|
10
|
+
loadGroups: (request: MVT_ServerGroupRequest<TGroup>) => Promise<TGroupResponse>;
|
|
11
|
+
loadRecords: (request: MVT_ServerRecordRequest<TGroup>) => Promise<TRecordResponse>;
|
|
12
|
+
groups?: (response: TGroupResponse) => TGroup[];
|
|
13
|
+
groupRowCount?: (response: TGroupResponse) => number;
|
|
14
|
+
groupId?: (group: TGroup, context: MVT_ServerGroupingContext<TGroup>) => string;
|
|
15
|
+
groupLabel?: (group: TGroup, context: MVT_ServerGroupingContext<TGroup>) => string;
|
|
16
|
+
groupValue?: (group: TGroup, context: MVT_ServerGroupingContext<TGroup>) => unknown;
|
|
17
|
+
groupCount?: (group: TGroup, context: MVT_ServerGroupingContext<TGroup>) => number | undefined;
|
|
18
|
+
groupMeta?: (group: TGroup, context: MVT_ServerGroupingContext<TGroup>) => Record<string, unknown>;
|
|
19
|
+
hasChildren?: (group: TGroup, context: MVT_ServerGroupingContext<TGroup>) => boolean;
|
|
20
|
+
records?: (response: TRecordResponse) => TData[];
|
|
21
|
+
recordRowCount?: (response: TRecordResponse) => number;
|
|
22
|
+
rowId?: (row: TData) => string;
|
|
23
|
+
cacheKey?: (request: MVT_ServerGroupRequest<TGroup> | MVT_ServerRecordRequest<TGroup>) => unknown[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build a {@link MVT_ServerGroupingProvider} with sensible defaults for common
|
|
27
|
+
* response formats:
|
|
28
|
+
*
|
|
29
|
+
* - `groups`/`records` default to the response itself when it is an array.
|
|
30
|
+
* - `groupRowCount`/`recordRowCount` default to the mapped array length.
|
|
31
|
+
* - `groupId`/`groupLabel` default to stringifying `groupValue` (or the group
|
|
32
|
+
* itself when it is a primitive).
|
|
33
|
+
* - `groupValue` defaults to the group object itself.
|
|
34
|
+
* - `groupMeta` defaults to `{}`; `groupCount` and aggregates stay optional.
|
|
35
|
+
* - `hasChildren` defaults to `true` (every level up to and including the last
|
|
36
|
+
* grouping level is expandable).
|
|
37
|
+
* - `rowId` falls back to the table's existing `getRowId` logic.
|
|
38
|
+
*/
|
|
39
|
+
export declare const createServerGroupingProvider: <TData extends MVT_RowData = MVT_RowData, TGroup = unknown, TGroupResponse = unknown, TRecordResponse = unknown>(options: MVT_CreateServerGroupingProviderOptions<TData, TGroup, TGroupResponse, TRecordResponse>) => MVT_ServerGroupingProvider<TData, TGroup, TGroupResponse, TRecordResponse>;
|