ztxkui 6.0.3 → 6.0.4
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/dist/UI/Form/index.js +192 -200
- package/dist/components/ProForm/item.js +23 -19
- package/package.json +1 -1
package/dist/UI/Form/index.js
CHANGED
|
@@ -98,229 +98,221 @@ function Home() {
|
|
|
98
98
|
useEffect(function () {
|
|
99
99
|
form.setFieldsValue(formData);
|
|
100
100
|
}, [form, formData]);
|
|
101
|
-
var items =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
var items = __spreadArray([
|
|
102
|
+
{
|
|
103
|
+
name: 'test1',
|
|
104
|
+
label: '测试1',
|
|
105
|
+
isRequired: true,
|
|
106
|
+
render: function (itemProps) {
|
|
107
|
+
// console.log('测试1', state);
|
|
108
|
+
return (React.createElement(Input, __assign({}, itemProps, { allowClear: true })));
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'test11',
|
|
113
|
+
label: '测试11',
|
|
114
|
+
rules: [
|
|
115
|
+
{
|
|
116
|
+
required: true,
|
|
117
|
+
message: '测试11必填',
|
|
110
118
|
},
|
|
119
|
+
],
|
|
120
|
+
render: function (itemProps) { return (React.createElement(Input, __assign({}, itemProps, { allowClear: true, onChange: function (e) {
|
|
121
|
+
setFormData(function (preData) {
|
|
122
|
+
return __assign(__assign({}, preData), { test11: e.target.value });
|
|
123
|
+
});
|
|
124
|
+
}, isAsrInput: true }))); },
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'test2',
|
|
128
|
+
label: '测试2',
|
|
129
|
+
dependencies: ['test1'],
|
|
130
|
+
isRequired: true,
|
|
131
|
+
render: function (itemProps, formInstance) {
|
|
132
|
+
// console.log('测试2 渲染');
|
|
133
|
+
return React.createElement(Input.TextArea, __assign({}, itemProps, { isAsrInput: true }));
|
|
111
134
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
shouldUpdateBeOutsideState: function () { return false; },
|
|
122
|
-
render: function (itemProps) { return (React.createElement(Input, __assign({}, itemProps, { allowClear: true, onChange: function (e) {
|
|
123
|
-
setFormData(function (preData) {
|
|
124
|
-
return __assign(__assign({}, preData), { test11: e.target.value });
|
|
125
|
-
});
|
|
126
|
-
}, isAsrInput: true }))); },
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'test22',
|
|
138
|
+
label: '测试22',
|
|
139
|
+
dependencies: ['test1'],
|
|
140
|
+
isChangeable: false,
|
|
141
|
+
render: function (itemProps, formInstance) {
|
|
142
|
+
// console.log(formInstance?.getFieldsValue());
|
|
143
|
+
return React.createElement(Input, __assign({}, itemProps, { allowClear: true }));
|
|
127
144
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'test23',
|
|
148
|
+
label: '测试23',
|
|
149
|
+
noLabel: true,
|
|
150
|
+
render: function (itemProps, formInstance) {
|
|
151
|
+
return (React.createElement(Radio.Group
|
|
152
|
+
// onChange={(e) => {
|
|
153
|
+
// setStatus(e.target.value);
|
|
154
|
+
// }}
|
|
155
|
+
, null,
|
|
156
|
+
React.createElement(Radio, { value: "1" }, "\u4F60\u597D"),
|
|
157
|
+
React.createElement(Radio, { value: "2" }, "\u518D\u89C1")));
|
|
138
158
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'test3',
|
|
162
|
+
label: '测试3',
|
|
163
|
+
shouldUpdateNames: ['test23'],
|
|
164
|
+
isDisplay: function (form) {
|
|
165
|
+
console.log(form, form.getFieldValue('test23'));
|
|
166
|
+
return form.getFieldValue('test23') === '1';
|
|
148
167
|
},
|
|
149
|
-
{
|
|
150
|
-
|
|
151
|
-
label: '测试23',
|
|
152
|
-
noLabel: true,
|
|
153
|
-
shouldUpdateBeOutsideState: function () { return false; },
|
|
154
|
-
render: function (itemProps, formInstance) {
|
|
155
|
-
return (React.createElement(Radio.Group, { onChange: function (e) {
|
|
156
|
-
setStatus(e.target.value);
|
|
157
|
-
} },
|
|
158
|
-
React.createElement(Radio, { value: "1" }, "\u4F60\u597D"),
|
|
159
|
-
React.createElement(Radio, { value: "2" }, "\u518D\u89C1")));
|
|
160
|
-
},
|
|
168
|
+
render: function (itemProps, formInstance) {
|
|
169
|
+
return React.createElement(Input, __assign({}, itemProps));
|
|
161
170
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'test4',
|
|
174
|
+
label: '测试4',
|
|
175
|
+
isRequired: true,
|
|
176
|
+
render: function (itemProps, formInstance) {
|
|
177
|
+
return (React.createElement(EnhanceSelect, __assign({}, itemProps, { list: [
|
|
178
|
+
{ id: '1', name: '小明' },
|
|
179
|
+
{ id: '2', name: '小虎' },
|
|
180
|
+
{ id: '3', name: '小明' },
|
|
181
|
+
{ id: '4', name: '小虎' },
|
|
182
|
+
{ id: '5', name: '小明' },
|
|
183
|
+
{ id: '6', name: '小虎' },
|
|
184
|
+
{ id: '7', name: '小明' },
|
|
185
|
+
{ id: '8', name: '小虎' },
|
|
186
|
+
{ id: '9', name: '小明' },
|
|
187
|
+
{ id: '10', name: '小虎' },
|
|
188
|
+
{ id: '11', name: '小明' },
|
|
189
|
+
{ id: '21', name: '小虎' },
|
|
190
|
+
{ id: '31', name: '小明' },
|
|
191
|
+
{ id: '41', name: '小虎' },
|
|
192
|
+
{ id: '51', name: '小明' },
|
|
193
|
+
{ id: '61', name: '小虎' },
|
|
194
|
+
{ id: '71', name: '小明' },
|
|
195
|
+
{ id: '81', name: '小虎' },
|
|
196
|
+
{ id: '91', name: '小明' },
|
|
197
|
+
{ id: '101', name: '小虎' },
|
|
198
|
+
], mode: "multiple", allowClear: true })));
|
|
174
199
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
},
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'test444',
|
|
203
|
+
label: '测试444',
|
|
204
|
+
isRequired: true,
|
|
205
|
+
render: function (itemProps, formInstance) {
|
|
206
|
+
return (React.createElement(TreeSelect, __assign({}, itemProps, { treeData: [
|
|
207
|
+
{ key: '1', title: '小明' },
|
|
208
|
+
{ key: '2', title: '小虎' },
|
|
209
|
+
{ key: '3', title: '小明' },
|
|
210
|
+
{ key: '4', title: '小虎' },
|
|
211
|
+
{ key: '5', title: '小明' },
|
|
212
|
+
{ key: '6', title: '小虎' },
|
|
213
|
+
{ key: '7', title: '小明' },
|
|
214
|
+
{ key: '8', title: '小虎' },
|
|
215
|
+
{ key: '9', title: '小明' },
|
|
216
|
+
{ key: '10', title: '小虎' },
|
|
217
|
+
{ key: '11', title: '小明' },
|
|
218
|
+
{ key: '21', title: '小虎' },
|
|
219
|
+
{ key: '31', title: '小明' },
|
|
220
|
+
{ key: '41', title: '小虎' },
|
|
221
|
+
{ key: '51', title: '小明' },
|
|
222
|
+
{ key: '61', title: '小虎' },
|
|
223
|
+
{ key: '71', title: '小明' },
|
|
224
|
+
{ key: '81', title: '小虎' },
|
|
225
|
+
{ key: '91', title: '小明' },
|
|
226
|
+
{ key: '101', title: '小虎' },
|
|
227
|
+
], treeCheckable: true, allowClear: true })));
|
|
204
228
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
{ key: '1', title: '小明' },
|
|
213
|
-
{ key: '2', title: '小虎' },
|
|
214
|
-
{ key: '3', title: '小明' },
|
|
215
|
-
{ key: '4', title: '小虎' },
|
|
216
|
-
{ key: '5', title: '小明' },
|
|
217
|
-
{ key: '6', title: '小虎' },
|
|
218
|
-
{ key: '7', title: '小明' },
|
|
219
|
-
{ key: '8', title: '小虎' },
|
|
220
|
-
{ key: '9', title: '小明' },
|
|
221
|
-
{ key: '10', title: '小虎' },
|
|
222
|
-
{ key: '11', title: '小明' },
|
|
223
|
-
{ key: '21', title: '小虎' },
|
|
224
|
-
{ key: '31', title: '小明' },
|
|
225
|
-
{ key: '41', title: '小虎' },
|
|
226
|
-
{ key: '51', title: '小明' },
|
|
227
|
-
{ key: '61', title: '小虎' },
|
|
228
|
-
{ key: '71', title: '小明' },
|
|
229
|
-
{ key: '81', title: '小虎' },
|
|
230
|
-
{ key: '91', title: '小明' },
|
|
231
|
-
{ key: '101', title: '小虎' },
|
|
232
|
-
], treeCheckable: true, allowClear: true })));
|
|
233
|
-
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'test5',
|
|
232
|
+
label: '测试5',
|
|
233
|
+
isRequired: true,
|
|
234
|
+
render: function (itemProps, formInstance) {
|
|
235
|
+
return (React.createElement(EnhanceSelect, { placeholder: "\u4E00\u6B21\u6027\u52A0\u8F7D\u6570\u636E", request: request, isCatch: true, dataKey: "id", titleKey: "name", url: "http://192.168.0.83:8000/api/zmdms-scm-accounting/advancepaymentoverdue/getOveStatusEnum", method: "GET" }));
|
|
234
236
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
},
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'test6',
|
|
240
|
+
label: '测试6',
|
|
241
|
+
isRequired: true,
|
|
242
|
+
render: function (itemProps, formInstance) {
|
|
243
|
+
// console.log('测试6', state);
|
|
244
|
+
return (React.createElement(Select, __assign({}, itemProps, { allowClear: true }),
|
|
245
|
+
React.createElement(Select.Option, { value: "1" }, "\u4F60\u597D")));
|
|
243
246
|
},
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
React.createElement(Select.Option, { value: "1" }, "\u4F60\u597D")));
|
|
253
|
-
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'test7',
|
|
250
|
+
label: '测试7',
|
|
251
|
+
isRequired: true,
|
|
252
|
+
noLabel: true,
|
|
253
|
+
render: function (itemProps, formInstance) {
|
|
254
|
+
return React.createElement(Input, __assign({}, itemProps));
|
|
254
255
|
},
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: 'test8',
|
|
259
|
+
label: '测试8',
|
|
260
|
+
isRequired: true,
|
|
261
|
+
noLabel: true,
|
|
262
|
+
render: function (itemProps, formInstance) {
|
|
263
|
+
return (React.createElement(Checkbox.Group, __assign({}, itemProps),
|
|
264
|
+
React.createElement(Checkbox, { value: "1" }, "\u662F"),
|
|
265
|
+
React.createElement(Checkbox, { value: "2" }, "\u5426")));
|
|
264
266
|
},
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'test9',
|
|
270
|
+
label: '测试9',
|
|
271
|
+
isRequired: true,
|
|
272
|
+
valuePropName: 'checked',
|
|
273
|
+
noLabel: true,
|
|
274
|
+
showBoxBorder: true,
|
|
275
|
+
render: function (itemProps, formInstance) {
|
|
276
|
+
return React.createElement(Checkbox, null, "\u662F");
|
|
276
277
|
},
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
showBoxBorder: true,
|
|
284
|
-
shouldUpdateBeOutsideState: function () { return false; },
|
|
285
|
-
render: function (itemProps, formInstance) {
|
|
286
|
-
return React.createElement(Checkbox, null, "\u662F");
|
|
287
|
-
},
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'test11',
|
|
281
|
+
label: '测试11',
|
|
282
|
+
render: function (itemProps, formInstance) {
|
|
283
|
+
return React.createElement(Input.TextArea, __assign({}, itemProps));
|
|
288
284
|
},
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
label: '测试11',
|
|
292
|
-
render: function (itemProps, formInstance) {
|
|
293
|
-
return React.createElement(Input.TextArea, __assign({}, itemProps));
|
|
294
|
-
},
|
|
295
|
-
}
|
|
296
|
-
], new Array(10).fill(1).map(function (item, index) {
|
|
297
|
-
return {
|
|
298
|
-
name: 'test6' + index,
|
|
299
|
-
label: '测试6' + index,
|
|
300
|
-
isRequired: true,
|
|
301
|
-
preText: React.createElement("span", null, "\u4F60\u597D\u00A0\u00A0\u00A0"),
|
|
302
|
-
shouldUpdateBeOutsideState: function () { return false; },
|
|
303
|
-
render: function (itemProps, formInstance) {
|
|
304
|
-
console.log('测试6' + index, state);
|
|
305
|
-
return (React.createElement(Select, __assign({}, itemProps, { allowClear: true }),
|
|
306
|
-
React.createElement(Select.Option, { value: "1" }, "\u4F60\u597D")));
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
}));
|
|
310
|
-
}, [state]);
|
|
311
|
-
var outsideState = useMemo(function () {
|
|
285
|
+
}
|
|
286
|
+
], new Array(10).fill(1).map(function (item, index) {
|
|
312
287
|
return {
|
|
313
|
-
|
|
288
|
+
name: 'test6' + index,
|
|
289
|
+
label: '测试6' + index,
|
|
290
|
+
isRequired: true,
|
|
291
|
+
preText: React.createElement("span", null, "\u4F60\u597D\u00A0\u00A0\u00A0"),
|
|
292
|
+
render: function (itemProps, formInstance) {
|
|
293
|
+
// console.log('测试6' + index, state);
|
|
294
|
+
return (React.createElement(Select, __assign({}, itemProps, { allowClear: true }),
|
|
295
|
+
React.createElement(Select.Option, { value: "1" }, "\u4F60\u597D")));
|
|
296
|
+
},
|
|
314
297
|
};
|
|
315
|
-
}
|
|
298
|
+
}));
|
|
299
|
+
// }, [state]);
|
|
300
|
+
// const outsideState = useMemo(() => {
|
|
301
|
+
// return {
|
|
302
|
+
// state,
|
|
303
|
+
// };
|
|
304
|
+
// }, [state]);
|
|
316
305
|
var searchHandle = function () {
|
|
317
306
|
console.log('searchHandle', form.getFieldsValue());
|
|
318
307
|
};
|
|
319
308
|
var resetHandle = function () {
|
|
320
309
|
form.resetFields();
|
|
321
310
|
};
|
|
311
|
+
console.log('rerender');
|
|
322
312
|
return (React.createElement("div", null,
|
|
323
|
-
React.createElement(ProForm, { form: form, items: items, initialValues: initialValues, showDynamic: true, showDynamicKey: "my-coco", configInfo: configInfoMemo,
|
|
313
|
+
React.createElement(ProForm, { form: form, items: items, initialValues: initialValues, showDynamic: true, showDynamicKey: "my-coco", configInfo: configInfoMemo,
|
|
314
|
+
// outsideState={outsideState}
|
|
315
|
+
rightWrapVisible: true, onSearchHandle: searchHandle, onResetHandle: resetHandle }),
|
|
324
316
|
React.createElement(Button, { onClick: function () {
|
|
325
317
|
setState(state + 1);
|
|
326
318
|
console.log(form.getFieldsValue());
|
|
@@ -23,7 +23,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import React, { memo } from 'react';
|
|
24
24
|
import { Form } from 'antd';
|
|
25
25
|
import classNames from 'classnames';
|
|
26
|
-
import isEqual from '../utils/isEqual';
|
|
27
26
|
function runHandle(form, handle) {
|
|
28
27
|
return typeof handle === 'function' ? handle(form) : handle;
|
|
29
28
|
}
|
|
@@ -197,21 +196,26 @@ function ItemWrap(props) {
|
|
|
197
196
|
width: getWidthStr(width),
|
|
198
197
|
} }, children));
|
|
199
198
|
}
|
|
200
|
-
|
|
201
|
-
export default memo(Item,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
199
|
+
export default memo(Item);
|
|
200
|
+
// // export default memo(Item, (prev, next) => {
|
|
201
|
+
// // // 返回false 就表示组件需要渲染
|
|
202
|
+
// // 返回true 就表示组件不需要渲染
|
|
203
|
+
// // 编写高性能表单时,可能会用到这个配置
|
|
204
|
+
// if (next?.shouldUpdateBeOutsideState) {
|
|
205
|
+
// if (
|
|
206
|
+
// isEqual(prev, next, [
|
|
207
|
+
// 'render',
|
|
208
|
+
// 'shouldUpdateBeOutsideState',
|
|
209
|
+
// 'shouldUpdate',
|
|
210
|
+
// 'outsideState',
|
|
211
|
+
// ])
|
|
212
|
+
// ) {
|
|
213
|
+
// return !next.shouldUpdateBeOutsideState(
|
|
214
|
+
// prev.outsideState,
|
|
215
|
+
// next.outsideState
|
|
216
|
+
// );
|
|
217
|
+
// }
|
|
218
|
+
// return false;
|
|
219
|
+
// }
|
|
220
|
+
// return isEqual(prev, next);
|
|
221
|
+
// });
|