szld-libs 0.3.55 → 0.3.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 +7810 -7807
- package/dist/szld-components.umd.js +37 -37
- package/es/hooks/useDetailRender.d.ts +2 -1
- package/es/hooks/useDetailRender.js +17 -10
- package/es/utils/method.js +6 -5
- package/lib/hooks/useDetailRender.d.ts +2 -1
- package/lib/hooks/useDetailRender.js +16 -9
- package/lib/utils/method.js +6 -5
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ interface IAttrSetDetailRendererProps {
|
|
|
12
12
|
layoutType?: 'row' | 'flex';
|
|
13
13
|
}
|
|
14
14
|
export default function useDetailRender({ labelSpan, valueSpan, imgWidth, imgHeight, layoutType, }: IAttrSetDetailRendererProps): {
|
|
15
|
-
renderDetail: ({ attrList, detailList, span, type, universalHeader, beforeExtraValue, operationColumn, }: {
|
|
15
|
+
renderDetail: ({ attrList, detailList, span, type, universalHeader, beforeExtraValue, operationColumn, langConfig, }: {
|
|
16
16
|
attrList?: any[] | undefined;
|
|
17
17
|
detailList?: any[] | undefined;
|
|
18
18
|
span?: number | undefined;
|
|
@@ -20,6 +20,7 @@ export default function useDetailRender({ labelSpan, valueSpan, imgWidth, imgHei
|
|
|
20
20
|
universalHeader?: any[] | undefined;
|
|
21
21
|
beforeExtraValue?: string | undefined;
|
|
22
22
|
operationColumn?: any;
|
|
23
|
+
langConfig?: any[] | undefined;
|
|
23
24
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
};
|
|
25
26
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { App, Row, Col, Flex, Table, Space, Image } from "antd";
|
|
3
3
|
import { handleSetTableRowColor } from "../utils/szxkFunc";
|
|
4
|
-
import { getJson, base64ToString } from "../utils/method";
|
|
4
|
+
import { getJson, base64ToString, getTitle } from "../utils/method";
|
|
5
5
|
import { useMemoizedFn } from "ahooks";
|
|
6
6
|
import { Fragment } from "react";
|
|
7
7
|
function useDetailRender({
|
|
@@ -88,7 +88,7 @@ function useDetailRender({
|
|
|
88
88
|
] })
|
|
89
89
|
] }, item == null ? void 0 : item.attrid);
|
|
90
90
|
};
|
|
91
|
-
const renderTextAttr = (item, span, beforeExtraValue) => {
|
|
91
|
+
const renderTextAttr = (item, span, beforeExtraValue, langConfig) => {
|
|
92
92
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
93
|
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
94
94
|
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
@@ -98,15 +98,14 @@ function useDetailRender({
|
|
|
98
98
|
/* @__PURE__ */ jsxs("span", { style: { wordWrap: "break-word" }, children: [
|
|
99
99
|
beforeExtraValue || "",
|
|
100
100
|
" ",
|
|
101
|
-
(item == null ? void 0 : item.attrvalue) || "-"
|
|
102
|
-
" "
|
|
101
|
+
getTitle(langConfig || [], (item == null ? void 0 : item.attrvalue) || "-")
|
|
103
102
|
] })
|
|
104
103
|
] }) }),
|
|
105
104
|
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
106
105
|
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
107
106
|
/* @__PURE__ */ jsxs(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: [
|
|
108
107
|
beforeExtraValue || "",
|
|
109
|
-
(item == null ? void 0 : item.attrvalue) || "-"
|
|
108
|
+
getTitle(langConfig || [], (item == null ? void 0 : item.attrvalue) || "-")
|
|
110
109
|
] })
|
|
111
110
|
] })
|
|
112
111
|
] }, item == null ? void 0 : item.attrid);
|
|
@@ -115,7 +114,8 @@ function useDetailRender({
|
|
|
115
114
|
detailList = [],
|
|
116
115
|
attrList = [],
|
|
117
116
|
universalHeader = [],
|
|
118
|
-
operationColumn
|
|
117
|
+
operationColumn,
|
|
118
|
+
langConfig = []
|
|
119
119
|
}) => {
|
|
120
120
|
var _a;
|
|
121
121
|
let columns = [];
|
|
@@ -124,7 +124,10 @@ function useDetailRender({
|
|
|
124
124
|
title: item == null ? void 0 : item["header-name"],
|
|
125
125
|
dataIndex: item == null ? void 0 : item["header-attribute-id"],
|
|
126
126
|
key: item == null ? void 0 : item["header-attribute-id"],
|
|
127
|
-
width: item == null ? void 0 : item["header-width"]
|
|
127
|
+
width: item == null ? void 0 : item["header-width"],
|
|
128
|
+
render: (text, record) => {
|
|
129
|
+
return getTitle(langConfig || [], text);
|
|
130
|
+
}
|
|
128
131
|
}));
|
|
129
132
|
} else {
|
|
130
133
|
columns = (_a = attrList == null ? void 0 : attrList[0]) == null ? void 0 : _a.map((item) => {
|
|
@@ -133,7 +136,10 @@ function useDetailRender({
|
|
|
133
136
|
title: item == null ? void 0 : item.attrname,
|
|
134
137
|
dataIndex: item == null ? void 0 : item.attrid,
|
|
135
138
|
key: item == null ? void 0 : item.attrid,
|
|
136
|
-
width: ((_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["input-width"]) || 200
|
|
139
|
+
width: ((_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["input-width"]) || 200,
|
|
140
|
+
render: (text, record) => {
|
|
141
|
+
return getTitle(langConfig || [], text);
|
|
142
|
+
}
|
|
137
143
|
};
|
|
138
144
|
});
|
|
139
145
|
}
|
|
@@ -175,7 +181,8 @@ function useDetailRender({
|
|
|
175
181
|
type = "form",
|
|
176
182
|
universalHeader = [],
|
|
177
183
|
beforeExtraValue = "",
|
|
178
|
-
operationColumn
|
|
184
|
+
operationColumn,
|
|
185
|
+
langConfig = []
|
|
179
186
|
}) => {
|
|
180
187
|
if (type === "table") {
|
|
181
188
|
return /* @__PURE__ */ jsx(Fragment, { children: renderTableDetail({ detailList, attrList, universalHeader, operationColumn }) });
|
|
@@ -193,7 +200,7 @@ function useDetailRender({
|
|
|
193
200
|
if ((info == null ? void 0 : info.input) === "radio-card") {
|
|
194
201
|
return renderRadioCardAttr(item, span);
|
|
195
202
|
}
|
|
196
|
-
return renderTextAttr(item, span, beforeExtraValue);
|
|
203
|
+
return renderTextAttr(item, span, beforeExtraValue, langConfig);
|
|
197
204
|
}) });
|
|
198
205
|
}
|
|
199
206
|
);
|
package/es/utils/method.js
CHANGED
|
@@ -370,7 +370,7 @@ const handleAttrListToObj = (attrList) => {
|
|
|
370
370
|
function processLevel(arr) {
|
|
371
371
|
const result = {};
|
|
372
372
|
arr.forEach((item) => {
|
|
373
|
-
var _a2, _b, _c, _d;
|
|
373
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
374
374
|
const key = `${item.attrid}_${item.attrtype}`;
|
|
375
375
|
if (item.attrtype === 1 && item.children.length > 0 && !Array.isArray(item.children)) {
|
|
376
376
|
result[key] = {
|
|
@@ -401,14 +401,15 @@ const handleAttrListToObj = (attrList) => {
|
|
|
401
401
|
return handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
|
|
402
402
|
});
|
|
403
403
|
} else {
|
|
404
|
-
|
|
404
|
+
item.childAsid = ((_d = (_c = children == null ? void 0 : children[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.asid) || "";
|
|
405
|
+
children = [[]];
|
|
405
406
|
}
|
|
406
407
|
if ((children == null ? void 0 : children.length) && Array.isArray(children == null ? void 0 : children[0])) {
|
|
407
408
|
result[key] = {
|
|
408
|
-
asid: ((
|
|
409
|
-
data_list: children.map((child) => {
|
|
409
|
+
asid: ((_f = (_e = children == null ? void 0 : children[0]) == null ? void 0 : _e[0]) == null ? void 0 : _f.asid) || item.childAsid || "",
|
|
410
|
+
data_list: (children == null ? void 0 : children.length) && ((_g = children == null ? void 0 : children[0]) == null ? void 0 : _g.length) && children.map((child) => {
|
|
410
411
|
return processLevel(child);
|
|
411
|
-
})
|
|
412
|
+
}) || []
|
|
412
413
|
};
|
|
413
414
|
}
|
|
414
415
|
} else {
|
|
@@ -12,7 +12,7 @@ interface IAttrSetDetailRendererProps {
|
|
|
12
12
|
layoutType?: 'row' | 'flex';
|
|
13
13
|
}
|
|
14
14
|
export default function useDetailRender({ labelSpan, valueSpan, imgWidth, imgHeight, layoutType, }: IAttrSetDetailRendererProps): {
|
|
15
|
-
renderDetail: ({ attrList, detailList, span, type, universalHeader, beforeExtraValue, operationColumn, }: {
|
|
15
|
+
renderDetail: ({ attrList, detailList, span, type, universalHeader, beforeExtraValue, operationColumn, langConfig, }: {
|
|
16
16
|
attrList?: any[] | undefined;
|
|
17
17
|
detailList?: any[] | undefined;
|
|
18
18
|
span?: number | undefined;
|
|
@@ -20,6 +20,7 @@ export default function useDetailRender({ labelSpan, valueSpan, imgWidth, imgHei
|
|
|
20
20
|
universalHeader?: any[] | undefined;
|
|
21
21
|
beforeExtraValue?: string | undefined;
|
|
22
22
|
operationColumn?: any;
|
|
23
|
+
langConfig?: any[] | undefined;
|
|
23
24
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
};
|
|
25
26
|
export {};
|
|
@@ -89,7 +89,7 @@ function useDetailRender({
|
|
|
89
89
|
] })
|
|
90
90
|
] }, item == null ? void 0 : item.attrid);
|
|
91
91
|
};
|
|
92
|
-
const renderTextAttr = (item, span, beforeExtraValue) => {
|
|
92
|
+
const renderTextAttr = (item, span, beforeExtraValue, langConfig) => {
|
|
93
93
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
94
94
|
layoutType === "flex" && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
95
95
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
@@ -99,15 +99,14 @@ function useDetailRender({
|
|
|
99
99
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { wordWrap: "break-word" }, children: [
|
|
100
100
|
beforeExtraValue || "",
|
|
101
101
|
" ",
|
|
102
|
-
(item == null ? void 0 : item.attrvalue) || "-"
|
|
103
|
-
" "
|
|
102
|
+
method.getTitle(langConfig || [], (item == null ? void 0 : item.attrvalue) || "-")
|
|
104
103
|
] })
|
|
105
104
|
] }) }),
|
|
106
105
|
layoutType === "row" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
107
106
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
108
107
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: [
|
|
109
108
|
beforeExtraValue || "",
|
|
110
|
-
(item == null ? void 0 : item.attrvalue) || "-"
|
|
109
|
+
method.getTitle(langConfig || [], (item == null ? void 0 : item.attrvalue) || "-")
|
|
111
110
|
] })
|
|
112
111
|
] })
|
|
113
112
|
] }, item == null ? void 0 : item.attrid);
|
|
@@ -116,7 +115,8 @@ function useDetailRender({
|
|
|
116
115
|
detailList = [],
|
|
117
116
|
attrList = [],
|
|
118
117
|
universalHeader = [],
|
|
119
|
-
operationColumn
|
|
118
|
+
operationColumn,
|
|
119
|
+
langConfig = []
|
|
120
120
|
}) => {
|
|
121
121
|
var _a;
|
|
122
122
|
let columns = [];
|
|
@@ -125,7 +125,10 @@ function useDetailRender({
|
|
|
125
125
|
title: item == null ? void 0 : item["header-name"],
|
|
126
126
|
dataIndex: item == null ? void 0 : item["header-attribute-id"],
|
|
127
127
|
key: item == null ? void 0 : item["header-attribute-id"],
|
|
128
|
-
width: item == null ? void 0 : item["header-width"]
|
|
128
|
+
width: item == null ? void 0 : item["header-width"],
|
|
129
|
+
render: (text, record) => {
|
|
130
|
+
return method.getTitle(langConfig || [], text);
|
|
131
|
+
}
|
|
129
132
|
}));
|
|
130
133
|
} else {
|
|
131
134
|
columns = (_a = attrList == null ? void 0 : attrList[0]) == null ? void 0 : _a.map((item) => {
|
|
@@ -134,7 +137,10 @@ function useDetailRender({
|
|
|
134
137
|
title: item == null ? void 0 : item.attrname,
|
|
135
138
|
dataIndex: item == null ? void 0 : item.attrid,
|
|
136
139
|
key: item == null ? void 0 : item.attrid,
|
|
137
|
-
width: ((_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["input-width"]) || 200
|
|
140
|
+
width: ((_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["input-width"]) || 200,
|
|
141
|
+
render: (text, record) => {
|
|
142
|
+
return method.getTitle(langConfig || [], text);
|
|
143
|
+
}
|
|
138
144
|
};
|
|
139
145
|
});
|
|
140
146
|
}
|
|
@@ -176,7 +182,8 @@ function useDetailRender({
|
|
|
176
182
|
type = "form",
|
|
177
183
|
universalHeader = [],
|
|
178
184
|
beforeExtraValue = "",
|
|
179
|
-
operationColumn
|
|
185
|
+
operationColumn,
|
|
186
|
+
langConfig = []
|
|
180
187
|
}) => {
|
|
181
188
|
if (type === "table") {
|
|
182
189
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: renderTableDetail({ detailList, attrList, universalHeader, operationColumn }) });
|
|
@@ -194,7 +201,7 @@ function useDetailRender({
|
|
|
194
201
|
if ((info == null ? void 0 : info.input) === "radio-card") {
|
|
195
202
|
return renderRadioCardAttr(item, span);
|
|
196
203
|
}
|
|
197
|
-
return renderTextAttr(item, span, beforeExtraValue);
|
|
204
|
+
return renderTextAttr(item, span, beforeExtraValue, langConfig);
|
|
198
205
|
}) });
|
|
199
206
|
}
|
|
200
207
|
);
|
package/lib/utils/method.js
CHANGED
|
@@ -372,7 +372,7 @@ const handleAttrListToObj = (attrList) => {
|
|
|
372
372
|
function processLevel(arr) {
|
|
373
373
|
const result = {};
|
|
374
374
|
arr.forEach((item) => {
|
|
375
|
-
var _a2, _b, _c, _d;
|
|
375
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
376
376
|
const key = `${item.attrid}_${item.attrtype}`;
|
|
377
377
|
if (item.attrtype === 1 && item.children.length > 0 && !Array.isArray(item.children)) {
|
|
378
378
|
result[key] = {
|
|
@@ -403,14 +403,15 @@ const handleAttrListToObj = (attrList) => {
|
|
|
403
403
|
return handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
|
|
404
404
|
});
|
|
405
405
|
} else {
|
|
406
|
-
|
|
406
|
+
item.childAsid = ((_d = (_c = children == null ? void 0 : children[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.asid) || "";
|
|
407
|
+
children = [[]];
|
|
407
408
|
}
|
|
408
409
|
if ((children == null ? void 0 : children.length) && Array.isArray(children == null ? void 0 : children[0])) {
|
|
409
410
|
result[key] = {
|
|
410
|
-
asid: ((
|
|
411
|
-
data_list: children.map((child) => {
|
|
411
|
+
asid: ((_f = (_e = children == null ? void 0 : children[0]) == null ? void 0 : _e[0]) == null ? void 0 : _f.asid) || item.childAsid || "",
|
|
412
|
+
data_list: (children == null ? void 0 : children.length) && ((_g = children == null ? void 0 : children[0]) == null ? void 0 : _g.length) && children.map((child) => {
|
|
412
413
|
return processLevel(child);
|
|
413
|
-
})
|
|
414
|
+
}) || []
|
|
414
415
|
};
|
|
415
416
|
}
|
|
416
417
|
} else {
|