szld-libs 0.2.95 → 0.2.97
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 +136 -129
- package/dist/szld-components.umd.js +18 -18
- package/es/components/DynamicForm/func.js +10 -8
- package/es/components/DynamicForm/useDynamicForm.d.ts +1 -1
- package/es/hooks/useRenderAttrSetDetail.d.ts +24 -0
- package/es/hooks/useRenderAttrSetDetail.js +186 -0
- package/es/index.js +4 -262
- package/es/mock/index.d.ts +0 -0
- package/es/mock/index.js +1 -0
- package/es/mock/vite.svg +1 -0
- package/es/utils/method.js +7 -0
- package/es/utils/szxkFunc.d.ts +8 -0
- package/es/utils/szxkFunc.js +7 -1
- package/es/vite-env.d.ts +6 -0
- package/lib/components/DynamicForm/func.js +10 -8
- package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -1
- package/lib/hooks/useRenderAttrSetDetail.d.ts +24 -0
- package/lib/hooks/useRenderAttrSetDetail.js +185 -0
- package/lib/index.js +1 -259
- package/lib/mock/index.d.ts +0 -0
- package/lib/mock/index.js +1 -0
- package/lib/mock/vite.svg +1 -0
- package/lib/utils/method.js +7 -0
- package/lib/utils/szxkFunc.d.ts +8 -0
- package/lib/utils/szxkFunc.js +6 -0
- package/lib/vite-env.d.ts +6 -0
- package/package.json +1 -1
|
@@ -180,14 +180,16 @@ const handleGetSingleAttrListObj = (children) => {
|
|
|
180
180
|
}
|
|
181
181
|
const dealList = (children2) => children2 == null ? void 0 : children2.map((v) => {
|
|
182
182
|
const obj = {};
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
if (Array.isArray(v)) {
|
|
184
|
+
v.forEach((x) => {
|
|
185
|
+
var _a;
|
|
186
|
+
if ((_a = x == null ? void 0 : x.children) == null ? void 0 : _a.length) {
|
|
187
|
+
obj[x.attrid] = dealList(x.children);
|
|
188
|
+
} else {
|
|
189
|
+
obj[x.attrid] = x.attrvalue;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
191
193
|
return obj;
|
|
192
194
|
});
|
|
193
195
|
return dealList(children);
|
|
@@ -27,7 +27,7 @@ declare function useDynamicForm(props: IDynamicFormProps): {
|
|
|
27
27
|
item: IformConfigItem;
|
|
28
28
|
readonly: boolean;
|
|
29
29
|
colNum: number;
|
|
30
|
-
instructionShowMode?: "
|
|
30
|
+
instructionShowMode?: "icon" | "flex" | undefined;
|
|
31
31
|
relatedid?: string | undefined;
|
|
32
32
|
form: FormInstance;
|
|
33
33
|
defaultWidth?: number | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
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, span, type, servicesUniversalHeader, beforeExtraValue, operationColumn, }: {
|
|
16
|
+
attrList: any[];
|
|
17
|
+
span?: number | undefined;
|
|
18
|
+
type?: "form" | "table" | undefined;
|
|
19
|
+
servicesUniversalHeader?: any[] | undefined;
|
|
20
|
+
beforeExtraValue?: string | undefined;
|
|
21
|
+
operationColumn?: any;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
|
+
import { App, Row, Col, Flex, Table, Space, Image } from "antd";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { useMemoizedFn } from "ahooks";
|
|
5
|
+
import { handleSetTableRowColor } from "../utils/szxkFunc";
|
|
6
|
+
function useAttrSetDetailRenderer({
|
|
7
|
+
labelSpan = 3,
|
|
8
|
+
valueSpan = 9,
|
|
9
|
+
imgWidth = 93,
|
|
10
|
+
imgHeight = 93,
|
|
11
|
+
layoutType = "row"
|
|
12
|
+
}) {
|
|
13
|
+
const { message } = App.useApp();
|
|
14
|
+
const renderRadioCardAttr = (item, span) => {
|
|
15
|
+
try {
|
|
16
|
+
const attrvalue = JSON.parse((item == null ? void 0 : item.attrvalue) || "{}") || "";
|
|
17
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
20
|
+
item == null ? void 0 : item.attrname,
|
|
21
|
+
":"
|
|
22
|
+
] }),
|
|
23
|
+
/* @__PURE__ */ jsx("span", { style: { wordWrap: "break-word" }, children: attrvalue == null ? void 0 : attrvalue.typename })
|
|
24
|
+
] }) }),
|
|
25
|
+
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
27
|
+
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: item == null ? void 0 : item.attrvalue })
|
|
28
|
+
] })
|
|
29
|
+
] }, item == null ? void 0 : item.attrid);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
message.error("房型数据格式错误,转json失败");
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const renderImageAttr = (item, span) => {
|
|
36
|
+
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
37
|
+
return;
|
|
38
|
+
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
39
|
+
const valueNode = () => /* @__PURE__ */ jsx(Space, { wrap: true, children: attrvalues.map((el, index) => /* @__PURE__ */ jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
style: {
|
|
43
|
+
border: "1px solid rgba(0, 0, 0, 0.15)",
|
|
44
|
+
borderRadius: 4
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ jsx(
|
|
47
|
+
Image,
|
|
48
|
+
{
|
|
49
|
+
style: { objectFit: "cover", padding: 5 },
|
|
50
|
+
width: imgWidth,
|
|
51
|
+
height: imgHeight,
|
|
52
|
+
src: el == null ? void 0 : el.FilePath,
|
|
53
|
+
alt: (item == null ? void 0 : item.attrname) || "-"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
index
|
|
58
|
+
)) });
|
|
59
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
62
|
+
item == null ? void 0 : item.attrname,
|
|
63
|
+
":"
|
|
64
|
+
] }),
|
|
65
|
+
valueNode()
|
|
66
|
+
] }) }),
|
|
67
|
+
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
69
|
+
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: valueNode() })
|
|
70
|
+
] })
|
|
71
|
+
] }, item == null ? void 0 : item.attrid);
|
|
72
|
+
};
|
|
73
|
+
const renderFileAttr = (item, span) => {
|
|
74
|
+
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
75
|
+
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)) });
|
|
76
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
78
|
+
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
79
|
+
item == null ? void 0 : item.attrname,
|
|
80
|
+
":"
|
|
81
|
+
] }),
|
|
82
|
+
valueNode()
|
|
83
|
+
] }) }),
|
|
84
|
+
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
86
|
+
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: valueNode() })
|
|
87
|
+
] })
|
|
88
|
+
] }, item == null ? void 0 : item.attrid);
|
|
89
|
+
};
|
|
90
|
+
const renderTextAttr = (item, span, beforeExtraValue) => {
|
|
91
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
92
|
+
layoutType === "flex" && /* @__PURE__ */ jsx(Col, { span, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
93
|
+
/* @__PURE__ */ jsxs("span", { style: { flexShrink: 0 }, children: [
|
|
94
|
+
item == null ? void 0 : item.attrname,
|
|
95
|
+
":"
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsxs("span", { style: { wordWrap: "break-word" }, children: [
|
|
98
|
+
beforeExtraValue || "",
|
|
99
|
+
" ",
|
|
100
|
+
(item == null ? void 0 : item.attrvalue) || "-",
|
|
101
|
+
" "
|
|
102
|
+
] })
|
|
103
|
+
] }) }),
|
|
104
|
+
layoutType === "row" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
105
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
106
|
+
/* @__PURE__ */ jsxs(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: [
|
|
107
|
+
beforeExtraValue || "",
|
|
108
|
+
(item == null ? void 0 : item.attrvalue) || "-"
|
|
109
|
+
] })
|
|
110
|
+
] })
|
|
111
|
+
] }, item == null ? void 0 : item.attrid);
|
|
112
|
+
};
|
|
113
|
+
const renderTableDetail = ({
|
|
114
|
+
attrList = [],
|
|
115
|
+
servicesUniversalHeader = [],
|
|
116
|
+
operationColumn
|
|
117
|
+
}) => {
|
|
118
|
+
const columns = servicesUniversalHeader == null ? void 0 : servicesUniversalHeader.map((item) => ({
|
|
119
|
+
title: item == null ? void 0 : item["header-name"],
|
|
120
|
+
dataIndex: item == null ? void 0 : item["header-attribute-id"],
|
|
121
|
+
key: item == null ? void 0 : item["header-attribute-id"],
|
|
122
|
+
width: item == null ? void 0 : item["header-width"]
|
|
123
|
+
}));
|
|
124
|
+
if (operationColumn) {
|
|
125
|
+
columns.push(operationColumn);
|
|
126
|
+
}
|
|
127
|
+
const dataSource = attrList == null ? void 0 : attrList.map((v, i) => ({
|
|
128
|
+
key: i,
|
|
129
|
+
...handleDealAttrList(v)
|
|
130
|
+
}));
|
|
131
|
+
return /* @__PURE__ */ jsx(Flex, { align: "center", children: /* @__PURE__ */ jsx(
|
|
132
|
+
Table,
|
|
133
|
+
{
|
|
134
|
+
style: { width: "100%" },
|
|
135
|
+
columns,
|
|
136
|
+
scroll: { x: "max-content" },
|
|
137
|
+
size: "small",
|
|
138
|
+
rowKey: "key",
|
|
139
|
+
onRow: handleSetTableRowColor,
|
|
140
|
+
dataSource,
|
|
141
|
+
pagination: false
|
|
142
|
+
}
|
|
143
|
+
) });
|
|
144
|
+
};
|
|
145
|
+
const handleDealAttrList = (attrList) => {
|
|
146
|
+
return attrList == null ? void 0 : attrList.reduce((pre, cur) => {
|
|
147
|
+
pre[cur == null ? void 0 : cur.attrid] = cur == null ? void 0 : cur.attrvalue;
|
|
148
|
+
return pre;
|
|
149
|
+
}, {});
|
|
150
|
+
};
|
|
151
|
+
const renderDetail = useMemoizedFn(
|
|
152
|
+
({
|
|
153
|
+
attrList = [],
|
|
154
|
+
span = 24,
|
|
155
|
+
type = "form",
|
|
156
|
+
servicesUniversalHeader = [],
|
|
157
|
+
beforeExtraValue = "",
|
|
158
|
+
operationColumn
|
|
159
|
+
}) => {
|
|
160
|
+
if (!(attrList == null ? void 0 : attrList.length))
|
|
161
|
+
return null;
|
|
162
|
+
if (type === "table") {
|
|
163
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderTableDetail({ attrList, servicesUniversalHeader, operationColumn }) });
|
|
164
|
+
}
|
|
165
|
+
return /* @__PURE__ */ jsx(Row, { gutter: [10, 8], children: attrList == null ? void 0 : attrList.map((item) => {
|
|
166
|
+
if ((item == null ? void 0 : item.attrtype) !== 0)
|
|
167
|
+
return /* @__PURE__ */ jsx(Fragment, {}, item == null ? void 0 : item.attrid);
|
|
168
|
+
const info = (item == null ? void 0 : item.json) || (item == null ? void 0 : item.info) && JSON.parse(item.info);
|
|
169
|
+
if ((info == null ? void 0 : info.input) === "image") {
|
|
170
|
+
return renderImageAttr(item, span);
|
|
171
|
+
}
|
|
172
|
+
if (["file", "audio", "video"].includes(info == null ? void 0 : info.input)) {
|
|
173
|
+
return renderFileAttr(item, span);
|
|
174
|
+
}
|
|
175
|
+
if ((info == null ? void 0 : info.input) === "radio-card") {
|
|
176
|
+
return renderRadioCardAttr(item, span);
|
|
177
|
+
}
|
|
178
|
+
return renderTextAttr(item, span, beforeExtraValue);
|
|
179
|
+
}) });
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
return { renderDetail };
|
|
183
|
+
}
|
|
184
|
+
export {
|
|
185
|
+
useAttrSetDetailRenderer as default
|
|
186
|
+
};
|
package/es/index.js
CHANGED
|
@@ -1,190 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect
|
|
2
|
+
import { useEffect } from "react";
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
|
-
import { App, Form
|
|
6
|
-
import
|
|
7
|
-
import { useRowSelection, useChangePwd, HmacSM3, BackHeader, SearchTable, CreateForm, CustomPagination } from "./main";
|
|
8
|
-
let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
|
|
5
|
+
import { App, Form } from "antd";
|
|
6
|
+
import { HmacSM3, BackHeader } from "./main";
|
|
9
7
|
const Demo = () => {
|
|
10
|
-
|
|
11
|
-
const [form] = Form.useForm();
|
|
8
|
+
Form.useForm();
|
|
12
9
|
useEffect(() => {
|
|
13
10
|
}, []);
|
|
14
|
-
const columns = [
|
|
15
|
-
{
|
|
16
|
-
dataIndex: ["a", 2],
|
|
17
|
-
title: "a"
|
|
18
|
-
},
|
|
19
|
-
Table.EXPAND_COLUMN,
|
|
20
|
-
{
|
|
21
|
-
dataIndex: "b",
|
|
22
|
-
title: "b",
|
|
23
|
-
width: 400
|
|
24
|
-
},
|
|
25
|
-
Table.SELECTION_COLUMN,
|
|
26
|
-
{
|
|
27
|
-
dataIndex: "c",
|
|
28
|
-
title: "c"
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
const [list, setList] = useState(
|
|
32
|
-
Array(10).fill(0).map((v, i) => ({ id: i }))
|
|
33
|
-
);
|
|
34
|
-
const [current, setCurrent] = useState(1);
|
|
35
|
-
const data = [{ id: 1 }, { id: 12 }, { id: 21 }];
|
|
36
|
-
const { selectedKeys, selectedRows, setSelectedKeys } = useRowSelection({
|
|
37
|
-
dataSource: list,
|
|
38
|
-
rowKey: "id",
|
|
39
|
-
defaultRows: data
|
|
40
|
-
});
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
setSelectedKeys([1, 12, 21]);
|
|
43
|
-
}, []);
|
|
44
|
-
const { handleChangePwd } = useChangePwd();
|
|
45
|
-
const typeList = [
|
|
46
|
-
{
|
|
47
|
-
flinfo: "数据",
|
|
48
|
-
children: [
|
|
49
|
-
{
|
|
50
|
-
flinfo: "数据1"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
flinfo: "数据2"
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
flinfo: "表",
|
|
59
|
-
children: [
|
|
60
|
-
{
|
|
61
|
-
flinfo: "表1"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
flinfo: "表2"
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
];
|
|
69
|
-
const imgAccept = ".jpg,.png,.jpeg";
|
|
70
|
-
const imgUploadProps = {
|
|
71
|
-
maxCount: 1,
|
|
72
|
-
action: "uploadAction",
|
|
73
|
-
accept: imgAccept,
|
|
74
|
-
showUploadList: false,
|
|
75
|
-
beforeUpload(file) {
|
|
76
|
-
var _a;
|
|
77
|
-
const accepts = imgAccept.split(",");
|
|
78
|
-
const fileType = (_a = file.name.split(".").pop()) == null ? void 0 : _a.toLocaleLowerCase();
|
|
79
|
-
if (!accepts.includes(`.${fileType}`)) {
|
|
80
|
-
message.error(`只允许上传${accepts.join("、")}文件`);
|
|
81
|
-
return Upload.LIST_IGNORE;
|
|
82
|
-
}
|
|
83
|
-
return file;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const normFile = (e) => {
|
|
87
|
-
if (Array.isArray(e)) {
|
|
88
|
-
return e;
|
|
89
|
-
}
|
|
90
|
-
return e && e.fileList;
|
|
91
|
-
};
|
|
92
|
-
const formItems = [
|
|
93
|
-
{
|
|
94
|
-
dataIndex: "asctypeid",
|
|
95
|
-
title: "编号",
|
|
96
|
-
valueType: "inputNumber",
|
|
97
|
-
valueProps: {
|
|
98
|
-
placeholder: "请输入编号",
|
|
99
|
-
controls: false,
|
|
100
|
-
min: 0
|
|
101
|
-
},
|
|
102
|
-
formItemProps: {
|
|
103
|
-
rules: [
|
|
104
|
-
{
|
|
105
|
-
required: true,
|
|
106
|
-
message: "请输入编号"
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
colProps: { span: 11 }
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
dataIndex: "asctype",
|
|
114
|
-
title: "归类名",
|
|
115
|
-
valueProps: {
|
|
116
|
-
placeholder: "请输入归类名",
|
|
117
|
-
maxLength: 100,
|
|
118
|
-
allowClear: true
|
|
119
|
-
},
|
|
120
|
-
colProps: { span: 11, offset: 2 },
|
|
121
|
-
formItemProps: {
|
|
122
|
-
rules: [
|
|
123
|
-
{
|
|
124
|
-
required: true,
|
|
125
|
-
message: "请输入归类名"
|
|
126
|
-
},
|
|
127
|
-
{ whitespace: true, message: "输入内容不能只有空格" }
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
dataIndex: "tabsortList",
|
|
133
|
-
title: "分类",
|
|
134
|
-
valueType: "cascader",
|
|
135
|
-
valueProps: {
|
|
136
|
-
placeholder: "请选择分类",
|
|
137
|
-
options: typeList,
|
|
138
|
-
changeOnSelect: true,
|
|
139
|
-
fieldNames: {
|
|
140
|
-
label: "flinfo",
|
|
141
|
-
value: "flinfo",
|
|
142
|
-
children: "children"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
colProps: {
|
|
146
|
-
span: 11
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
dataIndex: "fileList",
|
|
151
|
-
title: "营业执照",
|
|
152
|
-
valueType: "custom",
|
|
153
|
-
valueProps: {
|
|
154
|
-
children: /* @__PURE__ */ jsx(Upload, { ...imgUploadProps, children: /* @__PURE__ */ jsx(Button, { children: "上传营业执照" }) }),
|
|
155
|
-
fileList: form.getFieldValue("fileList")
|
|
156
|
-
},
|
|
157
|
-
colProps: {
|
|
158
|
-
md: 24,
|
|
159
|
-
xl: 10
|
|
160
|
-
},
|
|
161
|
-
formItemProps: {
|
|
162
|
-
valuePropName: "fileList",
|
|
163
|
-
getValueFromEvent: normFile,
|
|
164
|
-
rules: [{ required: true, message: "请上传营业执照" }]
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
];
|
|
168
|
-
const totalText = "共@";
|
|
169
|
-
const unitText = "条@";
|
|
170
|
-
const jumpText = "跳至@";
|
|
171
|
-
const pageText = "页@";
|
|
172
11
|
const sm3key = "Aa123456#";
|
|
173
12
|
const msg = "username=admin×tamp=1758782465&modelid=19955BC7B61A43B3A982F0B2053ABC34";
|
|
174
13
|
HmacSM3.hmac(sm3key, msg);
|
|
175
14
|
return /* @__PURE__ */ jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
176
15
|
/* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
|
|
177
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 20, align: "center", children: [
|
|
178
|
-
"1. 测试修改密码hooks",
|
|
179
|
-
/* @__PURE__ */ jsx(
|
|
180
|
-
Button,
|
|
181
|
-
{
|
|
182
|
-
onClick: () => handleChangePwd((params) => {
|
|
183
|
-
}),
|
|
184
|
-
children: "修改密码"
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
] }),
|
|
188
16
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
189
17
|
"2. 测试循环滚动组件",
|
|
190
18
|
/* @__PURE__ */ jsx(
|
|
@@ -197,92 +25,6 @@ const Demo = () => {
|
|
|
197
25
|
}
|
|
198
26
|
}
|
|
199
27
|
)
|
|
200
|
-
] }),
|
|
201
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
202
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 20, align: "center", style: { marginBottom: 10 }, children: [
|
|
203
|
-
"3. 测试表格组件",
|
|
204
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => setList(columns), children: "test" })
|
|
205
|
-
] }),
|
|
206
|
-
/* @__PURE__ */ jsx(
|
|
207
|
-
SearchTable,
|
|
208
|
-
{
|
|
209
|
-
tableProps: {
|
|
210
|
-
columns: [
|
|
211
|
-
{
|
|
212
|
-
dataIndex: "id",
|
|
213
|
-
title: "ID"
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
dataIndex: "a",
|
|
217
|
-
title: "a",
|
|
218
|
-
width: 200
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
dataIndex: "a2",
|
|
222
|
-
title: "a",
|
|
223
|
-
width: 200
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
dataIndex: "a3",
|
|
227
|
-
title: "a",
|
|
228
|
-
width: 200
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
dataIndex: "a4",
|
|
232
|
-
title: "a",
|
|
233
|
-
width: 400
|
|
234
|
-
}
|
|
235
|
-
],
|
|
236
|
-
dataSource: list,
|
|
237
|
-
resizeable: true,
|
|
238
|
-
rowKey: "id",
|
|
239
|
-
pagination: {
|
|
240
|
-
total: 25,
|
|
241
|
-
current,
|
|
242
|
-
pageSize: 10,
|
|
243
|
-
onChange(page, pageSize) {
|
|
244
|
-
const index = (page - 1) * 10;
|
|
245
|
-
const arr = Array(10).fill(0).map((v, i) => ({ id: i + index }));
|
|
246
|
-
setList(arr);
|
|
247
|
-
setCurrent(page);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
)
|
|
253
|
-
] }),
|
|
254
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
255
|
-
"4. 测试创建表单组件",
|
|
256
|
-
/* @__PURE__ */ jsx(
|
|
257
|
-
CreateForm,
|
|
258
|
-
{
|
|
259
|
-
items: formItems,
|
|
260
|
-
formProps: { form, wrapperCol: { span: 24 }, style: { width: "60%", marginTop: 10 } }
|
|
261
|
-
}
|
|
262
|
-
)
|
|
263
|
-
] }),
|
|
264
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
265
|
-
"5. 测试自定义分页组件",
|
|
266
|
-
/* @__PURE__ */ jsx(
|
|
267
|
-
CustomPagination,
|
|
268
|
-
{
|
|
269
|
-
paginationProps: {
|
|
270
|
-
total: 25,
|
|
271
|
-
current,
|
|
272
|
-
pageSize: 10,
|
|
273
|
-
onChange(page, pageSize) {
|
|
274
|
-
const index = (page - 1) * 10;
|
|
275
|
-
const arr = Array(10).fill(0).map((v, i) => ({ id: i + index }));
|
|
276
|
-
setList(arr);
|
|
277
|
-
setCurrent(page);
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
totalText,
|
|
281
|
-
unitText,
|
|
282
|
-
jumpText,
|
|
283
|
-
pageText
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
28
|
] })
|
|
287
29
|
] });
|
|
288
30
|
};
|
|
File without changes
|
package/es/mock/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/es/mock/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/es/utils/method.js
CHANGED
|
@@ -313,6 +313,7 @@ const handleAttrListToObj = (attrList) => {
|
|
|
313
313
|
const { attrvalue = [], children = [] } = item || {};
|
|
314
314
|
if (Array.isArray(attrvalue) && (attrvalue == null ? void 0 : attrvalue.length)) {
|
|
315
315
|
item.children = attrvalue.map((v) => {
|
|
316
|
+
return handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
|
|
316
317
|
});
|
|
317
318
|
result[key] = {
|
|
318
319
|
asid: ((_e = (_d = (_c = item.children) == null ? void 0 : _c[0]) == null ? void 0 : _d[0]) == null ? void 0 : _e.asid) || "",
|
|
@@ -466,6 +467,12 @@ const handleSelectOptions = async ({
|
|
|
466
467
|
}
|
|
467
468
|
return options;
|
|
468
469
|
};
|
|
470
|
+
const handleObjDetailToSignleAttrList = (attrList, detail) => {
|
|
471
|
+
return attrList.map((item) => ({
|
|
472
|
+
...item,
|
|
473
|
+
attrvalue: detail[item.attrid] || ""
|
|
474
|
+
}));
|
|
475
|
+
};
|
|
469
476
|
export {
|
|
470
477
|
base64ToString,
|
|
471
478
|
getJson,
|
package/es/utils/szxkFunc.d.ts
CHANGED
|
@@ -28,3 +28,11 @@ export declare const handleGetAttrDetail: (params: {
|
|
|
28
28
|
* @returns 处理后的属性集列表,每个属性项包含attrvalue
|
|
29
29
|
*/
|
|
30
30
|
export declare const handleObjDetailToSignleAttrList: (attrList: any[], detail: any) => any[];
|
|
31
|
+
/**
|
|
32
|
+
* 设置表格行的颜色
|
|
33
|
+
*/
|
|
34
|
+
export declare const handleSetTableRowColor: (record: any, index: number | undefined) => {
|
|
35
|
+
style: {
|
|
36
|
+
backgroundColor: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
package/es/utils/szxkFunc.js
CHANGED
|
@@ -26,8 +26,14 @@ const handleObjDetailToSignleAttrList = (attrList, detail) => {
|
|
|
26
26
|
attrvalue: detail[item.attrid] || ""
|
|
27
27
|
}));
|
|
28
28
|
};
|
|
29
|
+
const handleSetTableRowColor = (record, index) => ({
|
|
30
|
+
style: {
|
|
31
|
+
backgroundColor: index !== void 0 && index % 2 === 1 ? "var(--bg-color-2)" : "var(--bg-color-3)"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
29
34
|
export {
|
|
30
35
|
handleGetAttrDetail,
|
|
31
36
|
handleGetAttrList,
|
|
32
|
-
handleObjDetailToSignleAttrList
|
|
37
|
+
handleObjDetailToSignleAttrList,
|
|
38
|
+
handleSetTableRowColor
|
|
33
39
|
};
|
package/es/vite-env.d.ts
CHANGED
|
@@ -182,14 +182,16 @@ const handleGetSingleAttrListObj = (children) => {
|
|
|
182
182
|
}
|
|
183
183
|
const dealList = (children2) => children2 == null ? void 0 : children2.map((v) => {
|
|
184
184
|
const obj = {};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
if (Array.isArray(v)) {
|
|
186
|
+
v.forEach((x) => {
|
|
187
|
+
var _a;
|
|
188
|
+
if ((_a = x == null ? void 0 : x.children) == null ? void 0 : _a.length) {
|
|
189
|
+
obj[x.attrid] = dealList(x.children);
|
|
190
|
+
} else {
|
|
191
|
+
obj[x.attrid] = x.attrvalue;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
193
195
|
return obj;
|
|
194
196
|
});
|
|
195
197
|
return dealList(children);
|
|
@@ -27,7 +27,7 @@ declare function useDynamicForm(props: IDynamicFormProps): {
|
|
|
27
27
|
item: IformConfigItem;
|
|
28
28
|
readonly: boolean;
|
|
29
29
|
colNum: number;
|
|
30
|
-
instructionShowMode?: "
|
|
30
|
+
instructionShowMode?: "icon" | "flex" | undefined;
|
|
31
31
|
relatedid?: string | undefined;
|
|
32
32
|
form: FormInstance;
|
|
33
33
|
defaultWidth?: number | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
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, span, type, servicesUniversalHeader, beforeExtraValue, operationColumn, }: {
|
|
16
|
+
attrList: any[];
|
|
17
|
+
span?: number | undefined;
|
|
18
|
+
type?: "form" | "table" | undefined;
|
|
19
|
+
servicesUniversalHeader?: any[] | undefined;
|
|
20
|
+
beforeExtraValue?: string | undefined;
|
|
21
|
+
operationColumn?: any;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
};
|
|
24
|
+
export {};
|