@carefrees/form-utils-react-taro 0.0.4 → 0.0.5
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/esm/formItem/index.d.ts +3 -4
- package/esm/formItem/index.js +4 -5
- package/esm/formList/index.d.ts +1 -1
- package/esm/formList/index.js +5 -8
- package/esm/hooks/attr/attr.FormItem.d.ts +1 -1
- package/esm/hooks/attr/attr.FormItem.js +3 -4
- package/esm/index.d.ts +1 -12
- package/esm/index.js +5 -17
- package/esm/layout/index.d.ts +1 -1
- package/esm/layout/index.js +3 -3
- package/esm/layout/layout.formItem.js +2 -2
- package/lib/formItem/index.d.ts +3 -4
- package/lib/formItem/index.js +4 -5
- package/lib/formList/index.d.ts +1 -1
- package/lib/formList/index.js +5 -8
- package/lib/hooks/attr/attr.FormItem.d.ts +1 -1
- package/lib/hooks/attr/attr.FormItem.js +3 -4
- package/lib/index.d.ts +1 -12
- package/lib/index.js +23 -155
- package/lib/layout/index.d.ts +1 -1
- package/lib/layout/index.js +3 -3
- package/lib/layout/layout.formItem.js +2 -2
- package/package.json +4 -3
- package/src/formItem/index.tsx +3 -4
- package/src/formList/index.tsx +7 -4
- package/src/hooks/attr/attr.FormItem.tsx +1 -2
- package/src/index.tsx +2 -14
- package/src/layout/index.tsx +2 -1
- package/src/layout/layout.formItem.tsx +1 -1
- package/esm/hooks/register/register.FormHideItem.d.ts +0 -9
- package/esm/hooks/register/register.FormHideItem.js +0 -31
- package/esm/hooks/register/register.FormItem.d.ts +0 -23
- package/esm/hooks/register/register.FormItem.js +0 -42
- package/esm/hooks/register/register.FormList.d.ts +0 -9
- package/esm/hooks/register/register.FormList.js +0 -31
- package/esm/hooks/register/register.form.d.ts +0 -3
- package/esm/hooks/register/register.form.js +0 -17
- package/esm/hooks/useAttrs.d.ts +0 -25
- package/esm/hooks/useAttrs.js +0 -10
- package/esm/hooks/useForm.d.ts +0 -7
- package/esm/hooks/useForm.js +0 -13
- package/esm/hooks/useFormItem.d.ts +0 -7
- package/esm/hooks/useFormItem.js +0 -11
- package/esm/hooks/useFormItemParentName.d.ts +0 -30
- package/esm/hooks/useFormItemParentName.js +0 -61
- package/esm/hooks/useFormList.d.ts +0 -7
- package/esm/hooks/useFormList.js +0 -11
- package/esm/hooks/useHtmlFor.d.ts +0 -1
- package/esm/hooks/useHtmlFor.js +0 -10
- package/esm/hooks/useMultipleForm.d.ts +0 -13
- package/esm/hooks/useMultipleForm.js +0 -19
- package/esm/hooks/useUpdate.d.ts +0 -2
- package/esm/hooks/useUpdate.js +0 -10
- package/esm/hooks/useWatch.d.ts +0 -19
- package/esm/hooks/useWatch.js +0 -41
- package/lib/hooks/register/register.FormHideItem.d.ts +0 -9
- package/lib/hooks/register/register.FormHideItem.js +0 -65
- package/lib/hooks/register/register.FormItem.d.ts +0 -23
- package/lib/hooks/register/register.FormItem.js +0 -76
- package/lib/hooks/register/register.FormList.d.ts +0 -9
- package/lib/hooks/register/register.FormList.js +0 -65
- package/lib/hooks/register/register.form.d.ts +0 -3
- package/lib/hooks/register/register.form.js +0 -51
- package/lib/hooks/useAttrs.d.ts +0 -25
- package/lib/hooks/useAttrs.js +0 -47
- package/lib/hooks/useForm.d.ts +0 -7
- package/lib/hooks/useForm.js +0 -53
- package/lib/hooks/useFormItem.d.ts +0 -7
- package/lib/hooks/useFormItem.js +0 -51
- package/lib/hooks/useFormItemParentName.d.ts +0 -30
- package/lib/hooks/useFormItemParentName.js +0 -101
- package/lib/hooks/useFormList.d.ts +0 -7
- package/lib/hooks/useFormList.js +0 -51
- package/lib/hooks/useHtmlFor.d.ts +0 -1
- package/lib/hooks/useHtmlFor.js +0 -44
- package/lib/hooks/useMultipleForm.d.ts +0 -13
- package/lib/hooks/useMultipleForm.js +0 -62
- package/lib/hooks/useUpdate.d.ts +0 -2
- package/lib/hooks/useUpdate.js +0 -44
- package/lib/hooks/useWatch.d.ts +0 -19
- package/lib/hooks/useWatch.js +0 -78
- package/src/hooks/register/register.FormHideItem.ts +0 -29
- package/src/hooks/register/register.FormItem.ts +0 -52
- package/src/hooks/register/register.FormList.ts +0 -31
- package/src/hooks/register/register.form.ts +0 -18
- package/src/hooks/useAttrs.ts +0 -35
- package/src/hooks/useForm.ts +0 -23
- package/src/hooks/useFormItem.ts +0 -21
- package/src/hooks/useFormItemParentName.ts +0 -49
- package/src/hooks/useFormList.ts +0 -21
- package/src/hooks/useHtmlFor.ts +0 -9
- package/src/hooks/useMultipleForm.ts +0 -36
- package/src/hooks/useUpdate.ts +0 -12
- package/src/hooks/useWatch.ts +0 -61
package/lib/index.js
CHANGED
|
@@ -9,42 +9,6 @@ var __webpack_modules__ = {
|
|
|
9
9
|
"./hooks/attr/attr.FormItem": function(module) {
|
|
10
10
|
module.exports = require("./hooks/attr/attr.FormItem.js");
|
|
11
11
|
},
|
|
12
|
-
"./hooks/register/register.FormHideItem": function(module) {
|
|
13
|
-
module.exports = require("./hooks/register/register.FormHideItem.js");
|
|
14
|
-
},
|
|
15
|
-
"./hooks/register/register.FormItem": function(module) {
|
|
16
|
-
module.exports = require("./hooks/register/register.FormItem.js");
|
|
17
|
-
},
|
|
18
|
-
"./hooks/register/register.FormList": function(module) {
|
|
19
|
-
module.exports = require("./hooks/register/register.FormList.js");
|
|
20
|
-
},
|
|
21
|
-
"./hooks/register/register.form": function(module) {
|
|
22
|
-
module.exports = require("./hooks/register/register.form.js");
|
|
23
|
-
},
|
|
24
|
-
"./hooks/useAttrs": function(module) {
|
|
25
|
-
module.exports = require("./hooks/useAttrs.js");
|
|
26
|
-
},
|
|
27
|
-
"./hooks/useForm": function(module) {
|
|
28
|
-
module.exports = require("./hooks/useForm.js");
|
|
29
|
-
},
|
|
30
|
-
"./hooks/useFormItem": function(module) {
|
|
31
|
-
module.exports = require("./hooks/useFormItem.js");
|
|
32
|
-
},
|
|
33
|
-
"./hooks/useFormItemParentName": function(module) {
|
|
34
|
-
module.exports = require("./hooks/useFormItemParentName.js");
|
|
35
|
-
},
|
|
36
|
-
"./hooks/useFormList": function(module) {
|
|
37
|
-
module.exports = require("./hooks/useFormList.js");
|
|
38
|
-
},
|
|
39
|
-
"./hooks/useHtmlFor": function(module) {
|
|
40
|
-
module.exports = require("./hooks/useHtmlFor.js");
|
|
41
|
-
},
|
|
42
|
-
"./hooks/useMultipleForm": function(module) {
|
|
43
|
-
module.exports = require("./hooks/useMultipleForm.js");
|
|
44
|
-
},
|
|
45
|
-
"./hooks/useWatch": function(module) {
|
|
46
|
-
module.exports = require("./hooks/useWatch.js");
|
|
47
|
-
},
|
|
48
12
|
"./layout": function(module) {
|
|
49
13
|
module.exports = require("./layout/index.js");
|
|
50
14
|
},
|
|
@@ -54,6 +18,9 @@ var __webpack_modules__ = {
|
|
|
54
18
|
"./styles/index.css": function(module) {
|
|
55
19
|
module.exports = require("./styles/index.css");
|
|
56
20
|
},
|
|
21
|
+
"@carefrees/form-utils-react-hooks": function(module) {
|
|
22
|
+
module.exports = require("@carefrees/form-utils-react-hooks");
|
|
23
|
+
},
|
|
57
24
|
"@tarojs/components": function(module) {
|
|
58
25
|
module.exports = require("@tarojs/components");
|
|
59
26
|
},
|
|
@@ -118,26 +85,25 @@ var __webpack_exports__ = {};
|
|
|
118
85
|
var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("classnames");
|
|
119
86
|
var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);
|
|
120
87
|
var _layout__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./layout");
|
|
121
|
-
var
|
|
122
|
-
var
|
|
123
|
-
var _tarojs_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("@tarojs/components");
|
|
88
|
+
var _carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("@carefrees/form-utils-react-hooks");
|
|
89
|
+
var _tarojs_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("@tarojs/components");
|
|
124
90
|
__webpack_require__("./styles/index.css");
|
|
125
|
-
var
|
|
91
|
+
var _formItem__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./formItem");
|
|
126
92
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
127
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
93
|
+
for(var __WEBPACK_IMPORT_KEY__ in _formItem__WEBPACK_IMPORTED_MODULE_7__)if ([
|
|
128
94
|
"Form",
|
|
129
95
|
"default"
|
|
130
96
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
131
|
-
return
|
|
97
|
+
return _formItem__WEBPACK_IMPORTED_MODULE_7__[key];
|
|
132
98
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
133
99
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
134
|
-
var
|
|
100
|
+
var _formList__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./formList");
|
|
135
101
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
136
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
102
|
+
for(var __WEBPACK_IMPORT_KEY__ in _formList__WEBPACK_IMPORTED_MODULE_8__)if ([
|
|
137
103
|
"Form",
|
|
138
104
|
"default"
|
|
139
105
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
140
|
-
return
|
|
106
|
+
return _formList__WEBPACK_IMPORTED_MODULE_8__[key];
|
|
141
107
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
142
108
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
143
109
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
@@ -148,134 +114,36 @@ var __webpack_exports__ = {};
|
|
|
148
114
|
return _layout__WEBPACK_IMPORTED_MODULE_3__[key];
|
|
149
115
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
150
116
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
151
|
-
var
|
|
152
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
153
|
-
for(var __WEBPACK_IMPORT_KEY__ in _layout_layout_formItem__WEBPACK_IMPORTED_MODULE_10__)if ([
|
|
154
|
-
"Form",
|
|
155
|
-
"default"
|
|
156
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
157
|
-
return _layout_layout_formItem__WEBPACK_IMPORTED_MODULE_10__[key];
|
|
158
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
159
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
160
|
-
var _hooks_useAttrs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./hooks/useAttrs");
|
|
161
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
162
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useAttrs__WEBPACK_IMPORTED_MODULE_11__)if ([
|
|
163
|
-
"Form",
|
|
164
|
-
"default"
|
|
165
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
166
|
-
return _hooks_useAttrs__WEBPACK_IMPORTED_MODULE_11__[key];
|
|
167
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
168
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
169
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
170
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useForm__WEBPACK_IMPORTED_MODULE_4__)if ([
|
|
171
|
-
"Form",
|
|
172
|
-
"default"
|
|
173
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
174
|
-
return _hooks_useForm__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
175
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
176
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
177
|
-
var _hooks_useFormItem__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./hooks/useFormItem");
|
|
178
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
179
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useFormItem__WEBPACK_IMPORTED_MODULE_12__)if ([
|
|
180
|
-
"Form",
|
|
181
|
-
"default"
|
|
182
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
183
|
-
return _hooks_useFormItem__WEBPACK_IMPORTED_MODULE_12__[key];
|
|
184
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
185
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
186
|
-
var _hooks_useFormItemParentName__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./hooks/useFormItemParentName");
|
|
187
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
188
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useFormItemParentName__WEBPACK_IMPORTED_MODULE_13__)if ([
|
|
189
|
-
"Form",
|
|
190
|
-
"default"
|
|
191
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
192
|
-
return _hooks_useFormItemParentName__WEBPACK_IMPORTED_MODULE_13__[key];
|
|
193
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
194
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
195
|
-
var _hooks_useFormList__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./hooks/useFormList");
|
|
196
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
197
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useFormList__WEBPACK_IMPORTED_MODULE_14__)if ([
|
|
198
|
-
"Form",
|
|
199
|
-
"default"
|
|
200
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
201
|
-
return _hooks_useFormList__WEBPACK_IMPORTED_MODULE_14__[key];
|
|
202
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
203
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
204
|
-
var _hooks_useHtmlFor__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./hooks/useHtmlFor");
|
|
205
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
206
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useHtmlFor__WEBPACK_IMPORTED_MODULE_15__)if ([
|
|
207
|
-
"Form",
|
|
208
|
-
"default"
|
|
209
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
210
|
-
return _hooks_useHtmlFor__WEBPACK_IMPORTED_MODULE_15__[key];
|
|
211
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
212
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
213
|
-
var _hooks_useMultipleForm__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./hooks/useMultipleForm");
|
|
214
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
215
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useMultipleForm__WEBPACK_IMPORTED_MODULE_16__)if ([
|
|
216
|
-
"Form",
|
|
217
|
-
"default"
|
|
218
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
219
|
-
return _hooks_useMultipleForm__WEBPACK_IMPORTED_MODULE_16__[key];
|
|
220
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
221
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
222
|
-
var _hooks_useWatch__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./hooks/useWatch");
|
|
223
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
224
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_useWatch__WEBPACK_IMPORTED_MODULE_17__)if ([
|
|
225
|
-
"Form",
|
|
226
|
-
"default"
|
|
227
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
228
|
-
return _hooks_useWatch__WEBPACK_IMPORTED_MODULE_17__[key];
|
|
229
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
230
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
231
|
-
var _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./hooks/attr/attr.FormItem");
|
|
232
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
233
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_18__)if ([
|
|
234
|
-
"Form",
|
|
235
|
-
"default"
|
|
236
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
237
|
-
return _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_18__[key];
|
|
238
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
239
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
240
|
-
var _hooks_register_register_FormHideItem__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./hooks/register/register.FormHideItem");
|
|
241
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
242
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_register_register_FormHideItem__WEBPACK_IMPORTED_MODULE_19__)if ([
|
|
243
|
-
"Form",
|
|
244
|
-
"default"
|
|
245
|
-
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
246
|
-
return _hooks_register_register_FormHideItem__WEBPACK_IMPORTED_MODULE_19__[key];
|
|
247
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
248
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
249
|
-
var _hooks_register_register_FormItem__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("./hooks/register/register.FormItem");
|
|
117
|
+
var _layout_layout_formItem__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./layout/layout.formItem");
|
|
250
118
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
251
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
119
|
+
for(var __WEBPACK_IMPORT_KEY__ in _layout_layout_formItem__WEBPACK_IMPORTED_MODULE_9__)if ([
|
|
252
120
|
"Form",
|
|
253
121
|
"default"
|
|
254
122
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
255
|
-
return
|
|
123
|
+
return _layout_layout_formItem__WEBPACK_IMPORTED_MODULE_9__[key];
|
|
256
124
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
257
125
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
258
|
-
var
|
|
126
|
+
var _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./hooks/attr/attr.FormItem");
|
|
259
127
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
260
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
128
|
+
for(var __WEBPACK_IMPORT_KEY__ in _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_10__)if ([
|
|
261
129
|
"Form",
|
|
262
130
|
"default"
|
|
263
131
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
264
|
-
return
|
|
132
|
+
return _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_10__[key];
|
|
265
133
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
266
134
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
267
135
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
268
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
136
|
+
for(var __WEBPACK_IMPORT_KEY__ in _carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__)if ([
|
|
269
137
|
"Form",
|
|
270
138
|
"default"
|
|
271
139
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
272
|
-
return
|
|
140
|
+
return _carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
273
141
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
274
142
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
275
143
|
function Form(props) {
|
|
276
144
|
const { children, form, style, className, formData, hideData, hideRuleData, isAutoUpdatedFormData = false, name, onFinish, onFinishFailed, onValuesChange, layoutStyle, layoutClassName, ...rest } = props;
|
|
277
|
-
const formInstance = (0,
|
|
278
|
-
(0,
|
|
145
|
+
const formInstance = (0, _carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__.useForm)(form);
|
|
146
|
+
(0, _carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__.useRegisterForm)(formInstance, name);
|
|
279
147
|
const cls = (0, react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>classnames__WEBPACK_IMPORTED_MODULE_2___default()('carefrees-form', className), []);
|
|
280
148
|
(0, react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>formInstance.ctor(formData, hideData, hideRuleData), []);
|
|
281
149
|
formInstance.onFinish = onFinish;
|
|
@@ -292,9 +160,9 @@ var __webpack_exports__ = {};
|
|
|
292
160
|
event?.stopPropagation?.();
|
|
293
161
|
formInstance.submit();
|
|
294
162
|
};
|
|
295
|
-
return /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
163
|
+
return /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__.FormInstanceContext.Provider, {
|
|
296
164
|
value: formInstance,
|
|
297
|
-
children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
165
|
+
children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Form, {
|
|
298
166
|
className: cls,
|
|
299
167
|
style: style,
|
|
300
168
|
onSubmit: onSubmit,
|
package/lib/layout/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewProps } from '@tarojs/components';
|
|
3
|
-
import { AttrsOptions } from '
|
|
3
|
+
import { AttrsOptions } from '@carefrees/form-utils-react-hooks';
|
|
4
4
|
export interface FormLayoutProps extends AttrsOptions {
|
|
5
5
|
/**标题*/
|
|
6
6
|
title?: React.ReactNode;
|
package/lib/layout/index.js
CHANGED
|
@@ -41,10 +41,10 @@ const external_react_namespaceObject = require("react");
|
|
|
41
41
|
const components_namespaceObject = require("@tarojs/components");
|
|
42
42
|
const external_classnames_namespaceObject = require("classnames");
|
|
43
43
|
var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_classnames_namespaceObject);
|
|
44
|
-
const
|
|
44
|
+
const form_utils_react_hooks_namespaceObject = require("@carefrees/form-utils-react-hooks");
|
|
45
45
|
const preCls = 'carefrees-form-layout';
|
|
46
46
|
const FormLayout = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props)=>{
|
|
47
|
-
const { colCount: p_colCount = 4, errorLayout: p_errorLayout = 'left-bottom', labelMode: p_labelMode = 'left', showColon: p_showColon = true, formItemClassName: p_formItemClassName, formItemStyle: p_formItemStyle, formItemLabelClassName: p_formItemLabelClassName, formItemLabelStyle: p_formItemLabelStyle } = (0,
|
|
47
|
+
const { colCount: p_colCount = 4, errorLayout: p_errorLayout = 'left-bottom', labelMode: p_labelMode = 'left', showColon: p_showColon = true, formItemClassName: p_formItemClassName, formItemStyle: p_formItemStyle, formItemLabelClassName: p_formItemLabelClassName, formItemLabelStyle: p_formItemLabelStyle } = (0, form_utils_react_hooks_namespaceObject.useAttrs)();
|
|
48
48
|
const { colCount = p_colCount, title, extra, children, isAllColSpan, className, headerClassName, bodyClassName, style, headerStyle, bodyStyle, errorLayout = p_errorLayout, labelMode = p_labelMode, showColon = p_showColon, formItemClassName = p_formItemClassName, formItemStyle = p_formItemStyle, formItemLabelClassName = p_formItemLabelClassName, formItemLabelStyle = p_formItemLabelStyle, bordered = false, gap } = props;
|
|
49
49
|
const propsRef = (0, external_react_namespaceObject.useRef)(props);
|
|
50
50
|
propsRef.current = props;
|
|
@@ -91,7 +91,7 @@ const FormLayout = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props
|
|
|
91
91
|
colCount,
|
|
92
92
|
gap
|
|
93
93
|
]);
|
|
94
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
94
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_utils_react_hooks_namespaceObject.AttrsContext.Provider, {
|
|
95
95
|
value: value,
|
|
96
96
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(components_namespaceObject.View, {
|
|
97
97
|
style: style,
|
|
@@ -40,10 +40,10 @@ const components_namespaceObject = require("@tarojs/components");
|
|
|
40
40
|
const external_react_namespaceObject = require("react");
|
|
41
41
|
const external_classnames_namespaceObject = require("classnames");
|
|
42
42
|
var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_classnames_namespaceObject);
|
|
43
|
-
const
|
|
43
|
+
const form_utils_react_hooks_namespaceObject = require("@carefrees/form-utils-react-hooks");
|
|
44
44
|
const preCls = 'carefrees-form-item';
|
|
45
45
|
const LayoutFormItem = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props)=>{
|
|
46
|
-
const { formItemClassName, formItemLabelClassName, formItemLabelStyle, formItemStyle, labelMode: p_labelMode = 'top', errorLayout: p_errorLayout = 'left-bottom', showColon: p_showColon = true, colCount = 1, inputBordered: p_inputBordered = true } = (0,
|
|
46
|
+
const { formItemClassName, formItemLabelClassName, formItemLabelStyle, formItemStyle, labelMode: p_labelMode = 'top', errorLayout: p_errorLayout = 'left-bottom', showColon: p_showColon = true, colCount = 1, inputBordered: p_inputBordered = true } = (0, form_utils_react_hooks_namespaceObject.useAttrs)();
|
|
47
47
|
const { children, labelMode = p_labelMode, onlyRuleStyle, label, helpText, extra, showColon = p_showColon, colSpan = 1, rowSpan = 1, validateResult, htmlFor, required, errorLayout = p_errorLayout, style, className, labelClassName, labelStyle, inputBordered = p_inputBordered } = props;
|
|
48
48
|
const tip = validateResult?.tip;
|
|
49
49
|
const isInvalid = !!validateResult?.isInvalid;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "SunLxy <1011771396@qq.com>",
|
|
4
4
|
"description": "taro react 表单组件",
|
|
5
5
|
"homepage": "https://github.com/SunLxy/carefrees-form-utils",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.5",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
9
|
"module": "esm/index.js",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@carefrees/form-utils": "^0.0.
|
|
24
|
+
"@carefrees/form-utils": "^0.0.5",
|
|
25
|
+
"@carefrees/form-utils-react-hooks": "^0.0.5",
|
|
25
26
|
"classnames": "2.5.1"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
@@ -29,4 +30,4 @@
|
|
|
29
30
|
"@types/react": "18.2.21",
|
|
30
31
|
"react": "^18.2.0"
|
|
31
32
|
}
|
|
32
|
-
}
|
|
33
|
+
}
|
package/src/formItem/index.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { LayoutFormItem, LayoutFormItemProps } from '
|
|
1
|
+
import { LayoutFormItem, LayoutFormItemProps } from '../layout/layout.formItem';
|
|
2
2
|
import { useFormItemAttr, FormItemAttrOptions } from '../hooks/attr/attr.FormItem';
|
|
3
|
-
import {
|
|
4
|
-
import { useRegisterFormHideItem } from '
|
|
5
|
-
import React, { Fragment, memo } from 'react';
|
|
3
|
+
import { Fragment, memo } from 'react';
|
|
4
|
+
import { useRegisterFormHideItem, FormItemParentNameProvider } from '@carefrees/form-utils-react-hooks';
|
|
6
5
|
|
|
7
6
|
export interface FormItemProps extends FormItemAttrOptions, LayoutFormItemProps {
|
|
8
7
|
/**不进行样式渲染*/
|
package/src/formList/index.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { useRegisterFormList, RegisterFormListOptions } from './../hooks/register/register.FormList';
|
|
2
|
-
import { FormListInstanceContext } from '../hooks/useFormList';
|
|
3
|
-
import { FormItemParentNameProvider } from './../hooks/useFormItemParentName';
|
|
4
1
|
import { RuleInstanceBase, FormItemInstanceBase, FormListInstanceBase } from '@carefrees/form-utils';
|
|
5
|
-
import { useRegisterFormHideItem } from './../hooks/register/register.FormHideItem';
|
|
6
2
|
import React, { Fragment, memo } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
useRegisterFormHideItem,
|
|
5
|
+
FormItemParentNameProvider,
|
|
6
|
+
FormListInstanceContext,
|
|
7
|
+
useRegisterFormList,
|
|
8
|
+
RegisterFormListOptions,
|
|
9
|
+
} from '@carefrees/form-utils-react-hooks';
|
|
7
10
|
|
|
8
11
|
export interface FormListChildrenProps {
|
|
9
12
|
/**数据集合*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RuleInstanceBase, FormInstanceBase, FormItemInstanceBase, get } from '@carefrees/form-utils';
|
|
2
|
-
import { useRegisterFormItem, RegisterFormItemOptions } from '
|
|
3
|
-
import { useHtmlFor } from '../useHtmlFor';
|
|
2
|
+
import { useRegisterFormItem, RegisterFormItemOptions, useHtmlFor } from '@carefrees/form-utils-react-hooks';
|
|
4
3
|
import React, { cloneElement, isValidElement, useMemo } from 'react';
|
|
5
4
|
|
|
6
5
|
export interface FormItemAttrOptions extends RegisterFormItemOptions {
|
package/src/index.tsx
CHANGED
|
@@ -2,8 +2,7 @@ import React, { useMemo, useEffect } from 'react';
|
|
|
2
2
|
import { FormInstanceBase, ValidateErrorEntity } from '@carefrees/form-utils';
|
|
3
3
|
import clx from 'classnames';
|
|
4
4
|
import { FormLayout, FormLayoutProps } from './layout';
|
|
5
|
-
import { useForm, FormInstanceContext } from '
|
|
6
|
-
import { useRegisterForm } from './hooks/register/register.form';
|
|
5
|
+
import { useRegisterForm, useForm, FormInstanceContext } from '@carefrees/form-utils-react-hooks';
|
|
7
6
|
import { Form as TaroForm } from '@tarojs/components';
|
|
8
7
|
import type { CommonEventFunction, FormProps as TaroFormProps } from '@tarojs/components';
|
|
9
8
|
import './styles/index.css';
|
|
@@ -11,19 +10,8 @@ export * from './formItem';
|
|
|
11
10
|
export * from './formList';
|
|
12
11
|
export * from './layout';
|
|
13
12
|
export * from './layout/layout.formItem';
|
|
14
|
-
export * from './hooks/useAttrs';
|
|
15
|
-
export * from './hooks/useForm';
|
|
16
|
-
export * from './hooks/useFormItem';
|
|
17
|
-
export * from './hooks/useFormItemParentName';
|
|
18
|
-
export * from './hooks/useFormList';
|
|
19
|
-
export * from './hooks/useHtmlFor';
|
|
20
|
-
export * from './hooks/useMultipleForm';
|
|
21
|
-
export * from './hooks/useWatch';
|
|
22
13
|
export * from './hooks/attr/attr.FormItem';
|
|
23
|
-
export * from '
|
|
24
|
-
export * from './hooks/register/register.FormItem';
|
|
25
|
-
export * from './hooks/register/register.FormList';
|
|
26
|
-
export * from './hooks/register/register.form';
|
|
14
|
+
export * from '@carefrees/form-utils-react-hooks';
|
|
27
15
|
|
|
28
16
|
export interface FormProps<T = any> extends FormLayoutProps {
|
|
29
17
|
children?: React.ReactNode;
|
package/src/layout/index.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { Fragment, useMemo, useRef, memo } from 'react';
|
|
2
2
|
import { View, ViewProps } from '@tarojs/components';
|
|
3
3
|
import clx from 'classnames';
|
|
4
|
-
import { AttrsOptions, AttrsContext, useAttrs } from '
|
|
4
|
+
import { AttrsOptions, AttrsContext, useAttrs } from '@carefrees/form-utils-react-hooks';
|
|
5
|
+
|
|
5
6
|
export interface FormLayoutProps extends AttrsOptions {
|
|
6
7
|
/**标题*/
|
|
7
8
|
title?: React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { View, Label } from '@tarojs/components';
|
|
2
2
|
import React, { Fragment, useMemo, memo } from 'react';
|
|
3
3
|
import clx from 'classnames';
|
|
4
|
-
import { useAttrs } from '
|
|
4
|
+
import { useAttrs } from '@carefrees/form-utils-react-hooks';
|
|
5
5
|
|
|
6
6
|
export interface LayoutFormItemProps {
|
|
7
7
|
/**规则校验失败错误提示位置*/
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RegisterFormItemOptions } from './register.FormItem';
|
|
2
|
-
interface RegisterFormHideItemOptions extends Omit<RegisterFormItemOptions, 'rules'> {
|
|
3
|
-
}
|
|
4
|
-
/**注册表单隐藏表单项到表单实例中*/
|
|
5
|
-
export declare const useRegisterFormHideItem: (options: RegisterFormHideItemOptions) => {
|
|
6
|
-
form: import("@carefrees/form-utils").FormInstanceBase<any>;
|
|
7
|
-
isHide: any;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__carefrees_form_utils_f42d2666__ from "@carefrees/form-utils";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useFormItemParentName_js_a729dfb1__ from "../useFormItemParentName.js";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useForm_js_2c14e707__ from "../useForm.js";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useUpdate_js_b5f1687a__ from "../useUpdate.js";
|
|
6
|
-
const useRegisterFormHideItem = (options)=>{
|
|
7
|
-
const { name, sort, isJoinParentField = true } = options;
|
|
8
|
-
const form = (0, __WEBPACK_EXTERNAL_MODULE__useForm_js_2c14e707__.useFormInstance)();
|
|
9
|
-
const _update = (0, __WEBPACK_EXTERNAL_MODULE__useUpdate_js_b5f1687a__.useUpdate)();
|
|
10
|
-
const { newName, newSort } = (0, __WEBPACK_EXTERNAL_MODULE__useFormItemParentName_js_a729dfb1__.useFormItemParentName)({
|
|
11
|
-
name,
|
|
12
|
-
sort,
|
|
13
|
-
isJoinParentField
|
|
14
|
-
});
|
|
15
|
-
const hideItemInstance = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new __WEBPACK_EXTERNAL_MODULE__carefrees_form_utils_f42d2666__.FormHideItemInstanceBase().ctor(newName)).current;
|
|
16
|
-
const isHide = form.getFieldHideValue(newName);
|
|
17
|
-
hideItemInstance.instance = form;
|
|
18
|
-
hideItemInstance.updated = _update.current;
|
|
19
|
-
hideItemInstance.sort = newSort;
|
|
20
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
21
|
-
const unMount = form.registerFormHideItem(hideItemInstance);
|
|
22
|
-
return ()=>unMount();
|
|
23
|
-
}, [
|
|
24
|
-
newName
|
|
25
|
-
]);
|
|
26
|
-
return {
|
|
27
|
-
form,
|
|
28
|
-
isHide
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export { useRegisterFormHideItem };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 注册组件
|
|
3
|
-
*/
|
|
4
|
-
import { RuleInstanceBase } from '@carefrees/form-utils';
|
|
5
|
-
import type { RuleItem } from 'async-validator';
|
|
6
|
-
export interface RegisterFormItemOptions {
|
|
7
|
-
/**字段*/
|
|
8
|
-
name: string;
|
|
9
|
-
/**规则*/
|
|
10
|
-
rules?: RuleItem[];
|
|
11
|
-
/**排序值*/
|
|
12
|
-
sort?: string;
|
|
13
|
-
/**是否拼接父级字段*/
|
|
14
|
-
isJoinParentField?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**注册表单项到表单实例中*/
|
|
17
|
-
export declare const useRegisterFormItem: (options: RegisterFormItemOptions) => {
|
|
18
|
-
ruleInstance: RuleInstanceBase;
|
|
19
|
-
formItemInstance: import("@carefrees/form-utils").FormItemInstanceBase;
|
|
20
|
-
form: import("@carefrees/form-utils").FormInstanceBase<any>;
|
|
21
|
-
parentName: string;
|
|
22
|
-
newName: string;
|
|
23
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__carefrees_form_utils_f42d2666__ from "@carefrees/form-utils";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useUpdate_js_b5f1687a__ from "../useUpdate.js";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useForm_js_2c14e707__ from "../useForm.js";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useFormItem_js_cd5761e5__ from "../useFormItem.js";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useFormItemParentName_js_a729dfb1__ from "../useFormItemParentName.js";
|
|
7
|
-
const useRegisterFormItem = (options)=>{
|
|
8
|
-
const { name, rules, sort, isJoinParentField = true } = options;
|
|
9
|
-
const form = (0, __WEBPACK_EXTERNAL_MODULE__useForm_js_2c14e707__.useFormInstance)();
|
|
10
|
-
const { newName, newSort, parentName } = (0, __WEBPACK_EXTERNAL_MODULE__useFormItemParentName_js_a729dfb1__.useFormItemParentName)({
|
|
11
|
-
name,
|
|
12
|
-
sort,
|
|
13
|
-
isJoinParentField
|
|
14
|
-
});
|
|
15
|
-
const ruleInstance = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new __WEBPACK_EXTERNAL_MODULE__carefrees_form_utils_f42d2666__.RuleInstanceBase()).current;
|
|
16
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>ruleInstance.ctor(newName, rules), [
|
|
17
|
-
rules,
|
|
18
|
-
newName
|
|
19
|
-
]);
|
|
20
|
-
ruleInstance.instance = form;
|
|
21
|
-
ruleInstance.sort = newSort;
|
|
22
|
-
const formItemInstance = (0, __WEBPACK_EXTERNAL_MODULE__useFormItem_js_cd5761e5__.useFormItem)();
|
|
23
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>formItemInstance.ctor(newName, ruleInstance), []);
|
|
24
|
-
formItemInstance.instance = form;
|
|
25
|
-
formItemInstance.sort = newSort;
|
|
26
|
-
formItemInstance.parentDataField = parentName;
|
|
27
|
-
const _updated = (0, __WEBPACK_EXTERNAL_MODULE__useUpdate_js_b5f1687a__.useUpdate)();
|
|
28
|
-
formItemInstance.updated = _updated.current;
|
|
29
|
-
ruleInstance.updated = _updated.current;
|
|
30
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
31
|
-
const unMount = form.registerFormItem(formItemInstance);
|
|
32
|
-
return ()=>unMount();
|
|
33
|
-
}, []);
|
|
34
|
-
return {
|
|
35
|
-
ruleInstance,
|
|
36
|
-
formItemInstance,
|
|
37
|
-
form,
|
|
38
|
-
parentName,
|
|
39
|
-
newName
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export { useRegisterFormItem };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RegisterFormItemOptions } from './register.FormItem';
|
|
2
|
-
export interface RegisterFormListOptions extends RegisterFormItemOptions {
|
|
3
|
-
}
|
|
4
|
-
/**注册表单List到表单实例中*/
|
|
5
|
-
export declare const useRegisterFormList: (options: RegisterFormListOptions) => {
|
|
6
|
-
ruleInstance: import("@carefrees/form-utils").RuleInstanceBase;
|
|
7
|
-
formItemInstance: import("@carefrees/form-utils").FormItemInstanceBase;
|
|
8
|
-
formListInstance: import("@carefrees/form-utils").FormListInstanceBase;
|
|
9
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__register_FormItem_js_53f62622__ from "./register.FormItem.js";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useFormList_js_fe5717d9__ from "../useFormList.js";
|
|
4
|
-
const useRegisterFormList = (options)=>{
|
|
5
|
-
const { ...rest } = options;
|
|
6
|
-
const { ruleInstance, formItemInstance, form, newName, parentName } = (0, __WEBPACK_EXTERNAL_MODULE__register_FormItem_js_53f62622__.useRegisterFormItem)({
|
|
7
|
-
...rest
|
|
8
|
-
});
|
|
9
|
-
const formListInstance = (0, __WEBPACK_EXTERNAL_MODULE__useFormList_js_fe5717d9__.useFormList)();
|
|
10
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>formListInstance.ctor(newName), [
|
|
11
|
-
newName
|
|
12
|
-
]);
|
|
13
|
-
formListInstance.instance = form;
|
|
14
|
-
formListInstance.rule = ruleInstance;
|
|
15
|
-
formListInstance.sort = options.sort;
|
|
16
|
-
formListInstance.formItemInstance = formItemInstance;
|
|
17
|
-
formListInstance.parentDataField = parentName;
|
|
18
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
19
|
-
const unMount = form.registerFormList(options.name, formListInstance);
|
|
20
|
-
return ()=>unMount();
|
|
21
|
-
}, [
|
|
22
|
-
options.name,
|
|
23
|
-
formListInstance
|
|
24
|
-
]);
|
|
25
|
-
return {
|
|
26
|
-
ruleInstance,
|
|
27
|
-
formItemInstance,
|
|
28
|
-
formListInstance
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export { useRegisterFormList };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__useMultipleForm_js_ddedf30e__ from "../useMultipleForm.js";
|
|
3
|
-
const useRegisterForm = (form, name)=>{
|
|
4
|
-
const multipleForm = (0, __WEBPACK_EXTERNAL_MODULE__useMultipleForm_js_ddedf30e__.useMultipleFormInstance)();
|
|
5
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
6
|
-
let onMounted;
|
|
7
|
-
if (name) onMounted = multipleForm.ctor(name, form);
|
|
8
|
-
return ()=>{
|
|
9
|
-
onMounted?.();
|
|
10
|
-
};
|
|
11
|
-
}, [
|
|
12
|
-
name,
|
|
13
|
-
form
|
|
14
|
-
]);
|
|
15
|
-
return multipleForm;
|
|
16
|
-
};
|
|
17
|
-
export { useRegisterForm };
|
package/esm/hooks/useAttrs.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { LayoutFormItemProps } from '../layout/layout.formItem';
|
|
2
|
-
export interface AttrsOptions {
|
|
3
|
-
/**列数据*/
|
|
4
|
-
colCount?: number;
|
|
5
|
-
/**规则校验失败错误提示位置*/
|
|
6
|
-
errorLayout?: LayoutFormItemProps['errorLayout'];
|
|
7
|
-
/**label显示模式*/
|
|
8
|
-
labelMode?: LayoutFormItemProps['labelMode'];
|
|
9
|
-
/**是否显示label后的冒号*/
|
|
10
|
-
showColon?: boolean;
|
|
11
|
-
/**表单项 className*/
|
|
12
|
-
formItemClassName?: string;
|
|
13
|
-
/**表单项 style*/
|
|
14
|
-
formItemStyle?: React.CSSProperties;
|
|
15
|
-
/**表单项 label className*/
|
|
16
|
-
formItemLabelClassName?: string;
|
|
17
|
-
/**表单项 label style*/
|
|
18
|
-
formItemLabelStyle?: React.CSSProperties;
|
|
19
|
-
/**输入框底部边框*/
|
|
20
|
-
inputBordered?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**公共属性 Context */
|
|
23
|
-
export declare const AttrsContext: import("react").Context<AttrsOptions>;
|
|
24
|
-
/**子项中获取公共属性*/
|
|
25
|
-
export declare const useAttrs: () => AttrsOptions;
|
package/esm/hooks/useAttrs.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
-
const AttrsContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)({
|
|
3
|
-
colCount: 4,
|
|
4
|
-
errorLayout: 'left-bottom',
|
|
5
|
-
labelMode: 'top',
|
|
6
|
-
showColon: true,
|
|
7
|
-
inputBordered: true
|
|
8
|
-
});
|
|
9
|
-
const useAttrs = ()=>(0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(AttrsContext);
|
|
10
|
-
export { AttrsContext, useAttrs };
|
package/esm/hooks/useForm.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FormInstanceBase } from '@carefrees/form-utils';
|
|
2
|
-
/**表单实例 Context */
|
|
3
|
-
export declare const FormInstanceContext: import("react").Context<FormInstanceBase<any>>;
|
|
4
|
-
/**子项中获取表单实例*/
|
|
5
|
-
export declare function useFormInstance<T = any>(): FormInstanceBase<T>;
|
|
6
|
-
/**初始化表单实例*/
|
|
7
|
-
export declare function useForm<T = any>(form?: FormInstanceBase<T>): FormInstanceBase<T>;
|