szld-libs 0.2.70 → 0.2.72
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/szld-components.es.js +13051 -12759
- package/dist/szld-components.umd.js +54 -54
- package/es/components/DynamicForm/index.d.ts +7 -0
- package/es/components/DynamicForm/index.js +52 -7
- package/es/components/DynamicForm/useDynamicForm.d.ts +8 -2
- package/es/components/DynamicForm/useDynamicForm.js +263 -56
- package/es/utils/method.d.ts +21 -1
- package/es/utils/method.js +180 -80
- package/lib/components/DynamicForm/index.d.ts +7 -0
- package/lib/components/DynamicForm/index.js +49 -4
- package/lib/components/DynamicForm/useDynamicForm.d.ts +8 -2
- package/lib/components/DynamicForm/useDynamicForm.js +260 -53
- package/lib/utils/method.d.ts +21 -1
- package/lib/utils/method.js +180 -80
- package/package.json +1 -1
|
@@ -29,7 +29,9 @@ function useDynamicForm(props) {
|
|
|
29
29
|
relatedidKey,
|
|
30
30
|
actionUrlKey,
|
|
31
31
|
actionUrlExtraParams,
|
|
32
|
-
CustomModalComponent
|
|
32
|
+
CustomModalComponent,
|
|
33
|
+
setAttrList,
|
|
34
|
+
hideAttrList = []
|
|
33
35
|
} = props;
|
|
34
36
|
const formConfigRef = react.useRef([]);
|
|
35
37
|
const { message } = antd.App.useApp();
|
|
@@ -119,17 +121,30 @@ function useDynamicForm(props) {
|
|
|
119
121
|
value: value ? dayjs(value, format || "HH:mm:ss") : null
|
|
120
122
|
});
|
|
121
123
|
break;
|
|
124
|
+
case "range-picker":
|
|
125
|
+
baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.map((d) => d == null ? void 0 : d.format(format || "YYYY-MM-DD"));
|
|
126
|
+
baseProps.getValueProps = (value) => ({
|
|
127
|
+
value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
|
|
128
|
+
});
|
|
129
|
+
break;
|
|
130
|
+
case "multiple-date-picker":
|
|
131
|
+
baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.map((d) => d == null ? void 0 : d.format(format || "YYYY-MM-DD"));
|
|
132
|
+
baseProps.getValueProps = (value) => ({
|
|
133
|
+
value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
|
|
134
|
+
});
|
|
135
|
+
break;
|
|
122
136
|
}
|
|
123
137
|
return baseProps;
|
|
124
138
|
},
|
|
125
139
|
[handleNormFile]
|
|
126
140
|
);
|
|
127
141
|
const handleSetFormItemInitialValue = react.useCallback((itemWithJson) => {
|
|
128
|
-
var _a, _b, _c, _d;
|
|
142
|
+
var _a, _b, _c, _d, _e;
|
|
129
143
|
const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
|
|
130
|
-
|
|
144
|
+
const isFormList = (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b["properties-multiple"];
|
|
145
|
+
let initialValue = itemWithJson.attrvalue ?? ((_c = itemWithJson.json) == null ? void 0 : _c.default);
|
|
131
146
|
if (inputType === "label" && initialValue) {
|
|
132
|
-
initialValue = ((
|
|
147
|
+
initialValue = ((_d = itemWithJson.json) == null ? void 0 : _d["label-value"]) ?? initialValue ?? "-";
|
|
133
148
|
}
|
|
134
149
|
if ((inputType === "date-picker" || inputType === "time-picker") && initialValue) {
|
|
135
150
|
try {
|
|
@@ -139,8 +154,24 @@ function useDynamicForm(props) {
|
|
|
139
154
|
initialValue = void 0;
|
|
140
155
|
}
|
|
141
156
|
}
|
|
157
|
+
if (inputType === "range-picker" && initialValue) {
|
|
158
|
+
try {
|
|
159
|
+
initialValue = initialValue == null ? void 0 : initialValue.split("~");
|
|
160
|
+
initialValue = initialValue.map((v) => dayjs(v));
|
|
161
|
+
} catch (error) {
|
|
162
|
+
initialValue = void 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (inputType === "multiple-date-picker" && initialValue) {
|
|
166
|
+
try {
|
|
167
|
+
initialValue = initialValue == null ? void 0 : initialValue.split(",");
|
|
168
|
+
initialValue = initialValue.map((v) => dayjs(v));
|
|
169
|
+
} catch (error) {
|
|
170
|
+
initialValue = void 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
142
173
|
if (inputType === "cascader" && initialValue && typeof initialValue === "string") {
|
|
143
|
-
const delimiter = (
|
|
174
|
+
const delimiter = (_e = itemWithJson.json) == null ? void 0 : _e["cascader-delimiter"];
|
|
144
175
|
if (delimiter) {
|
|
145
176
|
initialValue = initialValue.split(delimiter).filter(Boolean);
|
|
146
177
|
}
|
|
@@ -161,6 +192,19 @@ function useDynamicForm(props) {
|
|
|
161
192
|
initialValue = [];
|
|
162
193
|
}
|
|
163
194
|
}
|
|
195
|
+
if (isFormList && itemWithJson.attrtype === 1) {
|
|
196
|
+
const children = itemWithJson.children || [];
|
|
197
|
+
if (Array.isArray(children)) {
|
|
198
|
+
initialValue = [
|
|
199
|
+
Object.assign(
|
|
200
|
+
{},
|
|
201
|
+
...children == null ? void 0 : children.map((child) => ({
|
|
202
|
+
[child.attrid]: handleSetFormItemInitialValue(child)
|
|
203
|
+
}))
|
|
204
|
+
)
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
164
208
|
return initialValue || null;
|
|
165
209
|
}, []);
|
|
166
210
|
const handleCollapseIcon = react.useCallback(
|
|
@@ -193,10 +237,18 @@ function useDynamicForm(props) {
|
|
|
193
237
|
formItemStyle,
|
|
194
238
|
relatedid,
|
|
195
239
|
form,
|
|
196
|
-
defaultWidth = 358
|
|
240
|
+
defaultWidth = 358,
|
|
241
|
+
isFormListItem = false,
|
|
242
|
+
formListField,
|
|
243
|
+
isShowLabel = true
|
|
197
244
|
}) => {
|
|
198
|
-
var _a, _b;
|
|
199
|
-
|
|
245
|
+
var _a, _b, _c, _d, _e;
|
|
246
|
+
const isFormList = (_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a["properties-multiple"];
|
|
247
|
+
let formListInitValue = [];
|
|
248
|
+
if (isFormList) {
|
|
249
|
+
formListInitValue = handleSetFormItemInitialValue(itemWithJson);
|
|
250
|
+
}
|
|
251
|
+
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
|
|
200
252
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
201
253
|
}
|
|
202
254
|
if (itemWithJson.attrtype === 1) {
|
|
@@ -207,23 +259,25 @@ function useDynamicForm(props) {
|
|
|
207
259
|
style: { backgroundColor: "transparent" },
|
|
208
260
|
expandIcon: ({ isActive }) => handleCollapseIcon({ isActive }),
|
|
209
261
|
onChange: async (key) => {
|
|
210
|
-
var _a2;
|
|
262
|
+
var _a2, _b2;
|
|
211
263
|
try {
|
|
212
264
|
const { children = [] } = itemWithJson;
|
|
213
|
-
if (key && (key == null ? void 0 : key.length) &&
|
|
265
|
+
if (key && (key == null ? void 0 : key.length) && formConfigRef.current && interfaceTypeChildren && !(children == null ? void 0 : children.length)) {
|
|
214
266
|
const res = await commonRequest(interfaceTypeChildren, {
|
|
215
267
|
instanceid: relatedid,
|
|
216
|
-
asid: itemWithJson.
|
|
217
|
-
tname: itemWithJson.
|
|
268
|
+
asid: (_a2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a2.propertiesID,
|
|
269
|
+
tname: itemWithJson.attrvalue
|
|
218
270
|
});
|
|
219
271
|
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
220
|
-
const
|
|
272
|
+
const list = ((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list) || [];
|
|
273
|
+
const arr = method.handleAttrList(list, { instanceid: relatedid, tname: itemWithJson.tname });
|
|
221
274
|
const _formConfig = _.cloneDeep(formConfigRef.current);
|
|
222
275
|
const _item = _formConfig.find((item) => item.attrid === itemWithJson.attrid);
|
|
223
276
|
if (_item) {
|
|
224
277
|
_item.children = [...arr];
|
|
225
278
|
}
|
|
226
|
-
setFormConfig(_formConfig);
|
|
279
|
+
setFormConfig == null ? void 0 : setFormConfig(_formConfig);
|
|
280
|
+
setAttrList == null ? void 0 : setAttrList(_formConfig);
|
|
227
281
|
}
|
|
228
282
|
}
|
|
229
283
|
} catch (error) {
|
|
@@ -233,7 +287,52 @@ function useDynamicForm(props) {
|
|
|
233
287
|
{
|
|
234
288
|
key: itemWithJson.attrid,
|
|
235
289
|
label: itemWithJson.attrname,
|
|
236
|
-
|
|
290
|
+
styles: {
|
|
291
|
+
header: {
|
|
292
|
+
paddingLeft: 0
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
children: isFormList ? /* @__PURE__ */ jsxRuntime.jsx(antd.Form.List, { name: itemWithJson.attrid, initialValue: formListInitValue, children: (fields, { add, remove }) => {
|
|
296
|
+
var _a2;
|
|
297
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", rowGap: 16, flexDirection: "column" }, children: [
|
|
298
|
+
fields.map((field) => {
|
|
299
|
+
var _a3;
|
|
300
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
301
|
+
antd.Card,
|
|
302
|
+
{
|
|
303
|
+
style: { width: ((_a3 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a3["properties-width"]) || defaultWidth + 100 },
|
|
304
|
+
size: "small",
|
|
305
|
+
title: `${itemWithJson.attrname} ${field.name + 1}`,
|
|
306
|
+
extra: /* @__PURE__ */ jsxRuntime.jsx(
|
|
307
|
+
icons.CloseOutlined,
|
|
308
|
+
{
|
|
309
|
+
onClick: () => {
|
|
310
|
+
remove(field.name);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
),
|
|
314
|
+
children: (itemWithJson.children || []).map((child, index) => {
|
|
315
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
|
|
316
|
+
item: child,
|
|
317
|
+
readonly,
|
|
318
|
+
colNum,
|
|
319
|
+
instructionShowMode,
|
|
320
|
+
relatedid,
|
|
321
|
+
form,
|
|
322
|
+
defaultWidth,
|
|
323
|
+
formItemStyle,
|
|
324
|
+
isFormListItem: true,
|
|
325
|
+
formListField: field,
|
|
326
|
+
isShowLabel: true
|
|
327
|
+
}) }, child.attrid || `child-${index}`);
|
|
328
|
+
})
|
|
329
|
+
},
|
|
330
|
+
field.key
|
|
331
|
+
);
|
|
332
|
+
}),
|
|
333
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { style: { width: ((_a2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a2["properties-width"]) || defaultWidth + 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
|
|
334
|
+
] });
|
|
335
|
+
} }) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: (itemWithJson.children || []).map((child, index) => {
|
|
237
336
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
|
|
238
337
|
item: child,
|
|
239
338
|
readonly,
|
|
@@ -265,6 +364,8 @@ function useDynamicForm(props) {
|
|
|
265
364
|
"mult-select",
|
|
266
365
|
"modal-select",
|
|
267
366
|
"date-picker",
|
|
367
|
+
"range-picker",
|
|
368
|
+
"multiple-date-picker",
|
|
268
369
|
"time-picker",
|
|
269
370
|
"week-picker",
|
|
270
371
|
"month-picker",
|
|
@@ -277,14 +378,92 @@ function useDynamicForm(props) {
|
|
|
277
378
|
if (["image", "file", "video", "audio"].includes(input)) {
|
|
278
379
|
placeholder = "请上传";
|
|
279
380
|
}
|
|
381
|
+
const { combinations = [] } = itemWithJson.json || {};
|
|
382
|
+
if (combinations == null ? void 0 : combinations.length) {
|
|
383
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { label: (_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["combination-name"], children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { children: combinations.map((item, index) => {
|
|
384
|
+
var _a2, _b2;
|
|
385
|
+
let initValue = handleSetFormItemInitialValue(item);
|
|
386
|
+
let width = defaultWidth;
|
|
387
|
+
const customWidth = {};
|
|
388
|
+
const mode = item.json.input || "text";
|
|
389
|
+
const itemStyle = formItemStyle == null ? void 0 : formItemStyle.find((v) => v.type === mode);
|
|
390
|
+
if (itemStyle) {
|
|
391
|
+
const { width: width2 } = (itemStyle == null ? void 0 : itemStyle.style) || {};
|
|
392
|
+
if (width2) {
|
|
393
|
+
customWidth["width"] = width2;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const widthRatio = (_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["combination-width-ratio"];
|
|
397
|
+
if (widthRatio) {
|
|
398
|
+
width = defaultWidth * widthRatio;
|
|
399
|
+
}
|
|
400
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
401
|
+
antd.Form.Item,
|
|
402
|
+
{
|
|
403
|
+
name: item.attrid,
|
|
404
|
+
noStyle: true,
|
|
405
|
+
initialValue: initValue,
|
|
406
|
+
rules: [
|
|
407
|
+
...((_b2 = item.json) == null ? void 0 : _b2.must) ? [
|
|
408
|
+
{
|
|
409
|
+
required: true,
|
|
410
|
+
message: `${placeholder}${item.attrname}`
|
|
411
|
+
}
|
|
412
|
+
] : []
|
|
413
|
+
],
|
|
414
|
+
...handleSetFormItemProps(item),
|
|
415
|
+
children: handleRenderItemInputMode({
|
|
416
|
+
item,
|
|
417
|
+
readonly,
|
|
418
|
+
formItemStyle,
|
|
419
|
+
radioAlign,
|
|
420
|
+
relatedid,
|
|
421
|
+
form,
|
|
422
|
+
defaultWidth: width,
|
|
423
|
+
customWidth
|
|
424
|
+
})
|
|
425
|
+
},
|
|
426
|
+
index
|
|
427
|
+
);
|
|
428
|
+
}) }) }, `${itemWithJson.attrid}+1`) });
|
|
429
|
+
}
|
|
430
|
+
if (isFormListItem && formListField) {
|
|
431
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
432
|
+
antd.Form.Item,
|
|
433
|
+
{
|
|
434
|
+
name: [formListField == null ? void 0 : formListField.name, itemWithJson.attrid],
|
|
435
|
+
label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
|
|
436
|
+
initialValue,
|
|
437
|
+
rules: [
|
|
438
|
+
...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
|
|
439
|
+
{
|
|
440
|
+
required: true,
|
|
441
|
+
message: `${placeholder}${itemWithJson.attrname}`
|
|
442
|
+
}
|
|
443
|
+
] : []
|
|
444
|
+
],
|
|
445
|
+
...handleSetFormItemProps(itemWithJson),
|
|
446
|
+
children: handleRenderItemInputMode({
|
|
447
|
+
item: itemWithJson,
|
|
448
|
+
readonly,
|
|
449
|
+
formItemStyle,
|
|
450
|
+
radioAlign,
|
|
451
|
+
relatedid,
|
|
452
|
+
form,
|
|
453
|
+
defaultWidth
|
|
454
|
+
})
|
|
455
|
+
},
|
|
456
|
+
itemWithJson.attrid
|
|
457
|
+
) });
|
|
458
|
+
}
|
|
280
459
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
281
460
|
antd.Form.Item,
|
|
282
461
|
{
|
|
283
462
|
name: itemWithJson.attrid,
|
|
284
|
-
label: handleDealInstruction(itemWithJson, instructionShowMode),
|
|
463
|
+
label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
|
|
285
464
|
initialValue,
|
|
286
465
|
rules: [
|
|
287
|
-
...((
|
|
466
|
+
...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
|
|
288
467
|
{
|
|
289
468
|
required: true,
|
|
290
469
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
@@ -340,7 +519,8 @@ function useDynamicForm(props) {
|
|
|
340
519
|
radioAlign = "horizontal",
|
|
341
520
|
relatedid,
|
|
342
521
|
form,
|
|
343
|
-
defaultWidth = 358
|
|
522
|
+
defaultWidth = 358,
|
|
523
|
+
customWidth = {}
|
|
344
524
|
}) => {
|
|
345
525
|
var _a, _b;
|
|
346
526
|
const mode = item.json.input || "text";
|
|
@@ -356,7 +536,7 @@ function useDynamicForm(props) {
|
|
|
356
536
|
{
|
|
357
537
|
disabled: true,
|
|
358
538
|
value: ((_a = item.json) == null ? void 0 : _a["label-value"]) || item.attrvalue || ((_b = item.json) == null ? void 0 : _b.default) || "-",
|
|
359
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
|
|
539
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
360
540
|
}
|
|
361
541
|
);
|
|
362
542
|
case "text":
|
|
@@ -367,7 +547,7 @@ function useDynamicForm(props) {
|
|
|
367
547
|
...params,
|
|
368
548
|
disabled: readonly,
|
|
369
549
|
allowClear: true,
|
|
370
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
|
|
550
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
371
551
|
}
|
|
372
552
|
);
|
|
373
553
|
case "textarea":
|
|
@@ -379,7 +559,7 @@ function useDynamicForm(props) {
|
|
|
379
559
|
rows: 5,
|
|
380
560
|
...params,
|
|
381
561
|
disabled: readonly,
|
|
382
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
|
|
562
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
383
563
|
}
|
|
384
564
|
);
|
|
385
565
|
case "number":
|
|
@@ -390,7 +570,7 @@ function useDynamicForm(props) {
|
|
|
390
570
|
placeholder: "请输入",
|
|
391
571
|
...params,
|
|
392
572
|
disabled: readonly,
|
|
393
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
|
|
573
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
394
574
|
}
|
|
395
575
|
);
|
|
396
576
|
case "select":
|
|
@@ -401,7 +581,7 @@ function useDynamicForm(props) {
|
|
|
401
581
|
handleUrlOptions,
|
|
402
582
|
item: item.json,
|
|
403
583
|
readonly,
|
|
404
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
|
|
584
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
|
|
405
585
|
commonRequestWidthParams,
|
|
406
586
|
commonRequest,
|
|
407
587
|
value: formatValue,
|
|
@@ -420,7 +600,7 @@ function useDynamicForm(props) {
|
|
|
420
600
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
421
601
|
SelectModel,
|
|
422
602
|
{
|
|
423
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
|
|
603
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
|
|
424
604
|
item: item.json,
|
|
425
605
|
value: item.attrvalue || item.json.default || "",
|
|
426
606
|
commonRequestWidthParams,
|
|
@@ -456,10 +636,27 @@ function useDynamicForm(props) {
|
|
|
456
636
|
picker: pickerObj[mode] || "date",
|
|
457
637
|
disabled: readonly,
|
|
458
638
|
placement: "bottomLeft",
|
|
459
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
|
|
639
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
460
640
|
}
|
|
461
641
|
);
|
|
462
642
|
}
|
|
643
|
+
case "range-picker":
|
|
644
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
645
|
+
antd.DatePicker.RangePicker,
|
|
646
|
+
{
|
|
647
|
+
disabled: readonly,
|
|
648
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
case "multiple-date-picker":
|
|
652
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
653
|
+
antd.DatePicker,
|
|
654
|
+
{
|
|
655
|
+
multiple: true,
|
|
656
|
+
disabled: readonly,
|
|
657
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
658
|
+
}
|
|
659
|
+
);
|
|
463
660
|
case "radio":
|
|
464
661
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
662
|
MyRadio,
|
|
@@ -527,7 +724,7 @@ function useDynamicForm(props) {
|
|
|
527
724
|
commonRequest,
|
|
528
725
|
item: item.json,
|
|
529
726
|
value: item.attrvalue,
|
|
530
|
-
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
|
|
727
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
|
|
531
728
|
interfaceTypeDict,
|
|
532
729
|
interfaceTypeSysDict,
|
|
533
730
|
actionUrlKey,
|
|
@@ -547,7 +744,16 @@ function useDynamicForm(props) {
|
|
|
547
744
|
}
|
|
548
745
|
);
|
|
549
746
|
default:
|
|
550
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
+
antd.Input,
|
|
749
|
+
{
|
|
750
|
+
placeholder: "请输入",
|
|
751
|
+
...params,
|
|
752
|
+
showCount: true,
|
|
753
|
+
disabled: readonly,
|
|
754
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
755
|
+
}
|
|
756
|
+
);
|
|
551
757
|
}
|
|
552
758
|
};
|
|
553
759
|
const handleRenderItem = ({
|
|
@@ -559,40 +765,41 @@ function useDynamicForm(props) {
|
|
|
559
765
|
form,
|
|
560
766
|
defaultWidth = 358,
|
|
561
767
|
formItemStyle,
|
|
562
|
-
radioAlign = "horizontal"
|
|
768
|
+
radioAlign = "horizontal",
|
|
769
|
+
isFormListItem = false,
|
|
770
|
+
formListField,
|
|
771
|
+
isShowLabel = true
|
|
563
772
|
}) => {
|
|
564
773
|
var _a;
|
|
565
774
|
const json = item.info_base64 === 1 ? method.getJson(method.base64ToString(item.info)) : method.getJson(item.info);
|
|
566
|
-
const itemWithJson = {
|
|
775
|
+
const itemWithJson = {
|
|
776
|
+
...item,
|
|
777
|
+
json: {
|
|
778
|
+
...item == null ? void 0 : item.json,
|
|
779
|
+
...json
|
|
780
|
+
}
|
|
781
|
+
};
|
|
567
782
|
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true) {
|
|
568
783
|
return null;
|
|
569
784
|
}
|
|
570
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
{
|
|
585
|
-
name: itemWithJson.attrid + "_objs",
|
|
586
|
-
style: { display: "none" },
|
|
587
|
-
initialValue: itemWithJson,
|
|
588
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { type: "hidden" })
|
|
589
|
-
},
|
|
590
|
-
itemWithJson.attrid + "_objs"
|
|
591
|
-
)
|
|
592
|
-
] }, itemWithJson.attrid);
|
|
785
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderFunc({
|
|
786
|
+
itemWithJson,
|
|
787
|
+
readonly,
|
|
788
|
+
colNum,
|
|
789
|
+
instructionShowMode,
|
|
790
|
+
relatedid,
|
|
791
|
+
form,
|
|
792
|
+
defaultWidth,
|
|
793
|
+
formItemStyle,
|
|
794
|
+
radioAlign,
|
|
795
|
+
isFormListItem,
|
|
796
|
+
formListField,
|
|
797
|
+
isShowLabel
|
|
798
|
+
}) }, itemWithJson.attrid);
|
|
593
799
|
};
|
|
594
800
|
return {
|
|
595
|
-
handleRenderItem
|
|
801
|
+
handleRenderItem,
|
|
802
|
+
handleSetFormItemInitialValue
|
|
596
803
|
};
|
|
597
804
|
}
|
|
598
805
|
module.exports = useDynamicForm;
|
package/lib/utils/method.d.ts
CHANGED
|
@@ -11,7 +11,21 @@ export declare const handleSubmitForm: (originalData: any, allValues: any) => {
|
|
|
11
11
|
updatedData: any;
|
|
12
12
|
uploadedFiles: any[];
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* 处理基础属性数组
|
|
16
|
+
*/
|
|
17
|
+
export declare const handleBaseAttrList: (attrList: any[], extraAttrs?: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
} | undefined) => any[];
|
|
20
|
+
/**
|
|
21
|
+
* 处理属性列表,合并组合属性
|
|
22
|
+
* @param attrList 属性列表
|
|
23
|
+
* @param extraAttrs 额外属性
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
export declare const handleAttrList: (attrList: any[], extraAttrs?: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
} | undefined) => any[];
|
|
15
29
|
export declare const handleFormConfig: ({ number, key, sourceNumber, guidInterfaceName, SelPCParamInterfaceName, servicerAttrListInterfaceName, accepterAttrListInterfaceName, defaultAttrListInterfaceName, commonRequest, guidParams, pcParam, attrReqKey, attrListExtraParams, }: {
|
|
16
30
|
number: string | number;
|
|
17
31
|
key: string;
|
|
@@ -46,3 +60,9 @@ export declare const handleFormConfig: ({ number, key, sourceNumber, guidInterfa
|
|
|
46
60
|
* @returns
|
|
47
61
|
*/
|
|
48
62
|
export declare const handleOperationFile: (params: any, data: any, commonRequestWidthParams: any) => Promise<any>;
|
|
63
|
+
/**
|
|
64
|
+
* 命名转换为驼峰命名
|
|
65
|
+
* @param str 烤肉串命名
|
|
66
|
+
* @returns 驼峰命名
|
|
67
|
+
*/
|
|
68
|
+
export declare function handleKebabToCamel(str: string): string;
|