szld-libs 0.4.50 → 0.4.52

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 (39) hide show
  1. package/dist/szld-components.es.js +15155 -15065
  2. package/dist/szld-components.umd.js +126 -126
  3. package/es/components/DynamicForm/func.d.ts +2 -2
  4. package/es/components/DynamicForm/func.js +13 -8
  5. package/es/components/DynamicForm/index.d.ts +1 -0
  6. package/es/components/DynamicForm/index.js +41 -7
  7. package/es/components/DynamicForm/myCascader/index.d.ts +2 -1
  8. package/es/components/DynamicForm/myCascader/index.js +9 -11
  9. package/es/components/DynamicForm/myRadio/index.d.ts +5 -1
  10. package/es/components/DynamicForm/myRadio/index.js +63 -17
  11. package/es/components/DynamicForm/myRichText/index.d.ts +2 -1
  12. package/es/components/DynamicForm/myRichText/index.js +20 -30
  13. package/es/components/DynamicForm/mySelect/index.js +1 -1
  14. package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +1 -1
  15. package/es/components/DynamicForm/useDynamicForm.d.ts +1 -0
  16. package/es/components/DynamicForm/useDynamicForm.js +23 -19
  17. package/es/index.js +5 -7
  18. package/es/mock/index.js +2 -2
  19. package/es/utils/szxkFunc.d.ts +11 -0
  20. package/es/utils/szxkFunc.js +25 -0
  21. package/lib/components/DynamicForm/func.d.ts +2 -2
  22. package/lib/components/DynamicForm/func.js +13 -8
  23. package/lib/components/DynamicForm/index.d.ts +1 -0
  24. package/lib/components/DynamicForm/index.js +38 -4
  25. package/lib/components/DynamicForm/myCascader/index.d.ts +2 -1
  26. package/lib/components/DynamicForm/myCascader/index.js +9 -11
  27. package/lib/components/DynamicForm/myRadio/index.d.ts +5 -1
  28. package/lib/components/DynamicForm/myRadio/index.js +61 -15
  29. package/lib/components/DynamicForm/myRichText/index.d.ts +2 -1
  30. package/lib/components/DynamicForm/myRichText/index.js +19 -29
  31. package/lib/components/DynamicForm/mySelect/index.js +1 -1
  32. package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +1 -1
  33. package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -0
  34. package/lib/components/DynamicForm/useDynamicForm.js +19 -15
  35. package/lib/index.js +5 -7
  36. package/lib/mock/index.js +2 -2
  37. package/lib/utils/szxkFunc.d.ts +11 -0
  38. package/lib/utils/szxkFunc.js +25 -0
  39. package/package.json +1 -1
@@ -1,9 +1,9 @@
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
- import { useRef, useEffect, useCallback, Fragment } from "react";
6
+ import { useCallback, Fragment } from "react";
7
7
  import isoWeek from "dayjs/plugin/isoWeek";
8
8
  import SelectModel from "./selectModel";
9
9
  import MyCheckbox from "./myCheckbox";
@@ -34,17 +34,12 @@ function useDynamicForm(props) {
34
34
  formShowType = "form",
35
35
  // 新增:表单展示类型,默认form
36
36
  langId,
37
- // 新增:语言id,默认10001
38
- getTitle
37
+ // 新增:语言id
38
+ getTitle: getTitle$1,
39
+ langData
40
+ // 新增:组件库固定文字语言匹配数据
39
41
  } = props;
40
- const formConfigRef = useRef([]);
41
42
  const { message } = App.useApp();
42
- useEffect(() => {
43
- if (!formConfig) {
44
- return;
45
- }
46
- formConfigRef.current = formConfig;
47
- }, [formConfig]);
48
43
  const handleNormFile = useCallback((e) => {
49
44
  if (Array.isArray(e)) {
50
45
  return e;
@@ -250,7 +245,9 @@ function useDynamicForm(props) {
250
245
  if (fields.length > 1) {
251
246
  remove(field.name);
252
247
  } else {
253
- message.warning("至少需要保留一个!");
248
+ message.warning(
249
+ langId && getTitle(langData, "006") || "至少保留一个表单"
250
+ );
254
251
  }
255
252
  }
256
253
  }
@@ -277,7 +274,7 @@ function useDynamicForm(props) {
277
274
  }),
278
275
  !isEdit && /* @__PURE__ */ jsx(Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsxs(Button, { type: "dashed", onClick: () => add(), block: true, children: [
279
276
  "+ ",
280
- langId === "10001" ? "新增" : "Add"
277
+ getTitle(langData, "004") || "新增"
281
278
  ] }) })
