szld-libs 0.4.49 → 0.4.51

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 (70) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +20249 -19514
  3. package/dist/szld-components.umd.js +229 -113
  4. package/es/components/DynamicForm/func.d.ts +2 -2
  5. package/es/components/DynamicForm/func.js +12 -7
  6. package/es/components/DynamicForm/index.d.ts +1 -0
  7. package/es/components/DynamicForm/index.js +41 -7
  8. package/es/components/DynamicForm/myCascader/index.d.ts +2 -1
  9. package/es/components/DynamicForm/myCascader/index.js +9 -11
  10. package/es/components/DynamicForm/myRadio/index.d.ts +5 -1
  11. package/es/components/DynamicForm/myRadio/index.js +63 -17
  12. package/es/components/DynamicForm/myRichText/index.d.ts +3 -1
  13. package/es/components/DynamicForm/myRichText/index.js +20 -30
  14. package/es/components/DynamicForm/mySelect/index.js +1 -1
  15. package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +1 -1
  16. package/es/components/DynamicForm/useDynamicForm.d.ts +1 -0
  17. package/es/components/DynamicForm/useDynamicForm.js +23 -19
  18. package/es/components/DynamicFormMobile/func.js +4 -0
  19. package/es/components/DynamicFormMobile/myRichText/enmu.d.ts +5 -0
  20. package/es/components/DynamicFormMobile/myRichText/enmu.js +68 -0
  21. package/es/components/DynamicFormMobile/myRichText/index.d.ts +11 -0
  22. package/es/components/DynamicFormMobile/myRichText/index.js +291 -0
  23. package/es/components/DynamicFormMobile/myRichText/vite.svg +1 -0
  24. package/es/components/DynamicFormMobile/mySelect/index.css +9 -1
  25. package/es/components/DynamicFormMobile/mySelect/index.d.ts +1 -1
  26. package/es/components/DynamicFormMobile/mySelect/index.js +55 -24
  27. package/es/components/DynamicFormMobile/myUpload/index.d.ts +1 -1
  28. package/es/components/DynamicFormMobile/selectModel/index.d.ts +1 -1
  29. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +1 -1
  30. package/es/components/DynamicFormMobile/useDynamicForm.d.ts +2 -2
  31. package/es/components/DynamicFormMobile/useDynamicForm.js +19 -4
  32. package/es/index.js +1 -1
  33. package/es/utils/szxkFunc.d.ts +11 -0
  34. package/es/utils/szxkFunc.js +25 -0
  35. package/lib/components/DynamicForm/func.d.ts +2 -2
  36. package/lib/components/DynamicForm/func.js +12 -7
  37. package/lib/components/DynamicForm/index.d.ts +1 -0
  38. package/lib/components/DynamicForm/index.js +38 -4
  39. package/lib/components/DynamicForm/myCascader/index.d.ts +2 -1
  40. package/lib/components/DynamicForm/myCascader/index.js +9 -11
  41. package/lib/components/DynamicForm/myRadio/index.d.ts +5 -1
  42. package/lib/components/DynamicForm/myRadio/index.js +61 -15
  43. package/lib/components/DynamicForm/myRichText/index.d.ts +3 -1
  44. package/lib/components/DynamicForm/myRichText/index.js +19 -29
  45. package/lib/components/DynamicForm/mySelect/index.js +1 -1
  46. package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +1 -1
  47. package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -0
  48. package/lib/components/DynamicForm/useDynamicForm.js +19 -15
  49. package/lib/components/DynamicFormMobile/func.js +4 -0
  50. package/lib/components/DynamicFormMobile/myRichText/enmu.d.ts +5 -0
  51. package/lib/components/DynamicFormMobile/myRichText/enmu.js +68 -0
  52. package/lib/components/DynamicFormMobile/myRichText/index.d.ts +11 -0
  53. package/lib/components/DynamicFormMobile/myRichText/index.js +290 -0
  54. package/lib/components/DynamicFormMobile/myRichText/vite.svg +1 -0
  55. package/lib/components/DynamicFormMobile/mySelect/index.css +9 -1
  56. package/lib/components/DynamicFormMobile/mySelect/index.d.ts +1 -1
  57. package/lib/components/DynamicFormMobile/mySelect/index.js +55 -24
  58. package/lib/components/DynamicFormMobile/myUpload/index.d.ts +1 -1
  59. package/lib/components/DynamicFormMobile/selectModel/index.d.ts +1 -1
  60. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +1 -1
  61. package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +2 -2
  62. package/lib/components/DynamicFormMobile/useDynamicForm.js +19 -4
  63. package/lib/index.js +1 -1
  64. package/lib/utils/szxkFunc.d.ts +11 -0
  65. package/lib/utils/szxkFunc.js +25 -0
  66. package/package.json +2 -1
  67. package/es/utils/enum.d.ts +0 -4
  68. package/es/utils/enum.js +0 -10
  69. package/lib/utils/enum.d.ts +0 -4
  70. package/lib/utils/enum.js +0 -10
