@carefrees/form-utils-vue 0.0.8
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.md +3 -0
- package/assets/index.css +207 -0
- package/esm/component.d.ts +3 -0
- package/esm/component.mjs +12 -0
- package/esm/form/index.d.ts +37 -0
- package/esm/form/index.mjs +6 -0
- package/esm/form/index.vue.d.ts +19 -0
- package/esm/form/index.vue.mjs +110 -0
- package/esm/form/index.vue2.mjs +4 -0
- package/esm/formItem/form.Item.base.vue.d.ts +16 -0
- package/esm/formItem/form.Item.base.vue.mjs +114 -0
- package/esm/formItem/form.Item.base.vue2.mjs +4 -0
- package/esm/formItem/form.hide.item.vue.d.ts +16 -0
- package/esm/formItem/form.hide.item.vue.mjs +78 -0
- package/esm/formItem/form.hide.item.vue2.mjs +4 -0
- package/esm/formItem/formItem.vue.d.ts +18 -0
- package/esm/formItem/formItem.vue.mjs +102 -0
- package/esm/formItem/formItem.vue2.mjs +4 -0
- package/esm/formItem/index.d.ts +71 -0
- package/esm/formItem/index.mjs +12 -0
- package/esm/hooks/attr/attr.FormItem.d.ts +876 -0
- package/esm/hooks/attr/attr.FormItem.mjs +120 -0
- package/esm/hooks/index.d.ts +13 -0
- package/esm/hooks/register/register.FormHideItem.d.ts +9 -0
- package/esm/hooks/register/register.FormHideItem.mjs +38 -0
- package/esm/hooks/register/register.FormItem.d.ts +802 -0
- package/esm/hooks/register/register.FormItem.mjs +55 -0
- package/esm/hooks/register/register.FormList.d.ts +789 -0
- package/esm/hooks/register/register.FormList.mjs +43 -0
- package/esm/hooks/register/register.form.d.ts +3 -0
- package/esm/hooks/register/register.form.mjs +12 -0
- package/esm/hooks/useAttrs.d.ts +24 -0
- package/esm/hooks/useAttrs.mjs +45 -0
- package/esm/hooks/useEffect.d.ts +2 -0
- package/esm/hooks/useEffect.mjs +14 -0
- package/esm/hooks/useForm.d.ts +8 -0
- package/esm/hooks/useForm.mjs +26 -0
- package/esm/hooks/useFormItem.d.ts +7 -0
- package/esm/hooks/useFormItem.mjs +26 -0
- package/esm/hooks/useFormItemParentName.d.ts +18 -0
- package/esm/hooks/useFormItemParentName.mjs +37 -0
- package/esm/hooks/useFormList.d.ts +7 -0
- package/esm/hooks/useFormList.mjs +26 -0
- package/esm/hooks/useHtmlFor.d.ts +2 -0
- package/esm/hooks/useHtmlFor.mjs +11 -0
- package/esm/hooks/useMultipleForm.d.ts +7 -0
- package/esm/hooks/useMultipleForm.mjs +27 -0
- package/esm/index.d.ts +11 -0
- package/esm/index.mjs +59 -0
- package/esm/instance/ruleIntsnace.d.ts +49 -0
- package/esm/instance/ruleIntsnace.mjs +73 -0
- package/esm/interface/index.d.ts +36 -0
- package/esm/interface/layout.d.ts +28 -0
- package/esm/interface/layout.formItem.d.ts +39 -0
- package/esm/layout/index.d.ts +65 -0
- package/esm/layout/index.mjs +12 -0
- package/esm/layout/layout.form.rows.vue.d.ts +10 -0
- package/esm/layout/layout.form.rows.vue.mjs +31 -0
- package/esm/layout/layout.form.rows.vue2.mjs +4 -0
- package/esm/layout/layout.formItem.vue.d.ts +18 -0
- package/esm/layout/layout.formItem.vue.mjs +216 -0
- package/esm/layout/layout.formItem.vue2.mjs +4 -0
- package/esm/layout/layout.vue.d.ts +16 -0
- package/esm/layout/layout.vue.mjs +166 -0
- package/esm/layout/layout.vue2.mjs +4 -0
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/withInstall.d.ts +3 -0
- package/esm/utils/withInstall.mjs +22 -0
- package/lib/component.d.ts +3 -0
- package/lib/component.js +12 -0
- package/lib/form/index.d.ts +37 -0
- package/lib/form/index.js +6 -0
- package/lib/form/index.vue.d.ts +19 -0
- package/lib/form/index.vue.js +110 -0
- package/lib/form/index.vue2.js +4 -0
- package/lib/formItem/form.Item.base.vue.d.ts +16 -0
- package/lib/formItem/form.Item.base.vue.js +114 -0
- package/lib/formItem/form.Item.base.vue2.js +4 -0
- package/lib/formItem/form.hide.item.vue.d.ts +16 -0
- package/lib/formItem/form.hide.item.vue.js +78 -0
- package/lib/formItem/form.hide.item.vue2.js +4 -0
- package/lib/formItem/formItem.vue.d.ts +18 -0
- package/lib/formItem/formItem.vue.js +102 -0
- package/lib/formItem/formItem.vue2.js +4 -0
- package/lib/formItem/index.d.ts +71 -0
- package/lib/formItem/index.js +12 -0
- package/lib/hooks/attr/attr.FormItem.d.ts +876 -0
- package/lib/hooks/attr/attr.FormItem.js +120 -0
- package/lib/hooks/index.d.ts +13 -0
- package/lib/hooks/register/register.FormHideItem.d.ts +9 -0
- package/lib/hooks/register/register.FormHideItem.js +38 -0
- package/lib/hooks/register/register.FormItem.d.ts +802 -0
- package/lib/hooks/register/register.FormItem.js +55 -0
- package/lib/hooks/register/register.FormList.d.ts +789 -0
- package/lib/hooks/register/register.FormList.js +43 -0
- package/lib/hooks/register/register.form.d.ts +3 -0
- package/lib/hooks/register/register.form.js +12 -0
- package/lib/hooks/useAttrs.d.ts +24 -0
- package/lib/hooks/useAttrs.js +45 -0
- package/lib/hooks/useEffect.d.ts +2 -0
- package/lib/hooks/useEffect.js +14 -0
- package/lib/hooks/useForm.d.ts +8 -0
- package/lib/hooks/useForm.js +26 -0
- package/lib/hooks/useFormItem.d.ts +7 -0
- package/lib/hooks/useFormItem.js +26 -0
- package/lib/hooks/useFormItemParentName.d.ts +18 -0
- package/lib/hooks/useFormItemParentName.js +37 -0
- package/lib/hooks/useFormList.d.ts +7 -0
- package/lib/hooks/useFormList.js +26 -0
- package/lib/hooks/useHtmlFor.d.ts +2 -0
- package/lib/hooks/useHtmlFor.js +11 -0
- package/lib/hooks/useMultipleForm.d.ts +7 -0
- package/lib/hooks/useMultipleForm.js +27 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +59 -0
- package/lib/instance/ruleIntsnace.d.ts +49 -0
- package/lib/instance/ruleIntsnace.js +73 -0
- package/lib/interface/index.d.ts +36 -0
- package/lib/interface/layout.d.ts +28 -0
- package/lib/interface/layout.formItem.d.ts +39 -0
- package/lib/layout/index.d.ts +65 -0
- package/lib/layout/index.js +12 -0
- package/lib/layout/layout.form.rows.vue.d.ts +10 -0
- package/lib/layout/layout.form.rows.vue.js +31 -0
- package/lib/layout/layout.form.rows.vue2.js +4 -0
- package/lib/layout/layout.formItem.vue.d.ts +18 -0
- package/lib/layout/layout.formItem.vue.js +216 -0
- package/lib/layout/layout.formItem.vue2.js +4 -0
- package/lib/layout/layout.vue.d.ts +16 -0
- package/lib/layout/layout.vue.js +166 -0
- package/lib/layout/layout.vue2.js +4 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/withInstall.d.ts +3 -0
- package/lib/utils/withInstall.js +22 -0
- package/package.json +33 -0
- package/src/component.ts +3 -0
- package/src/form/index.ts +3 -0
- package/src/form/index.vue +66 -0
- package/src/formItem/form.Item.base.vue +54 -0
- package/src/formItem/form.hide.item.vue +28 -0
- package/src/formItem/formItem.vue +38 -0
- package/src/formItem/index.ts +7 -0
- package/src/hooks/attr/attr.FormItem.tsx +170 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/register/register.FormHideItem.ts +45 -0
- package/src/hooks/register/register.FormItem.ts +80 -0
- package/src/hooks/register/register.FormList.ts +49 -0
- package/src/hooks/register/register.form.ts +12 -0
- package/src/hooks/useAttrs.ts +66 -0
- package/src/hooks/useEffect.ts +13 -0
- package/src/hooks/useForm.ts +28 -0
- package/src/hooks/useFormItem.ts +28 -0
- package/src/hooks/useFormItemParentName.ts +49 -0
- package/src/hooks/useFormList.ts +28 -0
- package/src/hooks/useHtmlFor.ts +9 -0
- package/src/hooks/useMultipleForm.ts +29 -0
- package/src/index.ts +16 -0
- package/src/instance/ruleIntsnace.ts +105 -0
- package/src/interface/index.ts +40 -0
- package/src/interface/layout.formItem.ts +42 -0
- package/src/interface/layout.ts +29 -0
- package/src/layout/index.ts +8 -0
- package/src/layout/layout.form.rows.vue +19 -0
- package/src/layout/layout.formItem.vue +119 -0
- package/src/layout/layout.vue +97 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/withInstall.ts +28 -0
- package/src/vite-env.d.ts +1 -0
package/README.md
ADDED
package/assets/index.css
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/* 表单 */
|
|
2
|
+
.carefrees-form {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* 布局 */
|
|
9
|
+
.carefrees-form-layout {
|
|
10
|
+
width: 100%;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
padding-bottom: 8px;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.carefrees-form-layout.all-colspan {
|
|
18
|
+
grid-column: 1 / -1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.carefrees-form-layout.bordered {
|
|
22
|
+
border: 1px solid #e0e0e0;
|
|
23
|
+
}
|
|
24
|
+
.carefrees-form-layout.bordered .carefrees-form-layout-header {
|
|
25
|
+
padding-inline-start: 8px;
|
|
26
|
+
padding-inline-end: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.carefrees-form-layout-header {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
align-items: center;
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
border-bottom: 1px solid #e0e0e0;
|
|
35
|
+
padding-top: 5px;
|
|
36
|
+
padding-bottom: 5px;
|
|
37
|
+
margin-block-end: 4px;
|
|
38
|
+
padding-inline-start: 2px;
|
|
39
|
+
padding-inline-end: 2px;
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.carefrees-form-layout-header-title {
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
color: #1d2129;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
.carefrees-form-layout-header-extra {
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
color: #1d2129;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.carefrees-form-layout-body {
|
|
57
|
+
width: 100%;
|
|
58
|
+
display: grid;
|
|
59
|
+
grid-template-columns: repeat(1, auto);
|
|
60
|
+
gap: 2px;
|
|
61
|
+
padding-left: 2px;
|
|
62
|
+
padding-right: 2px;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 表单项 */
|
|
67
|
+
.carefrees-form-item {
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
padding: 8px;
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
color: rgba(0, 0, 0, 0.88);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.carefrees-form-item-container {
|
|
77
|
+
flex: 1;
|
|
78
|
+
height: 100%;
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: 4px;
|
|
82
|
+
box-sizing: border-box;
|
|
83
|
+
}
|
|
84
|
+
.carefrees-form-item-container.left {
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
gap: 8px;
|
|
87
|
+
text-align: left;
|
|
88
|
+
}
|
|
89
|
+
.carefrees-form-item-container.left .carefrees-form-item-label {
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
}
|
|
92
|
+
.carefrees-form-item-container.between {
|
|
93
|
+
gap: 8px;
|
|
94
|
+
text-align: left;
|
|
95
|
+
flex-direction: row;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.carefrees-form-item-container.between .carefrees-form-item-body,
|
|
100
|
+
.carefrees-form-item-container.between .carefrees-form-item-body-input {
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
text-align: right;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.carefrees-form-item-label-warp {
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.carefrees-form-item-label {
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: flex-start;
|
|
114
|
+
position: relative;
|
|
115
|
+
font-size: 14px;
|
|
116
|
+
color: rgba(0, 0, 0, 0.88);
|
|
117
|
+
min-height: 1.4rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.carefrees-form-item-label.show-colon::after {
|
|
121
|
+
content: ':';
|
|
122
|
+
display: inline-block;
|
|
123
|
+
text-align: center;
|
|
124
|
+
margin: 0;
|
|
125
|
+
margin-inline-end: 2px;
|
|
126
|
+
margin-inline-start: 2px;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.carefrees-form-item-label.required::before {
|
|
131
|
+
content: '*';
|
|
132
|
+
color: red;
|
|
133
|
+
display: inline-block;
|
|
134
|
+
margin-inline-end: 4px;
|
|
135
|
+
box-sizing: border-box;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.carefrees-form-item-body {
|
|
139
|
+
position: relative;
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-direction: column;
|
|
142
|
+
align-items: flex-start;
|
|
143
|
+
justify-content: flex-start;
|
|
144
|
+
box-sizing: border-box;
|
|
145
|
+
gap: 4px;
|
|
146
|
+
flex: 1;
|
|
147
|
+
}
|
|
148
|
+
.carefrees-form-item-body-input {
|
|
149
|
+
box-sizing: border-box;
|
|
150
|
+
width: 100%;
|
|
151
|
+
flex: 1;
|
|
152
|
+
display: flex;
|
|
153
|
+
justify-content: flex-start;
|
|
154
|
+
align-items: flex-start;
|
|
155
|
+
flex-direction: row;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.carefrees-form-item-body-input.input-bordered {
|
|
159
|
+
border-bottom: 1px solid #e0e0e0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.carefrees-form-item-body-help {
|
|
163
|
+
width: 100%;
|
|
164
|
+
box-sizing: border-box;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.carefrees-form-item-body-error {
|
|
168
|
+
position: absolute;
|
|
169
|
+
width: 100%;
|
|
170
|
+
color: red;
|
|
171
|
+
top: auto;
|
|
172
|
+
left: 0;
|
|
173
|
+
right: 0;
|
|
174
|
+
bottom: -16px;
|
|
175
|
+
padding-top: 2px;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
box-sizing: border-box;
|
|
178
|
+
z-index: 10;
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: row;
|
|
182
|
+
justify-content: start;
|
|
183
|
+
}
|
|
184
|
+
.carefrees-form-item-body-error.right-bottom {
|
|
185
|
+
justify-content: flex-end;
|
|
186
|
+
top: auto;
|
|
187
|
+
left: 0;
|
|
188
|
+
right: 0;
|
|
189
|
+
bottom: -16px;
|
|
190
|
+
}
|
|
191
|
+
.carefrees-form-item-body-error.top-left {
|
|
192
|
+
justify-content: start;
|
|
193
|
+
top: -16px;
|
|
194
|
+
left: 0px;
|
|
195
|
+
right: 0px;
|
|
196
|
+
bottom: auto;
|
|
197
|
+
}
|
|
198
|
+
.carefrees-form-item-body-error.top-right {
|
|
199
|
+
justify-content: flex-end;
|
|
200
|
+
top: -16px;
|
|
201
|
+
left: 0px;
|
|
202
|
+
right: 0px;
|
|
203
|
+
bottom: auto;
|
|
204
|
+
}
|
|
205
|
+
.carefrees-form-item-extra {
|
|
206
|
+
box-sizing: border-box;
|
|
207
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Form } from "./form/index.mjs";
|
|
2
|
+
import { FormHideItem, FormItem, FormItemBase } from "./formItem/index.mjs";
|
|
3
|
+
import { FormLayoutRows, Layout, LayoutFormItem } from "./layout/index.mjs";
|
|
4
|
+
export {
|
|
5
|
+
Form,
|
|
6
|
+
FormHideItem,
|
|
7
|
+
FormItem,
|
|
8
|
+
FormItemBase,
|
|
9
|
+
FormLayoutRows,
|
|
10
|
+
Layout,
|
|
11
|
+
LayoutFormItem
|
|
12
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const Form: import('../utils').SFCWithInstall<{
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').FormProps<any>> & Readonly<{
|
|
3
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
4
|
+
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
5
|
+
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
+
finish: (...args: any[]) => void;
|
|
8
|
+
valuesChange: (...args: any[]) => void;
|
|
9
|
+
finishFailed: (...args: any[]) => void;
|
|
10
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
11
|
+
P: {};
|
|
12
|
+
B: {};
|
|
13
|
+
D: {};
|
|
14
|
+
C: {};
|
|
15
|
+
M: {};
|
|
16
|
+
Defaults: {};
|
|
17
|
+
}, Readonly<import('..').FormProps<any>> & Readonly<{
|
|
18
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, {}>;
|
|
22
|
+
__isFragment?: undefined;
|
|
23
|
+
__isTeleport?: undefined;
|
|
24
|
+
__isSuspense?: undefined;
|
|
25
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('..').FormProps<any>> & Readonly<{
|
|
26
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
28
|
+
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
finish: (...args: any[]) => void;
|
|
31
|
+
valuesChange: (...args: any[]) => void;
|
|
32
|
+
finishFailed: (...args: any[]) => void;
|
|
33
|
+
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
34
|
+
$slots: {
|
|
35
|
+
default?(_: {}): any;
|
|
36
|
+
};
|
|
37
|
+
})> & Record<string, any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormProps } from '../interface/index';
|
|
2
|
+
type __VLS_Props = FormProps;
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
4
|
+
finish: (...args: any[]) => void;
|
|
5
|
+
valuesChange: (...args: any[]) => void;
|
|
6
|
+
finishFailed: (...args: any[]) => void;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
9
|
+
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
10
|
+
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
12
|
+
default?(_: {}): any;
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { defineComponent, computed, reactive, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createVNode, mergeProps, withCtx, renderSlot } from "vue";
|
|
2
|
+
import { useRegisterForm } from "../hooks/register/register.form.mjs";
|
|
3
|
+
import { useForm, useFormProvide } from "../hooks/useForm.mjs";
|
|
4
|
+
import _sfc_main$1 from "../layout/layout.vue.mjs";
|
|
5
|
+
import clx from "classnames";
|
|
6
|
+
const __default__ = defineComponent({
|
|
7
|
+
name: "Form",
|
|
8
|
+
inheritAttrs: false
|
|
9
|
+
// 可选,防止属性自动应用到根元素
|
|
10
|
+
});
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
...__default__,
|
|
13
|
+
props: {
|
|
14
|
+
form: {},
|
|
15
|
+
style: { type: [Boolean, null, String, Object, Array] },
|
|
16
|
+
class: {},
|
|
17
|
+
layoutClass: {},
|
|
18
|
+
layoutStyle: { type: [Boolean, null, String, Object, Array] },
|
|
19
|
+
formData: {},
|
|
20
|
+
onValuesChange: {},
|
|
21
|
+
onFinish: {},
|
|
22
|
+
onFinishFailed: {},
|
|
23
|
+
hideData: {},
|
|
24
|
+
name: {},
|
|
25
|
+
hideRuleData: {},
|
|
26
|
+
title: { type: [Object, String, Number, Boolean, null, Array] },
|
|
27
|
+
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
28
|
+
isAllColSpan: { type: Boolean },
|
|
29
|
+
headerClass: {},
|
|
30
|
+
bodyClass: {},
|
|
31
|
+
headerStyle: { type: [Boolean, null, String, Object, Array] },
|
|
32
|
+
bodyStyle: { type: [Boolean, null, String, Object, Array] },
|
|
33
|
+
bordered: { type: Boolean },
|
|
34
|
+
colCount: {},
|
|
35
|
+
gap: {},
|
|
36
|
+
errorLayout: {},
|
|
37
|
+
labelMode: {},
|
|
38
|
+
showColon: {},
|
|
39
|
+
formItemClass: {},
|
|
40
|
+
formItemStyle: {},
|
|
41
|
+
formItemLabelClass: {},
|
|
42
|
+
formItemLabelStyle: {}
|
|
43
|
+
},
|
|
44
|
+
emits: ["finish", "valuesChange", "finishFailed"],
|
|
45
|
+
setup(__props, { emit: __emit }) {
|
|
46
|
+
const props = __props;
|
|
47
|
+
const {
|
|
48
|
+
form,
|
|
49
|
+
style,
|
|
50
|
+
formData,
|
|
51
|
+
hideData,
|
|
52
|
+
hideRuleData,
|
|
53
|
+
name,
|
|
54
|
+
onFinish,
|
|
55
|
+
onFinishFailed,
|
|
56
|
+
onValuesChange,
|
|
57
|
+
layoutStyle,
|
|
58
|
+
layoutClass,
|
|
59
|
+
...rest
|
|
60
|
+
} = props;
|
|
61
|
+
const cls = computed(() => clx("carefrees-form", props.class));
|
|
62
|
+
const formInstance = useForm(props.form);
|
|
63
|
+
formInstance.value.ctor(reactive(props.formData || {}), reactive(props.hideData || {}), reactive(props.hideRuleData || {}));
|
|
64
|
+
const emits = __emit;
|
|
65
|
+
formInstance.value.onFinish = (...rest2) => {
|
|
66
|
+
emits("finish", ...rest2);
|
|
67
|
+
};
|
|
68
|
+
formInstance.value.onValuesChange = (...rest2) => {
|
|
69
|
+
emits("valuesChange", ...rest2);
|
|
70
|
+
};
|
|
71
|
+
formInstance.value.onFinishFailed = (...rest2) => {
|
|
72
|
+
emits("finishFailed", ...rest2);
|
|
73
|
+
};
|
|
74
|
+
useRegisterForm(formInstance.value, props.name);
|
|
75
|
+
const onSubmit = (event) => {
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
|
+
(_a = event == null ? void 0 : event.preventDefault) == null ? void 0 : _a.call(event);
|
|
78
|
+
(_b = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _b.call(event);
|
|
79
|
+
(_d = (_c = formInstance.value).submit) == null ? void 0 : _d.call(_c);
|
|
80
|
+
};
|
|
81
|
+
useFormProvide(formInstance.value);
|
|
82
|
+
return (_ctx, _cache) => {
|
|
83
|
+
return openBlock(), createElementBlock(
|
|
84
|
+
"form",
|
|
85
|
+
{
|
|
86
|
+
class: normalizeClass(cls.value),
|
|
87
|
+
style: normalizeStyle(unref(style)),
|
|
88
|
+
onSubmit
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
createVNode(_sfc_main$1, mergeProps(rest, {
|
|
92
|
+
class: unref(layoutClass),
|
|
93
|
+
style: unref(layoutStyle)
|
|
94
|
+
}), {
|
|
95
|
+
default: withCtx(() => [
|
|
96
|
+
renderSlot(_ctx.$slots, "default")
|
|
97
|
+
]),
|
|
98
|
+
_: 3
|
|
99
|
+
/* FORWARDED */
|
|
100
|
+
}, 16, ["class", "style"])
|
|
101
|
+
],
|
|
102
|
+
38
|
|
103
|
+
/* CLASS, STYLE, NEED_HYDRATION */
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export {
|
|
109
|
+
_sfc_main as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormItemProps } from '../interface/index';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FormItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
3
|
+
label: (params: any) => any;
|
|
4
|
+
helpText: (params: any) => any;
|
|
5
|
+
extra: (params: any) => any;
|
|
6
|
+
}> & {
|
|
7
|
+
label: (params: any) => any;
|
|
8
|
+
helpText: (params: any) => any;
|
|
9
|
+
extra: (params: any) => any;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { defineComponent, useSlots, computed, toValue, createBlock, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, unref, normalizeClass, normalizeStyle, createSlots, withCtx, guardReactiveProps, renderList, renderSlot } from "vue";
|
|
2
|
+
import { useFormItemAttr } from "../hooks/attr/attr.FormItem.mjs";
|
|
3
|
+
import _sfc_main$1 from "../layout/layout.formItem.vue.mjs";
|
|
4
|
+
import { useFormItemParentNameProvide } from "../hooks/useFormItemParentName.mjs";
|
|
5
|
+
const __default__ = defineComponent({
|
|
6
|
+
name: "FormItemBase",
|
|
7
|
+
inheritAttrs: false
|
|
8
|
+
// 可选,防止属性自动应用到根元素
|
|
9
|
+
});
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
...__default__,
|
|
12
|
+
props: {
|
|
13
|
+
noStyle: { type: Boolean },
|
|
14
|
+
input: { type: [Object, String, Number, Boolean, null, Array] },
|
|
15
|
+
dependencies: {},
|
|
16
|
+
noticeOnlyRuleDataField: {},
|
|
17
|
+
isNoticeParentField: { type: Boolean },
|
|
18
|
+
noticeWatchField: {},
|
|
19
|
+
preserve: { type: Boolean },
|
|
20
|
+
useRules: {},
|
|
21
|
+
useAttrs: {},
|
|
22
|
+
inputAttrs: {},
|
|
23
|
+
valuePropName: {},
|
|
24
|
+
getValuePath: {},
|
|
25
|
+
getValueFromEvent: {},
|
|
26
|
+
formatValue: {},
|
|
27
|
+
onAfterUpdate: {},
|
|
28
|
+
trigger: {},
|
|
29
|
+
name: {},
|
|
30
|
+
rules: {},
|
|
31
|
+
sort: {},
|
|
32
|
+
isJoinParentField: { type: Boolean },
|
|
33
|
+
errorLayout: {},
|
|
34
|
+
required: { type: Boolean },
|
|
35
|
+
labelMode: {},
|
|
36
|
+
onlyRuleStyle: { type: Boolean },
|
|
37
|
+
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
38
|
+
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
39
|
+
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
40
|
+
showColon: { type: Boolean },
|
|
41
|
+
colSpan: {},
|
|
42
|
+
rowSpan: {},
|
|
43
|
+
htmlFor: {},
|
|
44
|
+
validateResult: {},
|
|
45
|
+
style: { type: [Boolean, null, String, Object, Array] },
|
|
46
|
+
class: {},
|
|
47
|
+
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
48
|
+
labelClass: {}
|
|
49
|
+
},
|
|
50
|
+
setup(__props) {
|
|
51
|
+
const props = __props;
|
|
52
|
+
const formAttrs = useFormItemAttr(props);
|
|
53
|
+
useFormItemParentNameProvide({
|
|
54
|
+
name: formAttrs.newName,
|
|
55
|
+
sort: formAttrs.newSort
|
|
56
|
+
});
|
|
57
|
+
const slots = useSlots();
|
|
58
|
+
const isRequired = computed(() => {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
return !!props.required || !!((_c = toValue((_b = (_a = formAttrs.ruleInstance) == null ? void 0 : _a.value) == null ? void 0 : _b.rules) || []) == null ? void 0 : _c.find((item) => {
|
|
61
|
+
return item.required;
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
64
|
+
return (_ctx, _cache) => {
|
|
65
|
+
return props.noStyle ? (openBlock(), createBlock(
|
|
66
|
+
resolveDynamicComponent(props.input),
|
|
67
|
+
normalizeProps(mergeProps({ key: 0 }, toValue(unref(formAttrs).attrsLastData))),
|
|
68
|
+
null,
|
|
69
|
+
16
|
|
70
|
+
/* FULL_PROPS */
|
|
71
|
+
)) : (openBlock(), createBlock(_sfc_main$1, {
|
|
72
|
+
key: 1,
|
|
73
|
+
label: props.label,
|
|
74
|
+
required: isRequired.value,
|
|
75
|
+
"error-layout": props.errorLayout,
|
|
76
|
+
"label-mode": props.labelMode,
|
|
77
|
+
"only-rule-style": props.onlyRuleStyle,
|
|
78
|
+
"show-colon": props.showColon,
|
|
79
|
+
"col-span": props.colSpan,
|
|
80
|
+
"row-span": props.rowSpan,
|
|
81
|
+
"html-for": unref(formAttrs).htmlFor,
|
|
82
|
+
style: normalizeStyle(props.style),
|
|
83
|
+
class: normalizeClass(props.class),
|
|
84
|
+
"label-style": props.labelStyle,
|
|
85
|
+
"label-class": props.labelClass,
|
|
86
|
+
"validate-result": unref(formAttrs).validateResult
|
|
87
|
+
}, createSlots({
|
|
88
|
+
default: withCtx(() => [
|
|
89
|
+
(openBlock(), createBlock(
|
|
90
|
+
resolveDynamicComponent(props.input),
|
|
91
|
+
normalizeProps(guardReactiveProps(toValue(unref(formAttrs).attrsLastData))),
|
|
92
|
+
null,
|
|
93
|
+
16
|
|
94
|
+
/* FULL_PROPS */
|
|
95
|
+
))
|
|
96
|
+
]),
|
|
97
|
+
_: 2
|
|
98
|
+
/* DYNAMIC */
|
|
99
|
+
}, [
|
|
100
|
+
renderList(slots, (item, name) => {
|
|
101
|
+
return {
|
|
102
|
+
name,
|
|
103
|
+
fn: withCtx((slotProps) => [
|
|
104
|
+
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
|
|
105
|
+
])
|
|
106
|
+
};
|
|
107
|
+
})
|
|
108
|
+
]), 1032, ["label", "required", "error-layout", "label-mode", "only-rule-style", "show-colon", "col-span", "row-span", "html-for", "style", "class", "label-style", "label-class", "validate-result"]));
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
export {
|
|
113
|
+
_sfc_main as default
|
|
114
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormItemProps } from '../interface/index';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FormItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
3
|
+
label: (params: any) => any;
|
|
4
|
+
helpText: (params: any) => any;
|
|
5
|
+
extra: (params: any) => any;
|
|
6
|
+
}> & {
|
|
7
|
+
label: (params: any) => any;
|
|
8
|
+
helpText: (params: any) => any;
|
|
9
|
+
extra: (params: any) => any;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent, useSlots, createBlock, createCommentVNode, unref, openBlock, normalizeProps, mergeProps, createSlots, renderList, withCtx, renderSlot, guardReactiveProps } from "vue";
|
|
2
|
+
import _sfc_main$1 from "./form.Item.base.vue.mjs";
|
|
3
|
+
import { useRegisterFormHideItem } from "../hooks/register/register.FormHideItem.mjs";
|
|
4
|
+
const __default__ = defineComponent({
|
|
5
|
+
name: "FormHideItem",
|
|
6
|
+
inheritAttrs: false
|
|
7
|
+
// 可选,防止属性自动应用到根元素
|
|
8
|
+
});
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
...__default__,
|
|
11
|
+
props: {
|
|
12
|
+
noStyle: { type: Boolean },
|
|
13
|
+
input: { type: [Object, String, Number, Boolean, null, Array] },
|
|
14
|
+
dependencies: {},
|
|
15
|
+
noticeOnlyRuleDataField: {},
|
|
16
|
+
isNoticeParentField: { type: Boolean },
|
|
17
|
+
noticeWatchField: {},
|
|
18
|
+
preserve: { type: Boolean },
|
|
19
|
+
useRules: {},
|
|
20
|
+
useAttrs: {},
|
|
21
|
+
inputAttrs: {},
|
|
22
|
+
valuePropName: {},
|
|
23
|
+
getValuePath: {},
|
|
24
|
+
getValueFromEvent: {},
|
|
25
|
+
formatValue: {},
|
|
26
|
+
onAfterUpdate: {},
|
|
27
|
+
trigger: {},
|
|
28
|
+
name: {},
|
|
29
|
+
rules: {},
|
|
30
|
+
sort: {},
|
|
31
|
+
isJoinParentField: { type: Boolean },
|
|
32
|
+
errorLayout: {},
|
|
33
|
+
required: { type: Boolean },
|
|
34
|
+
labelMode: {},
|
|
35
|
+
onlyRuleStyle: { type: Boolean },
|
|
36
|
+
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
37
|
+
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
38
|
+
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
39
|
+
showColon: { type: Boolean },
|
|
40
|
+
colSpan: {},
|
|
41
|
+
rowSpan: {},
|
|
42
|
+
htmlFor: {},
|
|
43
|
+
validateResult: {},
|
|
44
|
+
style: { type: [Boolean, null, String, Object, Array] },
|
|
45
|
+
class: {},
|
|
46
|
+
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
47
|
+
labelClass: {}
|
|
48
|
+
},
|
|
49
|
+
setup(__props) {
|
|
50
|
+
const props = __props;
|
|
51
|
+
const slots = useSlots();
|
|
52
|
+
const { isHide } = useRegisterFormHideItem({ name: props.name, sort: props.sort, isJoinParentField: props.isJoinParentField });
|
|
53
|
+
return (_ctx, _cache) => {
|
|
54
|
+
return !unref(isHide) ? (openBlock(), createBlock(
|
|
55
|
+
_sfc_main$1,
|
|
56
|
+
normalizeProps(mergeProps({ key: 0 }, props)),
|
|
57
|
+
createSlots({
|
|
58
|
+
_: 2
|
|
59
|
+
/* DYNAMIC */
|
|
60
|
+
}, [
|
|
61
|
+
renderList(slots, (item, name) => {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
fn: withCtx((slotProps) => [
|
|
65
|
+
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
|
|
66
|
+
])
|
|
67
|
+
};
|
|
68
|
+
})
|
|
69
|
+
]),
|
|
70
|
+
1040
|
|
71
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
72
|
+
)) : createCommentVNode("v-if", true);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
_sfc_main as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormItemProps } from '../interface/index';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Partial<FormItemProps>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Partial<FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
3
|
+
default: (params: any) => any;
|
|
4
|
+
label: (params: any) => any;
|
|
5
|
+
helpText: (params: any) => any;
|
|
6
|
+
extra: (params: any) => any;
|
|
7
|
+
}> & {
|
|
8
|
+
default: (params: any) => any;
|
|
9
|
+
label: (params: any) => any;
|
|
10
|
+
helpText: (params: any) => any;
|
|
11
|
+
extra: (params: any) => any;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|