szld-libs 0.3.43 → 0.3.46

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.
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dayjs = require("dayjs");
4
- const antd = require("antd");
5
4
  const handleGetPlaceholder = (itemWithJson, langId) => {
6
5
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
7
6
  let placeholderCn = "请输入", placeholderEn = "Please input";
@@ -115,108 +114,8 @@ const handleGetSingleAttrListObj = (children) => {
115
114
  });
116
115
  return dealList(children);
117
116
  };
118
- const getTitle = (langConfig, dataID) => {
119
- const titleData = langConfig.find((x) => (x == null ? void 0 : x.dataid) === dataID);
120
- return (titleData == null ? void 0 : titleData.content) ?? dataID;
121
- };
122
- const handleSelectOptions = async ({
123
- commonRequestWidthParams,
124
- commonRequest,
125
- interfaceTypeDict = "YLZDDictList",
126
- interfaceTypeSysDict = "YLZDSysConfigList",
127
- actionUrlKey = "action-url",
128
- actionUrlExtraParams = {},
129
- item,
130
- langConfig
131
- }) => {
132
- var _a;
133
- let options = [];
134
- const getDict = async (interfaceType) => {
135
- var _a2;
136
- let list = [];
137
- if (item.classify) {
138
- try {
139
- const response = await commonRequest(interfaceType, {
140
- asctypeid: item.classify
141
- });
142
- if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
143
- list = response.data.list.map((dictItem) => ({
144
- label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
145
- value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
146
- }));
147
- }
148
- } catch (error) {
149
- antd.message.error("加载选项失败");
150
- }
151
- }
152
- return list;
153
- };
154
- const getUrlOptions = async () => {
155
- var _a2, _b;
156
- try {
157
- const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
158
- const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
159
- const fileNames = item == null ? void 0 : item["field-names"];
160
- if (!keyFieldList.length) {
161
- antd.message.error("请配置key-field");
162
- return;
163
- }
164
- const response = await commonRequestWidthParams(
165
- {
166
- PageName: "dns_relay",
167
- Controlname: "CallActionUrl",
168
- InterfaceType: ""
169
- },
170
- {
171
- [actionUrlKey]: item == null ? void 0 : item["action-url"],
172
- ...actionUrlExtraParams
173
- }
174
- );
175
- if (response == null ? void 0 : response.data) {
176
- const data = response == null ? void 0 : response.data;
177
- const list = (data == null ? void 0 : data.list) || [];
178
- let urlData = [];
179
- if (Array.isArray(data)) {
180
- urlData = data;
181
- }
182
- if (Array.isArray(list)) {
183
- urlData = list;
184
- }
185
- if (fileNames) {
186
- options = urlData;
187
- } else {
188
- options = urlData.map((val) => ({
189
- label: handleUrlOptions(val, delimiter, keyFieldList),
190
- value: handleUrlOptions(val, delimiter, keyFieldList)
191
- }));
192
- }
193
- }
194
- } catch (error) {
195
- antd.message.error("加载选项失败");
196
- }
197
- };
198
- if (item.inputType === "local") {
199
- options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
200
- label: (langConfig == null ? void 0 : langConfig.length) ? getTitle(langConfig, val) : val,
201
- value: val
202
- }))) || [];
203
- if (item.options && Array.isArray(item.options)) {
204
- options = item.options;
205
- }
206
- } else if (item.inputType === "dictionary") {
207
- options = await getDict(interfaceTypeDict);
208
- } else if (item.inputType === "system-dictionary") {
209
- options = await getDict(interfaceTypeSysDict);
210
- }
211
- if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
212
- await getUrlOptions();
213
- }
214
- return options;
215
- };
216
117
  exports.disabledDate = disabledDate;
217
- exports.getTitle = getTitle;
218
118
  exports.handleGetPlaceholder = handleGetPlaceholder;
219
119
  exports.handleGetSingleAttrListObj = handleGetSingleAttrListObj;
220
- exports.handleSelectOptions = handleSelectOptions;
221
120
  exports.handleSetFormItemInitialValue = handleSetFormItemInitialValue;
222
121
  exports.handleUrlOptions = handleUrlOptions;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const func = require("../func");
4
3
  const reactVant = require("react-vant");
4
+ const method = require("../../../utils/method");
5
5
  const react = require("react");
6
6
  const antd = require("antd");
7
7
  const checkboxGroup = "index-module_checkbox-group_4684b";
@@ -46,7 +46,7 @@ const MySelect = ({
46
46
  handleLoadOptions();
47
47
  }, [item.inputType, item.classify, item.data, item.options]);
48
48
  const handleLoadOptions = async () => {
49
- const list = await func.handleSelectOptions({
49
+ const list = await method.handleSelectOptions({
50
50
  commonRequestWidthParams,
51
51
  commonRequest,
52
52
  interfaceTypeDict,
@@ -107,6 +107,11 @@ export declare const handleAttrListToObjDetail: ({ attrList, params, extra, comm
107
107
  * 将URL中的指定字段拼接为字符串
108
108
  */
109
109
  export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
110
+ /**
111
+ * 20260325新增
112
+ * 匹配语言数据
113
+ */
114
+ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
110
115
  /**
111
116
  * 根据属性项配置处理成下拉数据
112
117
  * @param param0
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const antd = require("antd");
4
4
  const dayjs = require("dayjs");
5
5
  const _ = require("lodash");
6
- const func = require("../components/DynamicForm/func");
7
6
  function getJson(jsonStr) {
8
7
  try {
9
8
  return JSON.parse(jsonStr);
@@ -444,6 +443,10 @@ const handleUrlOptions = (val, delimiter, list) => {
444
443
  });
445
444
  return arr.join(delimiter || "-");
446
445
  };
446
+ const getTitle = (langConfig, dataID) => {
447
+ const titleData = langConfig.find((x) => (x == null ? void 0 : x.dataid) === dataID);
448
+ return (titleData == null ? void 0 : titleData.content) ?? dataID;
449
+ };
447
450
  const handleSelectOptions = async ({
448
451
  commonRequestWidthParams,
449
452
  commonRequest,
@@ -522,7 +525,7 @@ const handleSelectOptions = async ({
522
525
  };
523
526
  if (item.inputType === "local") {
524
527
  options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
525
- label: (langConfig == null ? void 0 : langConfig.length) ? func.getTitle(langConfig, val) : val,
528
+ label: (langConfig == null ? void 0 : langConfig.length) ? getTitle(langConfig, val) : val,
526
529
  value: val
527
530
  }))) || [];
528
531
  if (item.options && Array.isArray(item.options)) {
@@ -546,6 +549,7 @@ const handleObjDetailToSignleAttrList = (attrList, detail) => {
546
549
  };
547
550
  exports.base64ToString = base64ToString;
548
551
  exports.getJson = getJson;
552
+ exports.getTitle = getTitle;
549
553
  exports.handleAttrList = handleAttrList;
550
554
  exports.handleAttrListToObj = handleAttrListToObj;
551
555
  exports.handleAttrListToObjDetail = handleAttrListToObjDetail;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.3.43",
4
+ "version": "0.3.46",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",