szld-libs 0.2.52 → 0.2.54

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.
Files changed (66) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +17007 -15272
  3. package/dist/szld-components.umd.js +55 -55
  4. package/es/components/DynamicForm/index.d.ts +102 -0
  5. package/es/components/DynamicForm/index.js +55 -0
  6. package/es/components/DynamicForm/myCascader/index.d.ts +13 -0
  7. package/es/components/DynamicForm/myCascader/index.js +186 -0
  8. package/es/components/DynamicForm/myCascader/vite.svg +1 -0
  9. package/es/components/DynamicForm/myCheckbox/index.d.ts +15 -0
  10. package/es/components/DynamicForm/myCheckbox/index.js +102 -0
  11. package/es/components/DynamicForm/myCheckbox/vite.svg +1 -0
  12. package/es/components/DynamicForm/myRadio/index.d.ts +16 -0
  13. package/es/components/DynamicForm/myRadio/index.js +100 -0
  14. package/es/components/DynamicForm/myRadio/vite.svg +1 -0
  15. package/es/components/DynamicForm/mySelect/index.d.ts +13 -0
  16. package/es/components/DynamicForm/mySelect/index.js +126 -0
  17. package/es/components/DynamicForm/mySelect/vite.svg +1 -0
  18. package/es/components/DynamicForm/myUpload/index.css +3 -0
  19. package/es/components/DynamicForm/myUpload/index.d.ts +15 -0
  20. package/es/components/DynamicForm/myUpload/index.js +102 -0
  21. package/es/components/DynamicForm/myUpload/vite.svg +1 -0
  22. package/es/components/DynamicForm/radioCard/index.d.ts +12 -0
  23. package/es/components/DynamicForm/radioCard/index.js +142 -0
  24. package/es/components/DynamicForm/radioCard/vite.svg +1 -0
  25. package/es/components/DynamicForm/selectModel/index.d.ts +21 -0
  26. package/es/components/DynamicForm/selectModel/index.js +197 -0
  27. package/es/components/DynamicForm/selectModel/vite.svg +1 -0
  28. package/es/components/DynamicForm/useDynamicForm.d.ts +26 -0
  29. package/es/components/DynamicForm/useDynamicForm.js +554 -0
  30. package/es/components/DynamicForm/vite.svg +1 -0
  31. package/es/main.d.ts +3 -1
  32. package/es/main.js +22 -18
  33. package/es/utils/method.d.ts +21 -0
  34. package/es/utils/method.js +186 -0
  35. package/lib/components/DynamicForm/index.d.ts +102 -0
  36. package/lib/components/DynamicForm/index.js +54 -0
  37. package/lib/components/DynamicForm/myCascader/index.d.ts +13 -0
  38. package/lib/components/DynamicForm/myCascader/index.js +185 -0
  39. package/lib/components/DynamicForm/myCascader/vite.svg +1 -0
  40. package/lib/components/DynamicForm/myCheckbox/index.d.ts +15 -0
  41. package/lib/components/DynamicForm/myCheckbox/index.js +101 -0
  42. package/lib/components/DynamicForm/myCheckbox/vite.svg +1 -0
  43. package/lib/components/DynamicForm/myRadio/index.d.ts +16 -0
  44. package/lib/components/DynamicForm/myRadio/index.js +99 -0
  45. package/lib/components/DynamicForm/myRadio/vite.svg +1 -0
  46. package/lib/components/DynamicForm/mySelect/index.d.ts +13 -0
  47. package/lib/components/DynamicForm/mySelect/index.js +125 -0
  48. package/lib/components/DynamicForm/mySelect/vite.svg +1 -0
  49. package/lib/components/DynamicForm/myUpload/index.css +3 -0
  50. package/lib/components/DynamicForm/myUpload/index.d.ts +15 -0
  51. package/lib/components/DynamicForm/myUpload/index.js +101 -0
  52. package/lib/components/DynamicForm/myUpload/vite.svg +1 -0
  53. package/lib/components/DynamicForm/radioCard/index.d.ts +12 -0
  54. package/lib/components/DynamicForm/radioCard/index.js +141 -0
  55. package/lib/components/DynamicForm/radioCard/vite.svg +1 -0
  56. package/lib/components/DynamicForm/selectModel/index.d.ts +21 -0
  57. package/lib/components/DynamicForm/selectModel/index.js +197 -0
  58. package/lib/components/DynamicForm/selectModel/vite.svg +1 -0
  59. package/lib/components/DynamicForm/useDynamicForm.d.ts +26 -0
  60. package/lib/components/DynamicForm/useDynamicForm.js +553 -0
  61. package/lib/components/DynamicForm/vite.svg +1 -0
  62. package/lib/main.d.ts +3 -1
  63. package/lib/main.js +5 -0
  64. package/lib/utils/method.d.ts +21 -0
  65. package/lib/utils/method.js +186 -0
  66. package/package.json +3 -1
