szld-libs 0.3.21 → 0.3.22
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 +14449 -14234
- package/dist/szld-components.umd.js +50 -50
- package/es/hooks/useDetailRender.d.ts +13 -7
- package/es/hooks/useDetailRender.js +162 -83
- package/lib/hooks/useDetailRender.d.ts +13 -7
- package/lib/hooks/useDetailRender.js +160 -81
- package/package.json +1 -1
- package/es/hooks/useRenderAttrSetDetail.d.ts +0 -25
- package/es/hooks/useRenderAttrSetDetail.js +0 -204
- package/lib/hooks/useRenderAttrSetDetail.d.ts +0 -25
- package/lib/hooks/useRenderAttrSetDetail.js +0 -203
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 宠物详情渲染 Hook
|
|
3
|
-
* @param attrList 属性列表数据
|
|
4
|
-
* @param config 配置信息(用于文件预览地址)
|
|
5
|
-
* @returns 渲染函数
|
|
6
|
-
*/
|
|
7
|
-
interface IAttrSetDetailRendererProps {
|
|
8
|
-
labelSpan?: number;
|
|
9
|
-
valueSpan?: number;
|
|
10
|
-
imgWidth?: number;
|
|
11
|
-
imgHeight?: number;
|
|
12
|
-
layoutType?: 'row' | 'flex';
|
|
13
|
-
}
|
|
14
|
-
export default function useAttrSetDetailRenderer({ labelSpan, valueSpan, imgWidth, imgHeight, layoutType, }: IAttrSetDetailRendererProps): {
|
|
15
|
-
renderDetail: ({ attrList, detailList, span, type, universalHeader, beforeExtraValue, operationColumn, }: {
|
|
16
|
-
attrList?: any[] | undefined;
|
|
17
|
-
detailList?: any[] | undefined;
|
|
18
|
-
span?: number | undefined;
|
|
19
|
-
type?: "form" | "table" | undefined;
|
|
20
|
-
universalHeader?: any[] | undefined;
|
|
21
|
-
beforeExtraValue?: string | undefined;
|
|
22
|
-
operationColumn?: any;
|
|
23
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
|
-
import { getJson, base64ToString } from "szld-libs/lib/utils/method";
|
|
3
|
-
import { App, Row, Col, Flex, Table, Space, Image } from "antd";
|
|
4
|
-
import { handleSetTableRowColor } from "../utils/szxkFunc";
|
|
5
|
-
import { useMemoizedFn } from "ahooks";
|
|
6
|
-
import { Fragment } from "react";
|
|
7
|
-
function useAttrSetDetailRenderer({
|
|
8
|
-
labelSpan = 3,
|
|
9
|
-
valueSpan = 9,
|
|
10
|
-
imgWidth = 93,
|
|
11
|
-
imgHeight = 93,
|
|
12
|
-
layoutType = "row"
|
|
13
|
-
}) {
|
|
14
|
-
const { message } = App.useApp();
|
|
15
|
-
const renderRadioCardAttr = (item, span) => {
|
|
16
|
-
try {
|
|
17
|
-
const attrvalue = JSON.parse((item == null ? void 0 : item.attrvalue) || "{}") || "";
|
|
18
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
-
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
20
|
-
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
21
|
-
item == null ? void 0 : item.attrname,
|
|
22
|
-
":"
|
|
23
|
-
] }),
|
|
24
|
-
/* @__PURE__ */ jsx("span", { style: { wordWrap: "break-word" }, children: attrvalue == null ? void 0 : attrvalue.typename })
|
|
25
|
-
] }) }),
|
|
26
|
-
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
27
|
-
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
28
|
-
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: item == null ? void 0 : item.attrvalue })
|
|
29
|
-
] })
|
|
30
|
-
] }, item == null ? void 0 : item.attrid);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
message.error("房型数据格式错误,转json失败");
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const renderImageAttr = (item, span) => {
|
|
37
|
-
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
38
|
-
return;
|
|
39
|
-
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
40
|
-
const valueNode = () => /* @__PURE__ */ jsx(Space, { wrap: true, children: attrvalues.map((el, index) => /* @__PURE__ */ jsx(
|
|
41
|
-
"div",
|
|
42
|
-
{
|
|
43
|
-
style: {
|
|
44
|
-
border: "1px solid rgba(0, 0, 0, 0.15)",
|
|
45
|
-
borderRadius: 4
|
|
46
|
-
},
|
|
47
|
-
children: /* @__PURE__ */ jsx(
|
|
48
|
-
Image,
|
|
49
|
-
{
|
|
50
|
-
style: { objectFit: "cover", padding: 5 },
|
|
51
|
-
width: imgWidth,
|
|
52
|
-
height: imgHeight,
|
|
53
|
-
src: el == null ? void 0 : el.FilePath,
|
|
54
|
-
alt: (item == null ? void 0 : item.attrname) || "-"
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
},
|
|
58
|
-
index
|
|
59
|
-
)) });
|
|
60
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
-
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
62
|
-
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
63
|
-
item == null ? void 0 : item.attrname,
|
|
64
|
-
":"
|
|
65
|
-
] }),
|
|
66
|
-
valueNode()
|
|
67
|
-
] }) }),
|
|
68
|
-
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
69
|
-
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
70
|
-
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: valueNode() })
|
|
71
|
-
] })
|
|
72
|
-
] }, item == null ? void 0 : item.attrid);
|
|
73
|
-
};
|
|
74
|
-
const renderFileAttr = (item, span) => {
|
|
75
|
-
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
76
|
-
const valueNode = () => /* @__PURE__ */ jsx(Space, { wrap: true, children: attrvalues.map((el, index) => /* @__PURE__ */ jsx("a", { onClick: () => window.open(el == null ? void 0 : el.FilePath), children: (el == null ? void 0 : el.FileName) || "-" }, index)) });
|
|
77
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
-
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
79
|
-
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
80
|
-
item == null ? void 0 : item.attrname,
|
|
81
|
-
":"
|
|
82
|
-
] }),
|
|
83
|
-
valueNode()
|
|
84
|
-
] }) }),
|
|
85
|
-
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
86
|
-
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
87
|
-
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: valueNode() })
|
|
88
|
-
] })
|
|
89
|
-
] }, item == null ? void 0 : item.attrid);
|
|
90
|
-
};
|
|
91
|
-
const renderTextAttr = (item, span, beforeExtraValue) => {
|
|
92
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
-
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
94
|
-
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
95
|
-
item == null ? void 0 : item.attrname,
|
|
96
|
-
":"
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ jsxs("span", { style: { wordWrap: "break-word" }, children: [
|
|
99
|
-
beforeExtraValue || "",
|
|
100
|
-
" ",
|
|
101
|
-
(item == null ? void 0 : item.attrvalue) || "-",
|
|
102
|
-
" "
|
|
103
|
-
] })
|
|
104
|
-
] }) }),
|
|
105
|
-
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
106
|
-
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
107
|
-
/* @__PURE__ */ jsxs(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: [
|
|
108
|
-
beforeExtraValue || "",
|
|
109
|
-
(item == null ? void 0 : item.attrvalue) || "-"
|
|
110
|
-
] })
|
|
111
|
-
] })
|
|
112
|
-
] }, item == null ? void 0 : item.attrid);
|
|
113
|
-
};
|
|
114
|
-
const renderTableDetail = ({
|
|
115
|
-
detailList = [],
|
|
116
|
-
attrList = [],
|
|
117
|
-
universalHeader = [],
|
|
118
|
-
operationColumn
|
|
119
|
-
}) => {
|
|
120
|
-
var _a;
|
|
121
|
-
let columns = [];
|
|
122
|
-
if (universalHeader == null ? void 0 : universalHeader.length) {
|
|
123
|
-
columns = universalHeader == null ? void 0 : universalHeader.map((item) => ({
|
|
124
|
-
title: item == null ? void 0 : item["header-name"],
|
|
125
|
-
dataIndex: item == null ? void 0 : item["header-attribute-id"],
|
|
126
|
-
key: item == null ? void 0 : item["header-attribute-id"],
|
|
127
|
-
width: item == null ? void 0 : item["header-width"]
|
|
128
|
-
}));
|
|
129
|
-
} else {
|
|
130
|
-
columns = (_a = attrList == null ? void 0 : attrList[0]) == null ? void 0 : _a.map((item) => {
|
|
131
|
-
var _a2;
|
|
132
|
-
return {
|
|
133
|
-
title: item == null ? void 0 : item.attrname,
|
|
134
|
-
dataIndex: item == null ? void 0 : item.attrid,
|
|
135
|
-
key: item == null ? void 0 : item.attrid,
|
|
136
|
-
width: ((_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["input-width"]) || 200
|
|
137
|
-
};
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
if (operationColumn && (columns == null ? void 0 : columns.length)) {
|
|
141
|
-
columns.push(operationColumn);
|
|
142
|
-
}
|
|
143
|
-
let dataSource = detailList;
|
|
144
|
-
if (attrList == null ? void 0 : attrList.length) {
|
|
145
|
-
dataSource = attrList == null ? void 0 : attrList.map((v, i) => ({
|
|
146
|
-
jxqyglbh: i,
|
|
147
|
-
...handleDealAttrList(v)
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
return /* @__PURE__ */ jsx(Flex, { align: "center", style: { width: "100%" }, children: /* @__PURE__ */ jsx(
|
|
151
|
-
Table,
|
|
152
|
-
{
|
|
153
|
-
style: { width: "100%" },
|
|
154
|
-
columns,
|
|
155
|
-
scroll: { x: "max-content" },
|
|
156
|
-
size: "small",
|
|
157
|
-
rowKey: "jxqyglbh",
|
|
158
|
-
onRow: handleSetTableRowColor,
|
|
159
|
-
dataSource,
|
|
160
|
-
pagination: false
|
|
161
|
-
}
|
|
162
|
-
) });
|
|
163
|
-
};
|
|
164
|
-
const handleDealAttrList = (attrList) => {
|
|
165
|
-
return attrList == null ? void 0 : attrList.reduce((pre, cur) => {
|
|
166
|
-
pre[cur == null ? void 0 : cur.attrid] = cur == null ? void 0 : cur.attrvalue;
|
|
167
|
-
return pre;
|
|
168
|
-
}, {});
|
|
169
|
-
};
|
|
170
|
-
const renderDetail = useMemoizedFn(
|
|
171
|
-
({
|
|
172
|
-
attrList = [],
|
|
173
|
-
detailList = [],
|
|
174
|
-
span = 24,
|
|
175
|
-
type = "form",
|
|
176
|
-
universalHeader = [],
|
|
177
|
-
beforeExtraValue = "",
|
|
178
|
-
operationColumn
|
|
179
|
-
}) => {
|
|
180
|
-
if (type === "table") {
|
|
181
|
-
return /* @__PURE__ */ jsx(Fragment, { children: renderTableDetail({ detailList, attrList, universalHeader, operationColumn }) });
|
|
182
|
-
}
|
|
183
|
-
return /* @__PURE__ */ jsx(Row, { gutter: [10, 8], children: attrList == null ? void 0 : attrList.map((item) => {
|
|
184
|
-
if ((item == null ? void 0 : item.attrtype) !== 0)
|
|
185
|
-
return /* @__PURE__ */ jsx(Fragment, {}, item == null ? void 0 : item.attrid);
|
|
186
|
-
const info = item.info_base64 === 1 ? getJson(base64ToString(item.info)) : getJson(item.info);
|
|
187
|
-
if ((info == null ? void 0 : info.input) === "image") {
|
|
188
|
-
return renderImageAttr(item, span);
|
|
189
|
-
}
|
|
190
|
-
if (["file", "audio", "video"].includes(info == null ? void 0 : info.input)) {
|
|
191
|
-
return renderFileAttr(item, span);
|
|
192
|
-
}
|
|
193
|
-
if ((info == null ? void 0 : info.input) === "radio-card") {
|
|
194
|
-
return renderRadioCardAttr(item, span);
|
|
195
|
-
}
|
|
196
|
-
return renderTextAttr(item, span, beforeExtraValue);
|
|
197
|
-
}) });
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
return { renderDetail };
|
|
201
|
-
}
|
|
202
|
-
export {
|
|
203
|
-
useAttrSetDetailRenderer as default
|
|
204
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 宠物详情渲染 Hook
|
|
3
|
-
* @param attrList 属性列表数据
|
|
4
|
-
* @param config 配置信息(用于文件预览地址)
|
|
5
|
-
* @returns 渲染函数
|
|
6
|
-
*/
|
|
7
|
-
interface IAttrSetDetailRendererProps {
|
|
8
|
-
labelSpan?: number;
|
|
9
|
-
valueSpan?: number;
|
|
10
|
-
imgWidth?: number;
|
|
11
|
-
imgHeight?: number;
|
|
12
|
-
layoutType?: 'row' | 'flex';
|
|
13
|
-
}
|
|
14
|
-
export default function useAttrSetDetailRenderer({ labelSpan, valueSpan, imgWidth, imgHeight, layoutType, }: IAttrSetDetailRendererProps): {
|
|
15
|
-
renderDetail: ({ attrList, detailList, span, type, universalHeader, beforeExtraValue, operationColumn, }: {
|
|
16
|
-
attrList?: any[] | undefined;
|
|
17
|
-
detailList?: any[] | undefined;
|
|
18
|
-
span?: number | undefined;
|
|
19
|
-
type?: "form" | "table" | undefined;
|
|
20
|
-
universalHeader?: any[] | undefined;
|
|
21
|
-
beforeExtraValue?: string | undefined;
|
|
22
|
-
operationColumn?: any;
|
|
23
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const method = require("szld-libs/lib/utils/method");
|
|
4
|
-
const antd = require("antd");
|
|
5
|
-
const szxkFunc = require("../utils/szxkFunc");
|
|
6
|
-
const ahooks = require("ahooks");
|
|
7
|
-
const react = require("react");
|
|
8
|
-
function useAttrSetDetailRenderer({
|
|
9
|
-
labelSpan = 3,
|
|
10
|
-
valueSpan = 9,
|
|
11
|
-
imgWidth = 93,
|
|
12
|
-
imgHeight = 93,
|
|
13
|
-
layoutType = "row"
|
|
14
|
-
}) {
|
|
15
|
-
const { message } = antd.App.useApp();
|
|
16
|
-
const renderRadioCardAttr = (item, span) => {
|
|
17
|
-
try {
|
|
18
|
-
const attrvalue = JSON.parse((item == null ? void 0 : item.attrvalue) || "{}") || "";
|
|
19
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
20
|
-
layoutType === "flex" && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
21
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
22
|
-
item == null ? void 0 : item.attrname,
|
|
23
|
-
":"
|
|
24
|
-
] }),
|
|
25
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { wordWrap: "break-word" }, children: attrvalue == null ? void 0 : attrvalue.typename })
|
|
26
|
-
] }) }),
|
|
27
|
-
layoutType === "row" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: item == null ? void 0 : item.attrvalue })
|
|
30
|
-
] })
|
|
31
|
-
] }, item == null ? void 0 : item.attrid);
|
|
32
|
-
} catch (error) {
|
|
33
|
-
message.error("房型数据格式错误,转json失败");
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const renderImageAttr = (item, span) => {
|
|
38
|
-
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
39
|
-
return;
|
|
40
|
-
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
41
|
-
const valueNode = () => /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { wrap: true, children: attrvalues.map((el, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
-
"div",
|
|
43
|
-
{
|
|
44
|
-
style: {
|
|
45
|
-
border: "1px solid rgba(0, 0, 0, 0.15)",
|
|
46
|
-
borderRadius: 4
|
|
47
|
-
},
|
|
48
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
-
antd.Image,
|
|
50
|
-
{
|
|
51
|
-
style: { objectFit: "cover", padding: 5 },
|
|
52
|
-
width: imgWidth,
|
|
53
|
-
height: imgHeight,
|
|
54
|
-
src: el == null ? void 0 : el.FilePath,
|
|
55
|
-
alt: (item == null ? void 0 : item.attrname) || "-"
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
},
|
|
59
|
-
index
|
|
60
|
-
)) });
|
|
61
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
62
|
-
layoutType === "flex" && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
63
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
64
|
-
item == null ? void 0 : item.attrname,
|
|
65
|
-
":"
|
|
66
|
-
] }),
|
|
67
|
-
valueNode()
|
|
68
|
-
] }) }),
|
|
69
|
-
layoutType === "row" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
70
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
71
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: valueNode() })
|
|
72
|
-
] })
|
|
73
|
-
] }, item == null ? void 0 : item.attrid);
|
|
74
|
-
};
|
|
75
|
-
const renderFileAttr = (item, span) => {
|
|
76
|
-
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
77
|
-
const valueNode = () => /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { wrap: true, children: attrvalues.map((el, index) => /* @__PURE__ */ jsxRuntime.jsx("a", { onClick: () => window.open(el == null ? void 0 : el.FilePath), children: (el == null ? void 0 : el.FileName) || "-" }, index)) });
|
|
78
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
79
|
-
layoutType === "flex" && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
80
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
81
|
-
item == null ? void 0 : item.attrname,
|
|
82
|
-
":"
|
|
83
|
-
] }),
|
|
84
|
-
valueNode()
|
|
85
|
-
] }) }),
|
|
86
|
-
layoutType === "row" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
87
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
88
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: valueNode() })
|
|
89
|
-
] })
|
|
90
|
-
] }, item == null ? void 0 : item.attrid);
|
|
91
|
-
};
|
|
92
|
-
const renderTextAttr = (item, span, beforeExtraValue) => {
|
|
93
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
94
|
-
layoutType === "flex" && /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
95
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
96
|
-
item == null ? void 0 : item.attrname,
|
|
97
|
-
":"
|
|
98
|
-
] }),
|
|
99
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { wordWrap: "break-word" }, children: [
|
|
100
|
-
beforeExtraValue || "",
|
|
101
|
-
" ",
|
|
102
|
-
(item == null ? void 0 : item.attrvalue) || "-",
|
|
103
|
-
" "
|
|
104
|
-
] })
|
|
105
|
-
] }) }),
|
|
106
|
-
layoutType === "row" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
107
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
108
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: [
|
|
109
|
-
beforeExtraValue || "",
|
|
110
|
-
(item == null ? void 0 : item.attrvalue) || "-"
|
|
111
|
-
] })
|
|
112
|
-
] })
|
|
113
|
-
] }, item == null ? void 0 : item.attrid);
|
|
114
|
-
};
|
|
115
|
-
const renderTableDetail = ({
|
|
116
|
-
detailList = [],
|
|
117
|
-
attrList = [],
|
|
118
|
-
universalHeader = [],
|
|
119
|
-
operationColumn
|
|
120
|
-
}) => {
|
|
121
|
-
var _a;
|
|
122
|
-
let columns = [];
|
|
123
|
-
if (universalHeader == null ? void 0 : universalHeader.length) {
|
|
124
|
-
columns = universalHeader == null ? void 0 : universalHeader.map((item) => ({
|
|
125
|
-
title: item == null ? void 0 : item["header-name"],
|
|
126
|
-
dataIndex: item == null ? void 0 : item["header-attribute-id"],
|
|
127
|
-
key: item == null ? void 0 : item["header-attribute-id"],
|
|
128
|
-
width: item == null ? void 0 : item["header-width"]
|
|
129
|
-
}));
|
|
130
|
-
} else {
|
|
131
|
-
columns = (_a = attrList == null ? void 0 : attrList[0]) == null ? void 0 : _a.map((item) => {
|
|
132
|
-
var _a2;
|
|
133
|
-
return {
|
|
134
|
-
title: item == null ? void 0 : item.attrname,
|
|
135
|
-
dataIndex: item == null ? void 0 : item.attrid,
|
|
136
|
-
key: item == null ? void 0 : item.attrid,
|
|
137
|
-
width: ((_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["input-width"]) || 200
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
if (operationColumn && (columns == null ? void 0 : columns.length)) {
|
|
142
|
-
columns.push(operationColumn);
|
|
143
|
-
}
|
|
144
|
-
let dataSource = detailList;
|
|
145
|
-
if (attrList == null ? void 0 : attrList.length) {
|
|
146
|
-
dataSource = attrList == null ? void 0 : attrList.map((v, i) => ({
|
|
147
|
-
jxqyglbh: i,
|
|
148
|
-
...handleDealAttrList(v)
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
152
|
-
antd.Table,
|
|
153
|
-
{
|
|
154
|
-
style: { width: "100%" },
|
|
155
|
-
columns,
|
|
156
|
-
scroll: { x: "max-content" },
|
|
157
|
-
size: "small",
|
|
158
|
-
rowKey: "jxqyglbh",
|
|
159
|
-
onRow: szxkFunc.handleSetTableRowColor,
|
|
160
|
-
dataSource,
|
|
161
|
-
pagination: false
|
|
162
|
-
}
|
|
163
|
-
) });
|
|
164
|
-
};
|
|
165
|
-
const handleDealAttrList = (attrList) => {
|
|
166
|
-
return attrList == null ? void 0 : attrList.reduce((pre, cur) => {
|
|
167
|
-
pre[cur == null ? void 0 : cur.attrid] = cur == null ? void 0 : cur.attrvalue;
|
|
168
|
-
return pre;
|
|
169
|
-
}, {});
|
|
170
|
-
};
|
|
171
|
-
const renderDetail = ahooks.useMemoizedFn(
|
|
172
|
-
({
|
|
173
|
-
attrList = [],
|
|
174
|
-
detailList = [],
|
|
175
|
-
span = 24,
|
|
176
|
-
type = "form",
|
|
177
|
-
universalHeader = [],
|
|
178
|
-
beforeExtraValue = "",
|
|
179
|
-
operationColumn
|
|
180
|
-
}) => {
|
|
181
|
-
if (type === "table") {
|
|
182
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: renderTableDetail({ detailList, attrList, universalHeader, operationColumn }) });
|
|
183
|
-
}
|
|
184
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: [10, 8], children: attrList == null ? void 0 : attrList.map((item) => {
|
|
185
|
-
if ((item == null ? void 0 : item.attrtype) !== 0)
|
|
186
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, {}, item == null ? void 0 : item.attrid);
|
|
187
|
-
const info = item.info_base64 === 1 ? method.getJson(method.base64ToString(item.info)) : method.getJson(item.info);
|
|
188
|
-
if ((info == null ? void 0 : info.input) === "image") {
|
|
189
|
-
return renderImageAttr(item, span);
|
|
190
|
-
}
|
|
191
|
-
if (["file", "audio", "video"].includes(info == null ? void 0 : info.input)) {
|
|
192
|
-
return renderFileAttr(item, span);
|
|
193
|
-
}
|
|
194
|
-
if ((info == null ? void 0 : info.input) === "radio-card") {
|
|
195
|
-
return renderRadioCardAttr(item, span);
|
|
196
|
-
}
|
|
197
|
-
return renderTextAttr(item, span, beforeExtraValue);
|
|
198
|
-
}) });
|
|
199
|
-
}
|
|
200
|
-
);
|
|
201
|
-
return { renderDetail };
|
|
202
|
-
}
|
|
203
|
-
module.exports = useAttrSetDetailRenderer;
|