@fle-ui/plus-dynamic-form 1.1.3 → 1.1.4-alpha.0
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/LICENSE +1 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +15 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +15 -4
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
package/es/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface DynamicFormRef {
|
|
|
7
7
|
interface DynamicFormProps extends ProFormProps {
|
|
8
8
|
style: React.CSSProperties;
|
|
9
9
|
request: () => Promise<Record<string, any>>;
|
|
10
|
+
initSetData: () => Promise<Record<string, any>>;
|
|
11
|
+
disabled: false;
|
|
10
12
|
}
|
|
11
13
|
declare const searchFormTypeToDynamicFormType: any;
|
|
12
14
|
declare const searchFormTypeToDynamicFormTypeRender: any;
|
package/es/index.js
CHANGED
|
@@ -58,7 +58,8 @@ var searchFormTypeToDynamicFormTypeSearch = {
|
|
|
58
58
|
};
|
|
59
59
|
function PlusDynamicForm(props, ref) {
|
|
60
60
|
var propsRequest = props.request,
|
|
61
|
-
propsContainStyles = props.style
|
|
61
|
+
propsContainStyles = props.style,
|
|
62
|
+
initSetData = props.initSetData;
|
|
62
63
|
var _Form$useForm = _Form.useForm(),
|
|
63
64
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
64
65
|
form = _Form$useForm2[0]; // 表单实例
|
|
@@ -147,7 +148,7 @@ function PlusDynamicForm(props, ref) {
|
|
|
147
148
|
});
|
|
148
149
|
var init = /*#__PURE__*/function () {
|
|
149
150
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
150
|
-
var res;
|
|
151
|
+
var res, initData;
|
|
151
152
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
152
153
|
while (1) switch (_context4.prev = _context4.next) {
|
|
153
154
|
case 0:
|
|
@@ -157,7 +158,16 @@ function PlusDynamicForm(props, ref) {
|
|
|
157
158
|
res = _context4.sent;
|
|
158
159
|
// 返回的值塞入表单
|
|
159
160
|
setFormData(res);
|
|
160
|
-
|
|
161
|
+
if (!initSetData) {
|
|
162
|
+
_context4.next = 9;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
_context4.next = 7;
|
|
166
|
+
return initSetData();
|
|
167
|
+
case 7:
|
|
168
|
+
initData = _context4.sent;
|
|
169
|
+
form.setFieldsValue(initData);
|
|
170
|
+
case 9:
|
|
161
171
|
case "end":
|
|
162
172
|
return _context4.stop();
|
|
163
173
|
}
|
|
@@ -181,7 +191,8 @@ function PlusDynamicForm(props, ref) {
|
|
|
181
191
|
flex: '110px'
|
|
182
192
|
}
|
|
183
193
|
}, props, {
|
|
184
|
-
form: form
|
|
194
|
+
form: form,
|
|
195
|
+
labelWrap: true
|
|
185
196
|
}), // 遍历系统字段
|
|
186
197
|
formData === null || formData === void 0 ? void 0 : formData.map(function (item) {
|
|
187
198
|
switch (item.fieldType) {
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface DynamicFormRef {
|
|
|
7
7
|
interface DynamicFormProps extends ProFormProps {
|
|
8
8
|
style: React.CSSProperties;
|
|
9
9
|
request: () => Promise<Record<string, any>>;
|
|
10
|
+
initSetData: () => Promise<Record<string, any>>;
|
|
11
|
+
disabled: false;
|
|
10
12
|
}
|
|
11
13
|
declare const searchFormTypeToDynamicFormType: any;
|
|
12
14
|
declare const searchFormTypeToDynamicFormTypeRender: any;
|
package/lib/index.js
CHANGED
|
@@ -66,7 +66,8 @@ var searchFormTypeToDynamicFormTypeSearch = exports.searchFormTypeToDynamicFormT
|
|
|
66
66
|
};
|
|
67
67
|
function PlusDynamicForm(props, ref) {
|
|
68
68
|
var propsRequest = props.request,
|
|
69
|
-
propsContainStyles = props.style
|
|
69
|
+
propsContainStyles = props.style,
|
|
70
|
+
initSetData = props.initSetData;
|
|
70
71
|
var _Form$useForm = _antd.Form.useForm(),
|
|
71
72
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
72
73
|
form = _Form$useForm2[0]; // 表单实例
|
|
@@ -155,7 +156,7 @@ function PlusDynamicForm(props, ref) {
|
|
|
155
156
|
});
|
|
156
157
|
var init = /*#__PURE__*/function () {
|
|
157
158
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
158
|
-
var res;
|
|
159
|
+
var res, initData;
|
|
159
160
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
160
161
|
while (1) switch (_context4.prev = _context4.next) {
|
|
161
162
|
case 0:
|
|
@@ -165,7 +166,16 @@ function PlusDynamicForm(props, ref) {
|
|
|
165
166
|
res = _context4.sent;
|
|
166
167
|
// 返回的值塞入表单
|
|
167
168
|
setFormData(res);
|
|
168
|
-
|
|
169
|
+
if (!initSetData) {
|
|
170
|
+
_context4.next = 9;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
_context4.next = 7;
|
|
174
|
+
return initSetData();
|
|
175
|
+
case 7:
|
|
176
|
+
initData = _context4.sent;
|
|
177
|
+
form.setFieldsValue(initData);
|
|
178
|
+
case 9:
|
|
169
179
|
case "end":
|
|
170
180
|
return _context4.stop();
|
|
171
181
|
}
|
|
@@ -189,7 +199,8 @@ function PlusDynamicForm(props, ref) {
|
|
|
189
199
|
flex: '110px'
|
|
190
200
|
}
|
|
191
201
|
}, props, {
|
|
192
|
-
form: form
|
|
202
|
+
form: form,
|
|
203
|
+
labelWrap: true
|
|
193
204
|
}), // 遍历系统字段
|
|
194
205
|
formData === null || formData === void 0 ? void 0 : formData.map(function (item) {
|
|
195
206
|
switch (item.fieldType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fle-ui/plus-dynamic-form",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4-alpha.0",
|
|
4
4
|
"description": "@fle-ui/plus-dynamic-form",
|
|
5
5
|
"author": "liqing19931031 <liqing@qq.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "b60745731ab6ad4293f17b9b4c062563fe4f1069",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"lodash": "^4.17.21"
|
|
33
33
|
}
|