@@ -8,31 +8,121 @@ import type { Component } from 'vue';
8
8
import type { BaseFormComponentType } from '@vben/common-ui' ;
9
9
import type { Recordable } from '@vben/types' ;
10
10
11
- import { defineComponent , getCurrentInstance , h , ref } from 'vue' ;
11
+ import {
12
+ defineAsyncComponent ,
13
+ defineComponent ,
14
+ getCurrentInstance ,
15
+ h ,
16
+ ref ,
17
+ } from 'vue' ;
12
18
13
19
import { ApiComponent , globalShareState , IconPicker } from '@vben/common-ui' ;
14
20
import { $t } from '@vben/locales' ;
15
21
16
- import {
17
- ElButton ,
18
- ElCheckbox ,
19
- ElCheckboxButton ,
20
- ElCheckboxGroup ,
21
- ElDatePicker ,
22
- ElDivider ,
23
- ElInput ,
24
- ElInputNumber ,
25
- ElNotification ,
26
- ElRadio ,
27
- ElRadioButton ,
28
- ElRadioGroup ,
29
- ElSelectV2 ,
30
- ElSpace ,
31
- ElSwitch ,
32
- ElTimePicker ,
33
- ElTreeSelect ,
34
- ElUpload ,
35
- } from 'element-plus' ;
22
+ import { ElNotification } from 'element-plus' ;
23
+
24
+ const ElButton = defineAsyncComponent ( ( ) =>
25
+ Promise . all ( [
26
+ import ( 'element-plus/es/components/button/index' ) ,
27
+ import ( 'element-plus/es/components/button/style/css' ) ,
28
+ ] ) . then ( ( [ res ] ) => res . ElButton ) ,
29
+ ) ;
30
+ const ElCheckbox = defineAsyncComponent ( ( ) =>
31
+ Promise . all ( [
32
+ import ( 'element-plus/es/components/checkbox/index' ) ,
33
+ import ( 'element-plus/es/components/checkbox/style/css' ) ,
34
+ ] ) . then ( ( [ res ] ) => res . ElCheckbox ) ,
35
+ ) ;
36
+ const ElCheckboxButton = defineAsyncComponent ( ( ) =>
37
+ Promise . all ( [
38
+ import ( 'element-plus/es/components/checkbox/index' ) ,
39
+ import ( 'element-plus/es/components/checkbox-button/style/css' ) ,
40
+ ] ) . then ( ( [ res ] ) => res . ElCheckboxButton ) ,
41
+ ) ;
42
+ const ElCheckboxGroup = defineAsyncComponent ( ( ) =>
43
+ Promise . all ( [
44
+ import ( 'element-plus/es/components/checkbox/index' ) ,
45
+ import ( 'element-plus/es/components/checkbox-group/style/css' ) ,
46
+ ] ) . then ( ( [ res ] ) => res . ElCheckboxGroup ) ,
47
+ ) ;
48
+ const ElDatePicker = defineAsyncComponent ( ( ) =>
49
+ Promise . all ( [
50
+ import ( 'element-plus/es/components/date-picker/index' ) ,
51
+ import ( 'element-plus/es/components/date-picker/style/css' ) ,
52
+ ] ) . then ( ( [ res ] ) => res . ElDatePicker ) ,
53
+ ) ;
54
+ const ElDivider = defineAsyncComponent ( ( ) =>
55
+ Promise . all ( [
56
+ import ( 'element-plus/es/components/divider/index' ) ,
57
+ import ( 'element-plus/es/components/divider/style/css' ) ,
58
+ ] ) . then ( ( [ res ] ) => res . ElDivider ) ,
59
+ ) ;
60
+ const ElInput = defineAsyncComponent ( ( ) =>
61
+ Promise . all ( [
62
+ import ( 'element-plus/es/components/input/index' ) ,
63
+ import ( 'element-plus/es/components/input/style/css' ) ,
64
+ ] ) . then ( ( [ res ] ) => res . ElInput ) ,
65
+ ) ;
66
+ const ElInputNumber = defineAsyncComponent ( ( ) =>
67
+ Promise . all ( [
68
+ import ( 'element-plus/es/components/input-number/index' ) ,
69
+ import ( 'element-plus/es/components/input-number/style/css' ) ,
70
+ ] ) . then ( ( [ res ] ) => res . ElInputNumber ) ,
71
+ ) ;
72
+ const ElRadio = defineAsyncComponent ( ( ) =>
73
+ Promise . all ( [
74
+ import ( 'element-plus/es/components/radio/index' ) ,
75
+ import ( 'element-plus/es/components/radio/style/css' ) ,
76
+ ] ) . then ( ( [ res ] ) => res . ElRadio ) ,
77
+ ) ;
78
+ const ElRadioButton = defineAsyncComponent ( ( ) =>
79
+ Promise . all ( [
80
+ import ( 'element-plus/es/components/radio/index' ) ,
81
+ import ( 'element-plus/es/components/radio-button/style/css' ) ,
82
+ ] ) . then ( ( [ res ] ) => res . ElRadioButton ) ,
83
+ ) ;
84
+ const ElRadioGroup = defineAsyncComponent ( ( ) =>
85
+ Promise . all ( [
86
+ import ( 'element-plus/es/components/radio/index' ) ,
87
+ import ( 'element-plus/es/components/radio-group/style/css' ) ,
88
+ ] ) . then ( ( [ res ] ) => res . ElRadioGroup ) ,
89
+ ) ;
90
+ const ElSelectV2 = defineAsyncComponent ( ( ) =>
91
+ Promise . all ( [
92
+ import ( 'element-plus/es/components/select-v2/index' ) ,
93
+ import ( 'element-plus/es/components/select-v2/style/css' ) ,
94
+ ] ) . then ( ( [ res ] ) => res . ElSelectV2 ) ,
95
+ ) ;
96
+ const ElSpace = defineAsyncComponent ( ( ) =>
97
+ Promise . all ( [
98
+ import ( 'element-plus/es/components/space/index' ) ,
99
+ import ( 'element-plus/es/components/space/style/css' ) ,
100
+ ] ) . then ( ( [ res ] ) => res . ElSpace ) ,
101
+ ) ;
102
+ const ElSwitch = defineAsyncComponent ( ( ) =>
103
+ Promise . all ( [
104
+ import ( 'element-plus/es/components/switch/index' ) ,
105
+ import ( 'element-plus/es/components/switch/style/css' ) ,
106
+ ] ) . then ( ( [ res ] ) => res . ElSwitch ) ,
107
+ ) ;
108
+ const ElTimePicker = defineAsyncComponent ( ( ) =>
109
+ Promise . all ( [
110
+ import ( 'element-plus/es/components/time-picker/index' ) ,
111
+ import ( 'element-plus/es/components/time-picker/style/css' ) ,
112
+ ] ) . then ( ( [ res ] ) => res . ElTimePicker ) ,
113
+ ) ;
114
+ const ElTreeSelect = defineAsyncComponent ( ( ) =>
115
+ Promise . all ( [
116
+ import ( 'element-plus/es/components/tree-select/index' ) ,
117
+ import ( 'element-plus/es/components/tree-select/style/css' ) ,
118
+ ] ) . then ( ( [ res ] ) => res . ElTreeSelect ) ,
119
+ ) ;
120
+ const ElUpload = defineAsyncComponent ( ( ) =>
121
+ Promise . all ( [
122
+ import ( 'element-plus/es/components/upload/index' ) ,
123
+ import ( 'element-plus/es/components/upload/style/css' ) ,
124
+ ] ) . then ( ( [ res ] ) => res . ElUpload ) ,
125
+ ) ;
36
126
37
127
const withDefaultPlaceholder = < T extends Component > (
38
128
component : T ,
0 commit comments