@@ -0,0 +1,554 @@
1
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
+ import { MinusSquareOutlined, PlusSquareOutlined, InfoCircleOutlined } from "@ant-design/icons";
3
+ import { useRef, useEffect, useCallback, Fragment as Fragment$1 } from "react";
4
+ import { getJson, base64ToString } from "../../utils/method";
5
+ import isoWeek from "dayjs/plugin/isoWeek";
6
+ import SelectModel from "./selectModel";
7
+ import MyCheckbox from "./myCheckbox";
8
+ import MyCascader from "./myCascader";
9
+ import dayjs from "dayjs";
10
+ import RadioCard from "./radioCard";
11
+ import MySelect from "./mySelect";
12
+ import MyUpload from "./myUpload";
13
+ import MyRadio from "./myRadio";
14
+ import _ from "lodash";
15
+ import { App, Col, Collapse, Form, Input, DatePicker, InputNumber, Flex, Tooltip } from "antd";
16
+ dayjs.extend(isoWeek);
17
+ function useDynamicForm(props) {
18
+ const {
19
+ commonRequestWidthParams,
20
+ uploadAction,
21
+ commonRequest,
22
+ formConfig,
23
+ setFormConfig,
24
+ interfaceTypeChildren,
25
+ updateDelFileList
26
+ } = props;
27
+ const formConfigRef = useRef([]);
28
+ const { message } = App.useApp();
29
+ useEffect(() => {
30
+ if (!formConfig) {
31
+ return;
32
+ }
33
+ formConfigRef.current = formConfig;
34
+ }, [formConfig]);
35
+ const handleUrlOptions = (val, delimiter, list) => {
36
+ let arr = [];
37
+ list.forEach((item) => {
38
+ arr.push(val == null ? void 0 : val[item]);
39
+ });
40
+ return arr.join(delimiter || "-");
41
+ };
42
+ const handleNormFile = useCallback((e) => {
43
+ if (Array.isArray(e)) {
44
+ return e;
45
+ }
46
+ return (e == null ? void 0 : e.fileList) ?? [];
47
+ }, []);
48
+ const handleDealFile = (file) => {
49
+ updateDelFileList(file);
50
+ };
51
+ const handleSetFormItemProps = useCallback(
52
+ (itemWithJson) => {
53
+ var _a, _b;
54
+ const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
55
+ const format = (_b = itemWithJson.json) == null ? void 0 : _b.format;
56
+ const baseProps = {};
57
+ switch (inputType) {
58
+ case "image":
59
+ case "file":
60
+ case "video":
61
+ case "audio":
62
+ baseProps.getValueFromEvent = handleNormFile;
63
+ break;
64
+ case "date-picker":
65
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "YYYY-MM-DD");
66
+ baseProps.getValueProps = (value) => ({
67
+ value: value ? dayjs(value) : null
68
+ });
69
+ break;
70
+ case "time-picker":
71
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "YYYY-MM-DD HH:mm:ss");
72
+ baseProps.getValueProps = (value) => ({
73
+ value: value ? dayjs(value) : null
74
+ });
75
+ break;
76
+ case "week-picker":
77
+ baseProps.getValueFromEvent = (date) => {
78
+ return `${date == null ? void 0 : date.year()}-${dayjs(date).isoWeek()}周`;
79
+ };
80
+ baseProps.getValueProps = (value) => {
81
+ if (!value)
82
+ return { value: null };
83
+ const [yearStr, weekStr] = value.split("-");
84
+ const year = Number(yearStr);
85
+ const week = Number(weekStr.replace("周", ""));
86
+ return {
87
+ value: dayjs().year(year).isoWeek(week)
88
+ };
89
+ };
90
+ break;
91
+ case "month-picker":
92
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "YYYY-MM");
93
+ baseProps.getValueProps = (value) => ({
94
+ value: value ? dayjs(value) : null
95
+ });
96
+ break;
97
+ case "quarter-picker":
98
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "YYYY年第Q季度");
99
+ baseProps.getValueProps = (value) => ({
100
+ value: value ? dayjs(value, format || "YYYY年第Q季度") : null
101
+ });
102
+ break;
103
+ case "year-picker":
104
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "YYYY");
105
+ baseProps.getValueProps = (value) => ({
106
+ value: value ? dayjs(value) : null
107
+ });
108
+ break;
109
+ case "second-picker":
110
+ baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "HH:mm:ss");
111
+ baseProps.getValueProps = (value) => ({
112
+ value: value ? dayjs(value, format || "HH:mm:ss") : null
113
+ });
114
+ break;
115
+ }
116
+ return baseProps;
117
+ },
118
+ [handleNormFile]
119
+ );
120
+ const handleSetFormItemInitialValue = useCallback((itemWithJson) => {
121
+ var _a, _b, _c, _d;
122
+ const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
123
+ let initialValue = itemWithJson.attrvalue ?? ((_b = itemWithJson.json) == null ? void 0 : _b.default);
124
+ if (inputType === "label" && initialValue) {
125
+ initialValue = ((_c = itemWithJson.json) == null ? void 0 : _c["label-value"]) ?? initialValue ?? "-";
126
+ }
127
+ if ((inputType === "date-picker" || inputType === "time-picker") && initialValue) {
128
+ try {
129
+ const date = dayjs(initialValue);
130
+ initialValue = date.isValid() ? date : void 0;
131
+ } catch (error) {
132
+ initialValue = void 0;
133
+ }
134
+ }
135
+ if (inputType === "cascader" && initialValue && typeof initialValue === "string") {
136
+ const delimiter = (_d = itemWithJson.json) == null ? void 0 : _d["cascader-delimiter"];
137
+ if (delimiter) {
138
+ initialValue = initialValue.split(delimiter).filter(Boolean);
139
+ }
140
+ }
141
+ if (["mult-select", "checkbox"].includes(inputType) && initialValue && typeof initialValue === "string") {
142
+ initialValue = initialValue.split(",").filter(Boolean);
143
+ }
144
+ if (["image", "video", "audio", "file"].includes(inputType) && initialValue) {
145
+ try {
146
+ const fileList = Array.isArray(initialValue) ? initialValue : JSON.parse(initialValue);
147
+ initialValue = fileList.map((file) => ({
148
+ ...file,
149
+ url: file.FilePath,
150
+ name: file.FileName,
151
+ uid: file.FileId
152
+ }));
153
+ } catch (error) {
154
+ initialValue = [];
155
+ }
156
+ }
157
+ return initialValue || null;
158
+ }, []);
159
+ const handleCollapseIcon = useCallback(
160
+ ({ isActive }) => isActive ? /* @__PURE__ */ jsx(MinusSquareOutlined, { style: { fontSize: 18, color: "#999" } }) : /* @__PURE__ */ jsx(PlusSquareOutlined, { style: { fontSize: 18, color: "#999" } }),
161
+ []
162
+ );
163
+ const handleDealInstruction = (itemWithJson, instructionShowMode) => {
164
+ var _a, _b, _c, _d, _e;
165
+ return /* @__PURE__ */ jsxs(Flex, { gap: 10, vertical: instructionShowMode === "flex", align: "center", children: [
166
+ /* @__PURE__ */ jsx("span", { children: itemWithJson.attrname }),
167
+ ((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsx(Tooltip, { title: (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b.instruction, children: /* @__PURE__ */ jsx(
168
+ InfoCircleOutlined,
169
+ {
170
+ style: {
171
+ color: ((_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["instruction-color"]) ?? "#888888",
172
+ fontSize: 16,
173
+ cursor: "pointer"
174
+ }
175
+ }
176
+ ) }) || /* @__PURE__ */ jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction })
177
+ ] });
178
+ };
179
+ const handleRenderFunc = useCallback(
180
+ ({
181
+ itemWithJson,
182
+ colNum = 1,
183
+ readonly = false,
184
+ instructionShowMode = "icon",
185
+ radioAlign = "horizontal",
186
+ formItemStyle,
187
+ relatedid,
188
+ form,
189
+ defaultWidth = 358
190
+ }) => {
191
+ var _a, _b;
192
+ if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true) {
193
+ return /* @__PURE__ */ jsx(Fragment, {});
194
+ }
195
+ if (itemWithJson.attrtype === 1) {
196
+ return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(
197
+ Collapse,
198
+ {
199
+ bordered: false,
200
+ style: { backgroundColor: "transparent" },
201
+ expandIcon: ({ isActive }) => handleCollapseIcon({ isActive }),
202
+ onChange: async (key) => {
203
+ var _a2;
204
+ try {
205
+ const { children = [] } = itemWithJson;
206
+ if (key && (key == null ? void 0 : key.length) && setFormConfig && formConfigRef.current && interfaceTypeChildren && !(children == null ? void 0 : children.length)) {
207
+ const res = await commonRequest(interfaceTypeChildren, {
208
+ instanceid: relatedid,
209
+ asid: itemWithJson.asid,
210
+ tname: itemWithJson.tname
211
+ });
212
+ if ((res == null ? void 0 : res.ReturnValue) === 1) {
213
+ const arr = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.list) || [];
214
+ const _formConfig = _.cloneDeep(formConfigRef.current);
215
+ const _item = _formConfig.find((item) => item.attrid === itemWithJson.attrid);
216
+ if (_item) {
217
+ _item.children = [...arr];
218
+ }
219
+ setFormConfig(_formConfig);
220
+ }
221
+ }
222
+ } catch (error) {
223
+ }
224
+ },
225
+ items: [
226
+ {
227
+ key: itemWithJson.attrid,
228
+ label: itemWithJson.attrname,
229
+ children: /* @__PURE__ */ jsx("div", { children: (itemWithJson.children || []).map((child, index) => {
230
+ return /* @__PURE__ */ jsx(Fragment$1, { children: handleRenderItem({
231
+ item: child,
232
+ readonly,
233
+ colNum,
234
+ instructionShowMode,
235
+ relatedid,
236
+ form,
237
+ defaultWidth,
238
+ formItemStyle
239
+ }) }, child.attrid || `child-${index}`);
240
+ }) })
241
+ }
242
+ ]
243
+ },
244
+ itemWithJson.attrid
245
+ ) });
246
+ }
247
+ if (itemWithJson.attrtype === 2) {
248
+ return /* @__PURE__ */ jsx(Fragment, { children: "实例信息" });
249
+ }
250
+ if (itemWithJson.attrtype === 0) {
251
+ let initialValue = handleSetFormItemInitialValue(itemWithJson);
252
+ return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(
253
+ Form.Item,
254
+ {
255
+ name: itemWithJson.attrid,
256
+ label: handleDealInstruction(itemWithJson, instructionShowMode),
257
+ initialValue,
258
+ rules: [
259
+ ...((_b = itemWithJson.json) == null ? void 0 : _b.must) ? [
260
+ {
261
+ required: true,
262
+ message: `请输入${itemWithJson.attrname}`
263
+ }
264
+ ] : []
265
+ ],
266
+ ...handleSetFormItemProps(itemWithJson),
267
+ children: handleRenderItemInputMode({
268
+ item: itemWithJson,
269
+ readonly,
270
+ formItemStyle,
271
+ radioAlign,
272
+ relatedid,
273
+ form,
274
+ defaultWidth
275
+ })
276
+ },
277
+ itemWithJson.attrid
278
+ ) });
279
+ }
280
+ return null;
281
+ },
282
+ [handleCollapseIcon]
283
+ );
284
+ const handleOnRemove = async (file) => {
285
+ var _a;
286
+ try {
287
+ const data = (_a = file == null ? void 0 : file.response) == null ? void 0 : _a.data;
288
+ if (data) {
289
+ if (!commonRequestWidthParams)
290
+ return;
291
+ const result = await commonRequestWidthParams(
292
+ { Controlname: "DelFile", PageName: "initializationfile" },
293
+ data
294
+ );
295
+ if ((result == null ? void 0 : result.ReturnValue) !== 1) {
296
+ message.error((result == null ? void 0 : result.msg) || "删除文件失败");
297
+ return false;
298
+ }
299
+ } else {
300
+ handleDealFile(file);
301
+ }
302
+ return true;
303
+ } catch (error) {
304
+ message.error("删除文件失败,请重试");
305
+ return false;
306
+ }
307
+ };
308
+ const handleRenderItemInputMode = ({
309
+ item,
310
+ readonly = false,
311
+ formItemStyle = [],
312
+ radioAlign = "horizontal",
313
+ relatedid,
314
+ form,
315
+ defaultWidth = 358
316
+ }) => {
317
+ var _a, _b;
318
+ const mode = item.json.input || "text";
319
+ const formatValue = handleSetFormItemInitialValue(item);
320
+ const params = item.json.length && {
321
+ maxLength: item.json.length
322
+ } || {};
323
+ const itemStyle = formItemStyle.find((v) => v.type === mode);
324
+ switch (mode) {
325
+ case "label":
326
+ return /* @__PURE__ */ jsx(
327
+ Input,
328
+ {
329
+ disabled: true,
330
+ value: ((_a = item.json) == null ? void 0 : _a["label-value"]) || item.attrvalue || ((_b = item.json) == null ? void 0 : _b.default) || "-",
331
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
332
+ }
333
+ );
334
+ case "text":
335
+ return /* @__PURE__ */ jsx(
336
+ Input,
337
+ {
338
+ placeholder: "请输入",
339
+ ...params,
340
+ disabled: readonly,
341
+ allowClear: true,
342
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
343
+ }
344
+ );
345
+ case "textarea":
346
+ return /* @__PURE__ */ jsx(
347
+ Input.TextArea,
348
+ {
349
+ allowClear: true,
350
+ placeholder: "请输入",
351
+ rows: 5,
352
+ ...params,
353
+ disabled: readonly,
354
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
355
+ }
356
+ );
357
+ case "number":
358
+ return /* @__PURE__ */ jsx(
359
+ InputNumber,
360
+ {
361
+ controls: false,
362
+ placeholder: "请输入",
363
+ ...params,
364
+ disabled: readonly,
365
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
366
+ }
367
+ );
368
+ case "select":
369
+ case "mult-select": {
370
+ return /* @__PURE__ */ jsx(
371
+ MySelect,
372
+ {
373
+ handleUrlOptions,
374
+ item: item.json,
375
+ readonly,
376
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
377
+ commonRequestWidthParams,
378
+ commonRequest,
379
+ value: formatValue,
380
+ onChange: (val) => {
381
+ form.setFieldValue(item.attrid, val);
382
+ }
383
+ }
384
+ );
385
+ }
386
+ case "modal-mult-select":
387
+ case "modal-select": {
388
+ return /* @__PURE__ */ jsx(
389
+ SelectModel,
390
+ {
391
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
392
+ item: item.json,
393
+ value: item.attrvalue || item.json.default || "",
394
+ commonRequestWidthParams,
395
+ commonRequest,
396
+ onSure: async (value) => {
397
+ form.setFieldValue(item.attrid, value);
398
+ },
399
+ disabled: readonly
400
+ }
401
+ );
402
+ }
403
+ case "date-picker":
404
+ case "time-picker":
405
+ case "week-picker":
406
+ case "month-picker":
407
+ case "quarter-picker":
408
+ case "year-picker":
409
+ case "second-picker": {
410
+ const pickerObj = {
411
+ "date-picker": "date",
412
+ "time-picker": "date",
413
+ "week-picker": "week",
414
+ "month-picker": "month",
415
+ "quarter-picker": "quarter",
416
+ "year-picker": "year",
417
+ "second-picker": "time"
418
+ };
419
+ return /* @__PURE__ */ jsx(
420
+ DatePicker,
421
+ {
422
+ showTime: mode === "time-picker",
423
+ picker: pickerObj[mode] || "date",
424
+ disabled: readonly,
425
+ placement: "bottomLeft",
426
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
427
+ }
428
+ );
429
+ }
430
+ case "radio":
431
+ return /* @__PURE__ */ jsx(
432
+ MyRadio,
433
+ {
434
+ radioAlign,
435
+ commonRequest,
436
+ commonRequestWidthParams,
437
+ item: item.json,
438
+ readonly,
439
+ options: params,
440
+ handleUrlOptions,
441
+ value: formatValue,
442
+ onChange: (e) => {
443
+ form.setFieldValue(item.attrid, e.target.value);
444
+ }
445
+ }
446
+ );
447
+ case "checkbox":
448
+ return /* @__PURE__ */ jsx(
449
+ MyCheckbox,
450
+ {
451
+ radioAlign,
452
+ commonRequest,
453
+ commonRequestWidthParams,
454
+ item: item.json,
455
+ readonly,
456
+ options: params,
457
+ value: formatValue,
458
+ handleUrlOptions,
459
+ onChange: (val) => {
460
+ form.setFieldValue(item.attrid, val.join(","));
461
+ }
462
+ }
463
+ );
464
+ case "audio":
465
+ case "file":
466
+ case "image":
467
+ case "video":
468
+ return /* @__PURE__ */ jsx(
469
+ MyUpload,
470
+ {
471
+ action: uploadAction && uploadAction("initializationfile"),
472
+ item: item.json,
473
+ uploadType: mode,
474
+ list: formatValue,
475
+ readonly,
476
+ relatedid,
477
+ onRemove: (file) => handleOnRemove(file)
478
+ }
479
+ );
480
+ case "cascader":
481
+ return /* @__PURE__ */ jsx(
482
+ MyCascader,
483
+ {
484
+ commonRequestWidthParams,
485
+ commonRequest,
486
+ item: item.json,
487
+ value: item.attrvalue,
488
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
489
+ }
490
+ );
491
+ case "radio-card":
492
+ return /* @__PURE__ */ jsx(
493
+ RadioCard,
494
+ {
495
+ item: item.json,
496
+ readonly,
497
+ onChange: (value) => {
498
+ form.setFieldValue(item.attrid, value);
499
+ },
500
+ commonRequestWidthParams
501
+ }
502
+ );
503
+ default:
504
+ return /* @__PURE__ */ jsx(Input, { placeholder: "请输入", ...params, showCount: true, disabled: readonly, style: { ...itemStyle == null ? void 0 : itemStyle.style } });
505
+ }
506
+ };
507
+ const handleRenderItem = ({
508
+ item,
509
+ readonly = false,
510
+ colNum = 1,
511
+ instructionShowMode = "icon",
512
+ relatedid,
513
+ form,
514
+ defaultWidth = 358,
515
+ formItemStyle,
516
+ radioAlign = "horizontal"
517
+ }) => {
518
+ var _a;
519
+ const json = item.info_base64 === 1 ? getJson(base64ToString(item.info)) : getJson(item.info);
520
+ const itemWithJson = { ...item, json };
521
+ if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true) {
522
+ return null;
523
+ }
524
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
525
+ handleRenderFunc({
526
+ itemWithJson,
527
+ readonly,
528
+ colNum,
529
+ instructionShowMode,
530
+ relatedid,
531
+ form,
532
+ defaultWidth,
533
+ formItemStyle,
534
+ radioAlign
535
+ }),
536
+ /* @__PURE__ */ jsx(
537
+ Form.Item,
538
+ {
539
+ name: itemWithJson.attrid + "_objs",
540
+ style: { display: "none" },
541
+ initialValue: itemWithJson,
542
+ children: /* @__PURE__ */ jsx(Input, { type: "hidden" })
543
+ },
544
+ itemWithJson.attrid + "_objs"
545
+ )
546
+ ] }, itemWithJson.attrid);
547
+ };
548
+ return {
549
+ handleRenderItem
550
+ };
551
+ }
552
+ export {
553
+ useDynamicForm as default
554
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/es/main.d.ts CHANGED
@@ -8,6 +8,7 @@ import CoralButton from './components/CoralButton';
8
8
  import LoopSlide from './components/LoopSlide';
9
9
  import showWorkFlow, { WorkFlowNode } from './components/WorkFlowNode';
10
10
  import CustomPagination from './components/CustomPagination';
11
+ import DynamicForm from './components/DynamicForm';
11
12
  import * as download from './utils/download';
12
13
  import * as fileType from './utils/filetype';
13
14
  import * as FormRules from './utils/formRules';
@@ -17,9 +18,10 @@ import * as verfyCode from './utils/verify-code';
17
18
  import AES from './utils/aes';
18
19
  import HmacSHA512 from './utils/hmacSHA512';
19
20
  import HmacSM3 from './utils/hmacSM3';
21
+ import * as method from './utils/method';
20
22
  import useCaptcha from './hooks/useCaptcha';
21
23
  import useChangePwd from './hooks/useChangePwd';
22
24
  import useConfig from './hooks/useConfig';
23
25
  import useRemember from './hooks/useRemember';
24
26
  import useRowSelection from './hooks/useRowSelection';
25
- export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, download, EditTable, fileType, FormRules, HmacSHA512, HmacSM3, LoopSlide, SearchTable, showWorkFlow, UploadFile, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode, WorkFlowNode, CustomPagination, };
27
+ export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, EditTable, HmacSHA512, HmacSM3, LoopSlide, SearchTable, showWorkFlow, UploadFile, DynamicForm, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, WorkFlowNode, CustomPagination, utils, download, fileType, FormRules, verfyCode, method, };
package/es/main.js CHANGED
@@ -8,44 +8,48 @@ import { default as default8 } from "./components/CoralButton";
8
8
  import { default as default9 } from "./components/LoopSlide";
