ztxkui 6.0.2 → 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
CHANGED
|
@@ -98,227 +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
|
-
|
|
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 })));
|
|
172
199
|
},
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
},
|
|
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 })));
|
|
202
228
|
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
{ key: '1', title: '小明' },
|
|
211
|
-
{ key: '2', title: '小虎' },
|
|
212
|
-
{ key: '3', title: '小明' },
|
|
213
|
-
{ key: '4', title: '小虎' },
|
|
214
|
-
{ key: '5', title: '小明' },
|
|
215
|
-
{ key: '6', title: '小虎' },
|
|
216
|
-
{ key: '7', title: '小明' },
|
|
217
|
-
{ key: '8', title: '小虎' },
|
|
218
|
-
{ key: '9', title: '小明' },
|
|
219
|
-
{ key: '10', title: '小虎' },
|
|
220
|
-
{ key: '11', title: '小明' },
|
|
221
|
-
{ key: '21', title: '小虎' },
|
|
222
|
-
{ key: '31', title: '小明' },
|
|
223
|
-
{ key: '41', title: '小虎' },
|
|
224
|
-
{ key: '51', title: '小明' },
|
|
225
|
-
{ key: '61', title: '小虎' },
|
|
226
|
-
{ key: '71', title: '小明' },
|
|
227
|
-
{ key: '81', title: '小虎' },
|
|
228
|
-
{ key: '91', title: '小明' },
|
|
229
|
-
{ key: '101', title: '小虎' },
|
|
230
|
-
], treeCheckable: true, allowClear: true })));
|
|
231
|
-
},
|
|
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" }));
|
|
232
236
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
},
|
|
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")));
|
|
241
246
|
},
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
React.createElement(Select.Option, { value: "1" }, "\u4F60\u597D")));
|
|
251
|
-
},
|
|
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));
|
|
252
255
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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")));
|
|
262
266
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
},
|
|
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");
|
|
274
277
|
},
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
showBoxBorder: true,
|
|
282
|
-
shouldUpdateBeOutsideState: function () { return false; },
|
|
283
|
-
render: function (itemProps, formInstance) {
|
|
284
|
-
return React.createElement(Checkbox, null, "\u662F");
|
|
285
|
-
},
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'test11',
|
|
281
|
+
label: '测试11',
|
|
282
|
+
render: function (itemProps, formInstance) {
|
|
283
|
+
return React.createElement(Input.TextArea, __assign({}, itemProps));
|
|
286
284
|
},
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
label: '测试11',
|
|
290
|
-
render: function (itemProps, formInstance) {
|
|
291
|
-
return React.createElement(Input.TextArea, __assign({}, itemProps));
|
|
292
|
-
},
|
|
293
|
-
}
|
|
294
|
-
], new Array(10).fill(1).map(function (item, index) {
|
|
295
|
-
return {
|
|
296
|
-
name: 'test6' + index,
|
|
297
|
-
label: '测试6' + index,
|
|
298
|
-
isRequired: true,
|
|
299
|
-
preText: React.createElement("span", null, "\u4F60\u597D\u00A0\u00A0\u00A0"),
|
|
300
|
-
shouldUpdateBeOutsideState: function () { return false; },
|
|
301
|
-
render: function (itemProps, formInstance) {
|
|
302
|
-
console.log('测试6' + index, state);
|
|
303
|
-
return (React.createElement(Select, __assign({}, itemProps, { allowClear: true }),
|
|
304
|
-
React.createElement(Select.Option, { value: "1" }, "\u4F60\u597D")));
|
|
305
|
-
},
|
|
306
|
-
};
|
|
307
|
-
}));
|
|
308
|
-
}, [state]);
|
|
309
|
-
var outsideState = useMemo(function () {
|
|
285
|
+
}
|
|
286
|
+
], new Array(10).fill(1).map(function (item, index) {
|
|
310
287
|
return {
|
|
311
|
-
|
|
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
|
+
},
|
|
312
297
|
};
|
|
313
|
-
}
|
|
298
|
+
}));
|
|
299
|
+
// }, [state]);
|
|
300
|
+
// const outsideState = useMemo(() => {
|
|
301
|
+
// return {
|
|
302
|
+
// state,
|
|
303
|
+
// };
|
|
304
|
+
// }, [state]);
|
|
314
305
|
var searchHandle = function () {
|
|
315
306
|
console.log('searchHandle', form.getFieldsValue());
|
|
316
307
|
};
|
|
317
308
|
var resetHandle = function () {
|
|
318
309
|
form.resetFields();
|
|
319
310
|
};
|
|
311
|
+
console.log('rerender');
|
|
320
312
|
return (React.createElement("div", null,
|
|
321
|
-
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 }),
|
|
322
316
|
React.createElement(Button, { onClick: function () {
|
|
323
317
|
setState(state + 1);
|
|
324
318
|
console.log(form.getFieldsValue());
|
|
@@ -15,15 +15,15 @@ export interface IFormItem extends FormItemProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* 是否必填
|
|
17
17
|
*/
|
|
18
|
-
isRequired?: boolean;
|
|
18
|
+
isRequired?: boolean | ((formInstance: FormInstance<any>) => boolean);
|
|
19
19
|
/**
|
|
20
20
|
* 是否可以修改
|
|
21
21
|
*/
|
|
22
|
-
isChangeable?: boolean;
|
|
22
|
+
isChangeable?: boolean | ((formInstance: FormInstance<any>) => boolean);
|
|
23
23
|
/**
|
|
24
24
|
* 是否展示
|
|
25
25
|
*/
|
|
26
|
-
isDisplay?: boolean;
|
|
26
|
+
isDisplay?: boolean | ((formInstance: FormInstance<any>) => boolean);
|
|
27
27
|
/**
|
|
28
28
|
* 前缀
|
|
29
29
|
*/
|
|
@@ -23,13 +23,40 @@ 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
|
}
|
|
30
29
|
function Item(item) {
|
|
31
30
|
var _a, _b, _c;
|
|
32
31
|
var render = item.render, isRequired = item.isRequired, isDisplay = item.isDisplay, isChangeable = item.isChangeable, dependencies = item.dependencies, shouldUpdate = item.shouldUpdate, preText = item.preText, nextText = item.nextText, disabled = item.disabled, noBorder = item.noBorder, noLabel = item.noLabel, showBoxBorder = item.showBoxBorder, width = item.width, shouldUpdateNames = item.shouldUpdateNames, shouldUpdateClear = item.shouldUpdateClear, configName = item.configName, index = item.index, itemClassName = item.itemClassName, form = item.form, _isDisplayConfigInfo = item._isDisplayConfigInfo, _isRequireConfigInfo = item._isRequireConfigInfo, _isChangeableConfigInfo = item._isChangeableConfigInfo, outsideState = item.outsideState, shouldUpdateBeOutsideState = item.shouldUpdateBeOutsideState, resetItem = __rest(item, ["render", "isRequired", "isDisplay", "isChangeable", "dependencies", "shouldUpdate", "preText", "nextText", "disabled", "noBorder", "noLabel", "showBoxBorder", "width", "shouldUpdateNames", "shouldUpdateClear", "configName", "index", "itemClassName", "form", "_isDisplayConfigInfo", "_isRequireConfigInfo", "_isChangeableConfigInfo", "outsideState", "shouldUpdateBeOutsideState"]);
|
|
32
|
+
// 更新是否必填配置
|
|
33
|
+
var updateIsRequired = function (isRequired) {
|
|
34
|
+
var _a;
|
|
35
|
+
var isRequireBoolean = !!isRequired;
|
|
36
|
+
var rules = Array.isArray(resetItem.rules) ? resetItem.rules : [];
|
|
37
|
+
// 是否之前就传入了必填非必填逻辑
|
|
38
|
+
var requiredIndex = rules.findIndex(function (rule) {
|
|
39
|
+
if (typeof rule === 'function') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return (rule === null || rule === void 0 ? void 0 : rule.required) === true || (rule === null || rule === void 0 ? void 0 : rule.required) === false;
|
|
43
|
+
});
|
|
44
|
+
// 如果找到了 直接替换之前的规则
|
|
45
|
+
if (requiredIndex !== -1) {
|
|
46
|
+
var message = (_a = rules[requiredIndex]) === null || _a === void 0 ? void 0 : _a.message;
|
|
47
|
+
rules.splice(requiredIndex, 1, {
|
|
48
|
+
required: isRequireBoolean,
|
|
49
|
+
message: message,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
rules.unshift({
|
|
54
|
+
required: isRequireBoolean,
|
|
55
|
+
message: resetItem.label + " \u672A\u586B!",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
resetItem.rules = rules;
|
|
59
|
+
};
|
|
33
60
|
// 处理配置相关逻辑 配置优先代码设置
|
|
34
61
|
// 传入了是否展示配置
|
|
35
62
|
var _isDisplay = typeof _isDisplayConfigInfo === 'undefined'
|
|
@@ -125,6 +152,20 @@ function Item(item) {
|
|
|
125
152
|
return (React.createElement(ItemWrap, { key: key, width: width },
|
|
126
153
|
preText ? preText : null,
|
|
127
154
|
React.createElement(Form.Item, { shouldUpdate: shouldUpdateHandle, noStyle: true }, function (formInstance) {
|
|
155
|
+
if (typeof isDisplay === 'function') {
|
|
156
|
+
var isD = isDisplay(form);
|
|
157
|
+
if (!isD) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (typeof isRequired === 'function') {
|
|
162
|
+
var isR = isRequired(form);
|
|
163
|
+
updateIsRequired(isR);
|
|
164
|
+
}
|
|
165
|
+
if (typeof isChangeable === 'function') {
|
|
166
|
+
var isC = isChangeable(form);
|
|
167
|
+
itemProps.disabled = !isC;
|
|
168
|
+
}
|
|
128
169
|
return item.name ? (React.createElement(Form.Item, __assign({}, resetItem, { className: itemClasses }), render(itemProps, formInstance))) : (render(itemProps, formInstance));
|
|
129
170
|
}),
|
|
130
171
|
nextText ? nextText : null));
|
|
@@ -155,21 +196,26 @@ function ItemWrap(props) {
|
|
|
155
196
|
width: getWidthStr(width),
|
|
156
197
|
} }, children));
|
|
157
198
|
}
|
|
158
|
-
|
|
159
|
-
export default memo(Item,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
+
// });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ztxkui",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React components library",
|
|
6
6
|
"author": "zt-front-end",
|
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
"source-map-explorer": "^2.5.2",
|
|
95
95
|
"typescript": "^4.1.2",
|
|
96
96
|
"web-vitals": "^1.0.1",
|
|
97
|
-
"ztxkutils": "^
|
|
97
|
+
"ztxkutils": "^2.10.66-32",
|
|
98
|
+
"ztxkui": "6.0.2"
|
|
98
99
|
},
|
|
99
100
|
"peerDependencies": {
|
|
100
101
|
"axios": ">=0.21.1",
|
|
@@ -104,4 +105,4 @@
|
|
|
104
105
|
"react-dom": ">=16.9.0",
|
|
105
106
|
"ztxkutils": ">=4.0.1"
|
|
106
107
|
}
|
|
107
|
-
}
|
|
108
|
+
}
|