282
279
  ] })
283
280
  }
@@ -331,7 +328,7 @@ function useDynamicForm(props) {
331
328
  if (itemWithJson.attrtype === 0) {
332
329
  const initialValue = handleSetFormItemInitialValue(itemWithJson);
333
330
  const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
334
- const placeholder = handleGetPlaceholder(itemWithJson, langId);
331
+ const placeholder = handleGetPlaceholder(itemWithJson, langId, langData);
335
332
  const { combinations = [] } = itemWithJson.json || {};
336
333
  if (combinations == null ? void 0 : combinations.length) {
337
334
  return /* @__PURE__ */ jsx(Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsx(
@@ -498,7 +495,7 @@ function useDynamicForm(props) {
498
495
  const formatValue = handleSetFormItemInitialValue(item);
499
496
  const message2 = ((_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
500
497
  const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
501
- const placeholder = handleGetPlaceholder(item, langId);
498
+ const placeholder = handleGetPlaceholder(item, langId, langData);
502
499
  const params = item.json.length && {
503
500
  maxLength: item.json.length
504
501
  } || {};
@@ -579,7 +576,7 @@ function useDynamicForm(props) {
579
576
  interfaceTypeSysDict,
580
577
  actionUrlKey,
581
578
  actionUrlExtraParams,
582
- getTitle,
579
+ getTitle: getTitle$1,
583
580
  langId,
584
581
  onChange: (val) => {
585
582
  if (val && typeof val === "object" && !Array.isArray(val)) {
@@ -622,7 +619,7 @@ function useDynamicForm(props) {
622
619
  item: item.json,
623
620
  form,
624
621
  attrid,
625
- getTitle,
622
+ getTitle: getTitle$1,
626
623
  value: item.attrvalue || item.json.default || "",
627
624
  commonRequestWidthParams,
628
625
  commonRequest,
@@ -696,13 +693,17 @@ function useDynamicForm(props) {
696
693
  commonRequestWidthParams,
697
694
  item: item.json,
698
695
  readonly: readonly || ((_r = item.json) == null ? void 0 : _r.readonly),
699
- options: params,
696
+ params,
700
697
  handleUrlOptions,
701
698
  value: formatValue,
702
699
  interfaceTypeDict,
703
700
  interfaceTypeSysDict,
704
701
  actionUrlKey,
705
702
  actionUrlExtraParams,
703
+ getTitle: getTitle$1,
704
+ attrid,
705
+ langId,
706
+ langData,
706
707
  onChange: (e) => {
707
708
  form.setFieldValue(item.attrid, e.target.value);
708
709
  }
@@ -760,7 +761,8 @@ function useDynamicForm(props) {
760
761
  interfaceTypeSysDict,
761
762
  actionUrlKey,
762
763
  actionUrlExtraParams,
763
- langId
764
+ langId,
765
+ langData
764
766
  }
765
767
  );
766
768
  case "radio-card":
@@ -784,6 +786,8 @@ function useDynamicForm(props) {
784
786
  readonly: readonly || ((_v = item.json) == null ? void 0 : _v.readonly),
785
787
  style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
786
788
  value: item.attrvalue,
789
+ langId,
790
+ langData,
787
791
  onChange: (value) => {
788
792
  form.setFieldValue(item.attrid, value);
789
793
  }
package/es/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { handleAttrList, handleSubmitForm } from "./utils/method";
3
- import { BackHeader, DynamicFormMobile } from "./main";
3
+ import { BackHeader, DynamicForm } from "./main";
4
4
  import { BrowserRouter } from "react-router-dom";
5
- import { ConfigProvider, App } from "antd";
6
- import { Form } from "react-vant";
5
+ import { ConfigProvider, App, Form, Button } from "antd";
7
6
  import { useRef, useState, useEffect } from "react";
8
7
  import ReactDOM from "react-dom/client";
9
8
  import zhCN from "antd/es/locale/zh_CN";
@@ -16,7 +15,7 @@ const Demo = () => {
16
15
  const formRef = useRef(null);
17
16
  const [form] = Form.useForm();
18
17
  const [list, setList] = useState([]);
19
- const [langId, setLangId] = useState("");
18
+ const [langId, setLangId] = useState("10002");
20
19
  const onValuesChange = async (values, allValues) => {
21
20
  };
22
21
  useEffect(() => {
@@ -34,14 +33,13 @@ const Demo = () => {
34
33
  /* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
35
34
  /* @__PURE__ */ jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, layout: "vertical", onFinish, children: [
36
35
  /* @__PURE__ */ jsx(
37
- DynamicFormMobile,
36
+ DynamicForm,
38
37
  {
39
38
  formConfig: list,
40
39
  readonly: false,
41
40
  form,
42
41
  relatedid: "guid",
43
42
  colNum: 1,
44
- defaultWidth: 358,
45
43
  commonRequestWidthParams: () => {
46
44
  return new Promise((resolve, reject) => {
47
45
  });
@@ -56,7 +54,7 @@ const Demo = () => {
56
54
  langId
57
55
  }
58
56
  ),
59
- /* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" } })
57
+ /* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "Submit" }) })
60
58
  ] }) }),
61
59
  /* @__PURE__ */ jsxs("div", { children: [
62
60
  "2. 测试循环滚动组件",
package/es/mock/index.js CHANGED
@@ -8,10 +8,10 @@ const attrList = [
8
8
  attrid: "30BDE6E7977E40069B55DDE61C8795AE",
9
9
  attrname: "Dates",
10
10
  attrtype: 0,
11
- info: '{"input":"mult-select","dataType":"string","data":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],"inputType":"local","length":500,"must":true}',
11
+ info: '{"input":"rich-text","dataType":"string","length":500,"must":true}',
12
12
  info_base64: 0,
13
13
  createtime: "2026-02-11 15:12:26",
14
- attrvalue: "",
14
+ attrvalue: "JTNDcCUzRSVFNSU4RSVCQiVFNSU5NSU4QSVFNiU5OCVBRiVFNyU5QSU4NCVFNCVCQyU4MSVFOSVCOSU4NSVFNyU5QSU4NCVFNSVBNyU5NCVFNSVCMSU4OCVFOSVBNSVCRiUzQyUyRnAlM0U=",
15
15
  serialnum: 1,
16
16
  children: []
17
17
  }
@@ -70,3 +70,14 @@ export declare const handleFormatMobileDate: (values: Record<string, any>, forma
70
70
  export declare const handleNonUniversalHeader: (nonUniversalHeader: Record<string, string>, data: Record<string, any>) => Record<string, any>;
71
71
  export declare const handleGetControlPanelConfig: (sourceNumber: string | number, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>) => Promise<any>;
72
72
  export declare const isJson: (str: string) => boolean;
73
+ export declare const getLangData: ({ commonRequestWidthParams, params, interfaceConfig, langId, }: {
74
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
75
+ params: {
76
+ sysid: string;
77
+ pageid?: string;
78
+ dataid?: string;
79
+ dicid?: string;
80
+ };
81
+ interfaceConfig?: Record<string, string> | undefined;
82
+ langId: string | undefined;
83
+ }) => Promise<any>;
@@ -107,7 +107,32 @@ const isJson = (str) => {
107
107
  return false;
108
108
  }
109
109
  };
110
+ const getLangData = async ({
111
+ commonRequestWidthParams,
112
+ params,
113
+ interfaceConfig = {
114
+ PageName: "dns_relay",
115
+ Controlname: "Connon_Control",
116
+ InterfaceType: "YYGLOpenList"
117
+ },
118
+ langId
119
+ }) => {
120
+ var _a;
121
+ try {
122
+ if (!langId)
123
+ return [];
124
+ langId = String(langId);
125
+ const res = await commonRequestWidthParams(interfaceConfig, params);
126
+ if ((res == null ? void 0 : res.ReturnValue) === 1) {
127
+ const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
128
+ return (list == null ? void 0 : list.filter((item) => item.dicid === langId)) || [];
129
+ }
130
+ return [];
131
+ } catch (error) {
132
+ }
133
+ };
110
134
  export {
135
+ getLangData,
111
136
  handleCallSupportCode,
112
137
  handleFormatMobileDate,
113
138
  handleGetAttrDetail,
@@ -1,7 +1,7 @@
1
1
  import { IformConfigItem, Ijson } from './index.d';
2
2
  import { RangePickerProps } from 'antd/es/date-picker';
3
3
  import { AxiosResponse } from 'axios';
4
- export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string) => string;
4
+ export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string, langData?: Record<string, any>[]) => string;
5
5
  /**
6
6
  * 处理表单项目初始值
7
7
  * 根据输入类型转换初始值为组件所需格式
@@ -23,7 +23,7 @@ export declare const handleGetSingleAttrListObj: (children: any[]) => {
23
23
  * 20260325新增
24
24
  * 匹配语言数据
25
25
  */
26
- export declare const getTitle: (langConfig: any[], dataID?: string) => any;
26
+ export declare const getTitle: (langConfig?: any[], dataID?: string) => any;
27
27
  /**
28
28
  * 根据属性项配置处理成下拉数据
29
29
  * @param param0
@@ -3,9 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dayjs = require("dayjs");
4
4
  const antd = require("antd");
5
5
  const method = require("../../utils/method");
6
- const handleGetPlaceholder = (itemWithJson, langId) => {
6
+ const handleGetPlaceholder = (itemWithJson, langId, langData) => {
7
7
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
8
- let placeholderCn = "请输入", placeholderEn = "Please input";
8
+ let dataId = "001";
9
+ let defaultMessage = "请输入";
9
10
  if ([
10
11
  "radio",
11
12
  "checkbox",
@@ -26,14 +27,16 @@ const handleGetPlaceholder = (itemWithJson, langId) => {
26
27
  "year-picker",
27
28
  "second-picker"
28
29
  ].includes(input)) {
29
- placeholderCn = "请选择";
30
- placeholderEn = "Please select";
30
+ dataId = "002";
31
+ defaultMessage = "请选择";
31
32
  }
32
33
  if (["image", "file", "video", "audio"].includes(input)) {
33
- placeholderCn = "请上传";
34
- placeholderEn = "Please upload";
34
+ dataId = "003";
35
+ defaultMessage = "请上传";
36
+ }
37
+ if (langId && (langData == null ? void 0 : langData.length)) {
38
+ defaultMessage = getTitle(langData, dataId);
35
39
  }
36
- const defaultMessage = langId === "10001" ? placeholderCn : placeholderEn;
37
40
  return defaultMessage;
38
41
  };
39
42
  const handleSetFormItemInitialValue = (itemWithJson) => {
@@ -45,7 +48,7 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
45
48
  }
46
49
  if (inputType === "range-picker" && initialValue) {
47
50
  try {
48
- initialValue = initialValue == null ? void 0 : initialValue.split("~");
51
+ initialValue = Array.isArray(initialValue) ? initialValue : initialValue == null ? void 0 : initialValue.split("~");
49
52
  initialValue = initialValue.map((v) => v);
50
53
  } catch (error) {
51
54
  initialValue = void 0;
@@ -126,6 +129,8 @@ const handleGetSingleAttrListObj = (children) => {
126
129
  return dealList(children);
127
130
  };
128
131
  const getTitle = (langConfig, dataID) => {
132
+ if (!(langConfig == null ? void 0 : langConfig.length))
133
+ return dataID;
129
134
  const titleData = langConfig.find((x) => (x == null ? void 0 : x.dataid) === dataID);
130
135
  return (titleData == null ? void 0 : titleData.content) ?? dataID;
131
136
  };
@@ -18,6 +18,7 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'lang-page-id': string; // 语言页面id
21
22
  'operation-types'?: string[]; // 自定义按钮类型列表
22
23
  'custom-operation'?: boolean; // 是否自定义按钮
23
24
  extraDescObj?: Record<string, any>;
@@ -3,6 +3,8 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const react = require("react");
4
4
  const antd = require("antd");
5
5
  const useDynamicForm = require("./useDynamicForm");
6
+ const szxkFunc = require("../../utils/szxkFunc");
7
+ const func = require("./func");
6
8
  const DynamicForm = react.forwardRef((props, ref) => {
7
9
  const {
8
10
  formConfig,
@@ -29,13 +31,14 @@ const DynamicForm = react.forwardRef((props, ref) => {
29
31
  formListItemWidth,
30
32
  formListItemName,
31
33
  isEdit = false,
32
- langId = "10001",
34
+ langId,
33
35
  getTitle
34
36
  } = props;
35
37
  const delFileListRef = react.useRef([]);
36
38
  const updateDelFileList = (file) => {
37
39
  delFileListRef.current.push(file);
38
40
  };
41
+ const [langData, setLangData] = react.useState([]);
39
42
  const { handleRenderItem } = useDynamicForm({
40
43
  commonRequestWidthParams,
41
44
  uploadAction,
@@ -52,8 +55,26 @@ const DynamicForm = react.forwardRef((props, ref) => {
52
55
  isEdit,
53
56
  formShowType,
54
57
  langId,
55
- getTitle
58
+ getTitle,
59
+ langData
60
+ // 新增:组件库固定文字语言匹配数据
56
61
  });
62
+ react.useEffect(() => {
63
+ if (!formConfig || !langId) {
64
+ return;
65
+ }
66
+ handleGetLangData();
67
+ }, [formConfig, langId]);
68
+ const handleGetLangData = async () => {
69
+ const langData2 = await szxkFunc.getLangData({
70
+ commonRequestWidthParams,
71
+ langId,
72
+ params: {
73
+ sysid: "3"
74
+ }
75
+ });
76
+ setLangData(langData2);
77
+ };
57
78
  react.useImperativeHandle(ref, () => ({
58
79
  getDelFileList: () => {
59
80
  return delFileListRef.current;
@@ -112,9 +133,22 @@ const DynamicForm = react.forwardRef((props, ref) => {
112
133
  }) }) }, field.key))
113
134
  ] }),
114
135
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "operation", vertical: true, children: [
115
- /* @__PURE__ */ jsxRuntime.jsx("a", { className: "custom-form-list-add-btn", onClick: () => add(), children: langId === "10001" ? "新增" : "Add" }),
136
+ /* @__PURE__ */ jsxRuntime.jsx("a", { className: "custom-form-list-add-btn", onClick: () => add(), children: langId && func.getTitle(langData, "004") || "新增" }),
116
137
  (fields == null ? void 0 : fields.length) > 0 && (fields == null ? void 0 : fields.map((v, i) => {
117
- return /* @__PURE__ */ jsxRuntime.jsx("a", { className: "custom-form-list-del-btn", onClick: () => remove(v.key), children: langId === "10001" ? "删除" : "Delete" }, v.key);
138
+ return /* @__PURE__ */ jsxRuntime.jsx(
139
+ "a",
140
+ {
141
+ className: "custom-form-list-del-btn",
142
+ onClick: () => {
143
+ if (i === 0) {
144
+ return antd.message.error(langId && func.getTitle(langData, "006") || "至少保留一个表单");
145
+ }
146
+ remove(v.key);
147
+ },
148
+ children: langId && func.getTitle(langData, "005") || "删除"
149
+ },
150
+ v.key
151
+ );
118
152
  }))
119
153
  ] })
120
154
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: colSpace, children: formConfig.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
@@ -14,6 +14,7 @@ interface MyCascaderProps {
14
14
  actionUrlKey: string;
15
15
  actionUrlExtraParams: object;
16
16
  langId?: string;
17
+ langData?: any[];
17
18
  }
18
- declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, }: MyCascaderProps) => import("react").JSX.Element;
19
+ declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, langData, }: MyCascaderProps) => import("react").JSX.Element;
19
20
  export default MyCascader;
@@ -2,6 +2,7 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const antd = require("antd");
4
4
  const react = require("react");
5
+ const func = require("../func");
5
6
  const MyCascader = ({
6
7
  item,
7
8
  readonly,
@@ -14,7 +15,8 @@ const MyCascader = ({
14
15
  interfaceTypeSysDict,
15
16
  actionUrlKey,
16
17
  actionUrlExtraParams,
17
- langId = "10001"
18
+ langId,
19
+ langData
18
20
  }) => {
19
21
  const [options, setOptions] = react.useState([]);
20
22
  const [loading, setLoading] = react.useState(false);
@@ -72,7 +74,7 @@ const MyCascader = ({
72
74
  setOptions(dictionaryOptions);
73
75
  }
74
76
  } catch (error) {
75
- message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
77
+ message.error(langId ? func.getTitle(langData, "008") : "加载数据失败");
76
78
  } finally {
77
79
  setLoading(false);
78
80
  }
@@ -90,7 +92,7 @@ const MyCascader = ({
90
92
  const searchFields = (item == null ? void 0 : item["search-field"]) || [];
91
93
  const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "-";
92
94
  if (!list.length) {
93
- message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
95
+ message.error(langId ? func.getTitle(langData, "009") : "请配置key-field");
94
96
  return;
95
97
  }
96
98
  const params = {
@@ -125,7 +127,7 @@ const MyCascader = ({
125
127
  }
126
128
  reject([]);
127
129
  } catch (error) {
128
- message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
130
+ message.error(langId ? func.getTitle(langData, "008") : "加载数据失败");
129
131
  reject([]);
130
132
  } finally {
131
133
  reject([]);
@@ -146,7 +148,7 @@ const MyCascader = ({
146
148
  {
147
149
  showSearch: { filter },
148
150
  loading,
149
- placeholder: "请选择",
151
+ placeholder: langId ? func.getTitle(langData, "002") : "请选择",
150
152
  loadData,
151
153
  disabled: readonly,
152
154
  onChange: handleChange,
@@ -159,16 +161,12 @@ const MyCascader = ({
159
161
  const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
160
162
  const searchFields = (item == null ? void 0 : item["search-field"]) || [];
161
163
  if (!list.length || !searchFields.length) {
162
- message.error(
163
- langId === "10001" ? "请配置key-field和search-field" : "Please configure key-field and search-field"
164
- );
164
+ message.error(langId ? func.getTitle(langData, "009") : "请配置key-field和search-field");
165
165
  return;
166
166
  }
167
167
  const targetFieldIndex = list.findIndex((item2) => item2 === searchFields[0]);
168
168
  if (targetFieldIndex === -1) {
169
- message.error(
170
- langId === "10001" ? "key-field与search-field配置不匹配" : "key-field and search-field configuration does not match"
171
- );
169
+ message.error(langId ? func.getTitle(langData, "010") : "key-field与search-field配置不匹配");
172
170
  return;
173
171
  }
174
172
  const values = value.map((v) => {
@@ -7,7 +7,7 @@ export interface IMYRadio {
7
7
  value?: string | number;
8
8
  item: Ijson;
9
9
  readonly?: boolean;
10
- options?: any;
10
+ params?: any;
11
11
  radioAlign?: 'vertical' | 'horizontal';
12
12
  handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
13
13
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
@@ -16,6 +16,10 @@ export interface IMYRadio {
16
16
  interfaceTypeSysDict: string;
17
17
  actionUrlKey: string;
18
18
  actionUrlExtraParams: object;
19
+ getTitle?: (pageID: string, dataID: string) => string;
20
+ attrid: string;
21
+ langId?: string;
22
+ langData?: any;
19
23
  }
20
24
  declare const MyRadio: (props: IMYRadio) => import("react").JSX.Element;
21
25
  export default MyRadio;
@@ -3,12 +3,13 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const antd = require("antd");
4
4
  const react = require("react");
5
5
  const func = require("../func");
6
+ const szxkFunc = require("szld-libs/es/utils/szxkFunc");
6
7
  const MyRadio = (props) => {
7
8
  const {
8
9
  item,
9
10
  onChange,
10
11
  readonly = false,
11
- options,
12
+ params,
12
13
  radioAlign = "horizontal",
13
14
  commonRequestWidthParams,
14
15
  commonRequest,
@@ -16,34 +17,79 @@ const MyRadio = (props) => {
16
17
  interfaceTypeDict,
17
18
  interfaceTypeSysDict,
18
19
  actionUrlKey,
19
- actionUrlExtraParams
20
+ actionUrlExtraParams,
21
+ getTitle,
22
+ attrid,
23
+ langId,
24
+ langData
20
25
  } = props;
26
+ const [loading, setLoading] = react.useState(false);
21
27
  const [list, setList] = react.useState([]);
28
+ const [instanceList, setInstanceList] = react.useState([]);
22
29
  react.useEffect(() => {
23
30
  handleLoadOptions();
24
31
  }, [item.inputType, item.classify, item.data, item.options]);
25
32
  const handleLoadOptions = async () => {
26
- const list2 = await func.handleSelectOptions({
27
- commonRequestWidthParams,
28
- commonRequest,
29
- interfaceTypeDict,
30
- interfaceTypeSysDict,
31
- actionUrlKey,
32
- actionUrlExtraParams,
33
- item
34
- });
35
- setList(list2);
33
+ try {
34
+ setLoading(true);
35
+ if (item.inputType === "instance-url" && (item == null ? void 0 : item["instance-source-number"]) && attrid) {
36
+ const keyField = item == null ? void 0 : item["key-field"];
37
+ if (!keyField) {
38
+ antd.message.warning(langId ? func.getTitle(langData, "010") : "请配置key-field");
39
+ return;
40
+ }
41
+ const params2 = {
42
+ "source-number": item == null ? void 0 : item["instance-source-number"]
43
+ };
44
+ let list3 = await szxkFunc.handleGetList(params2, commonRequestWidthParams);
45
+ const controlPanelConfig = await szxkFunc.handleGetControlPanelConfig(item == null ? void 0 : item["instance-source-number"], commonRequest);
46
+ if (controlPanelConfig) {
47
+ const nonUniversalHeader = (controlPanelConfig == null ? void 0 : controlPanelConfig["non-universal-header"]) || [];
48
+ const labelConfig = (nonUniversalHeader == null ? void 0 : nonUniversalHeader["label"]) || [];
49
+ const valueConfig = (keyField == null ? void 0 : keyField[attrid]) || {};
50
+ const options = list3 == null ? void 0 : list3.map((v) => {
51
+ const label = labelConfig == null ? void 0 : labelConfig.map((x) => v == null ? void 0 : v[x]).join("-");
52
+ const { list: list4, delimiter } = valueConfig;
53
+ const value2 = list4 == null ? void 0 : list4.map((x) => v == null ? void 0 : v[x]).join(delimiter || "-");
54
+ if (!label) {
55
+ return null;
56
+ }
57
+ return {
58
+ label: getTitle == null ? void 0 : getTitle((item == null ? void 0 : item["lang-page-id"]) || "5000000", label || label),
59
+ value: value2
60
+ };
61
+ });
62
+ setList(options);
63
+ setInstanceList(list3);
64
+ }
65
+ setLoading(false);
66
+ return;
67
+ }
68
+ const list2 = await func.handleSelectOptions({
69
+ commonRequestWidthParams,
70
+ commonRequest,
71
+ interfaceTypeDict,
72
+ interfaceTypeSysDict,
73
+ actionUrlKey,
74
+ actionUrlExtraParams,
75
+ item
76
+ });
77
+ setList(list2);
78
+ setLoading(false);
79
+ } catch (error) {
80
+ setLoading(false);
81
+ }
36
82
  };
37
- return /* @__PURE__ */ jsxRuntime.jsx(
83
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, children: /* @__PURE__ */ jsxRuntime.jsx(
38
84
  antd.Radio.Group,
39
85
  {
40
- ...options,
86
+ ...params,
41
87
  options: list,
42
88
  onChange,
43
89
  disabled: readonly,
44
90
  value,
45
91
  style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" }
46
92
  }
47
- );
93
+ ) });
48
94
  };
49
95
  module.exports = MyRadio;
@@ -6,6 +6,7 @@ interface IMyRichTextProps {
6
6
  value: string;
7
7
  langId?: string;
8
8
  onChange: (val: string) => void;
9
+ langData?: any;
9
10
  }
10
- declare const MyRichText: ({ item, readonly, style, value, langId, onChange }: IMyRichTextProps) => import("react").JSX.Element | null;
11
+ declare const MyRichText: ({ item, readonly, style, value, langId, langData, onChange }: IMyRichTextProps) => import("react").JSX.Element | null;
11
12
  export default MyRichText;