@fle-ui/plus-dynamic-form 1.1.1 → 1.1.3-diff.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 +16 -11
- package/lib/index.d.ts +2 -0
- package/lib/index.js +16 -11
- 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
|
}
|
|
@@ -170,9 +180,7 @@ function PlusDynamicForm(props, ref) {
|
|
|
170
180
|
useEffect(function () {
|
|
171
181
|
init();
|
|
172
182
|
}, []);
|
|
173
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
174
|
-
style: propsContainStyles || containStyles
|
|
175
|
-
}, "\u5907\u7528\u5B57\u6BB5"), (formData === null || formData === void 0 ? void 0 : formData.length) > 0 ? /*#__PURE__*/React.createElement(ProForm, _extends({
|
|
183
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (formData === null || formData === void 0 ? void 0 : formData.length) > 0 ? /*#__PURE__*/React.createElement(ProForm, _extends({
|
|
176
184
|
submitter: false,
|
|
177
185
|
layout: "horizontal",
|
|
178
186
|
grid: true,
|
|
@@ -181,10 +189,6 @@ function PlusDynamicForm(props, ref) {
|
|
|
181
189
|
},
|
|
182
190
|
labelCol: {
|
|
183
191
|
flex: '110px'
|
|
184
|
-
},
|
|
185
|
-
colProps: {
|
|
186
|
-
xl: 8,
|
|
187
|
-
md: 12
|
|
188
192
|
}
|
|
189
193
|
}, props, {
|
|
190
194
|
form: form
|
|
@@ -213,7 +217,8 @@ function PlusDynamicForm(props, ref) {
|
|
|
213
217
|
label: item.title,
|
|
214
218
|
placeholder: "\u8BF7\u586B\u5165".concat(item.title),
|
|
215
219
|
fieldProps: {
|
|
216
|
-
maxLength: item.fieldLength
|
|
220
|
+
maxLength: item.fieldLength,
|
|
221
|
+
showCount: true
|
|
217
222
|
},
|
|
218
223
|
rules: [{
|
|
219
224
|
required: item.required,
|
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
|
}
|
|
@@ -178,9 +188,7 @@ function PlusDynamicForm(props, ref) {
|
|
|
178
188
|
(0, _react.useEffect)(function () {
|
|
179
189
|
init();
|
|
180
190
|
}, []);
|
|
181
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
182
|
-
style: propsContainStyles || containStyles
|
|
183
|
-
}, "\u5907\u7528\u5B57\u6BB5"), (formData === null || formData === void 0 ? void 0 : formData.length) > 0 ? /*#__PURE__*/_react.default.createElement(_proComponents.ProForm, _extends({
|
|
191
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (formData === null || formData === void 0 ? void 0 : formData.length) > 0 ? /*#__PURE__*/_react.default.createElement(_proComponents.ProForm, _extends({
|
|
184
192
|
submitter: false,
|
|
185
193
|
layout: "horizontal",
|
|
186
194
|
grid: true,
|
|
@@ -189,10 +197,6 @@ function PlusDynamicForm(props, ref) {
|
|
|
189
197
|
},
|
|
190
198
|
labelCol: {
|
|
191
199
|
flex: '110px'
|
|
192
|
-
},
|
|
193
|
-
colProps: {
|
|
194
|
-
xl: 8,
|
|
195
|
-
md: 12
|
|
196
200
|
}
|
|
197
201
|
}, props, {
|
|
198
202
|
form: form
|
|
@@ -221,7 +225,8 @@ function PlusDynamicForm(props, ref) {
|
|
|
221
225
|
label: item.title,
|
|
222
226
|
placeholder: "\u8BF7\u586B\u5165".concat(item.title),
|
|
223
227
|
fieldProps: {
|
|
224
|
-
maxLength: item.fieldLength
|
|
228
|
+
maxLength: item.fieldLength,
|
|
229
|
+
showCount: true
|
|
225
230
|
},
|
|
226
231
|
rules: [{
|
|
227
232
|
required: item.required,
|
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.3-diff.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": "a1a8eca220b64c619ced27d1c5678175276228cb",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"lodash": "^4.17.21"
|
|
33
33
|
}
|