szld-libs 0.3.31 → 0.3.36

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 (41) hide show
  1. package/dist/szld-components.es.js +13903 -13972
  2. package/dist/szld-components.umd.js +53 -53
  3. package/es/components/DynamicForm/func.d.ts +1 -5
  4. package/es/components/DynamicForm/func.js +5 -0
  5. package/es/components/DynamicForm/index.js +4 -2
  6. package/es/components/DynamicForm/myCheckbox/index.d.ts +1 -1
  7. package/es/components/DynamicForm/myCheckbox/index.js +17 -70
  8. package/es/components/DynamicForm/myRadio/index.d.ts +1 -1
  9. package/es/components/DynamicForm/myRadio/index.js +17 -73
  10. package/es/components/DynamicForm/mySelect/index.d.ts +2 -1
  11. package/es/components/DynamicForm/mySelect/index.js +5 -3
  12. package/es/components/DynamicForm/useDynamicForm.d.ts +1 -0
  13. package/es/components/DynamicForm/useDynamicForm.js +16 -13
  14. package/es/components/DynamicFormMobile/func.d.ts +0 -5
  15. package/es/components/DynamicFormMobile/mySelect/index.js +1 -1
  16. package/es/hooks/useUniversalTable.js +1 -1
  17. package/es/index.js +19 -12
  18. package/es/mock/index.d.ts +14 -0
  19. package/es/mock/index.js +374 -70
  20. package/es/utils/method.d.ts +2 -1
  21. package/es/utils/method.js +4 -2
  22. package/lib/components/DynamicForm/func.d.ts +1 -5
  23. package/lib/components/DynamicForm/func.js +5 -0
  24. package/lib/components/DynamicForm/index.js +4 -2
  25. package/lib/components/DynamicForm/myCheckbox/index.d.ts +1 -1
  26. package/lib/components/DynamicForm/myCheckbox/index.js +16 -69
  27. package/lib/components/DynamicForm/myRadio/index.d.ts +1 -1
  28. package/lib/components/DynamicForm/myRadio/index.js +16 -72
  29. package/lib/components/DynamicForm/mySelect/index.d.ts +2 -1
  30. package/lib/components/DynamicForm/mySelect/index.js +5 -3
  31. package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -0
  32. package/lib/components/DynamicForm/useDynamicForm.js +15 -12
  33. package/lib/components/DynamicFormMobile/func.d.ts +0 -5
  34. package/lib/components/DynamicFormMobile/mySelect/index.js +1 -1
  35. package/lib/hooks/useUniversalTable.js +1 -1
  36. package/lib/index.js +16 -9
  37. package/lib/mock/index.d.ts +14 -0
  38. package/lib/mock/index.js +373 -69
  39. package/lib/utils/method.d.ts +2 -1
  40. package/lib/utils/method.js +4 -2
  41. package/package.json +1 -1
@@ -12,14 +12,10 @@ export declare const disabledDate: RangePickerProps['disabledDate'];
12
12
  * 将URL中的指定字段拼接为字符串
13
13
  */
14
14
  export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
15
- /**
16
- * 根据配置处理成下拉数据
17
- * @param param0
18
- * @returns
19
- */
20
15
  /**
21
16
  * attrList 格式的单层数组 处理成对象{attrid:attrname}
22
17
  */
23
18
  export declare const handleGetSingleAttrListObj: (children: any[]) => {
24
19
  [key: string]: any;
25
20
  }[];
21
+ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
@@ -112,8 +112,13 @@ const handleGetSingleAttrListObj = (children) => {
112
112
  });
113
113
  return dealList(children);
114
114
  };
