@gx-design-vue/pro-table 0.2.0-alpha.17 → 0.2.0-alpha.19
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/dist/ProTable.js +10 -3
- package/dist/components/ScrollBar/Bar.d.ts +3 -5
- package/dist/components/ScrollBar/Thumb.d.ts +3 -5
- package/dist/components/SearchForm/CollapseToggle.d.ts +4 -6
- package/dist/components/SearchForm/FormItemContainer.d.ts +5 -7
- package/dist/components/SearchForm/FormItemWrapper.d.ts +5 -7
- package/dist/components/SearchForm/SearchForm.d.ts +5 -7
- package/dist/components/Toolbar/FullscreenIcon.d.ts +3 -5
- package/dist/components/Toolbar/ListToolBar.d.ts +10 -12
- package/dist/components/Toolbar/index.d.ts +8 -10
- package/dist/hooks/useColumnResize.d.ts +1 -2
- package/dist/hooks/useFetchData.d.ts +2 -0
- package/dist/hooks/useFetchData.js +10 -9
- package/dist/hooks/useTableForm.d.ts +2 -0
- package/dist/hooks/useTableForm.js +68 -21
- package/dist/hooks/useTableSize.js +1 -1
- package/dist/pro-table.esm.js +458 -406
- package/dist/pro-table.js +1 -1
- package/dist/style/index.d.ts +1 -3
- package/package.json +20 -10
package/dist/ProTable.js
CHANGED
|
@@ -140,9 +140,10 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
140
140
|
if (props.form === false) return void 0;
|
|
141
141
|
return props.form?.actions;
|
|
142
142
|
});
|
|
143
|
-
const { formColumns, defaultFormSearch, formState, getFormSearch, resetFormState } = useTableForm({
|
|
143
|
+
const { formColumns, formParamKeys, defaultFormSearch, formState, getFormSearch, resetFormState } = useTableForm({
|
|
144
144
|
searchMap: computed(() => props.searchMap ?? []),
|
|
145
|
-
columns: computed(() => props.columns ?? [])
|
|
145
|
+
columns: computed(() => props.columns ?? []),
|
|
146
|
+
params: computed(() => props.params)
|
|
146
147
|
});
|
|
147
148
|
const { dataSource, setTableDataList, operateTableDataRow, handleTableChange, reload, run } = useFetchData({
|
|
148
149
|
rowKey: computed(() => props.rowKey),
|
|
@@ -157,6 +158,8 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
157
158
|
debounceTime: computed(() => props.debounceTime ?? 10),
|
|
158
159
|
params: computed(() => props.params),
|
|
159
160
|
defaultFormSearch,
|
|
161
|
+
formParamKeys,
|
|
162
|
+
getFormSearch,
|
|
160
163
|
onLoadingChange: props.onLoadingChange,
|
|
161
164
|
onRequestError: props.onRequestError,
|
|
162
165
|
onBeforeSearchSubmit: props.onBeforeSearchSubmit
|
|
@@ -417,7 +420,7 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
417
420
|
}, null)] })]), loadingState.value && createVNode("div", { "class": classNames(`${prefixCls.value}-loading-mask`, hashId.value) }, [createVNode(Spin, { "indicator": resolvedIndicator.value }, null)])])])])]);
|
|
418
421
|
};
|
|
419
422
|
}, {
|
|
420
|
-
props:
|
|
423
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
421
424
|
loading: {
|
|
422
425
|
type: [Boolean, Object],
|
|
423
426
|
required: false,
|
|
@@ -659,6 +662,10 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
659
662
|
type: String,
|
|
660
663
|
required: false
|
|
661
664
|
},
|
|
665
|
+
column: {
|
|
666
|
+
type: Object,
|
|
667
|
+
required: false
|
|
668
|
+
},
|
|
662
669
|
size: {
|
|
663
670
|
type: [String, null],
|
|
664
671
|
required: false
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { CSSProperties } from "vue";
|
|
3
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
4
2
|
|
|
5
3
|
//#region src/components/ScrollBar/Bar.d.ts
|
|
6
4
|
interface BarExpose {
|
|
@@ -28,7 +26,7 @@ declare const barProps: {
|
|
|
28
26
|
readonly default: false;
|
|
29
27
|
};
|
|
30
28
|
};
|
|
31
|
-
declare const _default:
|
|
29
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
32
30
|
readonly always: {
|
|
33
31
|
readonly type: BooleanConstructor;
|
|
34
32
|
readonly default: true;
|
|
@@ -48,7 +46,7 @@ declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
48
46
|
readonly type: BooleanConstructor;
|
|
49
47
|
readonly default: false;
|
|
50
48
|
};
|
|
51
|
-
}>, () =>
|
|
49
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
52
50
|
readonly always: {
|
|
53
51
|
readonly type: BooleanConstructor;
|
|
54
52
|
readonly default: true;
|
|
@@ -76,6 +74,6 @@ declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
76
74
|
};
|
|
77
75
|
readonly minSize: number;
|
|
78
76
|
readonly hasScrollY: boolean;
|
|
79
|
-
}, {}, {}, {}, string,
|
|
77
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
80
78
|
//#endregion
|
|
81
79
|
export { BarExpose, barProps, _default as default };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { CSSProperties } from "vue";
|
|
3
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
4
2
|
|
|
5
3
|
//#region src/components/ScrollBar/Thumb.d.ts
|
|
6
4
|
declare const thumbProps: {
|
|
@@ -17,7 +15,7 @@ declare const thumbProps: {
|
|
|
17
15
|
readonly default: () => {};
|
|
18
16
|
};
|
|
19
17
|
};
|
|
20
|
-
declare const _default:
|
|
18
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
21
19
|
readonly vertical: BooleanConstructor;
|
|
22
20
|
readonly size: StringConstructor;
|
|
23
21
|
readonly move: NumberConstructor;
|
|
@@ -30,7 +28,7 @@ declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
30
28
|
readonly type: () => CSSProperties;
|
|
31
29
|
readonly default: () => {};
|
|
32
30
|
};
|
|
33
|
-
}>, () =>
|
|
31
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
32
|
readonly vertical: BooleanConstructor;
|
|
35
33
|
readonly size: StringConstructor;
|
|
36
34
|
readonly move: NumberConstructor;
|
|
@@ -47,6 +45,6 @@ declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
47
45
|
readonly vertical: boolean;
|
|
48
46
|
readonly always: boolean;
|
|
49
47
|
readonly barStyle: CSSProperties;
|
|
50
|
-
}, {}, {}, {}, string,
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
51
49
|
//#endregion
|
|
52
50
|
export { _default as default, thumbProps };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { PropType } from "vue";
|
|
3
2
|
import { CustomRender, WithFalse } from "@gx-design-vue/pro-utils";
|
|
4
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/components/SearchForm/CollapseToggle.d.ts
|
|
7
|
-
declare const CollapseToggle:
|
|
5
|
+
declare const CollapseToggle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
6
|
collapsed: {
|
|
9
7
|
type: BooleanConstructor;
|
|
10
8
|
default: any;
|
|
@@ -25,7 +23,7 @@ declare const CollapseToggle: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
25
23
|
type: PropType<(collapsed: boolean) => void>;
|
|
26
24
|
required: true;
|
|
27
25
|
};
|
|
28
|
-
}>, () =>
|
|
26
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
27
|
collapsed: {
|
|
30
28
|
type: BooleanConstructor;
|
|
31
29
|
default: any;
|
|
@@ -47,9 +45,9 @@ declare const CollapseToggle: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
47
45
|
required: true;
|
|
48
46
|
};
|
|
49
47
|
}>> & Readonly<{}>, {
|
|
48
|
+
hashId: string;
|
|
50
49
|
collapsed: boolean;
|
|
51
50
|
collapseRender: WithFalse<(collapsed?: boolean) => CustomRender>;
|
|
52
|
-
|
|
53
|
-
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
51
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
52
|
//#endregion
|
|
55
53
|
export { CollapseToggle };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ProSearchMap } from "../../interface.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { PropType } from "vue";
|
|
4
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/components/SearchForm/FormItemContainer.d.ts
|
|
7
|
-
declare const FormItemContainer:
|
|
5
|
+
declare const FormItemContainer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
6
|
prefixCls: {
|
|
9
7
|
type: StringConstructor;
|
|
10
8
|
required: true;
|
|
@@ -35,7 +33,7 @@ declare const FormItemContainer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
35
33
|
type: PropType<() => void>;
|
|
36
34
|
default: any;
|
|
37
35
|
};
|
|
38
|
-
}>, () =>
|
|
36
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
37
|
prefixCls: {
|
|
40
38
|
type: StringConstructor;
|
|
41
39
|
required: true;
|
|
@@ -67,9 +65,9 @@ declare const FormItemContainer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
67
65
|
default: any;
|
|
68
66
|
};
|
|
69
67
|
}>> & Readonly<{}>, {
|
|
70
|
-
loading: boolean;
|
|
71
|
-
autoRequest: boolean;
|
|
72
68
|
onSubmit: () => void;
|
|
73
|
-
|
|
69
|
+
autoRequest: boolean;
|
|
70
|
+
loading: boolean;
|
|
71
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
72
|
//#endregion
|
|
75
73
|
export { FormItemContainer };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { CSSProperties, PropType } from "vue";
|
|
3
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
4
2
|
|
|
5
3
|
//#region src/components/SearchForm/FormItemWrapper.d.ts
|
|
6
|
-
declare const FormItemWrapper:
|
|
4
|
+
declare const FormItemWrapper: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
5
|
label: {
|
|
8
6
|
type: PropType<string | any>;
|
|
9
7
|
default: any;
|
|
@@ -36,7 +34,7 @@ declare const FormItemWrapper: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
36
34
|
type: NumberConstructor;
|
|
37
35
|
default: any;
|
|
38
36
|
};
|
|
39
|
-
}>, () =>
|
|
37
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
40
38
|
label: {
|
|
41
39
|
type: PropType<string | any>;
|
|
42
40
|
default: any;
|
|
@@ -70,13 +68,13 @@ declare const FormItemWrapper: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
70
68
|
default: any;
|
|
71
69
|
};
|
|
72
70
|
}>> & Readonly<{}>, {
|
|
73
|
-
hashId: string;
|
|
74
71
|
label: any;
|
|
75
72
|
labelWidth: string | number;
|
|
76
|
-
labelAlign: "left" | "
|
|
73
|
+
labelAlign: "left" | "center" | "right";
|
|
77
74
|
colon: boolean;
|
|
75
|
+
hashId: string;
|
|
78
76
|
formItemStyle: CSSProperties;
|
|
79
77
|
globalLabelGap: number;
|
|
80
|
-
}, {}, {}, {}, string,
|
|
78
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
81
79
|
//#endregion
|
|
82
80
|
export { FormItemWrapper };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { FormConfig, ProSearchMap } from "../../interface.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { PropType } from "vue";
|
|
4
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/components/SearchForm/SearchForm.d.ts
|
|
7
|
-
declare const ProTableSearchForm:
|
|
5
|
+
declare const ProTableSearchForm: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
6
|
prefixCls: {
|
|
9
7
|
type: StringConstructor;
|
|
10
8
|
required: true;
|
|
@@ -57,7 +55,7 @@ declare const ProTableSearchForm: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
57
55
|
type: PropType<(params: Record<string, any>) => void>;
|
|
58
56
|
default: any;
|
|
59
57
|
};
|
|
60
|
-
}>, () =>
|
|
58
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
61
59
|
prefixCls: {
|
|
62
60
|
type: StringConstructor;
|
|
63
61
|
required: true;
|
|
@@ -111,6 +109,8 @@ declare const ProTableSearchForm: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
111
109
|
default: any;
|
|
112
110
|
};
|
|
113
111
|
}>> & Readonly<{}>, {
|
|
112
|
+
onReset: (params: Record<string, any>) => void;
|
|
113
|
+
loading: any;
|
|
114
114
|
proClasses: Record<string, string>;
|
|
115
115
|
proStyles: Record<string, any>;
|
|
116
116
|
formColumns: ProSearchMap<"text", string>[];
|
|
@@ -122,9 +122,7 @@ declare const ProTableSearchForm: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
122
122
|
searchText?: string;
|
|
123
123
|
resetText?: string;
|
|
124
124
|
};
|
|
125
|
-
loading: any;
|
|
126
125
|
cardBordered: boolean;
|
|
127
|
-
|
|
128
|
-
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
126
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
129
127
|
//#endregion
|
|
130
128
|
export { ProTableSearchForm as default };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { PropType } from "vue";
|
|
3
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
4
2
|
|
|
5
3
|
//#region src/components/Toolbar/FullscreenIcon.d.ts
|
|
6
|
-
declare const FullscreenIcon:
|
|
4
|
+
declare const FullscreenIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
5
|
isFullscreen: {
|
|
8
6
|
type: BooleanConstructor;
|
|
9
7
|
required: true;
|
|
@@ -12,7 +10,7 @@ declare const FullscreenIcon: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
12
10
|
type: PropType<() => void>;
|
|
13
11
|
required: true;
|
|
14
12
|
};
|
|
15
|
-
}>, () =>
|
|
13
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
14
|
isFullscreen: {
|
|
17
15
|
type: BooleanConstructor;
|
|
18
16
|
required: true;
|
|
@@ -21,6 +19,6 @@ declare const FullscreenIcon: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
21
19
|
type: PropType<() => void>;
|
|
22
20
|
required: true;
|
|
23
21
|
};
|
|
24
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
22
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
23
|
//#endregion
|
|
26
24
|
export { FullscreenIcon };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ToolbarPlacement } from "../../interface.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { PropType, VNode } from "vue";
|
|
4
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/components/Toolbar/ListToolBar.d.ts
|
|
7
5
|
interface ListToolBarSetting {
|
|
@@ -10,7 +8,7 @@ interface ListToolBarSetting {
|
|
|
10
8
|
key?: string;
|
|
11
9
|
onClick?: (key?: string) => void;
|
|
12
10
|
}
|
|
13
|
-
declare const ListToolBar:
|
|
11
|
+
declare const ListToolBar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
12
|
prefixCls: {
|
|
15
13
|
type: StringConstructor;
|
|
16
14
|
required: true;
|
|
@@ -51,7 +49,7 @@ declare const ListToolBar: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
51
49
|
type: ObjectConstructor;
|
|
52
50
|
default: () => {};
|
|
53
51
|
};
|
|
54
|
-
}>, () =>
|
|
52
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
55
53
|
prefixCls: {
|
|
56
54
|
type: StringConstructor;
|
|
57
55
|
required: true;
|
|
@@ -93,19 +91,19 @@ declare const ListToolBar: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
93
91
|
default: () => {};
|
|
94
92
|
};
|
|
95
93
|
}>> & Readonly<{}>, {
|
|
94
|
+
headerTitle: any;
|
|
95
|
+
headerTitleTip: any;
|
|
96
96
|
titleTipText: string;
|
|
97
|
-
|
|
98
|
-
actions: VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
|
97
|
+
settings: VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
99
98
|
[key: string]: any;
|
|
100
99
|
}>[];
|
|
101
|
-
|
|
100
|
+
actions: VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
101
|
+
[key: string]: any;
|
|
102
|
+
}>[];
|
|
103
|
+
actionsPlacement: ToolbarPlacement;
|
|
102
104
|
listToolAfter: any;
|
|
103
|
-
headerTitleTip: any;
|
|
104
105
|
proClasses: Record<string, any>;
|
|
105
106
|
proStyles: Record<string, any>;
|
|
106
|
-
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
}>[];
|
|
109
|
-
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
107
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
110
108
|
//#endregion
|
|
111
109
|
export { ListToolBar, ListToolBarSetting };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ToolbarPlacement } from "../../interface.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { PropType, VNode } from "vue";
|
|
4
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/components/Toolbar/index.d.ts
|
|
7
|
-
declare const Toolbar:
|
|
5
|
+
declare const Toolbar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
6
|
prefixCls: {
|
|
9
7
|
type: StringConstructor;
|
|
10
8
|
required: true;
|
|
@@ -45,7 +43,7 @@ declare const Toolbar: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
45
43
|
type: ObjectConstructor;
|
|
46
44
|
default: () => {};
|
|
47
45
|
};
|
|
48
|
-
}>, () =>
|
|
46
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
47
|
prefixCls: {
|
|
50
48
|
type: StringConstructor;
|
|
51
49
|
required: true;
|
|
@@ -87,17 +85,17 @@ declare const Toolbar: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
87
85
|
default: () => {};
|
|
88
86
|
};
|
|
89
87
|
}>> & Readonly<{}>, {
|
|
90
|
-
|
|
88
|
+
headerTitle: any;
|
|
89
|
+
headerTitleTip: any;
|
|
91
90
|
titleTipText: string;
|
|
92
|
-
|
|
93
|
-
actions: VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
|
91
|
+
actions: VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
94
92
|
[key: string]: any;
|
|
95
93
|
}>[];
|
|
96
|
-
|
|
94
|
+
actionsPlacement: ToolbarPlacement;
|
|
97
95
|
listToolAfter: any;
|
|
98
|
-
headerTitleTip: any;
|
|
99
96
|
proClasses: Record<string, any>;
|
|
100
97
|
proStyles: Record<string, any>;
|
|
101
|
-
|
|
98
|
+
options: any;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
102
100
|
//#endregion
|
|
103
101
|
export { Toolbar, Toolbar as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ProColumnType } from "../interface.js";
|
|
2
|
-
import * as _$vue from "vue";
|
|
3
2
|
import { ComputedRef } from "vue";
|
|
4
3
|
|
|
5
4
|
//#region src/hooks/useColumnResize.d.ts
|
|
@@ -24,7 +23,7 @@ interface ResizableHeaderCellProps {
|
|
|
24
23
|
width?: number;
|
|
25
24
|
onResize?: (event: MouseEvent, info: ResizeInfo) => void;
|
|
26
25
|
}
|
|
27
|
-
declare function createResizableTitle():
|
|
26
|
+
declare function createResizableTitle(): import("vue").DefineComponent<ResizableHeaderCellProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ResizableHeaderCellProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
27
|
declare function useColumnResize(options: UseColumnResizeOptions): UseColumnResizeReturn;
|
|
29
28
|
//#endregion
|
|
30
29
|
export { ResizeInfo, UseColumnResizeOptions, UseColumnResizeReturn, useColumnResize };
|
|
@@ -16,6 +16,8 @@ interface FetchDataConfig<T = any, R = any> {
|
|
|
16
16
|
debounceTime: ComputedRef<number>;
|
|
17
17
|
params: ComputedRef<R | undefined>;
|
|
18
18
|
defaultFormSearch: Ref<Record<string, any>>;
|
|
19
|
+
formParamKeys: ComputedRef<string[]>;
|
|
20
|
+
getFormSearch: () => Record<string, any>;
|
|
19
21
|
onLoadingChange: ((loading: boolean) => any) | undefined;
|
|
20
22
|
onRequestError: ((e: Error) => void) | undefined;
|
|
21
23
|
onBeforeSearchSubmit: BeforeSearchSubmit<R> | undefined;
|
|
@@ -13,7 +13,7 @@ const EMPTY_ARRAY = [];
|
|
|
13
13
|
* 通过 requestId + AbortController 双重保证旧响应不回写。
|
|
14
14
|
*/
|
|
15
15
|
function useFetchData(config, action) {
|
|
16
|
-
const { rowKey, polling, pollingTime, request, postData, dataSource, immediate, waitRequest, autoRequest, debounceTime, params, defaultFormSearch, onLoadingChange, onRequestError, onBeforeSearchSubmit } = config;
|
|
16
|
+
const { rowKey, polling, pollingTime, request, postData, dataSource, immediate, waitRequest, autoRequest, debounceTime, params, defaultFormSearch, formParamKeys, getFormSearch, onLoadingChange, onRequestError, onBeforeSearchSubmit } = config;
|
|
17
17
|
const { pageInfo, paginationInfo, setPagination, setLoading, setColumns, removeRowKeys, syncSelectedRows, columns } = action;
|
|
18
18
|
const tableDataList = ref([]);
|
|
19
19
|
const unmounted = ref(false);
|
|
@@ -48,6 +48,13 @@ function useFetchData(config, action) {
|
|
|
48
48
|
abortController.value?.abort();
|
|
49
49
|
abortController.value = null;
|
|
50
50
|
}
|
|
51
|
+
function omitFormParams(source) {
|
|
52
|
+
if (!source) return {};
|
|
53
|
+
const omittedKeys = new Set(formParamKeys.value);
|
|
54
|
+
const result = {};
|
|
55
|
+
for (const key of Object.keys(source)) if (!omittedKeys.has(key)) result[key] = source[key];
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
51
58
|
/** 写入表格数据并同步 sortIndex,无 request 时同步 dataSource total */
|
|
52
59
|
function setTableDataList(list) {
|
|
53
60
|
tableDataList.value = getSortIndex(toRaw(list), toRaw(pageInfo));
|
|
@@ -81,7 +88,8 @@ function useFetchData(config, action) {
|
|
|
81
88
|
current: handleCurrentPage(toRaw(pageInfo), removeKeys.length)
|
|
82
89
|
},
|
|
83
90
|
...toRaw(defaultFormSearch.value),
|
|
84
|
-
...
|
|
91
|
+
...getFormSearch(),
|
|
92
|
+
...omitFormParams(toRaw(params.value)),
|
|
85
93
|
...fetchParams.params || {}
|
|
86
94
|
};
|
|
87
95
|
if (onBeforeSearchSubmit && isFunction(onBeforeSearchSubmit)) actionParams = await onBeforeSearchSubmit({
|
|
@@ -161,13 +169,6 @@ function useFetchData(config, action) {
|
|
|
161
169
|
dispatchFetch({ isPolling: false });
|
|
162
170
|
}
|
|
163
171
|
}, { deep: true });
|
|
164
|
-
watch(() => defaultFormSearch.value, (current, previous) => {
|
|
165
|
-
if (waitRequest.value) return;
|
|
166
|
-
if (current !== previous) {
|
|
167
|
-
setPagination({ current: 1 });
|
|
168
|
-
dispatchFetch({ isPolling: false });
|
|
169
|
-
}
|
|
170
|
-
}, { deep: true });
|
|
171
172
|
watch(() => polling.value, () => {
|
|
172
173
|
if (waitRequest.value) return;
|
|
173
174
|
if (!polling.value) stopPolling();
|
|
@@ -5,9 +5,11 @@ import { ComputedRef, Ref } from "vue";
|
|
|
5
5
|
interface UseTableFormOptions {
|
|
6
6
|
searchMap: ComputedRef<ProSearchMap[]>;
|
|
7
7
|
columns: ComputedRef<ProColumnType[]>;
|
|
8
|
+
params: ComputedRef<Record<string, any> | undefined>;
|
|
8
9
|
}
|
|
9
10
|
interface UseTableFormReturn {
|
|
10
11
|
formColumns: ComputedRef<ProSearchMap[]>;
|
|
12
|
+
formParamKeys: ComputedRef<string[]>;
|
|
11
13
|
defaultFormSearch: Ref<Record<string, any>>;
|
|
12
14
|
formState: Ref<Record<string, any>>;
|
|
13
15
|
getFormSearch: () => Record<string, any>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { computed, ref, toRaw, watch } from "vue";
|
|
2
2
|
import { cloneDeep } from "@gx-design-vue/pro-utils";
|
|
3
3
|
//#region src/hooks/useTableForm.ts
|
|
4
|
+
function hasOwnValue(target, key) {
|
|
5
|
+
return !!target && Object.hasOwn(target, key);
|
|
6
|
+
}
|
|
4
7
|
function sortFormItemsByOrder(items) {
|
|
5
8
|
let maxOrder = items.reduce((max, item) => {
|
|
6
9
|
return item.order !== void 0 ? Math.max(max, item.order) : max;
|
|
@@ -18,46 +21,97 @@ function sortFormItemsByOrder(items) {
|
|
|
18
21
|
sorted.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
19
22
|
return sorted;
|
|
20
23
|
}
|
|
21
|
-
function computeDefaultFormValues(columns) {
|
|
24
|
+
function computeDefaultFormValues(columns, params) {
|
|
22
25
|
const defaults = {};
|
|
23
26
|
for (const col of columns) {
|
|
24
27
|
const valueType = col.valueType ?? "text";
|
|
25
|
-
|
|
28
|
+
const name = col.name;
|
|
29
|
+
if (valueType === "dateRange" && (col.rangeStartName || col.rangeEndName)) {
|
|
30
|
+
const startKey = col.rangeStartName || "start";
|
|
31
|
+
const endKey = col.rangeEndName || "end";
|
|
32
|
+
defaults[startKey] = hasOwnValue(params, startKey) ? params[startKey] : void 0;
|
|
33
|
+
defaults[endKey] = hasOwnValue(params, endKey) ? params[endKey] : void 0;
|
|
34
|
+
} else if (hasOwnValue(params, name)) defaults[name] = params[name];
|
|
35
|
+
else if (col.initialValue !== void 0) defaults[col.name] = col.initialValue;
|
|
26
36
|
else if (valueType === "numberRange") defaults[col.name] = [];
|
|
27
37
|
else if (valueType === "treeSelect" && (col.field?.treeCheckable || col.field?.multiple)) defaults[col.name] = [];
|
|
28
38
|
else if (valueType === "cascader" && col.field?.multiple) defaults[col.name] = [];
|
|
29
|
-
else if (valueType === "dateRange")
|
|
30
|
-
defaults[col.rangeStartName || "start"] = void 0;
|
|
31
|
-
defaults[col.rangeEndName || "end"] = void 0;
|
|
32
|
-
} else defaults[col.name] = void 0;
|
|
39
|
+
else if (valueType === "dateRange") defaults[col.name] = void 0;
|
|
33
40
|
}
|
|
34
41
|
return defaults;
|
|
35
42
|
}
|
|
43
|
+
function buildFormStateFromDefaults(defaults, columns) {
|
|
44
|
+
const state = cloneDeep(toRaw(defaults));
|
|
45
|
+
for (const record of columns) if (record.valueType === "dateRange" && (record.rangeStartName || record.rangeEndName)) {
|
|
46
|
+
const startKey = record.rangeStartName || "start";
|
|
47
|
+
const endKey = record.rangeEndName || "end";
|
|
48
|
+
const startValue = defaults[startKey];
|
|
49
|
+
const endValue = defaults[endKey];
|
|
50
|
+
if (startValue !== void 0 || endValue !== void 0) state[record.name] = [startValue, endValue];
|
|
51
|
+
}
|
|
52
|
+
return state;
|
|
53
|
+
}
|
|
36
54
|
function useTableForm(options) {
|
|
37
|
-
const { searchMap, columns } = options;
|
|
55
|
+
const { searchMap, columns, params } = options;
|
|
38
56
|
const formColumns = computed(() => {
|
|
39
|
-
const colsFromSearchMap = searchMap.value;
|
|
57
|
+
const colsFromSearchMap = searchMap.value ?? [];
|
|
58
|
+
const searchMapNames = new Set(colsFromSearchMap.map((item) => item.name));
|
|
40
59
|
const colsFromColumns = columns.value.filter((col) => col.searchConfig).map((col) => ({
|
|
41
60
|
...col.searchConfig,
|
|
42
61
|
order: col.searchConfig.order ?? col.order ?? 0
|
|
43
|
-
}));
|
|
62
|
+
})).filter((col) => !searchMapNames.has(col.name));
|
|
44
63
|
return sortFormItemsByOrder([...colsFromSearchMap, ...colsFromColumns]);
|
|
45
64
|
});
|
|
65
|
+
const formParamKeys = computed(() => {
|
|
66
|
+
const keys = /* @__PURE__ */ new Set();
|
|
67
|
+
for (const record of formColumns.value) {
|
|
68
|
+
if (record.name !== void 0) keys.add(record.name);
|
|
69
|
+
if (record.valueType === "dateRange" && (record.rangeStartName || record.rangeEndName)) {
|
|
70
|
+
keys.add(record.rangeStartName || "start");
|
|
71
|
+
keys.add(record.rangeEndName || "end");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return [...keys];
|
|
75
|
+
});
|
|
46
76
|
const defaultFormSearch = computed(() => {
|
|
47
|
-
return computeDefaultFormValues(formColumns.value);
|
|
77
|
+
return computeDefaultFormValues(formColumns.value, params.value);
|
|
48
78
|
});
|
|
49
79
|
const formState = ref({});
|
|
50
80
|
watch(() => defaultFormSearch.value, (newDefaults) => {
|
|
51
|
-
formState.value
|
|
81
|
+
const nextState = { ...formState.value };
|
|
82
|
+
const defaultState = buildFormStateFromDefaults(newDefaults, formColumns.value);
|
|
83
|
+
for (const key of Object.keys(defaultState)) if (!hasOwnValue(nextState, key)) nextState[key] = defaultState[key];
|
|
84
|
+
formState.value = nextState;
|
|
85
|
+
}, {
|
|
86
|
+
deep: true,
|
|
87
|
+
immediate: true
|
|
88
|
+
});
|
|
89
|
+
watch(() => params.value, (newParams) => {
|
|
90
|
+
if (!newParams) return;
|
|
91
|
+
const nextState = { ...formState.value };
|
|
92
|
+
for (const record of formColumns.value) {
|
|
93
|
+
const name = record.name;
|
|
94
|
+
if (record.valueType === "dateRange" && (record.rangeStartName || record.rangeEndName)) {
|
|
95
|
+
const startKey = record.rangeStartName || "start";
|
|
96
|
+
const endKey = record.rangeEndName || "end";
|
|
97
|
+
if (hasOwnValue(newParams, startKey) || hasOwnValue(newParams, endKey)) {
|
|
98
|
+
const startValue = newParams[startKey];
|
|
99
|
+
const endValue = newParams[endKey];
|
|
100
|
+
nextState[name] = startValue !== void 0 || endValue !== void 0 ? [startValue, endValue] : void 0;
|
|
101
|
+
}
|
|
102
|
+
} else if (hasOwnValue(newParams, name)) nextState[name] = newParams[name];
|
|
103
|
+
}
|
|
104
|
+
formState.value = nextState;
|
|
52
105
|
}, {
|
|
53
106
|
deep: true,
|
|
54
107
|
immediate: true
|
|
55
108
|
});
|
|
56
109
|
function getFormSearch() {
|
|
57
|
-
const searchParams =
|
|
110
|
+
const searchParams = {};
|
|
58
111
|
for (const record of formColumns.value) {
|
|
59
112
|
const valueType = record.valueType ?? "text";
|
|
60
113
|
const name = record.name;
|
|
114
|
+
searchParams[name] = cloneDeep(toRaw(formState.value[name]));
|
|
61
115
|
if (valueType === "text") searchParams[name] = formState.value[name] ?? record.initialValue;
|
|
62
116
|
if (valueType === "dateRange" && (record.rangeStartName || record.rangeEndName)) {
|
|
63
117
|
const rangeValue = searchParams[name];
|
|
@@ -81,21 +135,14 @@ function useTableForm(options) {
|
|
|
81
135
|
return searchParams;
|
|
82
136
|
}
|
|
83
137
|
function resetFormState() {
|
|
84
|
-
|
|
85
|
-
formState.value = defaults;
|
|
86
|
-
for (const record of formColumns.value) if (record.valueType === "dateRange" && (record.rangeStartName || record.rangeEndName)) {
|
|
87
|
-
const startKey = record.rangeStartName || "start";
|
|
88
|
-
const endKey = record.rangeEndName || "end";
|
|
89
|
-
const startValue = defaults[startKey];
|
|
90
|
-
const endValue = defaults[endKey];
|
|
91
|
-
if (startValue !== void 0 || endValue !== void 0) formState.value[record.name] = [startValue, endValue];
|
|
92
|
-
}
|
|
138
|
+
formState.value = buildFormStateFromDefaults(cloneDeep(toRaw(defaultFormSearch.value)), formColumns.value);
|
|
93
139
|
}
|
|
94
140
|
function changeFormState(key, value) {
|
|
95
141
|
if (key) formState.value[key] = value;
|
|
96
142
|
}
|
|
97
143
|
return {
|
|
98
144
|
formColumns,
|
|
145
|
+
formParamKeys,
|
|
99
146
|
defaultFormSearch,
|
|
100
147
|
formState,
|
|
101
148
|
getFormSearch,
|