szld-libs 0.3.46 → 0.3.48

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.
@@ -140,7 +140,7 @@ function useDynamicForm(props) {
140
140
  var _a, _b, _c, _d, _e;
141
141
  return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 10, vertical: instructionShowMode === "flex", align: "center", children: [
142
142
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: itemWithJson.attrname }),
143
- ((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: method.getTitle(langConfig, (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b.instruction), children: /* @__PURE__ */ jsxRuntime.jsx(
143
+ ((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: func.getTitle(langConfig, (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b.instruction), children: /* @__PURE__ */ jsxRuntime.jsx(
144
144
  icons.InfoCircleOutlined,
145
145
  {
146
146
  style: {
@@ -149,7 +149,7 @@ function useDynamicForm(props) {
149
149
  cursor: "pointer"
150
150
  }
151
151
  }
152
- ) }) || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: method.getTitle(langConfig, (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction) })
152
+ ) }) || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: func.getTitle(langConfig, (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction) })
153
153
  ] });
154
154
  };
155
155
  const renderNestedFormList = react.useCallback(
@@ -296,7 +296,7 @@ function useDynamicForm(props) {
296
296
  }
297
297
  if (itemWithJson.attrtype === 0) {
298
298
  const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
299
- const message2 = method.getTitle(langConfig, (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"]);
299
+ const message2 = func.getTitle(langConfig, (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"]);
300
300
  const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
301
301
  const { combinations = [] } = itemWithJson.json || {};
302
302
  if (combinations == null ? void 0 : combinations.length) {
@@ -338,7 +338,7 @@ function useDynamicForm(props) {
338
338
  ...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
339
339
  {
340
340
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
341
- message: method.getTitle(langConfig, (_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
341
+ message: func.getTitle(langConfig, (_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
342
342
  }
343
343
  ] : []
344
344
  ],
@@ -378,7 +378,7 @@ function useDynamicForm(props) {
378
378
  ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
379
379
  {
380
380
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
381
- message: method.getTitle(langConfig, (_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
381
+ message: func.getTitle(langConfig, (_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
382
382
  }
383
383
  ] : []
384
384
  ],
@@ -438,7 +438,7 @@ function useDynamicForm(props) {
438
438
  const format = ((_a = item.json) == null ? void 0 : _a.format) || "";
439
439
  const attrid = item.attrid;
440
440
  const formatValue = func.handleSetFormItemInitialValue(item);
441
- const message2 = method.getTitle(langConfig, (_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
441
+ const message2 = func.getTitle(langConfig, (_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
442
442
  const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
443
443
  const placeholder = func.handleGetPlaceholder(item, langId);
444
444
  const params = item.json.length && {
@@ -1,5 +1,6 @@
1
- import { IformConfigItem } from './index.d';
1
+ import { IformConfigItem, Ijson } from './index.d';
2
2
  import { RangePickerProps } from 'antd/es/date-picker';
3
+ import { AxiosResponse } from 'axios';
3
4
  export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem, langId?: string) => string;
4
5
  /**
5
6
  * 处理表单项目初始值
@@ -18,3 +19,30 @@ export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]
18
19
  export declare const handleGetSingleAttrListObj: (children: any[]) => {
19
20
  [key: string]: any;
20
21
  }[];
22
+ /**
23
+ * 20260325新增
24
+ * 匹配语言数据
25
+ */
26
+ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
27
+ /**
28
+ * 根据属性项配置处理成下拉数据
29
+ * @param param0
30
+ * @returns
31
+ */
32
+ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, langConfig, }: {
33
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
34
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
35
+ interfaceTypeDict?: string | undefined;
36
+ interfaceTypeSysDict?: string | undefined;
37
+ actionUrlKey?: string | undefined;
38
+ actionUrlExtraParams?: object | undefined;
39
+ item: Ijson;
40
+ langConfig?: any[] | undefined;
41
+ }) => Promise<any[]>;
42
+ /**
43
+ * 单层详情数据对应到单个属性集
44
+ * @param attrList 属性集列表
45
+ * @param detail 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
46
+ * @returns 处理后的属性集列表,每个属性项包含attrvalue
47
+ */
48
+ export declare const handleObjDetailToSignleAttrList: (attrList: any[], detail: any) => any[];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dayjs = require("dayjs");
4
+ const antd = require("antd");
4
5
  const handleGetPlaceholder = (itemWithJson, langId) => {
5
6
  const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
6
7
  let placeholderCn = "请输入", placeholderEn = "Please input";
@@ -114,8 +115,115 @@ const handleGetSingleAttrListObj = (children) => {
114
115
  });
115
116
  return dealList(children);
116
117
  };
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: 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
+ const handleObjDetailToSignleAttrList = (attrList, detail) => {
217
+ return attrList.map((item) => ({
218
+ ...item,
219
+ attrvalue: detail[item.attrid] || ""
220
+ }));
221
+ };
117
222
  exports.disabledDate = disabledDate;
223
+ exports.getTitle = getTitle;
118
224
  exports.handleGetPlaceholder = handleGetPlaceholder;
119
225
  exports.handleGetSingleAttrListObj = handleGetSingleAttrListObj;
226
+ exports.handleObjDetailToSignleAttrList = handleObjDetailToSignleAttrList;
227
+ exports.handleSelectOptions = handleSelectOptions;
120
228
  exports.handleSetFormItemInitialValue = handleSetFormItemInitialValue;
121
229
  exports.handleUrlOptions = handleUrlOptions;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const reactVant = require("react-vant");
4
- const method = require("../../../utils/method");
4
+ const func = require("../func");
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 method.handleSelectOptions({
49
+ const list = await func.handleSelectOptions({
50
50
  commonRequestWidthParams,
51
51
  commonRequest,
52
52
  interfaceTypeDict,
@@ -27,12 +27,17 @@ declare function useUniversalTable(): {
27
27
  formItems: import("szld-libs/lib/components/CreateForm").CreateFormItemProps<import("szld-libs/lib/components/CreateForm").ValueType>[];
28
28
  selList: any[];
29
29
  }>;
30
- handleUniversalDelete: ({ commonRequest, refresh, interfaceType, record, configData, }: {
30
+ handleUniversalDelete: ({ commonRequest, refresh, interfaceType, record, configData, title, okText, cancelText, getTitle, pageID, }: {
31
31
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
32
32
  refresh: () => void;
33
33
  interfaceType?: string | undefined;
34
34
  record?: any;
35
35
  configData?: any;
36
+ title?: string | undefined;
37
+ okText?: string | undefined;
38
+ cancelText?: string | undefined;
39
+ getTitle?: ((pageID: string, dataID: string, defaultTitle?: string) => string) | undefined;
40
+ pageID?: string | undefined;
36
41
  }) => void;
37
42
  handleUniversalSearch: ({ values, currentSelList, currentActive, onSearch, tabItems, }: {
38
43
  values: any;
@@ -281,7 +281,12 @@ function useUniversalTable() {
281
281
  refresh,
282
282
  interfaceType = "YLFWLRInstanceDelete",
283
283
  record,
284
- configData
284
+ configData,
285
+ title,
286
+ okText,
287
+ cancelText,
288
+ getTitle,
289
+ pageID
285
290
  }) => {
286
291
  const mustAttrid = (configData == null ? void 0 : configData["must-attrid"]) || [];
287
292
  const obj = {};
@@ -296,18 +301,21 @@ function useUniversalTable() {
296
301
  ...obj
297
302
  };
298
303
  modal.confirm({
299
- title: "确认删除吗?",
304
+ title: title || "",
300
305
  icon: null,
301
306
  okType: "danger",
307
+ okText: okText || "",
308
+ cancelText: cancelText || "",
302
309
  onOk: () => {
303
310
  return new Promise(async (resolve, reject) => {
304
311
  const res = await commonRequest(interfaceType, params);
312
+ const msg = getTitle && getTitle(pageID || "", res == null ? void 0 : res["msg-code"], res == null ? void 0 : res.msg) || "删除失败";
305
313
  if ((res == null ? void 0 : res.ReturnValue) === 1) {
306
- message.success(res == null ? void 0 : res.msg);
314
+ message.success(msg);
307
315
  refresh();
308
316
  resolve(res);
309
317
  } else {
310
- message.error(res == null ? void 0 : res.msg);
318
+ message.error(msg || "删除失败");
311
319
  reject(res);
312
320
  }
313
321
  });
@@ -525,7 +525,7 @@ const handleSelectOptions = async ({
525
525
  };
526
526
  if (item.inputType === "local") {
527
527
  options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
528
- label: (langConfig == null ? void 0 : langConfig.length) ? getTitle(langConfig, val) : val,
528
+ label: val,
529
529
  value: val
530
530
  }))) || [];
531
531
  if (item.options && Array.isArray(item.options)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.3.46",
4
+ "version": "0.3.48",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",