115
+ const getTitle = (langConfig, dataID) => {
116
+ const titleData = langConfig.find((x) => (x == null ? void 0 : x.dataid) === dataID);
117
+ return (titleData == null ? void 0 : titleData.content) ?? dataID;
118
+ };
115
119
  export {
116
120
  disabledDate,
121
+ getTitle,
117
122
  handleGetPlaceholder,
118
123
  handleGetSingleAttrListObj,
119
124
  handleSetFormItemInitialValue,
@@ -29,7 +29,8 @@ const DynamicForm = forwardRef((props, ref) => {
29
29
  formListItemWidth,
30
30
  formListItemName,
31
31
  isEdit = false,
32
- langId = "10001"
32
+ langId = "10001",
33
+ langConfig = []
33
34
  } = props;
34
35
  const delFileListRef = useRef([]);
35
36
  const updateDelFileList = (file) => {
@@ -50,7 +51,8 @@ const DynamicForm = forwardRef((props, ref) => {
50
51
  CustomModalComponent,
51
52
  isEdit,
52
53
  formShowType,
53
- langId
54
+ langId,
55
+ langConfig
54
56
  });
55
57
  useImperativeHandle(ref, () => ({
56
58
  getDelFileList: () => {
@@ -14,7 +14,7 @@ export interface IMYRadio {
14
14
  interfaceTypeSysDict: string;
15
15
  actionUrlKey: string;
16
16
  actionUrlExtraParams: object;
17
- langId?: string;
17
+ langConfig?: any[];
18
18
  }
19
19
  declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
20
20
  export default MyCheckbox;
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { handleSelectOptions } from "@/utils/method";
2
3
  import { useState, useEffect } from "react";
3
- import { App, Checkbox } from "antd";
4
+ import { Checkbox } from "antd";
4
5
  const MyCheckbox = (props) => {
5
6
  const {
6
7
  item,
@@ -16,79 +17,25 @@ const MyCheckbox = (props) => {
16
17
  interfaceTypeSysDict,
17
18
  actionUrlKey,
18
19
  actionUrlExtraParams,
19
- langId
20
+ langConfig
20
21
  } = props;
21
- const { message } = App.useApp();
22
22
  const [list, setList] = useState([]);
23
23
  const [val, setVal] = useState(value || []);
24
24
  useEffect(() => {
25
- if ((item == null ? void 0 : item.inputType) === "local") {
26
- const arr = (item == null ? void 0 : item.data) || [];
27
- setList(arr.map((v) => ({ value: v, label: v })));
28
- } else if ((item == null ? void 0 : item.inputType) === "dictionary") {
29
- getList(item.classify, interfaceTypeDict);
30
- } else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
31
- getList(item.classify, interfaceTypeSysDict);
32
- } else if ((item == null ? void 0 : item.inputType) === "url") {
33
- getUrlList();
34
- }
35
- }, [item == null ? void 0 : item.inputType]);
36
- const getList = async (id, interfaceType) => {
37
- var _a;
38
- if (!id) {
39
- return;
40
- }
41
- const res = await commonRequest(interfaceType, { asctypeid: id });
42
- if ((res == null ? void 0 : res.ReturnValue) === 1) {
43
- const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
44
- setList(
45
- arr.map((v) => {
46
- const value2 = v.dicid + "-" + v.info;
47
- return { value: value2, label: value2 };
48
- })
49
- );
50
- }
51
- };
52
- const getUrlList = async () => {
53
- var _a, _b;
54
- try {
55
- const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
56
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
57
- if (!keyFieldList.length) {
58
- message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
59
- return;
60
- }
61
- const response = await commonRequestWidthParams(
62
- {
63
- PageName: "dns_relay",
64
- Controlname: "CallActionUrl",
65
- InterfaceType: ""
66
- },
67
- {
68
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
69
- ...actionUrlExtraParams
70
- }
71
- );
72
- if (response == null ? void 0 : response.data) {
73
- const data = response == null ? void 0 : response.data;
74
- const list2 = data == null ? void 0 : data.list;
75
- let urlData = [];
76
- if (Array.isArray(data)) {
77
- urlData = data;
78
- }
79
- if (Array.isArray(list2)) {
80
- urlData = list2;
81
- }
82
- const urlOptions = urlData.map((val2) => ({
83
- label: handleUrlOptions(val2, delimiter, keyFieldList),
84
- value: handleUrlOptions(val2, delimiter, keyFieldList)
85
- }));
86
- setList([...urlOptions]);
87
- }
88
- } catch (error) {
89
- message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
90
- } finally {
91
- }
25
+ handleLoadOptions();
26
+ }, [item.inputType, item.classify, item.data, item.options]);
27
+ const handleLoadOptions = async () => {
28
+ const list2 = await handleSelectOptions({
29
+ commonRequestWidthParams,
30
+ commonRequest,
31
+ interfaceTypeDict,
32
+ interfaceTypeSysDict,
33
+ actionUrlKey,
34
+ actionUrlExtraParams,
35
+ item,
36
+ langConfig: langConfig || []
37
+ });
38
+ setList(list2);
92
39
  };
93
40
  return /* @__PURE__ */ jsx(
94
41
  Checkbox.Group,
@@ -15,7 +15,7 @@ export interface IMYRadio {
15
15
  interfaceTypeSysDict: string;
16
16
  actionUrlKey: string;
17
17
  actionUrlExtraParams: object;
18
- langId?: string;
18
+ langConfig?: any[];
19
19
  }
20
20
  declare const MyRadio: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
21
21
  export default MyRadio;
@@ -1,5 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { App, Radio } from "antd";
2
+ import { handleSelectOptions } from "@/utils/method";
3
+ import { Radio } from "antd";
3
4
  import { useState, useEffect } from "react";
4
5
  const MyRadio = (props) => {
5
6
  const {
@@ -10,86 +11,29 @@ const MyRadio = (props) => {
10
11
  radioAlign = "horizontal",
11
12
  commonRequestWidthParams,
12
13
  commonRequest,
13
- handleUrlOptions,
14
14
  value,
15
15
  interfaceTypeDict,
16
16
  interfaceTypeSysDict,
17
17
  actionUrlKey,
18
18
  actionUrlExtraParams,
19
- langId
19
+ langConfig
20
20
  } = props;
21
- const { message } = App.useApp();
22
21
  const [list, setList] = useState([]);
23
22
  useEffect(() => {
24
- if ((item == null ? void 0 : item.inputType) === "local") {
25
- const arr = (item == null ? void 0 : item.data) || [];
26
- setList(arr.map((v) => ({ value: v, label: v })));
27
- } else if ((item == null ? void 0 : item.inputType) === "dictionary") {
28
- getList(item.classify, interfaceTypeDict);
29
- } else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
30
- getList(item.classify, interfaceTypeSysDict);
31
- } else if ((item == null ? void 0 : item.inputType) === "url") {
32
- getUrlList();
33
- }
34
- }, [item == null ? void 0 : item.inputType]);
35
- const getList = async (id, interfaceType) => {
36
- var _a;
37
- if (!id) {
38
- return;
39
- }
40
- const res = await commonRequest(interfaceType, { asctypeid: id });
41
- if ((res == null ? void 0 : res.ReturnValue) === 1) {
42
- const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
43
- setList(
44
- arr.map((v) => {
45
- const value2 = v.dicid + "-" + v.info;
46
- return { value: value2, label: value2 };
47
- })
48
- );
49
- }
50
- };
51
- const getUrlList = async () => {
52
- var _a, _b;
53
- try {
54
- const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
55
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
56
- if (!keyFieldList.length) {
57
- message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
58
- return;
59
- }
60
- if (!commonRequestWidthParams)
61
- return;
62
- const response = await commonRequestWidthParams(
63
- {
64
- PageName: "dns_relay",
65
- Controlname: "CallActionUrl",
66
- InterfaceType: ""
67
- },
68
- {
69
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
70
- ...actionUrlExtraParams
71
- }
72
- );
73
- if (response == null ? void 0 : response.data) {
74
- const data = response == null ? void 0 : response.data;
75
- const list2 = data == null ? void 0 : data.list;
76
- let urlData = [];
77
- if (Array.isArray(data)) {
78
- urlData = data;
79
- }
80
- if (Array.isArray(list2)) {
81
- urlData = list2;
82
- }
83
- const urlOptions = urlData.map((val) => ({
84
- label: handleUrlOptions(val, delimiter, keyFieldList),
85
- value: handleUrlOptions(val, delimiter, keyFieldList)
86
- }));
87
- setList([...urlOptions]);
88
- }
89
- } catch (error) {
90
- message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
91
- } finally {
92
- }
23
+ handleLoadOptions();
24
+ }, [item.inputType, item.classify, item.data, item.options]);
25
+ const handleLoadOptions = async () => {
26
+ const list2 = await handleSelectOptions({
27
+ commonRequestWidthParams,
28
+ commonRequest,
29
+ interfaceTypeDict,
30
+ interfaceTypeSysDict,
31
+ actionUrlKey,
32
+ actionUrlExtraParams,
33
+ item,
34
+ langConfig
35
+ });
36
+ setList(list2);
93
37
  };
94
38
  return /* @__PURE__ */ jsx(
95
39
  Radio.Group,
@@ -1,6 +1,6 @@
1
1
  import { Ijson } from '../index.d';
2
2
  import { AxiosResponse } from 'axios';
3
- declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, }: {
3
+ declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, langConfig, }: {
4
4
  item: Ijson;
5
5
  readonly?: boolean | undefined;
6
6
  style?: any;
@@ -13,5 +13,6 @@ declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, comm
13
13
  actionUrlKey: string;
14
14
  actionUrlExtraParams: object;
15
15
  langId?: string | undefined;
16
+ langConfig?: any[] | undefined;
16
17
  }) => import("react/jsx-runtime").JSX.Element;
17
18
  export default MySelect;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { handleSelectOptions } from "../../../utils/method";
2
+ import { handleSelectOptions } from "@/utils/method";
3
3
  import { handleGetPlaceholder } from "../func";
4
4
  import { useState, useEffect } from "react";
5
5
  import { Select } from "antd";
@@ -15,7 +15,8 @@ const MySelect = ({
15
15
  interfaceTypeSysDict,
16
16
  actionUrlKey,
17
17
  actionUrlExtraParams,
18
- langId
18
+ langId,
19
+ langConfig
19
20
  }) => {
20
21
  const [options, setOptions] = useState([]);
21
22
  const [loading, setLoading] = useState(false);
@@ -31,7 +32,8 @@ const MySelect = ({
31
32
  interfaceTypeSysDict,
32
33
  actionUrlKey,
33
34
  actionUrlExtraParams,
34
- item
35
+ item,
36
+ langConfig: langConfig || []
35
37
  });
36
38
  setOptions(list);
37
39
  setLoading(false);
@@ -18,6 +18,7 @@ interface IDynamicFormProps {
18
18
  isEdit?: boolean;
19
19
  formShowType?: 'form' | 'table';
20
20
  langId?: string;
21
+ langConfig?: any[];
21
22
  }
22
23
  type NestedFormListFieldData = FormListFieldData & {
23
24
  parentName?: (string | number)[];
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { MinusSquareOutlined, PlusSquareOutlined, CloseOutlined, InfoCircleOutlined } from "@ant-design/icons";
3
- import { handleSetFormItemInitialValue, handleGetPlaceholder, disabledDate } from "./func";
3
+ import { handleSetFormItemInitialValue, getTitle, handleGetPlaceholder, disabledDate } from "./func";
4
4
  import { handleUrlOptions, getJson, base64ToString } from "../../utils/method";
5
5
  import SelectModelBackfillFormItem from "./selectModelBackfillFormItem";
6
6
  import { useRef, useEffect, useCallback, Fragment } from "react";
@@ -30,7 +30,8 @@ function useDynamicForm(props) {
30
30
  CustomModalComponent,
31
31
  isEdit,
32
32
  formShowType = "form",
33
- langId
33
+ langId,
34
+ langConfig = []
34
35
  } = props;
35
36
  const formConfigRef = useRef([]);
36
37
  const { message } = App.useApp();
@@ -138,7 +139,7 @@ function useDynamicForm(props) {
138
139
  var _a, _b, _c, _d, _e;
139
140
  return /* @__PURE__ */ jsxs(Flex, { gap: 10, vertical: instructionShowMode === "flex", align: "center", children: [
140
141
  /* @__PURE__ */ jsx("span", { children: itemWithJson.attrname }),
141
- ((_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(
142
+ ((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsx(Tooltip, { title: getTitle(langConfig, (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b.instruction), children: /* @__PURE__ */ jsx(
142
143
  InfoCircleOutlined,
143
144
  {
144
145
  style: {
@@ -147,7 +148,7 @@ function useDynamicForm(props) {
147
148
  cursor: "pointer"
148
149
  }
149
150
  }
150
- ) }) || /* @__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 })
151
+ ) }) || /* @__PURE__ */ jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: getTitle(langConfig, (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction) })
151
152
  ] });
152
153
  };
153
154
  const renderNestedFormList = useCallback(
@@ -240,7 +241,10 @@ function useDynamicForm(props) {
240
241
  field.key
241
242
  );
242
243
  }),
243
- !isEdit && /* @__PURE__ */ jsx(Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsx(Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
244
+ !isEdit && /* @__PURE__ */ jsx(Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsxs(Button, { type: "dashed", onClick: () => add(), block: true, children: [
245
+ "+ ",
246
+ langId === "10001" ? "新增" : "Add"
247
+ ] }) })
244
248
  ] })
245
249
  }
246
250
  )
@@ -291,7 +295,7 @@ function useDynamicForm(props) {
291
295
  }
292
296
  if (itemWithJson.attrtype === 0) {
293
297
  const initialValue = handleSetFormItemInitialValue(itemWithJson);
294
- const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
298
+ const message2 = getTitle(langConfig, (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"]);
295
299
  const placeholder = handleGetPlaceholder(itemWithJson, langId);
296
300
  const { combinations = [] } = itemWithJson.json || {};
297
301
  if (combinations == null ? void 0 : combinations.length) {
@@ -333,7 +337,7 @@ function useDynamicForm(props) {
333
337
  ...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
334
338
  {
335
339
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
336
- message: ((_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
340
+ message: getTitle(langConfig, (_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
337
341
  }
338
342
  ] : []
339
343
  ],
@@ -373,7 +377,7 @@ function useDynamicForm(props) {
373
377
  ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
374
378
  {
375
379
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
376
- message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
380
+ message: getTitle(langConfig, (_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
377
381
  }
378
382
  ] : []
379
383
  ],
@@ -407,7 +411,7 @@ function useDynamicForm(props) {
407
411
  data
408
412
  );
409
413
  if ((result == null ? void 0 : result.ReturnValue) !== 1) {
410
- message.error((result == null ? void 0 : result.msg) || "删除文件失败");
414
+ message.error(result == null ? void 0 : result.msg);
411
415
  return false;
412
416
  }
413
417
  } else {
@@ -415,7 +419,6 @@ function useDynamicForm(props) {
415
419
  }
416
420
  return true;
417
421
  } catch (error) {
418
- message.error("删除文件失败,请重试");
419
422
  return false;
420
423
  }
421
424
  };
@@ -434,7 +437,7 @@ function useDynamicForm(props) {
434
437
  const format = ((_a = item.json) == null ? void 0 : _a.format) || "";
435
438
  const attrid = item.attrid;
436
439
  const formatValue = handleSetFormItemInitialValue(item);
437
- const message2 = ((_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
440
+ const message2 = getTitle(langConfig, (_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
438
441
  const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
439
442
  const placeholder = handleGetPlaceholder(item, langId);
440
443
  const params = item.json.length && {
@@ -517,6 +520,7 @@ function useDynamicForm(props) {
517
520
  actionUrlKey,
518
521
  actionUrlExtraParams,
519
522
  langId,
523
+ langConfig,
520
524
  onChange: (val) => {
521
525
  form.setFieldValue(item.attrid, val);
522
526
  }
@@ -622,7 +626,7 @@ function useDynamicForm(props) {
622
626
  interfaceTypeSysDict,
623
627
  actionUrlKey,
624
628
  actionUrlExtraParams,
625
- langId,
629
+ langConfig,
626
630
  onChange: (e) => {
627
631
  form.setFieldValue(item.attrid, e.target.value);
628
632
  }
@@ -644,7 +648,6 @@ function useDynamicForm(props) {
644
648
  interfaceTypeSysDict,
645
649
  actionUrlKey,
646
650
  actionUrlExtraParams,
647
- langId,
648
651
  onChange: (val) => {
649
652
  form.setFieldValue(item.attrid, val.join(","));
650
653
  }
@@ -12,11 +12,6 @@ export declare const disabledDate: RangePickerProps['disabledDate'];
12
12
  * 将URL中的指定字段拼接为字符串
13
13
  */
14
14
  export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
15
- /**
16
- * 根据配置处理成下拉数据
17
- * @param param0
18
- * @returns
19
- */
20
15
  /**
21
16
  * attrList 格式的单层数组 处理成对象{attrid:attrname}
22
17
  */
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { Field, Popup, Checkbox, Picker } from "react-vant";
3
- import { handleSelectOptions } from "../../../utils/method";
3
+ import { handleSelectOptions } from "@/utils/method";
4
4
  import { useState, useEffect } from "react";
5
5
  import { Flex } from "antd";
6
6
  const checkboxGroup = "index-module_checkbox-group_4684b";
@@ -209,7 +209,7 @@ function useUniversalTable() {
209
209
  dataIndex: (item == null ? void 0 : item["header-attribute-id"]) || "",
210
210
  width: isDefaultWidth ? (item == null ? void 0 : item["header-width"]) || 180 : void 0,
211
211
  render: (text) => {
212
- if (text && (text == null ? void 0 : text.includes("FileName")) && (text == null ? void 0 : text.includes("FilePath"))) {
212
+ if (text && text && typeof text === "string" && (text == null ? void 0 : text.includes("FileName")) && (text == null ? void 0 : text.includes("FilePath"))) {
213
213
  try {
214
214
  const items = JSON.parse(text);
215
215
  if (items == null ? void 0 : items.length) {
package/es/index.js CHANGED
@@ -1,33 +1,40 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { commonRequestWidthParams, uploadFormAction, commonRequest } from "./services";
3
- import { handleAttrListToObj, handleAttrList } from "./utils/method";
3
+ import { handleAttrList } from "./utils/method";
4
4
  import { BackHeader, DynamicForm } from "./main";
5
5
  import { BrowserRouter } from "react-router-dom";
6
6
  import { ConfigProvider, App, Form, Button } from "antd";
7
- import { useEffect, useRef } from "react";
7
+ import { useRef, useState } from "react";
8
8
  import ReactDOM from "react-dom/client";
9
9
  import zhCN from "antd/es/locale/zh_CN";
10
- import { attrList } from "./mock";
10
+ import { attrList, langConfig } from "./mock";
11
11
  import dayjs from "dayjs";
12
12
  const index = "";
13
13
  const tableDetail = "";
14
14
  dayjs.locale("zh-cn");
15
15
  const Demo = () => {
16
- useEffect(() => {
17
- handleAttrListToObj(attrList);
18
- }, []);
19
16
  const formRef = useRef(null);
20
17
  const [form] = Form.useForm();
21
- const onFinish = async (values) => {
22
- return;
18
+ const [list, setList] = useState(handleAttrList(attrList));
19
+ const onValuesChange = async (values, allValues) => {
20
+ const keys = Object.keys(values);
21
+ if (keys.includes("6A5984BD547449088172BD33F2A965E8")) {
22
+ list.forEach((item) => {
23
+ if (item.attrid === "4E507938BE7448E5883CFCD9C962707D") {
24
+ item.json.data = ["1", "2", "3"];
25
+ item.info = JSON.stringify(item == null ? void 0 : item.json);
26
+ }
27
+ });
28
+ setList([...list]);
29
+ }
23
30
  };
24
31
  return /* @__PURE__ */ jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
25
32
  /* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
26
- /* @__PURE__ */ jsx("div", { style: {}, children: /* @__PURE__ */ jsxs(Form, { form, onFinish, children: [
33
+ /* @__PURE__ */ jsx("div", { style: {}, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, children: [
27
34
  /* @__PURE__ */ jsx(
28
35
  DynamicForm,
29
36
  {
30
- formConfig: handleAttrList(attrList),
37
+ formConfig: list,
31
38
  readonly: false,
32
39
  form,
33
40
  relatedid: "guid",
@@ -38,8 +45,8 @@ const Demo = () => {
38
45
  commonRequest,
39
46
  instructionShowMode: "icon",
40
47
  ref: formRef,
41
- formShowType: "table",
42
- langId: "10002"
48
+ langId: "10001",
49
+ langConfig
43
50
  }
44
51
  ),
45
52
  /* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "提交" }) })
@@ -1,2 +1,16 @@
1
1
  export declare const baseAttrList: never[];
2
2
  export declare const attrList: any;
3
+ export declare const langConfig: {
4
+ xh: string;
5
+ lanid: string;
6
+ sysid: string;
7
+ sysname: string;
8
+ systype: string;
9
+ pageid: string;
10
+ pageinfo: string;
11
+ dataid: string;
12
+ datainfo: string;
13
+ dicid: string;
14
+ info: string;
15
+ content: string;
16
+ }[];