szld-libs 0.4.54 → 0.4.57
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.
- package/dist/szld-components.es.js +2969 -2965
- package/dist/szld-components.umd.js +58 -58
- package/es/hooks/useUniversalTable.d.ts +4 -3
- package/es/hooks/useUniversalTable.js +7 -4
- package/es/mock/index.js +56 -567
- package/es/utils/method.js +3 -2
- package/lib/hooks/useUniversalTable.d.ts +4 -3
- package/lib/hooks/useUniversalTable.js +7 -4
- package/lib/mock/index.js +56 -567
- package/lib/utils/method.js +3 -2
- package/package.json +1 -1
package/es/utils/method.js
CHANGED
|
@@ -5,7 +5,8 @@ function getJson(jsonStr) {
|
|
|
5
5
|
try {
|
|
6
6
|
return JSON.parse(jsonStr);
|
|
7
7
|
} catch (error) {
|
|
8
|
-
|
|
8
|
+
const fixedData = jsonStr.replace(/\\_/g, "_");
|
|
9
|
+
return fixedData ? JSON.parse(fixedData) : {};
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
function base64ToString(base64Str) {
|
|
@@ -225,7 +226,7 @@ const processItem = (item, extraAttrs, notDisplay) => {
|
|
|
225
226
|
if (!item.json && item.info) {
|
|
226
227
|
try {
|
|
227
228
|
const infoStr = item.info_base64 === 1 ? base64ToString(item.info) : item.info;
|
|
228
|
-
const json = getJson(infoStr);
|
|
229
|
+
const json = typeof infoStr === "string" ? getJson(infoStr) : infoStr;
|
|
229
230
|
const _extraAttrs = _.cloneDeep(extraAttrs) || {};
|
|
230
231
|
const { langConfig = [], attrLangConfig = [] } = _extraAttrs || {};
|
|
231
232
|
_extraAttrs == null ? true : delete _extraAttrs.langConfig;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
declare function useUniversalTable(): {
|
|
4
|
-
handleUniversalHeaderToColumns: ({ universalHeader, extraBtn, operationColumnConfig, attributeSetId, getTitle, downloadText,
|
|
4
|
+
handleUniversalHeaderToColumns: ({ universalHeader, extraBtn, operationColumnConfig, attributeSetId, getTitle, downloadText, otherLangPageId, objDefaultLangPageId, }: {
|
|
5
5
|
universalHeader: any[];
|
|
6
|
-
extraBtn?:
|
|
6
|
+
extraBtn?: {
|
|
7
|
+
[key: string]: (record: any, content: string, item: any) => ReactNode;
|
|
8
|
+
} | ((record: any, content: string, item: any) => ReactNode) | undefined;
|
|
7
9
|
operationColumnConfig?: any;
|
|
8
10
|
attributeSetId?: string | undefined;
|
|
9
11
|
getTitle?: ((pageID: string, dataID: string) => string) | undefined;
|
|
10
12
|
downloadText?: string | undefined;
|
|
11
|
-
isDefaultWidth?: boolean | undefined;
|
|
12
13
|
otherLangPageId?: string | undefined;
|
|
13
14
|
objDefaultLangPageId?: string | undefined;
|
|
14
15
|
}) => any[] | import("antd/es/message/interface").MessageType;
|
|
@@ -220,7 +220,6 @@ function useUniversalTable() {
|
|
|
220
220
|
attributeSetId,
|
|
221
221
|
getTitle,
|
|
222
222
|
downloadText = "下载",
|
|
223
|
-
isDefaultWidth = true,
|
|
224
223
|
otherLangPageId,
|
|
225
224
|
objDefaultLangPageId = "5000000"
|
|
226
225
|
// 处理这种数据时 如果没有拼接页面编号则使用默认编号{"list":["021"],"delimiter":""}
|
|
@@ -232,7 +231,7 @@ function useUniversalTable() {
|
|
|
232
231
|
const column = {
|
|
233
232
|
title: attributeSetId ? (getTitle == null ? void 0 : getTitle(attributeSetId, item == null ? void 0 : item["header-attribute-id"])) || "" : (item == null ? void 0 : item["header-name"]) || "",
|
|
234
233
|
dataIndex: (item == null ? void 0 : item["header-attribute-id"]) || "",
|
|
235
|
-
width:
|
|
234
|
+
width: (item == null ? void 0 : item["header-width"]) || void 0,
|
|
236
235
|
render: (text, record) => {
|
|
237
236
|
var _a, _b, _c, _d;
|
|
238
237
|
if (text && text && typeof text === "string" && (text == null ? void 0 : text.includes("FileName")) && (text == null ? void 0 : text.includes("FilePath"))) {
|
|
@@ -276,6 +275,7 @@ function useUniversalTable() {
|
|
|
276
275
|
const showBtn = item == null ? void 0 : item["show-btn"];
|
|
277
276
|
if (mulAttrConfig && mulAttrConfig.list && Array.isArray(mulAttrConfig.list)) {
|
|
278
277
|
column.render = (_, record) => {
|
|
278
|
+
var _a;
|
|
279
279
|
const { list: list2, delimiter = "," } = mulAttrConfig;
|
|
280
280
|
const values = list2.map((attrId) => {
|
|
281
281
|
if (!attrId)
|
|
@@ -286,17 +286,20 @@ function useUniversalTable() {
|
|
|
286
286
|
if (showBtn && extraBtn) {
|
|
287
287
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
288
288
|
content ?? "-",
|
|
289
|
-
extraBtn
|
|
289
|
+
typeof extraBtn === "function" ? extraBtn(record, content, item) : null,
|
|
290
|
+
typeof extraBtn === "object" ? (_a = extraBtn == null ? void 0 : extraBtn[item == null ? void 0 : item["header-attribute-id"]]) == null ? void 0 : _a.call(extraBtn, record, content, item) : null
|
|
290
291
|
] });
|
|
291
292
|
}
|
|
292
293
|
return content || "-";
|
|
293
294
|
};
|
|
294
295
|
} else if (showBtn && extraBtn) {
|
|
295
296
|
column.render = (_, record) => {
|
|
297
|
+
var _a;
|
|
296
298
|
const content = record[column.dataIndex] || "";
|
|
297
299
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
298
300
|
content || "-",
|
|
299
|
-
extraBtn(record, content, item)
|
|
301
|
+
typeof extraBtn === "function" ? extraBtn(record, content, item) : null,
|
|
302
|
+
typeof extraBtn === "object" ? (_a = extraBtn == null ? void 0 : extraBtn[item == null ? void 0 : item["header-attribute-id"]]) == null ? void 0 : _a.call(extraBtn, record, content, item) : null
|
|
300
303
|
] });
|
|
301
304
|
};
|
|
302
305
|
}
|