fast-element-plus 2.0.19 → 2.0.21
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/CHANGELOG.md +47 -20
- package/CONTRIBUTING.md +3 -4
- package/README.md +80 -27
- package/README.zh.md +66 -27
- package/dist/component.d.ts +110 -110
- package/dist/components/avatar/src/avatar.d.ts +26 -26
- package/dist/components/avatar/src/avatar.mjs +10 -10
- package/dist/components/avatar/src/avatar.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +32 -27
- package/dist/components/button/src/button.mjs +57 -36
- package/dist/components/button/src/button.mjs.map +1 -1
- package/dist/components/carNumber/src/carNumber.d.ts +8 -8
- package/dist/components/carNumber/src/carNumber.mjs +5 -5
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.d.ts +6 -6
- package/dist/components/contextMenu/src/contextMenu.mjs +5 -5
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.type.d.ts +7 -7
- package/dist/components/dialog/src/dialog.d.ts +74 -74
- package/dist/components/dialog/src/dialog.mjs +31 -31
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +57 -57
- package/dist/components/drawer/src/drawer.mjs +24 -24
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +30 -30
- package/dist/components/form/src/form.mjs +16 -16
- package/dist/components/form/src/form.mjs.map +1 -1
- package/dist/components/form/src/formItem.d.ts +30 -30
- package/dist/components/form/src/formItem.mjs +13 -13
- package/dist/components/form/src/formItem.mjs.map +1 -1
- package/dist/components/formItemTip/src/formItemTip.d.ts +9 -9
- package/dist/components/formItemTip/src/formItemTip.mjs +3 -3
- package/dist/components/formItemTip/src/formItemTip.mjs.map +1 -1
- package/dist/components/icon/src/icon.d.ts +10 -10
- package/dist/components/icon/src/icon.mjs +4 -4
- package/dist/components/icon/src/icon.mjs.map +1 -1
- package/dist/components/iconSelector/src/iconSelector.d.ts +6 -6
- package/dist/components/iconSelector/src/iconSelector.mjs +4 -4
- package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +36 -36
- package/dist/components/image/src/image.mjs +11 -11
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +37 -37
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +16 -16
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +12 -12
- package/dist/components/layoutGrid/src/layoutGrid.mjs +6 -6
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGridItem.d.ts +18 -18
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +8 -8
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +88 -88
- package/dist/components/select/src/select.mjs +28 -28
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/select/src/selectOption.d.ts +13 -13
- package/dist/components/select/src/selectOption.mjs +6 -6
- package/dist/components/select/src/selectOption.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +78 -84
- package/dist/components/selectPage/src/selectPage.mjs +49 -35
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/index.mjs +2 -1
- package/dist/components/selectV2/index.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +160 -851
- package/dist/components/selectV2/src/selectV2.mjs +30 -338
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/index.mjs +3 -2
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/page.type.d.ts +1 -1
- package/dist/components/table/src/table.d.ts +211 -744
- package/dist/components/table/src/table.mjs +131 -327
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.state.d.ts +3 -3
- package/dist/components/table/src/table.type.d.ts +1 -9
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +102 -399
- package/dist/components/table/src/tableColumn.mjs +62 -213
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.d.ts +4 -4
- package/dist/components/table/src/tableColumnSettingDialog.mjs +3 -3
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/dist/components/table/src/tablePagination.d.ts +4 -4
- package/dist/components/table/src/tablePagination.mjs +3 -3
- package/dist/components/table/src/tablePagination.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.d.ts +12 -12
- package/dist/components/table/src/tableSearchForm.mjs +6 -6
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/table/src/tableSearchFormItem.d.ts +4 -4
- package/dist/components/table/src/tableSearchFormItem.mjs +2 -2
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/dist/components/table/src/useTable.d.ts +1 -0
- package/dist/components/table/src/useTable.mjs +109 -65
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.d.ts +4 -4
- package/dist/components/table/utils/table.mjs +6 -6
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +86 -86
- package/dist/components/tree/src/tree.mjs +46 -46
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +144 -150
- package/dist/components/treeSelect/src/treeSelect.mjs +55 -55
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.d.ts +36 -36
- package/dist/components/upload/src/upload.mjs +17 -17
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +47 -47
- package/dist/components/uploadImage/src/uploadImage.mjs +23 -23
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +41 -41
- package/dist/components/uploadImages/src/uploadImages.mjs +21 -21
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-debounce/index.mjs +19 -11
- package/dist/directives/click-debounce/index.mjs.map +1 -1
- package/dist/directives/click-throttle/index.d.ts +4 -2
- package/dist/directives/click-throttle/index.mjs +21 -11
- package/dist/directives/click-throttle/index.mjs.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal/props.d.ts +685 -0
- package/dist/internal/props.mjs +683 -0
- package/dist/internal/props.mjs.map +1 -0
- package/dist/utils/loading-tasks.d.ts +5 -0
- package/dist/utils/loading-tasks.mjs +32 -0
- package/dist/utils/loading-tasks.mjs.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +5 -10
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/** FaDrawer 的运行时 Props
|
|
1
|
+
/** FaDrawer 的运行时 Props 定义 */
|
|
2
2
|
export declare const faDrawerProps: {
|
|
3
|
-
/**
|
|
3
|
+
/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */
|
|
4
4
|
appendToBody: {
|
|
5
5
|
type: BooleanConstructor;
|
|
6
6
|
default: boolean;
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
8
|
+
/** enable dragging feature for Dialog */
|
|
9
9
|
draggable: {
|
|
10
10
|
type: BooleanConstructor;
|
|
11
11
|
default: boolean;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
13
|
+
/** destroy elements in Dialog when closed */
|
|
14
14
|
destroyOnClose: {
|
|
15
15
|
type: BooleanConstructor;
|
|
16
16
|
default: boolean;
|
|
17
17
|
};
|
|
18
|
-
/**
|
|
18
|
+
/** 显示刷新按钮 */
|
|
19
19
|
showRefresh: {
|
|
20
20
|
type: BooleanConstructor;
|
|
21
21
|
default: boolean;
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
23
|
+
/** 显示全屏图标 */
|
|
24
24
|
showFullscreen: {
|
|
25
25
|
type: BooleanConstructor;
|
|
26
26
|
default: boolean;
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
28
|
+
/** 显示关闭按钮 */
|
|
29
29
|
showCloseButton: {
|
|
30
30
|
type: BooleanConstructor;
|
|
31
31
|
default: boolean;
|
|
32
32
|
};
|
|
33
|
-
/**
|
|
33
|
+
/** 显示确认按钮 */
|
|
34
34
|
showConfirmButton: {
|
|
35
35
|
type: BooleanConstructor;
|
|
36
36
|
default: boolean;
|
|
37
37
|
};
|
|
38
|
-
/**
|
|
38
|
+
/** 禁用确认按钮 */
|
|
39
39
|
disabledConfirmButton: BooleanConstructor;
|
|
40
|
-
/**
|
|
40
|
+
/** 关闭按钮文字,默认取消 */
|
|
41
41
|
closeButtonText: {
|
|
42
42
|
type: StringConstructor;
|
|
43
43
|
default: string;
|
|
44
44
|
};
|
|
45
|
-
/**
|
|
45
|
+
/** 确认按钮文字,默认确认 */
|
|
46
46
|
confirmButtonText: {
|
|
47
47
|
type: StringConstructor;
|
|
48
48
|
default: string;
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
50
|
+
/** 隐藏底部操作 */
|
|
51
51
|
hideFooter: BooleanConstructor;
|
|
52
|
-
/**
|
|
52
|
+
/** 显示关闭回调 */
|
|
53
53
|
showBeforeClose: BooleanConstructor;
|
|
54
|
-
/**
|
|
54
|
+
/** 打开之后 */
|
|
55
55
|
afterOpen: {
|
|
56
56
|
type: import("vue").PropType<() => void | Promise<void>>;
|
|
57
57
|
};
|
|
@@ -114,11 +114,11 @@ export declare const faDrawerProps: {
|
|
|
114
114
|
title: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
115
115
|
ariaLevel: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "2", boolean>;
|
|
116
116
|
};
|
|
117
|
-
/** FaDrawer 的运行时 Emits
|
|
117
|
+
/** FaDrawer 的运行时 Emits 定义 */
|
|
118
118
|
export declare const faDrawerEmits: {
|
|
119
|
-
/**
|
|
119
|
+
/** v-model 回调 */
|
|
120
120
|
"update:modelValue": (value: boolean) => boolean;
|
|
121
|
-
/**
|
|
121
|
+
/** 确认按钮点击事件 */
|
|
122
122
|
confirmClick: () => boolean;
|
|
123
123
|
'resize-start': (evt: MouseEvent, size: number) => boolean;
|
|
124
124
|
resize: (evt: MouseEvent, size: number) => boolean;
|
|
@@ -130,85 +130,85 @@ export declare const faDrawerEmits: {
|
|
|
130
130
|
openAutoFocus: () => boolean;
|
|
131
131
|
closeAutoFocus: () => boolean;
|
|
132
132
|
};
|
|
133
|
-
/** FaDrawer
|
|
133
|
+
/** FaDrawer 的插槽参数 */
|
|
134
134
|
export interface FaDrawerSlots extends Record<string, unknown> {
|
|
135
|
-
/**
|
|
135
|
+
/** 默认内容插槽 */
|
|
136
136
|
default: {
|
|
137
137
|
loading: boolean;
|
|
138
138
|
};
|
|
139
|
-
/**
|
|
139
|
+
/** 头部插槽 */
|
|
140
140
|
header: {
|
|
141
141
|
loading: boolean;
|
|
142
142
|
close: () => void;
|
|
143
143
|
titleId: string;
|
|
144
144
|
titleClass: string;
|
|
145
145
|
};
|
|
146
|
-
/**
|
|
146
|
+
/** 标题插槽 */
|
|
147
147
|
title: {
|
|
148
148
|
loading: boolean;
|
|
149
149
|
close: () => void;
|
|
150
150
|
titleId: string;
|
|
151
151
|
titleClass: string;
|
|
152
152
|
};
|
|
153
|
-
/**
|
|
153
|
+
/** 底部插槽 */
|
|
154
154
|
footer: {
|
|
155
155
|
loading: boolean;
|
|
156
156
|
close: () => void;
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
160
|
-
/**
|
|
160
|
+
/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */
|
|
161
161
|
appendToBody: {
|
|
162
162
|
type: BooleanConstructor;
|
|
163
163
|
default: boolean;
|
|
164
164
|
};
|
|
165
|
-
/**
|
|
165
|
+
/** enable dragging feature for Dialog */
|
|
166
166
|
draggable: {
|
|
167
167
|
type: BooleanConstructor;
|
|
168
168
|
default: boolean;
|
|
169
169
|
};
|
|
170
|
-
/**
|
|
170
|
+
/** destroy elements in Dialog when closed */
|
|
171
171
|
destroyOnClose: {
|
|
172
172
|
type: BooleanConstructor;
|
|
173
173
|
default: boolean;
|
|
174
174
|
};
|
|
175
|
-
/**
|
|
175
|
+
/** 显示刷新按钮 */
|
|
176
176
|
showRefresh: {
|
|
177
177
|
type: BooleanConstructor;
|
|
178
178
|
default: boolean;
|
|
179
179
|
};
|
|
180
|
-
/**
|
|
180
|
+
/** 显示全屏图标 */
|
|
181
181
|
showFullscreen: {
|
|
182
182
|
type: BooleanConstructor;
|
|
183
183
|
default: boolean;
|
|
184
184
|
};
|
|
185
|
-
/**
|
|
185
|
+
/** 显示关闭按钮 */
|
|
186
186
|
showCloseButton: {
|
|
187
187
|
type: BooleanConstructor;
|
|
188
188
|
default: boolean;
|
|
189
189
|
};
|
|
190
|
-
/**
|
|
190
|
+
/** 显示确认按钮 */
|
|
191
191
|
showConfirmButton: {
|
|
192
192
|
type: BooleanConstructor;
|
|
193
193
|
default: boolean;
|
|
194
194
|
};
|
|
195
|
-
/**
|
|
195
|
+
/** 禁用确认按钮 */
|
|
196
196
|
disabledConfirmButton: BooleanConstructor;
|
|
197
|
-
/**
|
|
197
|
+
/** 关闭按钮文字,默认取消 */
|
|
198
198
|
closeButtonText: {
|
|
199
199
|
type: StringConstructor;
|
|
200
200
|
default: string;
|
|
201
201
|
};
|
|
202
|
-
/**
|
|
202
|
+
/** 确认按钮文字,默认确认 */
|
|
203
203
|
confirmButtonText: {
|
|
204
204
|
type: StringConstructor;
|
|
205
205
|
default: string;
|
|
206
206
|
};
|
|
207
|
-
/**
|
|
207
|
+
/** 隐藏底部操作 */
|
|
208
208
|
hideFooter: BooleanConstructor;
|
|
209
|
-
/**
|
|
209
|
+
/** 显示关闭回调 */
|
|
210
210
|
showBeforeClose: BooleanConstructor;
|
|
211
|
-
/**
|
|
211
|
+
/** 打开之后 */
|
|
212
212
|
afterOpen: {
|
|
213
213
|
type: import("vue").PropType<() => void | Promise<void>>;
|
|
214
214
|
};
|
|
@@ -271,24 +271,24 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
271
271
|
title: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
272
272
|
ariaLevel: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "2", boolean>;
|
|
273
273
|
}>, {
|
|
274
|
-
/**
|
|
274
|
+
/** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */
|
|
275
275
|
handleClose: import("vue").ComputedRef<(() => void) | undefined>;
|
|
276
|
-
/**
|
|
276
|
+
/** 加载状态 */
|
|
277
277
|
loading: import("vue").Ref<boolean, boolean>;
|
|
278
|
-
/**
|
|
278
|
+
/** 是否显示 */
|
|
279
279
|
visible: import("vue").Ref<boolean, boolean>;
|
|
280
|
-
/**
|
|
280
|
+
/** 打开弹窗 */
|
|
281
281
|
open: (openFunction?: () => void | Promise<void>) => Promise<void>;
|
|
282
|
-
/**
|
|
282
|
+
/** 关闭弹窗 */
|
|
283
283
|
close: (closeFunction?: () => void | Promise<void>) => Promise<void>;
|
|
284
|
-
/**
|
|
284
|
+
/** 刷新弹窗 */
|
|
285
285
|
refresh: () => Promise<void>;
|
|
286
|
-
/**
|
|
286
|
+
/** 弹窗加载 */
|
|
287
287
|
doLoading: (loadingFunction: () => void | Promise<void>) => Promise<void>;
|
|
288
288
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
289
|
-
/**
|
|
289
|
+
/** v-model 回调 */
|
|
290
290
|
"update:modelValue": (value: boolean) => boolean;
|
|
291
|
-
/**
|
|
291
|
+
/** 确认按钮点击事件 */
|
|
292
292
|
confirmClick: () => boolean;
|
|
293
293
|
'resize-start': (evt: MouseEvent, size: number) => boolean;
|
|
294
294
|
resize: (evt: MouseEvent, size: number) => boolean;
|
|
@@ -300,58 +300,58 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
300
300
|
openAutoFocus: () => boolean;
|
|
301
301
|
closeAutoFocus: () => boolean;
|
|
302
302
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
303
|
-
/**
|
|
303
|
+
/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */
|
|
304
304
|
appendToBody: {
|
|
305
305
|
type: BooleanConstructor;
|
|
306
306
|
default: boolean;
|
|
307
307
|
};
|
|
308
|
-
/**
|
|
308
|
+
/** enable dragging feature for Dialog */
|
|
309
309
|
draggable: {
|
|
310
310
|
type: BooleanConstructor;
|
|
311
311
|
default: boolean;
|
|
312
312
|
};
|
|
313
|
-
/**
|
|
313
|
+
/** destroy elements in Dialog when closed */
|
|
314
314
|
destroyOnClose: {
|
|
315
315
|
type: BooleanConstructor;
|
|
316
316
|
default: boolean;
|
|
317
317
|
};
|
|
318
|
-
/**
|
|
318
|
+
/** 显示刷新按钮 */
|
|
319
319
|
showRefresh: {
|
|
320
320
|
type: BooleanConstructor;
|
|
321
321
|
default: boolean;
|
|
322
322
|
};
|
|
323
|
-
/**
|
|
323
|
+
/** 显示全屏图标 */
|
|
324
324
|
showFullscreen: {
|
|
325
325
|
type: BooleanConstructor;
|
|
326
326
|
default: boolean;
|
|
327
327
|
};
|
|
328
|
-
/**
|
|
328
|
+
/** 显示关闭按钮 */
|
|
329
329
|
showCloseButton: {
|
|
330
330
|
type: BooleanConstructor;
|
|
331
331
|
default: boolean;
|
|
332
332
|
};
|
|
333
|
-
/**
|
|
333
|
+
/** 显示确认按钮 */
|
|
334
334
|
showConfirmButton: {
|
|
335
335
|
type: BooleanConstructor;
|
|
336
336
|
default: boolean;
|
|
337
337
|
};
|
|
338
|
-
/**
|
|
338
|
+
/** 禁用确认按钮 */
|
|
339
339
|
disabledConfirmButton: BooleanConstructor;
|
|
340
|
-
/**
|
|
340
|
+
/** 关闭按钮文字,默认取消 */
|
|
341
341
|
closeButtonText: {
|
|
342
342
|
type: StringConstructor;
|
|
343
343
|
default: string;
|
|
344
344
|
};
|
|
345
|
-
/**
|
|
345
|
+
/** 确认按钮文字,默认确认 */
|
|
346
346
|
confirmButtonText: {
|
|
347
347
|
type: StringConstructor;
|
|
348
348
|
default: string;
|
|
349
349
|
};
|
|
350
|
-
/**
|
|
350
|
+
/** 隐藏底部操作 */
|
|
351
351
|
hideFooter: BooleanConstructor;
|
|
352
|
-
/**
|
|
352
|
+
/** 显示关闭回调 */
|
|
353
353
|
showBeforeClose: BooleanConstructor;
|
|
354
|
-
/**
|
|
354
|
+
/** 打开之后 */
|
|
355
355
|
afterOpen: {
|
|
356
356
|
type: import("vue").PropType<() => void | Promise<void>>;
|
|
357
357
|
};
|
|
@@ -10,69 +10,69 @@ import { Fragment, computed, createVNode, defineComponent, mergeProps, nextTick,
|
|
|
10
10
|
import { Close, Eleme, Refresh } from "@element-plus/icons-vue";
|
|
11
11
|
import { ElButton, ElDrawer, ElIcon, ElMessage, ElMessageBox, ElScrollbar, drawerEmits, drawerProps, useGlobalSize } from "element-plus";
|
|
12
12
|
//#region src/components/drawer/src/drawer.tsx
|
|
13
|
-
/** FaDrawer 的运行时 Props
|
|
13
|
+
/** FaDrawer 的运行时 Props 定义 */
|
|
14
14
|
const faDrawerProps = {
|
|
15
15
|
...drawerProps,
|
|
16
|
-
/**
|
|
16
|
+
/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */
|
|
17
17
|
appendToBody: {
|
|
18
18
|
type: Boolean,
|
|
19
19
|
default: true
|
|
20
20
|
},
|
|
21
|
-
/**
|
|
21
|
+
/** enable dragging feature for Dialog */
|
|
22
22
|
draggable: {
|
|
23
23
|
type: Boolean,
|
|
24
24
|
default: true
|
|
25
25
|
},
|
|
26
|
-
/**
|
|
26
|
+
/** destroy elements in Dialog when closed */
|
|
27
27
|
destroyOnClose: {
|
|
28
28
|
type: Boolean,
|
|
29
29
|
default: true
|
|
30
30
|
},
|
|
31
|
-
/**
|
|
31
|
+
/** 显示刷新按钮 */
|
|
32
32
|
showRefresh: {
|
|
33
33
|
type: Boolean,
|
|
34
34
|
default: true
|
|
35
35
|
},
|
|
36
|
-
/**
|
|
36
|
+
/** 显示全屏图标 */
|
|
37
37
|
showFullscreen: {
|
|
38
38
|
type: Boolean,
|
|
39
39
|
default: true
|
|
40
40
|
},
|
|
41
|
-
/**
|
|
41
|
+
/** 显示关闭按钮 */
|
|
42
42
|
showCloseButton: {
|
|
43
43
|
type: Boolean,
|
|
44
44
|
default: true
|
|
45
45
|
},
|
|
46
|
-
/**
|
|
46
|
+
/** 显示确认按钮 */
|
|
47
47
|
showConfirmButton: {
|
|
48
48
|
type: Boolean,
|
|
49
49
|
default: true
|
|
50
50
|
},
|
|
51
|
-
/**
|
|
51
|
+
/** 禁用确认按钮 */
|
|
52
52
|
disabledConfirmButton: Boolean,
|
|
53
|
-
/**
|
|
53
|
+
/** 关闭按钮文字,默认取消 */
|
|
54
54
|
closeButtonText: {
|
|
55
55
|
type: String,
|
|
56
56
|
default: "取消"
|
|
57
57
|
},
|
|
58
|
-
/**
|
|
58
|
+
/** 确认按钮文字,默认确认 */
|
|
59
59
|
confirmButtonText: {
|
|
60
60
|
type: String,
|
|
61
61
|
default: "确认"
|
|
62
62
|
},
|
|
63
|
-
/**
|
|
63
|
+
/** 隐藏底部操作 */
|
|
64
64
|
hideFooter: Boolean,
|
|
65
|
-
/**
|
|
65
|
+
/** 显示关闭回调 */
|
|
66
66
|
showBeforeClose: Boolean,
|
|
67
|
-
/**
|
|
67
|
+
/** 打开之后 */
|
|
68
68
|
afterOpen: { type: definePropType(Function) }
|
|
69
69
|
};
|
|
70
|
-
/** FaDrawer 的运行时 Emits
|
|
70
|
+
/** FaDrawer 的运行时 Emits 定义 */
|
|
71
71
|
const faDrawerEmits = {
|
|
72
72
|
...drawerEmits,
|
|
73
|
-
/**
|
|
73
|
+
/** v-model 回调 */
|
|
74
74
|
"update:modelValue": (value) => typeof value === "boolean",
|
|
75
|
-
/**
|
|
75
|
+
/** 确认按钮点击事件 */
|
|
76
76
|
confirmClick: () => true
|
|
77
77
|
};
|
|
78
78
|
var drawer_default = defineComponent({
|
|
@@ -281,19 +281,19 @@ var drawer_default = defineComponent({
|
|
|
281
281
|
])] }
|
|
282
282
|
}));
|
|
283
283
|
return useExpose(expose, {
|
|
284
|
-
/**
|
|
284
|
+
/** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */
|
|
285
285
|
handleClose: computed(() => drawerRef.value?.handleClose),
|
|
286
|
-
/**
|
|
286
|
+
/** 加载状态 */
|
|
287
287
|
loading: toRef(state, "loading"),
|
|
288
|
-
/**
|
|
288
|
+
/** 是否显示 */
|
|
289
289
|
visible: toRef(state, "visible"),
|
|
290
|
-
/**
|
|
290
|
+
/** 打开弹窗 */
|
|
291
291
|
open: handleOpen,
|
|
292
|
-
/**
|
|
292
|
+
/** 关闭弹窗 */
|
|
293
293
|
close: handleClose,
|
|
294
|
-
/**
|
|
294
|
+
/** 刷新弹窗 */
|
|
295
295
|
refresh: handleRefresh,
|
|
296
|
-
/**
|
|
296
|
+
/** 弹窗加载 */
|
|
297
297
|
doLoading: handleLoading
|
|
298
298
|
});
|
|
299
299
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.mjs","names":["update:modelValue"],"sources":["../../../../src/components/drawer/src/drawer.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, nextTick, onBeforeUnmount, reactive, shallowRef, toRef, watch } from \"vue\";\nimport { Close, Eleme, Refresh } from \"@element-plus/icons-vue\";\nimport { ElButton, ElDrawer, ElIcon, ElMessage, ElMessageBox, ElScrollbar, drawerEmits, drawerProps, useGlobalSize } from \"element-plus\";\nimport { FullScreen, FullScreenExit } from \"@fast-element-plus/icons-vue\";\nimport { callOptionalFunction, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\n\n/** FaDrawer 的运行时 Props 定义。 */\nexport const faDrawerProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...drawerProps,\n\t/** @description whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */\n\tappendToBody: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** @description 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** @description 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** @description 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** @description 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** @description 打开之后 */\n\tafterOpen: {\n\t\ttype: definePropType<() => void | Promise<void>>(Function),\n\t},\n};\n\n/** FaDrawer 的运行时 Emits 定义。 */\nexport const faDrawerEmits = {\n\t...drawerEmits,\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** @description 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDrawer 的插槽参数。 */\nexport interface FaDrawerSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** @description 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** @description 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** @description 底部插槽 */\n\tfooter: { loading: boolean; close: () => void };\n}\n\nexport default defineComponent({\n\tname: \"FaDrawer\",\n\tprops: faDrawerProps,\n\temits: faDrawerEmits,\n\tslots: makeSlots<FaDrawerSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst drawerRef = shallowRef<InstanceType<typeof ElDrawer> | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\tfullscreen: false,\n\t\t\tsize: withDefineType<typeof props.size>(),\n\t\t\tdragging: false,\n\t\t\trefreshing: false,\n\t\t});\n\n\t\tlet cacheOpenFunction: (() => void | Promise<void>) | undefined;\n\n\t\tconst handleOpen = async (openFunction?: () => void | Promise<void>) => {\n\t\t\tstate.visible = true;\n\t\t\tcacheOpenFunction = openFunction;\n\t\t\tawait nextTick();\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(props.afterOpen ?? openFunction);\n\t\t\t\temit(\"open\");\n\t\t\t} catch (error) {\n\t\t\t\tstate.visible = false;\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleClose = async (closeFunction?: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(closeFunction);\n\t\t\t\temit(\"close\");\n\t\t\t\tstate.visible = false;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleRefresh = async () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.refreshing = true;\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 500);\n\t\t\t\t});\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tawait handleOpen(cacheOpenFunction);\n\t\t\t\tElMessage.success(\"刷新成功\");\n\t\t\t} finally {\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleBeforeClose = (done: () => void) => {\n\t\t\tif (state.loading) return;\n\t\t\t// 解决 image 预览摁下 ese 会关闭弹窗的问题\n\t\t\tif (document.querySelector(\".el-image-viewer__wrapper\")) return;\n\n\t\t\tconst newDone = () => {\n\t\t\t\t// 组件对外约定为无参数完成钩子,不采用 Element Plus 的 done 回调签名。\n\t\t\t\treturn callOptionalFunction(props.beforeClose, done).then(() => {\n\t\t\t\t\temit(\"close\");\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (props.showBeforeClose) {\n\t\t\t\t// 用户取消关闭属于正常分支,无需继续执行 beforeClose。\n\t\t\t\tElMessageBox.confirm(\"确定关闭?\", { type: \"warning\" }).then(() => newDone());\n\t\t\t} else {\n\t\t\t\tnewDone();\n\t\t\t}\n\t\t};\n\n\t\tconst handleFullscreen = () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.fullscreen = !state.fullscreen;\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\temit(\"confirmClick\");\n\t\t};\n\n\t\tconst handleCloseClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\thandleClose();\n\t\t};\n\n\t\tconst handleDraggablePointermove = (event: PointerEvent) => {\n\t\t\tconst horizontal = props.direction === \"rtl\" || props.direction === \"ltr\";\n\t\t\tconst viewportSize = horizontal ? document.documentElement.clientWidth : document.documentElement.clientHeight;\n\t\t\tlet nextSize: number;\n\t\t\tswitch (props.direction) {\n\t\t\t\tcase \"ltr\":\n\t\t\t\t\tnextSize = event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ttb\":\n\t\t\t\t\tnextSize = event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"btt\":\n\t\t\t\t\tnextSize = viewportSize - event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"rtl\":\n\t\t\t\tdefault:\n\t\t\t\t\tnextSize = viewportSize - event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstate.size = `${Math.min(Math.max(nextSize, viewportSize * 0.2), viewportSize * 0.95).toString()}px`;\n\t\t};\n\n\t\tconst stopDraggable = () => {\n\t\t\tstate.dragging = false;\n\t\t\tdocument.removeEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.removeEventListener(\"pointerup\", stopDraggable);\n\t\t};\n\n\t\tconst handleDraggablePointerdown = (event: PointerEvent) => {\n\t\t\tevent.preventDefault();\n\t\t\tstate.dragging = true;\n\t\t\tdocument.addEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.addEventListener(\"pointerup\", stopDraggable, { once: true });\n\t\t};\n\n\t\twatch(\n\t\t\t() => state.visible,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"update:modelValue\", newValue);\n\t\t\t}\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.size,\n\t\t\t(newValue) => {\n\t\t\t\tstate.size = newValue;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tonBeforeUnmount(stopDraggable);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elDrawerProps = useProps(props, drawerProps, [\"modelValue\", \"size\", \"showClose\", \"beforeClose\"]);\n\t\t// open、close 是 Fast 异步业务流程完成事件,不直接透传 Element Plus 的同名生命周期事件。\n\t\tconst elDrawerEmits = useEmits(drawerEmits, emit, [\"open\", \"close\", \"update:modelValue\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElDrawer\n\t\t\t\t{...elDrawerProps.value}\n\t\t\t\t{...elDrawerEmits.value}\n\t\t\t\tref={drawerRef}\n\t\t\t\tclass={[\n\t\t\t\t\t\"fa-drawer\",\n\t\t\t\t\t`fa-drawer-${globalSize.value}`,\n\t\t\t\t\t{ \"fa-drawer__fullscreen\": state.fullscreen, \"fa-drawer__dragging\": state.dragging },\n\t\t\t\t]}\n\t\t\t\tvModel={state.visible}\n\t\t\t\tsize={state.size}\n\t\t\t\tshowClose={false}\n\t\t\t\tbeforeClose={handleBeforeClose}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\theader: ({ titleId, titleClass }: { close: () => void; titleId: string; titleClass: string }) => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div id={titleId} class={[\"fa-drawer__header-title\", titleClass]}>\n\t\t\t\t\t\t\t\t{slots.title?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass }) ?? props.title}\n\t\t\t\t\t\t\t\t{slots.header?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass })}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{props.showRefresh && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"刷新\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleRefresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Refresh />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showFullscreen && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle={state.fullscreen ? \"关闭全屏显示\" : \"全屏显示\"}\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleFullscreen}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>{state.fullscreen ? <FullScreenExit /> : <FullScreen />}</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showClose && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"关闭\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleCloseClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Close />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{props.draggable && <div class=\"fa-drawer__draggable\" onPointerdown={handleDraggablePointerdown} />}\n\t\t\t\t\t\t\t<ElScrollbar vLoading={state.loading} element-loading-text=\"加载中...\">\n\t\t\t\t\t\t\t\t{!state.refreshing && slots.default?.(state)}\n\t\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\t...(!props.hideFooter && {\n\t\t\t\t\t\tfooter: () => [\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{slots.footer?.({ loading: state.loading, close: handleCloseClick })}\n\t\t\t\t\t\t\t\t{props.showCloseButton && (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.loading} onClick={handleCloseClick}>\n\t\t\t\t\t\t\t\t\t\t{props.closeButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{props.showConfirmButton && (\n\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\tloadingIcon={Eleme}\n\t\t\t\t\t\t\t\t\t\tdisabled={props.disabledConfirmButton}\n\t\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{state.loading ? \"加载中...\" : props.confirmButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElDrawer>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */\n\t\t\thandleClose: computed(() => drawerRef.value?.handleClose),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: toRef(state, \"loading\"),\n\t\t\t/** @description 是否显示 */\n\t\t\tvisible: toRef(state, \"visible\"),\n\t\t\t/** @description 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** @description 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** @description 刷新弹窗 */\n\t\t\trefresh: handleRefresh,\n\t\t\t/** @description 弹窗加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,WAAW;EACV,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,iBAAiB;EAChB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,uBAAuB;;CAEvB,iBAAiB;EAChB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;;CAEZ,iBAAiB;;CAEjB,WAAW,EACV,MAAM,eAA2C,QAAQ,EAC1D;AACD;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;CAEH,sBAAsB,UAAmB,OAAO,UAAU;;CAE1D,oBAAoB;AACrB;AAcA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,aAAa,cAAc;EACjC,MAAM,YAAY,WAAiD,IAAI;EAE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Q;IAAgB,GAAA,CAAA,YAAA,QAAA,EAAA,SAAA,OAAA,GAAA,EAAA,eAAA,CAAA,YAAA,OAAA,MAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA;GAM1B,CAAA;GAGH,eAAS,YAAA,UAAA,MAAA,CAEN,MAAM,aAAS,YAAA,OAAA;IAAA,SAAA;IAAA,iBAAqD;GAA0B,GAAA,IAAA,GAAI,eAAA,YAAA,aAAA,EAAA,wBAAA,SAAA,GAAA,EAAA,eAAA,CAEjG,CAAC,MAAM,cAAc,MAAM,UAAU,KAAK,CAAC,EAAA,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GADtB,MAAM,OAAO,CAAA,CAAA,CAAA,CAAA;GAKtC,GAAI,CAAC,MAAM,cAAc,EACxB,cAAc,CAAA,YAAA,UAAA,MAAA;IAEX,MAAM,SAAS;KAAE,SAAS,MAAM;KAAS,OAAO;IAAiB,CAAC;IAClE,MAAM,mBAAe,YAAA,UAAA;KAAA,YACD,MAAM;KAAO,WAAW;IAAgB,GAAA,EAAA,eAAA,CAC1D,MAAM,eAAe,EAAA,CAAA;IAGvB,MAAM,qBAAiB,YAAA,UAAA;KAAA,WAEb,MAAM;KAAO,eACT;KAAK,YACR,MAAM;KAAqB,QAAA;KAAA,WAE5B;IAAkB,GAAA,EAAA,eAAA,CAE1B,MAAM,UAAU,WAAW,MAAM,iBAAiB,EAAA,CAAA;GAEpD,CAAA,CAAA,EAGJ;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,SAAS,MAAM,OAAO,SAAS;;GAE/B,SAAS,MAAM,OAAO,SAAS;;GAE/B,MAAM;;GAEN,OAAO;;GAEP,SAAS;;GAET,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"drawer.mjs","names":["update:modelValue"],"sources":["../../../../src/components/drawer/src/drawer.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, nextTick, onBeforeUnmount, reactive, shallowRef, toRef, watch } from \"vue\";\nimport { Close, Eleme, Refresh } from \"@element-plus/icons-vue\";\nimport { ElButton, ElDrawer, ElIcon, ElMessage, ElMessageBox, ElScrollbar, drawerEmits, drawerProps, useGlobalSize } from \"element-plus\";\nimport { FullScreen, FullScreenExit } from \"@fast-element-plus/icons-vue\";\nimport { callOptionalFunction, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\n\n/** FaDrawer 的运行时 Props 定义 */\nexport const faDrawerProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...drawerProps,\n\t/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */\n\tappendToBody: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** 打开之后 */\n\tafterOpen: {\n\t\ttype: definePropType<() => void | Promise<void>>(Function),\n\t},\n};\n\n/** FaDrawer 的运行时 Emits 定义 */\nexport const faDrawerEmits = {\n\t...drawerEmits,\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDrawer 的插槽参数 */\nexport interface FaDrawerSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 底部插槽 */\n\tfooter: { loading: boolean; close: () => void };\n}\n\nexport default defineComponent({\n\tname: \"FaDrawer\",\n\tprops: faDrawerProps,\n\temits: faDrawerEmits,\n\tslots: makeSlots<FaDrawerSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst drawerRef = shallowRef<InstanceType<typeof ElDrawer> | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\tfullscreen: false,\n\t\t\tsize: withDefineType<typeof props.size>(),\n\t\t\tdragging: false,\n\t\t\trefreshing: false,\n\t\t});\n\n\t\tlet cacheOpenFunction: (() => void | Promise<void>) | undefined;\n\n\t\tconst handleOpen = async (openFunction?: () => void | Promise<void>) => {\n\t\t\tstate.visible = true;\n\t\t\tcacheOpenFunction = openFunction;\n\t\t\tawait nextTick();\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(props.afterOpen ?? openFunction);\n\t\t\t\temit(\"open\");\n\t\t\t} catch (error) {\n\t\t\t\tstate.visible = false;\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleClose = async (closeFunction?: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(closeFunction);\n\t\t\t\temit(\"close\");\n\t\t\t\tstate.visible = false;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleRefresh = async () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.refreshing = true;\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 500);\n\t\t\t\t});\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tawait handleOpen(cacheOpenFunction);\n\t\t\t\tElMessage.success(\"刷新成功\");\n\t\t\t} finally {\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleBeforeClose = (done: () => void) => {\n\t\t\tif (state.loading) return;\n\t\t\t// 解决 image 预览摁下 ese 会关闭弹窗的问题\n\t\t\tif (document.querySelector(\".el-image-viewer__wrapper\")) return;\n\n\t\t\tconst newDone = () => {\n\t\t\t\t// 组件对外约定为无参数完成钩子,不采用 Element Plus 的 done 回调签名。\n\t\t\t\treturn callOptionalFunction(props.beforeClose, done).then(() => {\n\t\t\t\t\temit(\"close\");\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (props.showBeforeClose) {\n\t\t\t\t// 用户取消关闭属于正常分支,无需继续执行 beforeClose。\n\t\t\t\tElMessageBox.confirm(\"确定关闭?\", { type: \"warning\" }).then(() => newDone());\n\t\t\t} else {\n\t\t\t\tnewDone();\n\t\t\t}\n\t\t};\n\n\t\tconst handleFullscreen = () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.fullscreen = !state.fullscreen;\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\temit(\"confirmClick\");\n\t\t};\n\n\t\tconst handleCloseClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\thandleClose();\n\t\t};\n\n\t\tconst handleDraggablePointermove = (event: PointerEvent) => {\n\t\t\tconst horizontal = props.direction === \"rtl\" || props.direction === \"ltr\";\n\t\t\tconst viewportSize = horizontal ? document.documentElement.clientWidth : document.documentElement.clientHeight;\n\t\t\tlet nextSize: number;\n\t\t\tswitch (props.direction) {\n\t\t\t\tcase \"ltr\":\n\t\t\t\t\tnextSize = event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ttb\":\n\t\t\t\t\tnextSize = event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"btt\":\n\t\t\t\t\tnextSize = viewportSize - event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"rtl\":\n\t\t\t\tdefault:\n\t\t\t\t\tnextSize = viewportSize - event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstate.size = `${Math.min(Math.max(nextSize, viewportSize * 0.2), viewportSize * 0.95).toString()}px`;\n\t\t};\n\n\t\tconst stopDraggable = () => {\n\t\t\tstate.dragging = false;\n\t\t\tdocument.removeEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.removeEventListener(\"pointerup\", stopDraggable);\n\t\t};\n\n\t\tconst handleDraggablePointerdown = (event: PointerEvent) => {\n\t\t\tevent.preventDefault();\n\t\t\tstate.dragging = true;\n\t\t\tdocument.addEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.addEventListener(\"pointerup\", stopDraggable, { once: true });\n\t\t};\n\n\t\twatch(\n\t\t\t() => state.visible,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"update:modelValue\", newValue);\n\t\t\t}\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.size,\n\t\t\t(newValue) => {\n\t\t\t\tstate.size = newValue;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tonBeforeUnmount(stopDraggable);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elDrawerProps = useProps(props, drawerProps, [\"modelValue\", \"size\", \"showClose\", \"beforeClose\"]);\n\t\t// open、close 是 Fast 异步业务流程完成事件,不直接透传 Element Plus 的同名生命周期事件。\n\t\tconst elDrawerEmits = useEmits(drawerEmits, emit, [\"open\", \"close\", \"update:modelValue\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElDrawer\n\t\t\t\t{...elDrawerProps.value}\n\t\t\t\t{...elDrawerEmits.value}\n\t\t\t\tref={drawerRef}\n\t\t\t\tclass={[\n\t\t\t\t\t\"fa-drawer\",\n\t\t\t\t\t`fa-drawer-${globalSize.value}`,\n\t\t\t\t\t{ \"fa-drawer__fullscreen\": state.fullscreen, \"fa-drawer__dragging\": state.dragging },\n\t\t\t\t]}\n\t\t\t\tvModel={state.visible}\n\t\t\t\tsize={state.size}\n\t\t\t\tshowClose={false}\n\t\t\t\tbeforeClose={handleBeforeClose}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\theader: ({ titleId, titleClass }: { close: () => void; titleId: string; titleClass: string }) => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div id={titleId} class={[\"fa-drawer__header-title\", titleClass]}>\n\t\t\t\t\t\t\t\t{slots.title?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass }) ?? props.title}\n\t\t\t\t\t\t\t\t{slots.header?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass })}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{props.showRefresh && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"刷新\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleRefresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Refresh />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showFullscreen && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle={state.fullscreen ? \"关闭全屏显示\" : \"全屏显示\"}\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleFullscreen}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>{state.fullscreen ? <FullScreenExit /> : <FullScreen />}</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showClose && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"关闭\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleCloseClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Close />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{props.draggable && <div class=\"fa-drawer__draggable\" onPointerdown={handleDraggablePointerdown} />}\n\t\t\t\t\t\t\t<ElScrollbar vLoading={state.loading} element-loading-text=\"加载中...\">\n\t\t\t\t\t\t\t\t{!state.refreshing && slots.default?.(state)}\n\t\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\t...(!props.hideFooter && {\n\t\t\t\t\t\tfooter: () => [\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{slots.footer?.({ loading: state.loading, close: handleCloseClick })}\n\t\t\t\t\t\t\t\t{props.showCloseButton && (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.loading} onClick={handleCloseClick}>\n\t\t\t\t\t\t\t\t\t\t{props.closeButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{props.showConfirmButton && (\n\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\tloadingIcon={Eleme}\n\t\t\t\t\t\t\t\t\t\tdisabled={props.disabledConfirmButton}\n\t\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{state.loading ? \"加载中...\" : props.confirmButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElDrawer>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */\n\t\t\thandleClose: computed(() => drawerRef.value?.handleClose),\n\t\t\t/** 加载状态 */\n\t\t\tloading: toRef(state, \"loading\"),\n\t\t\t/** 是否显示 */\n\t\t\tvisible: toRef(state, \"visible\"),\n\t\t\t/** 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** 刷新弹窗 */\n\t\t\trefresh: handleRefresh,\n\t\t\t/** 弹窗加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,WAAW;EACV,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,iBAAiB;EAChB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,uBAAuB;;CAEvB,iBAAiB;EAChB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;;CAEZ,iBAAiB;;CAEjB,WAAW,EACV,MAAM,eAA2C,QAAQ,EAC1D;AACD;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;CAEH,sBAAsB,UAAmB,OAAO,UAAU;;CAE1D,oBAAoB;AACrB;AAcA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;E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idateCallback } from "element-plus";
|
|
2
2
|
import type { FaLayoutGridBreakpoint } from "../../layoutGrid";
|
|
3
|
-
/** FaForm 的运行时 Props
|
|
3
|
+
/** FaForm 的运行时 Props 定义 */
|
|
4
4
|
export declare const faFormProps: {
|
|
5
|
-
/**
|
|
5
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
6
6
|
labelWidth: {
|
|
7
7
|
type: (NumberConstructor | StringConstructor)[];
|
|
8
8
|
default: string;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
10
|
+
/** Suffix of the label. */
|
|
11
11
|
labelSuffix: {
|
|
12
12
|
type: StringConstructor;
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
16
16
|
scrollToError: {
|
|
17
17
|
type: BooleanConstructor;
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
21
21
|
detailForm: BooleanConstructor;
|
|
22
|
-
/**
|
|
22
|
+
/** Grid布局 */
|
|
23
23
|
grid: {
|
|
24
24
|
type: BooleanConstructor;
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
27
|
+
/** Grid布局列配置 */
|
|
28
28
|
cols: {
|
|
29
29
|
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
30
30
|
default: () => {
|
|
@@ -63,38 +63,38 @@ export declare const faFormProps: {
|
|
|
63
63
|
export declare const faFormEmits: {
|
|
64
64
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => boolean;
|
|
65
65
|
};
|
|
66
|
-
/** FaForm
|
|
66
|
+
/** FaForm 的插槽参数 */
|
|
67
67
|
export interface FaFormSlots extends Record<string, unknown> {
|
|
68
|
-
/**
|
|
68
|
+
/** 默认内容插槽 */
|
|
69
69
|
default: {
|
|
70
70
|
cols: Record<FaLayoutGridBreakpoint, number>;
|
|
71
71
|
gap: [number, number];
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
75
|
-
/**
|
|
75
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
76
76
|
labelWidth: {
|
|
77
77
|
type: (NumberConstructor | StringConstructor)[];
|
|
78
78
|
default: string;
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
80
|
+
/** Suffix of the label. */
|
|
81
81
|
labelSuffix: {
|
|
82
82
|
type: StringConstructor;
|
|
83
83
|
default: string;
|
|
84
84
|
};
|
|
85
|
-
/**
|
|
85
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
86
86
|
scrollToError: {
|
|
87
87
|
type: BooleanConstructor;
|
|
88
88
|
default: boolean;
|
|
89
89
|
};
|
|
90
|
-
/**
|
|
90
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
91
91
|
detailForm: BooleanConstructor;
|
|
92
|
-
/**
|
|
92
|
+
/** Grid布局 */
|
|
93
93
|
grid: {
|
|
94
94
|
type: BooleanConstructor;
|
|
95
95
|
default: boolean;
|
|
96
96
|
};
|
|
97
|
-
/**
|
|
97
|
+
/** Grid布局列配置 */
|
|
98
98
|
cols: {
|
|
99
99
|
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
100
100
|
default: () => {
|
|
@@ -129,50 +129,50 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
129
129
|
};
|
|
130
130
|
disabled: BooleanConstructor;
|
|
131
131
|
}>, {
|
|
132
|
-
/**
|
|
132
|
+
/** 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */
|
|
133
133
|
validate: (callback?: FormValidateCallback) => import("element-plus").FormValidationResult;
|
|
134
|
-
/**
|
|
134
|
+
/** 验证具体的某个字段。 */
|
|
135
135
|
validateField: import("vue").ComputedRef<((props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => import("element-plus").FormValidationResult) | undefined>;
|
|
136
|
-
/**
|
|
136
|
+
/** 重置该表单项,将其值重置为初始值,并移除校验结果 */
|
|
137
137
|
resetFields: import("vue").ComputedRef<((props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void) | undefined>;
|
|
138
|
-
/**
|
|
138
|
+
/** 清理某个字段的表单验证信息。 */
|
|
139
139
|
clearValidate: import("vue").ComputedRef<((props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void) | undefined>;
|
|
140
|
-
/**
|
|
140
|
+
/** 滚动到指定的字段 */
|
|
141
141
|
scrollToField: import("vue").ComputedRef<((prop: import("element-plus").FormItemProp) => void) | undefined>;
|
|
142
|
-
/**
|
|
142
|
+
/** 获取所有字段的 context */
|
|
143
143
|
fields: import("vue").ComputedRef<import("vue").Reactive<import("element-plus").FormItemContext[]> | undefined>;
|
|
144
|
-
/**
|
|
144
|
+
/** 获取指定字段的 context。 */
|
|
145
145
|
getField: import("vue").ComputedRef<((prop: import("element-plus").FormItemProp) => import("element-plus").FormItemContext | undefined) | undefined>;
|
|
146
|
-
/**
|
|
146
|
+
/** 设置表单字段的初始值。 */
|
|
147
147
|
setInitialValues: import("vue").ComputedRef<((initModel: Record<string, any>) => void) | undefined>;
|
|
148
|
-
/**
|
|
148
|
+
/** 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */
|
|
149
149
|
validateScrollToField: () => import("element-plus").FormValidationResult;
|
|
150
150
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
151
151
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => boolean;
|
|
152
152
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
153
|
-
/**
|
|
153
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
154
154
|
labelWidth: {
|
|
155
155
|
type: (NumberConstructor | StringConstructor)[];
|
|
156
156
|
default: string;
|
|
157
157
|
};
|
|
158
|
-
/**
|
|
158
|
+
/** Suffix of the label. */
|
|
159
159
|
labelSuffix: {
|
|
160
160
|
type: StringConstructor;
|
|
161
161
|
default: string;
|
|
162
162
|
};
|
|
163
|
-
/**
|
|
163
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
164
164
|
scrollToError: {
|
|
165
165
|
type: BooleanConstructor;
|
|
166
166
|
default: boolean;
|
|
167
167
|
};
|
|
168
|
-
/**
|
|
168
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
169
169
|
detailForm: BooleanConstructor;
|
|
170
|
-
/**
|
|
170
|
+
/** Grid布局 */
|
|
171
171
|
grid: {
|
|
172
172
|
type: BooleanConstructor;
|
|
173
173
|
default: boolean;
|
|
174
174
|
};
|
|
175
|
-
/**
|
|
175
|
+
/** Grid布局列配置 */
|
|
176
176
|
cols: {
|
|
177
177
|
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
178
178
|
default: () => {
|