cosey 0.3.11 → 0.3.13
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.
|
@@ -5,7 +5,7 @@ export * from './useTable';
|
|
|
5
5
|
declare const _Table: {
|
|
6
6
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
7
7
|
api: {
|
|
8
|
-
type: import("vue").PropType<(...args: any[]) => Promise<any
|
|
8
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
9
9
|
};
|
|
10
10
|
immediate: {
|
|
11
11
|
type: BooleanConstructor;
|
|
@@ -167,12 +167,15 @@ declare const _Table: {
|
|
|
167
167
|
disabled: BooleanConstructor;
|
|
168
168
|
}>>>;
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
transformParams: {
|
|
171
171
|
type: import("vue").PropType<(params: Record<string, any>) => any>;
|
|
172
172
|
};
|
|
173
|
-
|
|
173
|
+
transformResponse: {
|
|
174
174
|
type: import("vue").PropType<(res: any) => any>;
|
|
175
175
|
};
|
|
176
|
+
parallelFetch: {
|
|
177
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
178
|
+
};
|
|
176
179
|
toolbarConfig: {
|
|
177
180
|
type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
|
|
178
181
|
default: boolean;
|
|
@@ -328,7 +331,7 @@ declare const _Table: {
|
|
|
328
331
|
Defaults: {};
|
|
329
332
|
}, Readonly<import("vue").ExtractPropTypes<{
|
|
330
333
|
api: {
|
|
331
|
-
type: import("vue").PropType<(...args: any[]) => Promise<any
|
|
334
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
332
335
|
};
|
|
333
336
|
immediate: {
|
|
334
337
|
type: BooleanConstructor;
|
|
@@ -490,12 +493,15 @@ declare const _Table: {
|
|
|
490
493
|
disabled: BooleanConstructor;
|
|
491
494
|
}>>>;
|
|
492
495
|
};
|
|
493
|
-
|
|
496
|
+
transformParams: {
|
|
494
497
|
type: import("vue").PropType<(params: Record<string, any>) => any>;
|
|
495
498
|
};
|
|
496
|
-
|
|
499
|
+
transformResponse: {
|
|
497
500
|
type: import("vue").PropType<(res: any) => any>;
|
|
498
501
|
};
|
|
502
|
+
parallelFetch: {
|
|
503
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
504
|
+
};
|
|
499
505
|
toolbarConfig: {
|
|
500
506
|
type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
|
|
501
507
|
default: boolean;
|
|
@@ -648,7 +654,7 @@ declare const _Table: {
|
|
|
648
654
|
__isSuspense?: never;
|
|
649
655
|
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
650
656
|
api: {
|
|
651
|
-
type: import("vue").PropType<(...args: any[]) => Promise<any
|
|
657
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
652
658
|
};
|
|
653
659
|
immediate: {
|
|
654
660
|
type: BooleanConstructor;
|
|
@@ -671,12 +677,15 @@ declare const _Table: {
|
|
|
671
677
|
formProps: {
|
|
672
678
|
type: import("vue").PropType<import("..").TableQueryProps>;
|
|
673
679
|
};
|
|
674
|
-
|
|
680
|
+
transformParams: {
|
|
675
681
|
type: import("vue").PropType<(params: Record<string, any>) => any>;
|
|
676
682
|
};
|
|
677
|
-
|
|
683
|
+
transformResponse: {
|
|
678
684
|
type: import("vue").PropType<(res: any) => any>;
|
|
679
685
|
};
|
|
686
|
+
parallelFetch: {
|
|
687
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
688
|
+
};
|
|
680
689
|
toolbarConfig: {
|
|
681
690
|
type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
|
|
682
691
|
default: boolean;
|
|
@@ -16,7 +16,7 @@ const getTableStyle = (token) => {
|
|
|
16
16
|
},
|
|
17
17
|
[`${componentCls}-header`]: {
|
|
18
18
|
flex: "none",
|
|
19
|
-
paddingInline: token.
|
|
19
|
+
paddingInline: token.paddingSM,
|
|
20
20
|
paddingBlockStart: token.size
|
|
21
21
|
},
|
|
22
22
|
[`${componentCls}-body`]: {
|
|
@@ -30,8 +30,8 @@ const getTableStyle = (token) => {
|
|
|
30
30
|
flex: "none",
|
|
31
31
|
alignItems: "center",
|
|
32
32
|
justifyContent: "center",
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
paddingBlockStart: token.paddingSM,
|
|
34
|
+
paddingInline: token.paddingSM
|
|
35
35
|
},
|
|
36
36
|
[`${componentCls}-toolbar-left`]: {},
|
|
37
37
|
[`${componentCls}-toolbar-right`]: {
|
|
@@ -49,6 +49,10 @@ const getTableStyle = (token) => {
|
|
|
49
49
|
animationIterationCount: "infinite"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
+
[`${componentCls}-before-table`]: {
|
|
53
|
+
paddingBlockStart: token.paddingSM,
|
|
54
|
+
paddingInline: token.paddingSM
|
|
55
|
+
},
|
|
52
56
|
[`${componentCls}-table`]: {
|
|
53
57
|
minHeight: 0,
|
|
54
58
|
flex: 1,
|
|
@@ -61,8 +65,8 @@ const getTableStyle = (token) => {
|
|
|
61
65
|
flex: "none",
|
|
62
66
|
flexWrap: "wrap",
|
|
63
67
|
justifyContent: "flex-end",
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
paddingBlockEnd: token.paddingSM,
|
|
69
|
+
paddingInline: token.paddingSM
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
};
|
|
@@ -17,7 +17,7 @@ export declare const tableEmitOnProps: Record<string, {
|
|
|
17
17
|
}>;
|
|
18
18
|
export declare const tableProps: {
|
|
19
19
|
api: {
|
|
20
|
-
type: PropType<(...args: any[]) => Promise<any
|
|
20
|
+
type: PropType<(...args: any[]) => Promise<any> | any>;
|
|
21
21
|
};
|
|
22
22
|
immediate: {
|
|
23
23
|
type: BooleanConstructor;
|
|
@@ -40,12 +40,15 @@ export declare const tableProps: {
|
|
|
40
40
|
formProps: {
|
|
41
41
|
type: PropType<TableQueryProps>;
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
transformParams: {
|
|
44
44
|
type: PropType<(params: Record<string, any>) => any>;
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
transformResponse: {
|
|
47
47
|
type: PropType<(res: any) => any>;
|
|
48
48
|
};
|
|
49
|
+
parallelFetch: {
|
|
50
|
+
type: PropType<(...args: any[]) => Promise<any> | any>;
|
|
51
|
+
};
|
|
49
52
|
toolbarConfig: {
|
|
50
53
|
type: PropType<ToolbarConfig | boolean>;
|
|
51
54
|
default: boolean;
|
|
@@ -146,6 +149,7 @@ export interface TableSlots {
|
|
|
146
149
|
empty?: (props: Record<string, never>) => any;
|
|
147
150
|
'toolbar-left'?: (props: Record<string, never>) => any;
|
|
148
151
|
'toolbar-right'?: (props: Record<string, never>) => any;
|
|
152
|
+
'before-table'?: (props: Record<string, never>) => any;
|
|
149
153
|
}
|
|
150
154
|
export declare const elSlotsName: readonly ["default", "append", "empty"];
|
|
151
155
|
export interface TableCustomExpose {
|
|
@@ -60,10 +60,13 @@ const tableExtraProps = {
|
|
|
60
60
|
formProps: {
|
|
61
61
|
type: Object
|
|
62
62
|
},
|
|
63
|
-
|
|
63
|
+
transformParams: {
|
|
64
64
|
type: Function
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
transformResponse: {
|
|
67
|
+
type: Function
|
|
68
|
+
},
|
|
69
|
+
parallelFetch: {
|
|
67
70
|
type: Function
|
|
68
71
|
},
|
|
69
72
|
toolbarConfig: {
|
|
@@ -4,7 +4,7 @@ import { type TableColumnProps } from './table-column/table-column';
|
|
|
4
4
|
type __VLS_Slots = TableSlots;
|
|
5
5
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
6
|
api: {
|
|
7
|
-
type: import("vue").PropType<(...args: any[]) => Promise<any
|
|
7
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
8
8
|
};
|
|
9
9
|
immediate: {
|
|
10
10
|
type: BooleanConstructor;
|
|
@@ -27,12 +27,15 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
27
27
|
formProps: {
|
|
28
28
|
type: import("vue").PropType<import("..").TableQueryProps>;
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
transformParams: {
|
|
31
31
|
type: import("vue").PropType<(params: Record<string, any>) => any>;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
transformResponse: {
|
|
34
34
|
type: import("vue").PropType<(res: any) => any>;
|
|
35
35
|
};
|
|
36
|
+
parallelFetch: {
|
|
37
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
38
|
+
};
|
|
36
39
|
toolbarConfig: {
|
|
37
40
|
type: import("vue").PropType<ToolbarConfig | boolean>;
|
|
38
41
|
default: boolean;
|
|
@@ -157,7 +160,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
157
160
|
updateKeyChildren: (key: string, data: any[]) => void;
|
|
158
161
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
159
162
|
api: {
|
|
160
|
-
type: import("vue").PropType<(...args: any[]) => Promise<any
|
|
163
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
161
164
|
};
|
|
162
165
|
immediate: {
|
|
163
166
|
type: BooleanConstructor;
|
|
@@ -180,12 +183,15 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
180
183
|
formProps: {
|
|
181
184
|
type: import("vue").PropType<import("..").TableQueryProps>;
|
|
182
185
|
};
|
|
183
|
-
|
|
186
|
+
transformParams: {
|
|
184
187
|
type: import("vue").PropType<(params: Record<string, any>) => any>;
|
|
185
188
|
};
|
|
186
|
-
|
|
189
|
+
transformResponse: {
|
|
187
190
|
type: import("vue").PropType<(res: any) => any>;
|
|
188
191
|
};
|
|
192
|
+
parallelFetch: {
|
|
193
|
+
type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
|
|
194
|
+
};
|
|
189
195
|
toolbarConfig: {
|
|
190
196
|
type: import("vue").PropType<ToolbarConfig | boolean>;
|
|
191
197
|
default: boolean;
|
|
@@ -123,6 +123,9 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
123
123
|
};
|
|
124
124
|
const flattedColumns = computed(() => flatColumns(props.columns));
|
|
125
125
|
const tableData = ref(props.data || []);
|
|
126
|
+
watch(() => props.data, () => {
|
|
127
|
+
tableData.value = props.data || [];
|
|
128
|
+
});
|
|
126
129
|
const tableDataWithSummary = computed(() => {
|
|
127
130
|
const columns = flattedColumns.value.map(column => {
|
|
128
131
|
return {
|
|
@@ -151,7 +154,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
151
154
|
...orderParams,
|
|
152
155
|
...filterEmptyFormValue(tableQueryRef.value?.getFieldsValue() || {})
|
|
153
156
|
};
|
|
154
|
-
return filterEmptyFormValue(props.
|
|
157
|
+
return filterEmptyFormValue(props.transformParams?.(params) || params);
|
|
155
158
|
};
|
|
156
159
|
const getFullFetchParams = () => {
|
|
157
160
|
return {
|
|
@@ -163,10 +166,17 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
163
166
|
const {
|
|
164
167
|
isFetching,
|
|
165
168
|
execute
|
|
166
|
-
} = useFetch(() =>
|
|
169
|
+
} = useFetch(() => {
|
|
170
|
+
const params = getFullFetchParams();
|
|
171
|
+
return Promise.all([props.api?.({
|
|
172
|
+
...params
|
|
173
|
+
}), props.parallelFetch?.({
|
|
174
|
+
...params
|
|
175
|
+
})]);
|
|
176
|
+
}, {
|
|
167
177
|
immediate: false,
|
|
168
|
-
onSuccess(res) {
|
|
169
|
-
res = props.
|
|
178
|
+
onSuccess([res]) {
|
|
179
|
+
res = props.transformResponse?.(res) || res;
|
|
170
180
|
tableData.value = (tableKeys.list ? get(res, tableKeys.list) : res) || [];
|
|
171
181
|
total.value = +get(res, tableKeys.total) || 0;
|
|
172
182
|
elTableRef.value?.setScrollTop(0);
|
|
@@ -462,6 +472,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
462
472
|
}, null, 8, ["modelValue", "virtual-ref"])])) : createCommentVNode("v-if", true)], 2
|
|
463
473
|
/* CLASS */)) : createCommentVNode("v-if", true)], 2
|
|
464
474
|
/* CLASS */)], 2
|
|
475
|
+
/* CLASS */)) : createCommentVNode("v-if", true), _ctx.$slots["before-table"] ? (openBlock(), createElementBlock("div", {
|
|
476
|
+
key: 1,
|
|
477
|
+
class: normalizeClass(`${unref(prefixCls)}-before-table`)
|
|
478
|
+
}, [renderSlot(_ctx.$slots, "before-table")], 2
|
|
465
479
|
/* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
|
|
466
480
|
class: normalizeClass(`${unref(prefixCls)}-table`)
|
|
467
481
|
}, [createVNode(_component_el_table, mergeProps({
|
|
@@ -524,7 +538,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
524
538
|
};
|
|
525
539
|
})]), 1040, ["class", "data", "expand-row-keys"])], 2
|
|
526
540
|
/* CLASS */), paginationProps.value ? (openBlock(), createBlock(_component_el_pagination, mergeProps({
|
|
527
|
-
key:
|
|
541
|
+
key: 2
|
|
528
542
|
}, paginationProps.value, {
|
|
529
543
|
"current-page": page.value,
|
|
530
544
|
"onUpdate:currentPage": _cache[3] || (_cache[3] = $event => page.value = $event),
|