@silver-formily/element-plus 3.0.3 → 4.0.2
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.en-US.md +3 -1
- package/README.md +3 -1
- package/esm/autocomplete/index.d.ts +41 -1
- package/esm/cascader/index.d.ts +31 -1
- package/esm/checkbox/index.d.ts +819 -1
- package/esm/color-picker/index.d.ts +210 -1
- package/esm/color-picker-panel/index.d.ts +130 -1
- package/esm/date-picker/index.d.ts +447 -1
- package/esm/date-picker-panel/index.d.ts +147 -1
- package/esm/editable/index.d.ts +60 -1
- package/esm/form-collapse/index.d.ts +3 -3
- package/esm/form-dialog/dialog-content.mjs +10 -12
- package/esm/form-dialog/dialog-content.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +22 -26
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +0 -1
- package/esm/form-drawer/drawer-content.mjs +10 -12
- package/esm/form-drawer/drawer-content.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +22 -26
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +0 -1
- package/esm/form-item/index.d.ts +83 -1
- package/esm/form-layout/form-layout.vue.d.ts +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.mjs +2 -1
- package/esm/input/index.d.ts +43 -1
- package/esm/input-number/index.d.ts +328 -1
- package/esm/input-tag/index.d.ts +26 -1
- package/esm/mention/index.d.ts +36 -1
- package/esm/password/index.d.ts +42 -1
- package/esm/picker-select/index.d.ts +47 -0
- package/esm/picker-select/index.mjs +14 -0
- package/esm/picker-select/index.mjs.map +1 -0
- package/esm/picker-select/picker-select.mjs +186 -0
- package/esm/picker-select/picker-select.mjs.map +1 -0
- package/esm/picker-select/types.d.ts +23 -0
- package/esm/query-form-item/index.d.ts +152 -1
- package/esm/radio/index.d.ts +100 -46
- package/esm/rate/index.d.ts +186 -1
- package/esm/segmented/index.d.ts +28 -1
- package/esm/select/index.d.ts +112 -1
- package/esm/select-table/index.d.ts +61 -1
- package/esm/select-table/select-table.mjs +63 -29
- package/esm/select-table/select-table.mjs.map +1 -1
- package/esm/select-table/types.d.ts +22 -0
- package/esm/slider/index.d.ts +178 -1
- package/esm/switch/index.d.ts +298 -1
- package/esm/time-picker/index.d.ts +446 -1
- package/esm/time-select/index.d.ts +188 -1
- package/esm/transfer/index.d.ts +268 -1
- package/esm/tree/index.d.ts +45 -1
- package/esm/tree/types.d.ts +18 -0
- package/esm/tree-select/index.d.ts +19 -1
- package/esm/upload/index.d.ts +129 -1
- package/package.json +3 -3
- package/esm/shared/url-change-listener.mjs +0 -50
- package/esm/shared/url-change-listener.mjs.map +0 -1
package/esm/rate/index.d.ts
CHANGED
|
@@ -1,8 +1,193 @@
|
|
|
1
1
|
import { ElRate } from "element-plus";
|
|
2
|
+
import * as _$vue from "vue";
|
|
3
|
+
import * as _$element_plus_es_utils_index_mjs0 from "element-plus/es/utils/index.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/rate/index.d.ts
|
|
4
6
|
type RateProps = typeof ElRate;
|
|
5
|
-
declare const Rate:
|
|
7
|
+
declare const Rate: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vue.DefineComponent<{
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: _$vue.PropType<number>;
|
|
10
|
+
default: number;
|
|
11
|
+
};
|
|
12
|
+
disabled: {
|
|
13
|
+
type: _$vue.PropType<boolean>;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
size: {
|
|
17
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
18
|
+
};
|
|
19
|
+
clearable: {
|
|
20
|
+
type: _$vue.PropType<boolean>;
|
|
21
|
+
};
|
|
22
|
+
ariaLabel: {
|
|
23
|
+
type: _$vue.PropType<string>;
|
|
24
|
+
};
|
|
25
|
+
id: {
|
|
26
|
+
type: _$vue.PropType<string>;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
max: {
|
|
30
|
+
type: _$vue.PropType<number>;
|
|
31
|
+
default: number;
|
|
32
|
+
};
|
|
33
|
+
textColor: {
|
|
34
|
+
type: _$vue.PropType<string>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
lowThreshold: {
|
|
38
|
+
type: _$vue.PropType<number>;
|
|
39
|
+
default: number;
|
|
40
|
+
};
|
|
41
|
+
highThreshold: {
|
|
42
|
+
type: _$vue.PropType<number>;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
45
|
+
colors: {
|
|
46
|
+
type: _$vue.PropType<string[] | Record<number, string>>;
|
|
47
|
+
default: () => string[];
|
|
48
|
+
};
|
|
49
|
+
voidColor: {
|
|
50
|
+
type: _$vue.PropType<string>;
|
|
51
|
+
default: string;
|
|
52
|
+
};
|
|
53
|
+
disabledVoidColor: {
|
|
54
|
+
type: _$vue.PropType<string>;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
icons: {
|
|
58
|
+
type: _$vue.PropType<(string | _$vue.Component)[] | Record<number, string | _$vue.Component>>;
|
|
59
|
+
default: () => any[];
|
|
60
|
+
};
|
|
61
|
+
voidIcon: {
|
|
62
|
+
type: _$vue.PropType<string | _$vue.Component>;
|
|
63
|
+
default: () => any;
|
|
64
|
+
};
|
|
65
|
+
disabledVoidIcon: {
|
|
66
|
+
type: _$vue.PropType<string | _$vue.Component>;
|
|
67
|
+
default: () => any;
|
|
68
|
+
};
|
|
69
|
+
allowHalf: {
|
|
70
|
+
type: _$vue.PropType<boolean>;
|
|
71
|
+
};
|
|
72
|
+
showText: {
|
|
73
|
+
type: _$vue.PropType<boolean>;
|
|
74
|
+
};
|
|
75
|
+
showScore: {
|
|
76
|
+
type: _$vue.PropType<boolean>;
|
|
77
|
+
};
|
|
78
|
+
texts: {
|
|
79
|
+
type: _$vue.PropType<string[]>;
|
|
80
|
+
default: () => string[];
|
|
81
|
+
};
|
|
82
|
+
scoreTemplate: {
|
|
83
|
+
type: _$vue.PropType<string>;
|
|
84
|
+
default: string;
|
|
85
|
+
};
|
|
86
|
+
}, {
|
|
87
|
+
setCurrentValue: (value: number, event?: MouseEvent) => void;
|
|
88
|
+
resetCurrentValue: () => void;
|
|
89
|
+
}, unknown, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
|
90
|
+
"update:modelValue": (value: number) => void;
|
|
91
|
+
change: (value: number) => void;
|
|
92
|
+
}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
|
|
93
|
+
modelValue: {
|
|
94
|
+
type: _$vue.PropType<number>;
|
|
95
|
+
default: number;
|
|
96
|
+
};
|
|
97
|
+
disabled: {
|
|
98
|
+
type: _$vue.PropType<boolean>;
|
|
99
|
+
default: undefined;
|
|
100
|
+
};
|
|
101
|
+
size: {
|
|
102
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
103
|
+
};
|
|
104
|
+
clearable: {
|
|
105
|
+
type: _$vue.PropType<boolean>;
|
|
106
|
+
};
|
|
107
|
+
ariaLabel: {
|
|
108
|
+
type: _$vue.PropType<string>;
|
|
109
|
+
};
|
|
110
|
+
id: {
|
|
111
|
+
type: _$vue.PropType<string>;
|
|
112
|
+
default: undefined;
|
|
113
|
+
};
|
|
114
|
+
max: {
|
|
115
|
+
type: _$vue.PropType<number>;
|
|
116
|
+
default: number;
|
|
117
|
+
};
|
|
118
|
+
textColor: {
|
|
119
|
+
type: _$vue.PropType<string>;
|
|
120
|
+
default: string;
|
|
121
|
+
};
|
|
122
|
+
lowThreshold: {
|
|
123
|
+
type: _$vue.PropType<number>;
|
|
124
|
+
default: number;
|
|
125
|
+
};
|
|
126
|
+
highThreshold: {
|
|
127
|
+
type: _$vue.PropType<number>;
|
|
128
|
+
default: number;
|
|
129
|
+
};
|
|
130
|
+
colors: {
|
|
131
|
+
type: _$vue.PropType<string[] | Record<number, string>>;
|
|
132
|
+
default: () => string[];
|
|
133
|
+
};
|
|
134
|
+
voidColor: {
|
|
135
|
+
type: _$vue.PropType<string>;
|
|
136
|
+
default: string;
|
|
137
|
+
};
|
|
138
|
+
disabledVoidColor: {
|
|
139
|
+
type: _$vue.PropType<string>;
|
|
140
|
+
default: string;
|
|
141
|
+
};
|
|
142
|
+
icons: {
|
|
143
|
+
type: _$vue.PropType<(string | _$vue.Component)[] | Record<number, string | _$vue.Component>>;
|
|
144
|
+
default: () => any[];
|
|
145
|
+
};
|
|
146
|
+
voidIcon: {
|
|
147
|
+
type: _$vue.PropType<string | _$vue.Component>;
|
|
148
|
+
default: () => any;
|
|
149
|
+
};
|
|
150
|
+
disabledVoidIcon: {
|
|
151
|
+
type: _$vue.PropType<string | _$vue.Component>;
|
|
152
|
+
default: () => any;
|
|
153
|
+
};
|
|
154
|
+
allowHalf: {
|
|
155
|
+
type: _$vue.PropType<boolean>;
|
|
156
|
+
};
|
|
157
|
+
showText: {
|
|
158
|
+
type: _$vue.PropType<boolean>;
|
|
159
|
+
};
|
|
160
|
+
showScore: {
|
|
161
|
+
type: _$vue.PropType<boolean>;
|
|
162
|
+
};
|
|
163
|
+
texts: {
|
|
164
|
+
type: _$vue.PropType<string[]>;
|
|
165
|
+
default: () => string[];
|
|
166
|
+
};
|
|
167
|
+
scoreTemplate: {
|
|
168
|
+
type: _$vue.PropType<string>;
|
|
169
|
+
default: string;
|
|
170
|
+
};
|
|
171
|
+
}>> & {
|
|
172
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
173
|
+
onChange?: ((value: number) => any) | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
disabled: boolean;
|
|
176
|
+
id: string;
|
|
177
|
+
modelValue: number;
|
|
178
|
+
max: number;
|
|
179
|
+
textColor: string;
|
|
180
|
+
colors: string[] | Record<number, string>;
|
|
181
|
+
lowThreshold: number;
|
|
182
|
+
highThreshold: number;
|
|
183
|
+
voidColor: string;
|
|
184
|
+
disabledVoidColor: string;
|
|
185
|
+
icons: Array<string | _$vue.Component> | Record<number, string | _$vue.Component>;
|
|
186
|
+
voidIcon: string | _$vue.Component;
|
|
187
|
+
disabledVoidIcon: string | _$vue.Component;
|
|
188
|
+
texts: string[];
|
|
189
|
+
scoreTemplate: string;
|
|
190
|
+
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>>;
|
|
6
191
|
//#endregion
|
|
7
192
|
export { Rate, RateProps };
|
|
8
193
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/segmented/index.d.ts
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
import * as _$element_plus_es_components_segmented_src_types_mjs0 from "element-plus/es/components/segmented/src/types.mjs";
|
|
3
|
+
|
|
1
4
|
//#region src/segmented/index.d.ts
|
|
2
|
-
declare const Segmented:
|
|
5
|
+
declare const Segmented: {
|
|
6
|
+
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
7
|
+
options?: _$element_plus_es_components_segmented_src_types_mjs0.Option[];
|
|
8
|
+
}> & Readonly<{}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, _$vue.PublicProps, {}, true, {}, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, {}, any, _$vue.ComponentProvideOptions, {
|
|
9
|
+
P: {};
|
|
10
|
+
B: {};
|
|
11
|
+
D: {};
|
|
12
|
+
C: {};
|
|
13
|
+
M: {};
|
|
14
|
+
Defaults: {};
|
|
15
|
+
}, Readonly<{
|
|
16
|
+
options?: _$element_plus_es_components_segmented_src_types_mjs0.Option[];
|
|
17
|
+
}> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
18
|
+
__isFragment?: never;
|
|
19
|
+
__isTeleport?: never;
|
|
20
|
+
__isSuspense?: never;
|
|
21
|
+
} & _$vue.ComponentOptionsBase<Readonly<{
|
|
22
|
+
options?: _$element_plus_es_components_segmented_src_types_mjs0.Option[];
|
|
23
|
+
}> & Readonly<{}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, _$vue.ComponentProvideOptions> & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps & (new () => {
|
|
24
|
+
$slots: {
|
|
25
|
+
default?: (props: {
|
|
26
|
+
item: any;
|
|
27
|
+
}) => any;
|
|
28
|
+
};
|
|
29
|
+
});
|
|
3
30
|
//#endregion
|
|
4
31
|
export { Segmented };
|
|
5
32
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/select/index.d.ts
CHANGED
|
@@ -1,5 +1,116 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
import * as _$element_plus_es_utils_index_mjs0 from "element-plus/es/utils/index.mjs";
|
|
3
|
+
|
|
1
4
|
//#region src/select/index.d.ts
|
|
2
|
-
declare const Select:
|
|
5
|
+
declare const Select: {
|
|
6
|
+
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
7
|
+
options?: Array<(Partial<{
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
created: boolean;
|
|
10
|
+
}> & Omit<{
|
|
11
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
12
|
+
readonly disabled: boolean;
|
|
13
|
+
readonly created: boolean;
|
|
14
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
15
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">) | (Partial<{
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
}> & Omit<{
|
|
18
|
+
readonly disabled: boolean;
|
|
19
|
+
readonly label?: string;
|
|
20
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled"> & {
|
|
21
|
+
options: (Partial<{
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
created: boolean;
|
|
24
|
+
}> & Omit<{
|
|
25
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
26
|
+
readonly disabled: boolean;
|
|
27
|
+
readonly created: boolean;
|
|
28
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
29
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">)[];
|
|
30
|
+
})>;
|
|
31
|
+
}> & Readonly<{}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, _$vue.PublicProps, {}, true, {}, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, {}, any, _$vue.ComponentProvideOptions, {
|
|
32
|
+
P: {};
|
|
33
|
+
B: {};
|
|
34
|
+
D: {};
|
|
35
|
+
C: {};
|
|
36
|
+
M: {};
|
|
37
|
+
Defaults: {};
|
|
38
|
+
}, Readonly<{
|
|
39
|
+
options?: Array<(Partial<{
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
created: boolean;
|
|
42
|
+
}> & Omit<{
|
|
43
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
44
|
+
readonly disabled: boolean;
|
|
45
|
+
readonly created: boolean;
|
|
46
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
47
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">) | (Partial<{
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
}> & Omit<{
|
|
50
|
+
readonly disabled: boolean;
|
|
51
|
+
readonly label?: string;
|
|
52
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled"> & {
|
|
53
|
+
options: (Partial<{
|
|
54
|
+
disabled: boolean;
|
|
55
|
+
created: boolean;
|
|
56
|
+
}> & Omit<{
|
|
57
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
58
|
+
readonly disabled: boolean;
|
|
59
|
+
readonly created: boolean;
|
|
60
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
61
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">)[];
|
|
62
|
+
})>;
|
|
63
|
+
}> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
64
|
+
__isFragment?: never;
|
|
65
|
+
__isTeleport?: never;
|
|
66
|
+
__isSuspense?: never;
|
|
67
|
+
} & _$vue.ComponentOptionsBase<Readonly<{
|
|
68
|
+
options?: Array<(Partial<{
|
|
69
|
+
disabled: boolean;
|
|
70
|
+
created: boolean;
|
|
71
|
+
}> & Omit<{
|
|
72
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
73
|
+
readonly disabled: boolean;
|
|
74
|
+
readonly created: boolean;
|
|
75
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
76
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">) | (Partial<{
|
|
77
|
+
disabled: boolean;
|
|
78
|
+
}> & Omit<{
|
|
79
|
+
readonly disabled: boolean;
|
|
80
|
+
readonly label?: string;
|
|
81
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled"> & {
|
|
82
|
+
options: (Partial<{
|
|
83
|
+
disabled: boolean;
|
|
84
|
+
created: boolean;
|
|
85
|
+
}> & Omit<{
|
|
86
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
87
|
+
readonly disabled: boolean;
|
|
88
|
+
readonly created: boolean;
|
|
89
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
90
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">)[];
|
|
91
|
+
})>;
|
|
92
|
+
}> & Readonly<{}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, _$vue.ComponentProvideOptions> & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps & (new () => {
|
|
93
|
+
$slots: {
|
|
94
|
+
option?: (props: {
|
|
95
|
+
option: Partial<{
|
|
96
|
+
disabled: boolean;
|
|
97
|
+
created: boolean;
|
|
98
|
+
}> & Omit<{
|
|
99
|
+
readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
100
|
+
readonly disabled: boolean;
|
|
101
|
+
readonly created: boolean;
|
|
102
|
+
readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
|
|
103
|
+
} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">;
|
|
104
|
+
}) => any;
|
|
105
|
+
header?: () => any;
|
|
106
|
+
footer?: () => any;
|
|
107
|
+
prefix?: () => any;
|
|
108
|
+
empty?: () => any;
|
|
109
|
+
tag?: () => any;
|
|
110
|
+
loading?: () => any;
|
|
111
|
+
label?: () => any;
|
|
112
|
+
};
|
|
113
|
+
});
|
|
3
114
|
//#endregion
|
|
4
115
|
export { Select };
|
|
5
116
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,65 @@
|
|
|
1
|
+
import { ISelectTableProps } from "./types.js";
|
|
2
|
+
import * as _$element_plus0 from "element-plus";
|
|
3
|
+
import * as _$vue from "vue";
|
|
4
|
+
|
|
1
5
|
//#region src/select-table/index.d.ts
|
|
2
|
-
declare const SelectTable:
|
|
6
|
+
declare const SelectTable: {
|
|
7
|
+
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<ISelectTableProps> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
9
|
+
}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (...args: any[]) => void;
|
|
11
|
+
}, _$vue.PublicProps, {
|
|
12
|
+
loading: boolean;
|
|
13
|
+
dataSource: any[];
|
|
14
|
+
valueType: "all" | "parent" | "child" | "path";
|
|
15
|
+
mode: "multiple" | "single";
|
|
16
|
+
columns: _$element_plus0.Column<any>[];
|
|
17
|
+
optionAsValue: boolean;
|
|
18
|
+
clickRowToSelect: boolean;
|
|
19
|
+
showAlertToolbar: boolean;
|
|
20
|
+
ignoreSelectable: boolean;
|
|
21
|
+
}, false, {}, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, {}, any, _$vue.ComponentProvideOptions, {
|
|
22
|
+
P: {};
|
|
23
|
+
B: {};
|
|
24
|
+
D: {};
|
|
25
|
+
C: {};
|
|
26
|
+
M: {};
|
|
27
|
+
Defaults: {};
|
|
28
|
+
}, Readonly<ISelectTableProps> & Readonly<{
|
|
29
|
+
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
30
|
+
}>, {}, {}, {}, {}, {
|
|
31
|
+
loading: boolean;
|
|
32
|
+
dataSource: any[];
|
|
33
|
+
valueType: "all" | "parent" | "child" | "path";
|
|
34
|
+
mode: "multiple" | "single";
|
|
35
|
+
columns: _$element_plus0.Column<any>[];
|
|
36
|
+
optionAsValue: boolean;
|
|
37
|
+
clickRowToSelect: boolean;
|
|
38
|
+
showAlertToolbar: boolean;
|
|
39
|
+
ignoreSelectable: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
__isFragment?: never;
|
|
42
|
+
__isTeleport?: never;
|
|
43
|
+
__isSuspense?: never;
|
|
44
|
+
} & _$vue.ComponentOptionsBase<Readonly<ISelectTableProps> & Readonly<{
|
|
45
|
+
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
46
|
+
}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
|
47
|
+
"update:modelValue": (...args: any[]) => void;
|
|
48
|
+
}, string, {
|
|
49
|
+
loading: boolean;
|
|
50
|
+
dataSource: any[];
|
|
51
|
+
valueType: "all" | "parent" | "child" | "path";
|
|
52
|
+
mode: "multiple" | "single";
|
|
53
|
+
columns: _$element_plus0.Column<any>[];
|
|
54
|
+
optionAsValue: boolean;
|
|
55
|
+
clickRowToSelect: boolean;
|
|
56
|
+
showAlertToolbar: boolean;
|
|
57
|
+
ignoreSelectable: boolean;
|
|
58
|
+
}, {}, string, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, _$vue.ComponentProvideOptions> & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps & (new () => {
|
|
59
|
+
$slots: {
|
|
60
|
+
default?: (props: {}) => any;
|
|
61
|
+
};
|
|
62
|
+
});
|
|
3
63
|
//#endregion
|
|
4
64
|
export { SelectTable };
|
|
5
65
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -46,57 +46,90 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
46
|
const emit = __emit;
|
|
47
47
|
const elTableProps = useAttrs();
|
|
48
48
|
const field = useField();
|
|
49
|
+
const elTableRef = ref();
|
|
50
|
+
const radioSelectedKey = ref();
|
|
51
|
+
function requireRowKey() {
|
|
52
|
+
if (!props.rowKey) throw new Error("rowKey is required");
|
|
53
|
+
return props.rowKey;
|
|
54
|
+
}
|
|
55
|
+
function getRowValue(item) {
|
|
56
|
+
if (!props.rowKey || !item) return;
|
|
57
|
+
return item[props.rowKey];
|
|
58
|
+
}
|
|
59
|
+
function getSingleSelectedKey(value) {
|
|
60
|
+
if (!isValid(value)) return null;
|
|
61
|
+
return props.optionAsValue ? getRowValue(value) ?? null : value;
|
|
62
|
+
}
|
|
63
|
+
function getMultipleSelectedKeys(value) {
|
|
64
|
+
if (!Array.isArray(value)) return [];
|
|
65
|
+
return value.map((item) => props.optionAsValue ? getRowValue(item) : item).filter(isValid);
|
|
66
|
+
}
|
|
67
|
+
function syncRadioSelection(item) {
|
|
68
|
+
radioSelectedKey.value = getRowValue(item) ?? null;
|
|
69
|
+
elTableRef.value?.setCurrentRow(item);
|
|
70
|
+
}
|
|
49
71
|
function compatibleRadioValue(key) {
|
|
50
72
|
return lt(version, "2.6.0") ? { label: key } : { value: key };
|
|
51
73
|
}
|
|
52
|
-
const elTableRef = ref();
|
|
53
|
-
const rowKey = props.rowKey;
|
|
54
74
|
function getInitialSelectedList() {
|
|
55
|
-
if (props.
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
if (!isValid(props.modelValue)) return [];
|
|
76
|
+
if (props.mode === "multiple") {
|
|
77
|
+
if (!Array.isArray(props.modelValue)) return [];
|
|
78
|
+
return props.modelValue.map((item) => {
|
|
79
|
+
if (!props.optionAsValue) {
|
|
80
|
+
if (!props.rowKey) return null;
|
|
81
|
+
return { [props.rowKey]: item };
|
|
82
|
+
}
|
|
83
|
+
return item;
|
|
84
|
+
}).filter(isValid);
|
|
85
|
+
} else {
|
|
86
|
+
if (props.optionAsValue) return [props.modelValue];
|
|
87
|
+
if (!props.rowKey) return [];
|
|
88
|
+
return [{ [props.rowKey]: props.modelValue }];
|
|
89
|
+
}
|
|
60
90
|
}
|
|
61
91
|
const selectedFlatDataSource = ref(getInitialSelectedList());
|
|
62
92
|
let prevSelection = [];
|
|
63
|
-
const radioSelectedKey = ref();
|
|
64
93
|
const currentSelectLength = computed(() => {
|
|
65
94
|
if (props.mode === "multiple") return Array.isArray(props.modelValue) ? props.modelValue.length : 0;
|
|
66
95
|
else return isValid(radioSelectedKey.value) ? 1 : 0;
|
|
67
96
|
});
|
|
68
97
|
watch(() => props.dataSource, async () => {
|
|
69
|
-
const selectedKeys = uniq(selectedFlatDataSource.value.map((item) => item
|
|
98
|
+
const selectedKeys = uniq(selectedFlatDataSource.value.map((item) => getRowValue(item)).filter(isValid));
|
|
70
99
|
await nextTick();
|
|
71
100
|
for (const item of props.dataSource) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
onRadioClick(item);
|
|
76
|
-
}
|
|
101
|
+
const itemKey = getRowValue(item);
|
|
102
|
+
if (isValid(itemKey) && selectedKeys.includes(itemKey)) if (props.mode === "multiple") elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable);
|
|
103
|
+
else syncRadioSelection(item);
|
|
77
104
|
await nextTick();
|
|
78
|
-
prevSelection = elTableRef.value?.getSelectionRows();
|
|
105
|
+
prevSelection = elTableRef.value?.getSelectionRows() ?? [];
|
|
79
106
|
}
|
|
80
107
|
}, { immediate: true });
|
|
81
108
|
watch(() => [props.modelValue, props.loading], async ([value, loading]) => {
|
|
82
109
|
if (loading) return;
|
|
83
|
-
if (props.mode === "single")
|
|
84
|
-
|
|
110
|
+
if (props.mode === "single") {
|
|
111
|
+
const selectedKey = getSingleSelectedKey(value);
|
|
112
|
+
radioSelectedKey.value = selectedKey;
|
|
113
|
+
const selectedItem = props.dataSource.find((item) => getRowValue(item) === selectedKey);
|
|
114
|
+
elTableRef.value?.setCurrentRow(selectedItem);
|
|
115
|
+
} else {
|
|
85
116
|
await nextTick();
|
|
86
|
-
const currentDisplayDataKeys = elTableRef.value?.getSelectionRows().map((item) => item[
|
|
87
|
-
const valueKeys =
|
|
88
|
-
selectedFlatDataSource.value = selectedFlatDataSource.value.filter((item) => valueKeys.includes(item
|
|
117
|
+
const currentDisplayDataKeys = elTableRef.value?.getSelectionRows().map((item) => getRowValue(item)).filter(isValid) ?? [];
|
|
118
|
+
const valueKeys = getMultipleSelectedKeys(value);
|
|
119
|
+
selectedFlatDataSource.value = selectedFlatDataSource.value.filter((item) => valueKeys.includes(getRowValue(item)));
|
|
89
120
|
if (isEqual(valueKeys, currentDisplayDataKeys)) return;
|
|
90
121
|
const diffItems = xor(valueKeys, currentDisplayDataKeys);
|
|
91
|
-
for (const tableItem of props.dataSource)
|
|
92
|
-
const
|
|
93
|
-
|
|
122
|
+
for (const tableItem of props.dataSource) {
|
|
123
|
+
const itemKey = getRowValue(tableItem);
|
|
124
|
+
if (isValid(itemKey) && diffItems.includes(itemKey)) {
|
|
125
|
+
const shouldSelect = valueKeys.includes(itemKey);
|
|
126
|
+
elTableRef.value?.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable);
|
|
127
|
+
}
|
|
94
128
|
}
|
|
95
129
|
}
|
|
96
130
|
}, { immediate: true });
|
|
97
131
|
function onSelect(newSelection) {
|
|
98
|
-
|
|
99
|
-
if (!rowKey) throw new Error("rowKey is required");
|
|
132
|
+
const rowKey = requireRowKey();
|
|
100
133
|
const removedItemList = prevSelection.length > newSelection.length ? differenceWith(prevSelection, newSelection, (itemPrev, itemNext) => {
|
|
101
134
|
return itemPrev[rowKey] === itemNext[rowKey];
|
|
102
135
|
}) : [];
|
|
@@ -112,7 +145,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
112
145
|
else emit("update:modelValue", selectedFlatDataSource.value.map((item) => item[rowKey]));
|
|
113
146
|
}
|
|
114
147
|
function onRadioClick(item) {
|
|
115
|
-
|
|
148
|
+
const rowKey = requireRowKey();
|
|
149
|
+
syncRadioSelection(item);
|
|
116
150
|
if (props.optionAsValue) emit("update:modelValue", item);
|
|
117
151
|
else emit("update:modelValue", item[rowKey]);
|
|
118
152
|
}
|
|
@@ -131,7 +165,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
131
165
|
emit("update:modelValue", []);
|
|
132
166
|
selectedFlatDataSource.value = [];
|
|
133
167
|
} else {
|
|
134
|
-
|
|
168
|
+
syncRadioSelection(null);
|
|
135
169
|
emit("update:modelValue", null);
|
|
136
170
|
}
|
|
137
171
|
}
|
|
@@ -155,7 +189,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
155
189
|
ref_key: "elTableRef",
|
|
156
190
|
ref: elTableRef
|
|
157
191
|
}, unref(elTableProps), {
|
|
158
|
-
"row-key":
|
|
192
|
+
"row-key": __props.rowKey,
|
|
159
193
|
"row-class-name": props.clickRowToSelect ? `--click-row-select` : "",
|
|
160
194
|
data: props.dataSource,
|
|
161
195
|
"highlight-current-row": props.mode === "single",
|
|
@@ -176,7 +210,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
176
210
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => radioSelectedKey.value = $event),
|
|
177
211
|
style: { "width": "100%" }
|
|
178
212
|
}, {
|
|
179
|
-
default: withCtx(() => [createVNode(unref(ElRadio), mergeProps(compatibleRadioValue(row[
|
|
213
|
+
default: withCtx(() => [createVNode(unref(ElRadio), mergeProps(compatibleRadioValue(row[__props.rowKey]), { onChange: () => onRadioClick(row) }), {
|
|
180
214
|
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode(" \xA0 ", -1)])]),
|
|
181
215
|
_: 1
|
|
182
216
|
}, 16, ["onChange"])]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-table.mjs","names":[],"sources":["../../src/select-table/select-table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nconst elTableRef = ref<TableInstance>()\nconst rowKey = props.rowKey\nfunction getInitialSelectedList() {\n if (props.mode === 'multiple') {\n return props.modelValue?.map((item) => {\n if (!props.optionAsValue) {\n return {\n [rowKey]: item,\n }\n }\n return item\n }) ?? []\n }\n else {\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst radioSelectedKey = ref()\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => item[rowKey]),\n )\n await nextTick()\n for (const item of props.dataSource) {\n if (selectedKeys.includes(item[rowKey])) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n elTableRef.value?.setCurrentRow(item)\n onRadioClick(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => item[rowKey])\n const valueKeys = props.optionAsValue\n ? value?.map(item => item[rowKey])\n : value ?? []\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(item[rowKey]),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n if (diffItems.includes(tableItem[rowKey])) {\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\n elTableRef.value.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n /* istanbul ignore if -- @preserve */\n if (!rowKey) {\n throw new Error('rowKey is required')\n }\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n radioSelectedKey.value = item[rowKey]\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n radioSelectedKey.value = null\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n \n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,eAAe,UAAS;EAC9B,MAAM,QAAQ,UAAS;EAEvB,SAAS,qBAAqB,KAAa;AACzC,UAAO,GAAG,SAAS,QAAQ,GAAG,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO,KAAI;;EAG9D,MAAM,aAAa,KAAmB;EACtC,MAAM,SAAS,MAAM;EACrB,SAAS,yBAAyB;AAChC,OAAI,MAAM,SAAS,WACjB,QAAO,MAAM,YAAY,KAAK,SAAS;AACrC,QAAI,CAAC,MAAM,cACT,QAAO,GACJ,SAAS,MACZ;AAEF,WAAO;KACP,IAAI,EAAC;OAGP,QAAO,MAAM,gBAAgB,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,SAAS,MAAM,YAAY,CAAA;;EAIrF,MAAM,yBAAyB,IADH,wBAAuB,CACG;EAEtD,IAAI,gBAAgB,EAAC;EAErB,MAAM,mBAAmB,KAAI;EAE7B,MAAM,sBAAsB,eAAe;AACzC,OAAI,MAAM,SAAS,WACjB,QAAO,MAAM,QAAQ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CAAA,EAAA;8BAGjC,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFC,UAED,GAAA,CAAA,EAAA,CAAA;;;;;;SAIU,MAAM,QAAQ,WAAM,IAClC,WAAQ,KAAA,QAAA,WAAA,EAAA,KAAA,GAAA,CAAA,IAAA,UAAA,KAAA,EAGR,mBAIE,UAAA,EAAA,KAAA,GAAA,EAAA,WAHkB,MAAM,UAAjB,YAAO;yBADhB,YAIE,MAAA,cAAA,EAJF,WAIE,EAAA,SAAA,MAAA,EAFQ,SAAO,EACd,KAAK,QAAQ,QAAQ,QAAQ,MAAA,CAAA,EAAA,MAAA,GAAA;;;;;;;;2BArCvB,MAAM,QAAO,CAAA,CAAA,CAAA,EAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"select-table.mjs","names":[],"sources":["../../src/select-table/select-table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\nconst elTableRef = ref<TableInstance>()\nconst radioSelectedKey = ref()\n\nfunction requireRowKey() {\n if (!props.rowKey) {\n throw new Error('rowKey is required')\n }\n return props.rowKey\n}\n\nfunction getRowValue(item?: Record<string, any> | null) {\n if (!props.rowKey || !item) {\n return undefined\n }\n return item[props.rowKey]\n}\n\nfunction getSingleSelectedKey(value: any) {\n if (!isValid(value)) {\n return null\n }\n return props.optionAsValue ? getRowValue(value) ?? null : value\n}\n\nfunction getMultipleSelectedKeys(value: any) {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .map(item => props.optionAsValue ? getRowValue(item) : item)\n .filter(isValid)\n}\n\nfunction syncRadioSelection(item?: Record<string, any> | null) {\n radioSelectedKey.value = getRowValue(item) ?? null\n elTableRef.value?.setCurrentRow(item)\n}\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nfunction getInitialSelectedList() {\n if (!isValid(props.modelValue)) {\n return []\n }\n\n if (props.mode === 'multiple') {\n if (!Array.isArray(props.modelValue)) {\n return []\n }\n\n return props.modelValue.map((item) => {\n if (!props.optionAsValue) {\n if (!props.rowKey) {\n return null\n }\n return {\n [props.rowKey]: item,\n }\n }\n return item\n }).filter(isValid)\n }\n else {\n if (props.optionAsValue) {\n return [props.modelValue]\n }\n if (!props.rowKey) {\n return []\n }\n return [{ [props.rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => getRowValue(item)).filter(isValid),\n )\n await nextTick()\n for (const item of props.dataSource) {\n const itemKey = getRowValue(item)\n if (isValid(itemKey) && selectedKeys.includes(itemKey)) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n syncRadioSelection(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows() ?? []\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n const selectedKey = getSingleSelectedKey(value)\n radioSelectedKey.value = selectedKey\n const selectedItem = props.dataSource.find(item => getRowValue(item) === selectedKey)\n elTableRef.value?.setCurrentRow(selectedItem)\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => getRowValue(item))\n .filter(isValid) ?? []\n const valueKeys = getMultipleSelectedKeys(value)\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(getRowValue(item)),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n const itemKey = getRowValue(tableItem)\n if (isValid(itemKey) && diffItems.includes(itemKey)) {\n const shouldSelect = valueKeys.includes(itemKey)\n elTableRef.value?.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n const rowKey = requireRowKey()\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n const rowKey = requireRowKey()\n syncRadioSelection(item)\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n syncRadioSelection(null)\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n \n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,eAAe,UAAS;EAC9B,MAAM,QAAQ,UAAS;EACvB,MAAM,aAAa,KAAmB;EACtC,MAAM,mBAAmB,KAAI;EAE7B,SAAS,gBAAgB;AACvB,OAAI,CAAC,MAAM,OACT,OAAM,IAAI,MAAM,qBAAoB;AAEtC,UAAO,MAAM;;EAGf,SAAS,YAAY,MAAmC;AACtD,OAAI,CAAC,MAAM,UAAU,CAAC,KACpB;AAEF,UAAO,KAAK,MAAM;;EAGpB,SAAS,qBAAqB,OAAY;AACxC,OAAI,CAAC,QAAQ,MAAM,CACjB,QAAO;AAET,UAAO,MAAM,gBAAgB,YAAY,MAAM,IAAI,OAAO;;EAG5D,SAAS,wBAAwB,OAAY;AAC3C,OAAI,CAAC,MAAM,QAAQ,MAAM,CACvB,QAAO,EAAC;AAEV,UAAO,MACJ,KAAI,SAAQ,MAAM,gBAAgB,YAAY,KAAK,GAAG,KAAI,CAC1D,OAAO,QAAO;;EAGnB,SAAS,mBAAmB,MAAmC;AAC7D,oBAAiB,QAAQ,YAAY,KAAK,IAAI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YAIE,MAAA,cAAA,EAJF,WAIE,EAAA,SAAA,MAAA,EAFQ,SAAO,EACd,KAAK,QAAQ,QAAQ,QAAQ,MAAA,CAAA,EAAA,MAAA,GAAA;;;;;;;;2BArCvB,MAAM,QAAO,CAAA,CAAA,CAAA,EAAA,EAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Column } from "element-plus";
|
|
2
|
+
import { GeneralField } from "@formily/core";
|
|
3
|
+
|
|
4
|
+
//#region src/select-table/types.d.ts
|
|
5
|
+
interface ISelectTableProps {
|
|
6
|
+
columns?: Column<any>[];
|
|
7
|
+
mode?: 'multiple' | 'single';
|
|
8
|
+
dataSource?: any[];
|
|
9
|
+
optionAsValue?: boolean;
|
|
10
|
+
valueType?: 'all' | 'parent' | 'child' | 'path';
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
rowKey: string;
|
|
13
|
+
clickRowToSelect?: boolean;
|
|
14
|
+
showAlertToolbar?: boolean;
|
|
15
|
+
modelValue?: any;
|
|
16
|
+
data?: Record<string, any>[];
|
|
17
|
+
selectable?: (row: Record<string, any>, index: number, field: GeneralField) => boolean;
|
|
18
|
+
ignoreSelectable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ISelectTableProps };
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|