9
9
  import { WorkFlowNode, default as default10 } from "./components/WorkFlowNode";
10
10
  import { default as default11 } from "./components/CustomPagination";
11
+ import { default as default12 } from "./components/DynamicForm";
11
12
  import * as download from "./utils/download";
12
13
  import * as filetype from "./utils/filetype";
13
14
  import * as formRules from "./utils/formRules";
14
- import { default as default12 } from "./utils/image-compression";
15
+ import { default as default13 } from "./utils/image-compression";
15
16
  import * as index from "./utils/index";
16
17
  import * as verifyCode from "./utils/verify-code";
17
- import { default as default13 } from "./utils/aes";
18
- import { default as default14 } from "./utils/hmacSHA512";
19
- import { default as default15 } from "./utils/hmacSM3";
20
- import { default as default16 } from "./hooks/useCaptcha";
21
- import { default as default17 } from "./hooks/useChangePwd";
22
- import { default as default18 } from "./hooks/useConfig";
23
- import { default as default19 } from "./hooks/useRemember";
24
- import { default as default20 } from "./hooks/useRowSelection";
18
+ import { default as default14 } from "./utils/aes";
19
+ import { default as default15 } from "./utils/hmacSHA512";
20
+ import { default as default16 } from "./utils/hmacSM3";
21
+ import * as method from "./utils/method";
22
+ import { default as default17 } from "./hooks/useCaptcha";
23
+ import { default as default18 } from "./hooks/useChangePwd";
24
+ import { default as default19 } from "./hooks/useConfig";
25
+ import { default as default20 } from "./hooks/useRemember";
26
+ import { default as default21 } from "./hooks/useRowSelection";
25
27
  export {
26
- default13 as AES,
28
+ default14 as AES,
27
29
  default7 as AuthButton,
28
30
  default2 as BackHeader,
29
31
  default8 as CoralButton,
30
32
  default3 as CreateForm,
31
33
  default11 as CustomPagination,
34
+ default12 as DynamicForm,
32
35
  default6 as EditTable,
33
36
  formRules as FormRules,
34
- default14 as HmacSHA512,
35
- default15 as HmacSM3,
37
+ default15 as HmacSHA512,
38
+ default16 as HmacSM3,
36
39
  default9 as LoopSlide,
37
40
  default4 as SearchTable,
38
41
  default5 as UploadFile,
39
42
  WorkFlowNode,
40
- default12 as compressionImage,
43
+ default13 as compressionImage,
41
44
  download,
42
45
  filetype as fileType,
46
+ method,
43
47
  default10 as showWorkFlow,
44
- default16 as useCaptcha,
45
- default17 as useChangePwd,
46
- default18 as useConfig,
47
- default19 as useRemember,
48
- default20 as useRowSelection,
48
+ default17 as useCaptcha,
49
+ default18 as useChangePwd,
50
+ default19 as useConfig,
51
+ default20 as useRemember,
52
+ default21 as useRowSelection,
49
53
  index as utils,
50
54
  verifyCode as verfyCode
51
55
  };
@@ -0,0 +1,21 @@
1
+ export declare function getJson(jsonStr: string): any;
2
+ export declare function base64ToString(base64Str: string): string;
3
+ export declare function isBase64(str: string): boolean;
4
+ export declare const handleSubmitForm: (originalData: any, allValues: any) => {
5
+ updatedData: any;
6
+ uploadedFiles: any[];
7
+ };
8
+ export declare const handleAttrList: (attrList: any[]) => any[];
9
+ export declare const handleFormConfig: ({ number, key, sourceNumber, guidInterfaceName, SelPCParamInterfaceName, attrListInterfaceName, commonRequest, }: {
10
+ number: string | number;
11
+ key: string;
12
+ guidInterfaceName: string;
13
+ SelPCParamInterfaceName: string;
14
+ attrListInterfaceName: string;
15
+ sourceNumber?: string | number | undefined;
16
+ commonRequest: any;
17
+ }) => Promise<{
18
+ baseData: any;
19
+ newGUID: string;
20
+ attrListConfigs: any[];
21
+ }>;