element-plus-suite 0.0.3 → 0.0.5
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/README.md +86 -1
- package/dist/form-pro/component-map.d.ts +32 -0
- package/dist/form-pro/index.d.ts +2 -0
- package/dist/form-pro/index.vue.d.ts +70 -0
- package/dist/form-pro/types.d.ts +123 -0
- package/dist/form-pro/utils.d.ts +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +826 -233
- package/dist/table-pro/composables/use-table-merge.d.ts +2 -2
- package/dist/table-pro/composables/use-table-request.d.ts +1 -0
- package/dist/table-pro/index.d.ts +1 -1
- package/dist/table-pro/index.vue.d.ts +19 -1
- package/dist/table-pro/types.d.ts +33 -6
- package/package.json +1 -1
|
@@ -10,10 +10,10 @@ interface UseTableMergeOptions<Row> {
|
|
|
10
10
|
lazy: () => boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare function useTableMerge<Row>(options: UseTableMergeOptions<Row>): {
|
|
13
|
-
spanMethod: ComputedRef<import('..').TableProSpanMethod<any> | ((params: TableProSpanMethodParams<Row>) => {
|
|
13
|
+
spanMethod: ComputedRef<import('..').TableProSpanMethod<any> | ((params: TableProSpanMethodParams<Row>) => number[] | {
|
|
14
14
|
rowspan: number;
|
|
15
15
|
colspan: number;
|
|
16
|
-
} |
|
|
16
|
+
} | undefined) | undefined>;
|
|
17
17
|
spanMap: ComputedRef<Map<string, number[]>>;
|
|
18
18
|
};
|
|
19
19
|
export {};
|
|
@@ -3,6 +3,7 @@ interface UseTableRequestOptions<Row> {
|
|
|
3
3
|
request: () => TableProRequest<Row> | undefined;
|
|
4
4
|
page: () => number | null;
|
|
5
5
|
pageSize: () => number | null;
|
|
6
|
+
query: () => Record<string, any>;
|
|
6
7
|
onLoaded?: (result: TableProRequestResult<Row>) => void;
|
|
7
8
|
onError?: (error: unknown) => void;
|
|
8
9
|
onData?: (result: TableProRequestResult<Row>) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as ElTablePro } from './index.vue';
|
|
2
|
-
export type { TableProColumn, TableProColumnContext, TableProColumnHeaderRenderScope, TableProColumnRenderScope, TableProInstance, TableProOwnInstance, TableProOwnProps, TableProPagination, TableProProps, TableProRequest, TableProRequestParams, TableProRequestResult, TableProSpanMethod, TableProSpanMethodParams, TableProSpanMethodResult, TableProTableInstance, TableProTableProps, TableProTreeProps, ResolvedTableProPagination, } from './types';
|
|
2
|
+
export type { TableProColumn, TableProColumnContext, TableProColumnHeaderRenderScope, TableProColumnRenderScope, TableProFilterConfigExtension, TableProFilterConfig, TableProInstance, TableProOwnInstance, TableProOwnProps, TableProPagination, TableProProps, TableProRequest, TableProRequestParams, TableProRequestResult, TableProSpanMethod, TableProSpanMethodParams, TableProSpanMethodResult, TableProTableInstance, TableProTableProps, TableProTreeProps, ResolvedTableProPagination, } from './types';
|
|
3
3
|
export { TABLE_PRO_DEFAULT_PAGINATION, normalizePagination, } from './types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { TableProColumn, TableProPagination, TableProRequest, TableProRequestResult } from './types';
|
|
2
|
+
import { TableProColumn, TableProFilterConfig, TableProPagination, TableProRequest, TableProRequestResult } from './types';
|
|
3
3
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
4
|
columns: {
|
|
5
5
|
type: PropType<TableProColumn<any>[]>;
|
|
@@ -17,6 +17,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
17
17
|
type: PropType<string[]>;
|
|
18
18
|
default: () => never[];
|
|
19
19
|
};
|
|
20
|
+
query: {
|
|
21
|
+
type: PropType<Record<string, any>>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
filter: {
|
|
25
|
+
type: PropType<TableProFilterConfig>;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
20
28
|
data: {
|
|
21
29
|
type: PropType<any[]>;
|
|
22
30
|
default: () => never[];
|
|
@@ -47,6 +55,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
47
55
|
type: PropType<string[]>;
|
|
48
56
|
default: () => never[];
|
|
49
57
|
};
|
|
58
|
+
query: {
|
|
59
|
+
type: PropType<Record<string, any>>;
|
|
60
|
+
default: undefined;
|
|
61
|
+
};
|
|
62
|
+
filter: {
|
|
63
|
+
type: PropType<TableProFilterConfig>;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
50
66
|
data: {
|
|
51
67
|
type: PropType<any[]>;
|
|
52
68
|
default: () => never[];
|
|
@@ -59,7 +75,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
59
75
|
onError?: ((_error: unknown) => any) | undefined;
|
|
60
76
|
onLoaded?: ((_result: TableProRequestResult<any>) => any) | undefined;
|
|
61
77
|
}>, {
|
|
78
|
+
filter: TableProFilterConfig<Record<string, any>>;
|
|
62
79
|
data: any[];
|
|
80
|
+
query: Record<string, any>;
|
|
63
81
|
columns: TableProColumn<any>[];
|
|
64
82
|
request: TableProRequest<any>;
|
|
65
83
|
pagination: boolean | TableProPagination;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Ref, VNode, VNodeChild } from 'vue';
|
|
2
|
+
import { FormProConfig, FormProSchemaItem } from '../form-pro/types';
|
|
2
3
|
/**
|
|
3
4
|
* 表格列在运行时由 Element Plus 提供。
|
|
4
5
|
* 这里只声明组件库会用到的公共字段,其余字段保持开放
|
|
@@ -73,9 +74,10 @@ export interface TableProTableProps {
|
|
|
73
74
|
treeProps?: TableProTreeProps;
|
|
74
75
|
[key: string]: any;
|
|
75
76
|
}
|
|
76
|
-
export interface TableProRequestParams {
|
|
77
|
+
export interface TableProRequestParams<Query = Record<string, any>> {
|
|
77
78
|
page: number | null;
|
|
78
79
|
pageSize: number | null;
|
|
80
|
+
query: Query;
|
|
79
81
|
signal: AbortSignal;
|
|
80
82
|
}
|
|
81
83
|
export interface TableProRequestResult<Row> {
|
|
@@ -93,7 +95,7 @@ export interface TableProColumnRenderScope<Row> {
|
|
|
93
95
|
column: TableProColumnContext<any>;
|
|
94
96
|
$index: number;
|
|
95
97
|
}
|
|
96
|
-
export type TableProRequest<Row
|
|
98
|
+
export type TableProRequest<Row, Query = Record<string, any>> = (params: TableProRequestParams<Query>) => Promise<TableProRequestResult<Row>>;
|
|
97
99
|
type ElTableColumnProps = {
|
|
98
100
|
type?: string;
|
|
99
101
|
label?: string;
|
|
@@ -150,18 +152,39 @@ export interface TableProPagination {
|
|
|
150
152
|
page?: number;
|
|
151
153
|
pageSize?: number;
|
|
152
154
|
pageSizes?: number[];
|
|
155
|
+
pagerCount?: number;
|
|
153
156
|
layout?: string;
|
|
154
157
|
background?: boolean;
|
|
155
158
|
}
|
|
156
|
-
export interface
|
|
159
|
+
export interface TableProFilterConfigExtension extends FormProConfig {
|
|
160
|
+
/** 是否显示筛选表单的展开/收起按钮 */
|
|
161
|
+
showCollapseButton?: boolean;
|
|
162
|
+
/** 收起时显示的行数,默认 1 */
|
|
163
|
+
collapseRows?: number;
|
|
164
|
+
/** 收起时显示的字段数量;设置后优先于 collapseRows */
|
|
165
|
+
collapseCount?: number;
|
|
166
|
+
/** 是否默认收起;显示折叠按钮时默认 true */
|
|
167
|
+
collapsed?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface TableProFilterConfig<Query = Record<string, any>> {
|
|
170
|
+
schema: FormProSchemaItem[];
|
|
171
|
+
formConfig?: TableProFilterConfigExtension;
|
|
172
|
+
model?: Query;
|
|
173
|
+
defaultValue?: Query;
|
|
174
|
+
}
|
|
175
|
+
export interface TableProOwnProps<Row, Query = Record<string, any>> {
|
|
157
176
|
columns?: TableProColumn<Row>[];
|
|
158
|
-
request?: TableProRequest<Row>;
|
|
177
|
+
request?: TableProRequest<Row, Query>;
|
|
159
178
|
pagination?: boolean | TableProPagination;
|
|
160
|
-
/**
|
|
179
|
+
/** 按数组顺序依次合并连续同值字段 */
|
|
161
180
|
mergeFields?: string[];
|
|
181
|
+
/** 已应用的检索条件对象 */
|
|
182
|
+
query?: Query;
|
|
183
|
+
/** 可选的筛选表单配置 */
|
|
184
|
+
filter?: TableProFilterConfig<Query>;
|
|
162
185
|
}
|
|
163
186
|
type ElTableProps = Partial<TableProTableProps>;
|
|
164
|
-
export type TableProProps<Row extends Record<string, any>> = Omit<ElTableProps, 'data' | 'rowKey'> & TableProOwnProps<Row> & {
|
|
187
|
+
export type TableProProps<Row extends Record<string, any>, Query = Record<string, any>> = Omit<ElTableProps, 'data' | 'rowKey'> & TableProOwnProps<Row, Query> & {
|
|
165
188
|
data?: Row[];
|
|
166
189
|
rowKey: (keyof Row & string) | ((row: Row) => string | number);
|
|
167
190
|
};
|
|
@@ -169,12 +192,15 @@ export interface TableProOwnInstance {
|
|
|
169
192
|
reload: (options?: {
|
|
170
193
|
page?: number;
|
|
171
194
|
}) => Promise<void>;
|
|
195
|
+
search: () => Promise<void>;
|
|
196
|
+
resetFilter: () => Promise<void>;
|
|
172
197
|
}
|
|
173
198
|
export type TableProInstance = TableProOwnInstance & TableProTableInstance;
|
|
174
199
|
export declare const TABLE_PRO_DEFAULT_PAGINATION: {
|
|
175
200
|
readonly page: 1;
|
|
176
201
|
readonly pageSize: 20;
|
|
177
202
|
readonly pageSizes: readonly [10, 20, 50, 100];
|
|
203
|
+
readonly pagerCount: 5;
|
|
178
204
|
readonly layout: "total, sizes, prev, pager, next, jumper";
|
|
179
205
|
readonly background: true;
|
|
180
206
|
};
|
|
@@ -182,6 +208,7 @@ export type ResolvedTableProPagination = {
|
|
|
182
208
|
page: number;
|
|
183
209
|
pageSize: number;
|
|
184
210
|
pageSizes: readonly number[];
|
|
211
|
+
pagerCount: number;
|
|
185
212
|
layout: string;
|
|
186
213
|
background: boolean;
|
|
187
214
|
};
|