@@ -1,14 +1,16 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
+ import { handleGetList, handleGetControlPanelConfig } from "../../../utils/szxkFunc";
2
3
  import { handleSelectOptions, findRowByValue } from "../../DynamicForm/func";
3
4
  import { Toast, Field, Popup, Checkbox, Picker } from "react-vant";
4
5
  import { useState, useEffect } from "react";
5
6
  import { Flex } from "antd";
6
- import { handleGetList, handleGetControlPanelConfig } from "../../../utils/szxkFunc";
7
7
  const checkboxGroup = "index-module_checkbox-group_4684b";
8
8
  const checkboxGroupHeader = "index-module_checkbox-group-header_192bd";
9
9
  const checkboxGroupContent = "index-module_checkbox-group-content_f81a1";
10
10
  const checkboxItem = "index-module_checkbox-item_1b36c";
11
11
  const checkboxGroupCancel = "index-module_checkbox-group-cancel_c5cfb";
12
+ const checkboxGroupCheckAll = "index-module_checkbox-group-check-all_1e608";
13
+ const item = "index-module_item_4fef5";
12
14
  const styles = {
13
15
  "checkbox-group": "index-module_checkbox-group_4684b",
14
16
  checkboxGroup,
@@ -19,10 +21,13 @@ const styles = {
19
21
  "checkbox-item": "index-module_checkbox-item_1b36c",
20
22
  checkboxItem,
21
23
  "checkbox-group-cancel": "index-module_checkbox-group-cancel_c5cfb",
22
- checkboxGroupCancel
24
+ checkboxGroupCancel,
25
+ "checkbox-group-check-all": "index-module_checkbox-group-check-all_1e608",
26
+ checkboxGroupCheckAll,
27
+ item
23
28
  };
24
29
  const MySelect = ({
25
- item,
30
+ item: item2,
26
31
  readonly,
27
32
  style,
28
33
  commonRequestWidthParams,
@@ -37,29 +42,34 @@ const MySelect = ({
37
42
  getTitle,
38
43
  attrid
39
44
  }) => {
45
+ var _a;
40
46
  const [options, setOptions] = useState([]);
41
47
  const [instanceList, setInstanceList] = useState([]);
48
+ const [isAllChecked, setIsAllChecked] = useState(false);
49
+ const [showPopup, setShowPopup] = useState(false);
50
+ const [selectedValues, setSelectedValues] = useState([]);
51
+ const [confirmValues, setConfirmValues] = useState([]);
42
52
  useEffect(() => {
43
- if (item.input === "mult-select" && value && Array.isArray(value)) {
53
+ if (item2.input === "mult-select" && value && Array.isArray(value)) {
44
54
  setSelectedValues(value || []);
45
55
  setConfirmValues(value || []);
46
56
  }
47
57
  }, [value]);
48
58
  useEffect(() => {
49
59
  handleLoadOptions();
50
- }, [item.inputType, item.classify, item.data, item.options]);
60
+ }, [item2.inputType, item2.classify, item2.data, item2.options]);
51
61
  const handleLoadOptions = async () => {
52
- if (item.inputType === "instance-url" && (item == null ? void 0 : item["instance-source-number"]) && attrid) {
53
- const keyField = item == null ? void 0 : item["key-field"];
62
+ if (item2.inputType === "instance-url" && (item2 == null ? void 0 : item2["instance-source-number"]) && attrid) {
63
+ const keyField = item2 == null ? void 0 : item2["key-field"];
54
64
  if (!keyField) {
55
65
  Toast("请配置key-field");
56
66
  return;
57
67
  }
58
68
  const params = {
59
- "source-number": item == null ? void 0 : item["instance-source-number"]
69
+ "source-number": item2 == null ? void 0 : item2["instance-source-number"]
60
70
  };
61
71
  let list2 = await handleGetList(params, commonRequestWidthParams);
62
- const controlPanelConfig = await handleGetControlPanelConfig(item == null ? void 0 : item["instance-source-number"], commonRequest);
72
+ const controlPanelConfig = await handleGetControlPanelConfig(item2 == null ? void 0 : item2["instance-source-number"], commonRequest);
63
73
  if (controlPanelConfig) {
64
74
  const nonUniversalHeader = (controlPanelConfig == null ? void 0 : controlPanelConfig["non-universal-header"]) || [];
65
75
  const labelConfig = (nonUniversalHeader == null ? void 0 : nonUniversalHeader["label"]) || [];
@@ -88,14 +98,11 @@ const MySelect = ({
88
98
  interfaceTypeSysDict,
89
99
  actionUrlKey,
90
100
  actionUrlExtraParams,
91
- item
101
+ item: item2
92
102
  });
93
103
  setOptions(list);
94
104
  };
95
- const [showPopup, setShowPopup] = useState(false);
96
- const [selectedValues, setSelectedValues] = useState([]);
97
- const [confirmValues, setConfirmValues] = useState([]);
98
- return /* @__PURE__ */ jsx(Fragment, { children: item.input === "mult-select" ? /* @__PURE__ */ jsxs("div", { style: { width: "100%", ...style }, children: [
105
+ return /* @__PURE__ */ jsx(Fragment, { children: item2.input === "mult-select" ? /* @__PURE__ */ jsxs("div", { style: { width: "100%", ...style }, children: [
99
106
  /* @__PURE__ */ jsx(
100
107
  Field,
101
108
  {
@@ -109,7 +116,7 @@ const MySelect = ({
109
116
  setSelectedValues([...confirmValues]);
110
117
  setShowPopup(true);
111
118
  },
112
- placeholder: langId === "10001" ? (item == null ? void 0 : item["default-prompt"]) || "请选择" : (item == null ? void 0 : item["default-prompt"]) || "Please select"
119
+ placeholder: langId === "10001" ? (item2 == null ? void 0 : item2["default-prompt"]) || "请选择" : (item2 == null ? void 0 : item2["default-prompt"]) || "Please select"
113
120
  }
114
121
  ),
115
122
  /* @__PURE__ */ jsx(
@@ -135,14 +142,38 @@ const MySelect = ({
135
142
  }
136
143
  )
137
144
  ] }),
145
+ (item2 == null ? void 0 : item2["custom-operation"]) && item2.input === "mult-select" && ((_a = item2 == null ? void 0 : item2["operation-types"]) == null ? void 0 : _a.includes("check-all")) && /* @__PURE__ */ jsx("div", { className: styles["checkbox-group-check-all"], children: /* @__PURE__ */ jsx(
146
+ Checkbox,
147
+ {
148
+ className: styles["item"],
149
+ shape: "square",
150
+ checked: isAllChecked,
151
+ onChange: (v) => {
152
+ setIsAllChecked(v);
153
+ setSelectedValues(v ? options.map((item22) => item22.value) : []);
154
+ },
155
+ children: langId === "10001" ? "全选" : "check all"
156
+ }
157
+ ) }),
138
158
  /* @__PURE__ */ jsx(
139
159
  "div",
140
160
  {
141
161
  style: {
142
- height: " calc(60vh - 70px)"
162
+ height: " calc(60vh - 126px)"
143
163
  },
144
164
  className: styles["checkbox-group-content"],
145
- children: /* @__PURE__ */ jsx(Checkbox.Group, { iconSize: "18", onChange: (v) => setSelectedValues(v), value: selectedValues, children: options.map((item2) => /* @__PURE__ */ jsx(Checkbox, { shape: "square", className: styles["checkbox-item"], name: item2.value, children: item2.label }, item2.value)) })
165
+ children: /* @__PURE__ */ jsx(
166
+ Checkbox.Group,
167
+ {
168
+ iconSize: "18",
169
+ onChange: (v) => {
170
+ setSelectedValues(v);
171
+ setIsAllChecked((v == null ? void 0 : v.length) === (options == null ? void 0 : options.length));
172
+ },
173
+ value: selectedValues,
174
+ children: options.map((item22) => /* @__PURE__ */ jsx(Checkbox, { shape: "square", className: styles["checkbox-item"], name: item22.value, children: item22.label }, item22.value))
175
+ }
176
+ )
146
177
  }
147
178
  )
148
179
  ] })
@@ -158,8 +189,8 @@ const MySelect = ({
158
189
  text: "label"
159
190
  },
160
191
  onConfirm: (val) => {
161
- if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (item == null ? void 0 : item.inputType) === "instance-url") {
162
- const keyField = item == null ? void 0 : item["key-field"];
192
+ if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (item2 == null ? void 0 : item2.inputType) === "instance-url") {
193
+ const keyField = item2 == null ? void 0 : item2["key-field"];
163
194
  const row = findRowByValue(instanceList, String(val));
164
195
  const keys = Object.keys(keyField || {});
165
196
  const newObj = keys == null ? void 0 : keys.reduce((prev, cur) => {
@@ -174,16 +205,16 @@ const MySelect = ({
174
205
  onChange(val);
175
206
  },
176
207
  children: (val, _, actions) => {
177
- var _a;
208
+ var _a2;
178
209
  val = val || value;
179
210
  let str = "";
180
211
  if (Array.isArray(val)) {
181
212
  str = (val == null ? void 0 : val.map((v) => {
182
- var _a2;
183
- return ((_a2 = options.find((x) => x.value === v)) == null ? void 0 : _a2.label) || v;
213
+ var _a3;
214
+ return ((_a3 = options.find((x) => x.value === v)) == null ? void 0 : _a3.label) || v;
184
215
  }).join(",")) || "";
185
216
  }
186
- str = ((_a = options.find((v) => v.value === val)) == null ? void 0 : _a.label) || val;
217
+ str = ((_a2 = options.find((v) => v.value === val)) == null ? void 0 : _a2.label) || val;
187
218
  return /* @__PURE__ */ jsx(
188
219
  Field,
189
220
  {
@@ -191,7 +222,7 @@ const MySelect = ({
191
222
  isLink: true,
192
223
  readOnly: true,
193
224
  clickable: true,
194
- placeholder: langId === "10001" ? (item == null ? void 0 : item["default-prompt"]) || "请选择" : (item == null ? void 0 : item["default-prompt"]) || "Please select",
225
+ placeholder: langId === "10001" ? (item2 == null ? void 0 : item2["default-prompt"]) || "请选择" : (item2 == null ? void 0 : item2["default-prompt"]) || "Please select",
195
226
  value: str,
196
227
  onClick: () => {
197
228
  if (readonly)
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { UploadFile } from 'antd/es/upload/interface';
3
- import { Ijson } from '../index.d';
3
+ import { Ijson } from '../../DynamicForm/index.d';
4
4
  interface IMYUpload {
5
5
  action?: string;
6
6
  onChange?: (checkedValue: any[]) => void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AxiosResponse } from 'axios';
3
- import { Ijson } from '../index.d';
3
+ import { Ijson } from '../../DynamicForm/index.d';
4
4
  interface SelectModelProps {
5
5
  item: Ijson;
6
6
  onSure: (value: string) => void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AxiosResponse } from 'axios';
3
- import { Ijson } from '../index.d';
3
+ import { Ijson } from '../../DynamicForm/index.d';
4
4
  import { FormInstance } from 'react-vant';
5
5
  interface SelectModelProps {
6
6
  item: Ijson;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { IformConfigItem, IformItemStyle } from '../DynamicForm/index.d';
3
- import { AxiosResponse } from 'axios';
4
2
  import { FormListFieldData, UploadFile } from 'antd';
3
+ import { IformConfigItem, IformItemStyle } from '../DynamicForm/index.d';
5
4
  import { FormInstance } from 'react-vant';
5
+ import { AxiosResponse } from 'axios';
6
6
  interface IDynamicFormProps {
7
7
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
8
8
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
@@ -1,21 +1,22 @@
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 } from "./func";
3
+ import { App, Col, Collapse, Card, Flex, Button, DatePicker, Tooltip } from "antd";
4
4
  import { handleUrlOptions, getJson, base64ToString } from "../../utils/method";
5
+ import { handleSetFormItemInitialValue, handleGetPlaceholder } from "./func";
5
6
  import SelectModelBackfillFormItem from "./selectModelBackfillFormItem";
7
+ import { Form, Input, DatetimePicker } from "react-vant";
6
8
  import { useRef, useEffect, useCallback, Fragment } from "react";
7
9
  import isoWeek from "dayjs/plugin/isoWeek";
8
10
  import SelectModel from "./selectModel";
9
11
  import MyCheckbox from "./myCheckbox";
10
12
  import MyCascader from "./myCascader";
13
+ import MyCalendar from "./myCalendar";
14
+ import MyRichText from "./myRichText";
11
15
  import dayjs from "dayjs";
12
16
  import RadioCard from "./radioCard";
13
17
  import MySelect from "./mySelect";
14
18
  import MyUpload from "./myUpload";
15
19
  import MyRadio from "./myRadio";
16
- import { App, Col, Collapse, Card, Flex, Button, DatePicker, Tooltip } from "antd";
17
- import { Form, Input, DatetimePicker } from "react-vant";
18
- import MyCalendar from "./myCalendar";
19
20
  dayjs.extend(isoWeek);
20
21
  function useDynamicForm(props) {
21
22
  const {
@@ -757,6 +758,20 @@ function useDynamicForm(props) {
757
758
  commonRequestWidthParams
758
759
  }
759
760
  );
761
+ case "rich-text":
762
+ return /* @__PURE__ */ jsx(
763
+ MyRichText,
764
+ {
765
+ langId,
766
+ readonly,
767
+ item: item.json,
768
+ onChange: (val) => {
769
+ form.setFieldValue(item.attrid, val);
770
+ },
771
+ value: formatValue,
772
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
773
+ }
774
+ );
760
775
  default:
761
776
  return /* @__PURE__ */ jsx(
762
777
  Input,
package/es/index.js CHANGED
@@ -15,7 +15,7 @@ const Demo = () => {
15
15
  const formRef = useRef(null);
16
16
  const [form] = Form.useForm();
17
17
  const [list, setList] = useState([]);
18
- const [langId, setLangId] = useState("");
18
+ const [langId, setLangId] = useState("10002");
19
19
  const onValuesChange = async (values, allValues) => {
20
20
  };
21
21
  useEffect(() => {
@@ -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) => {
@@ -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;