szld-libs 0.2.58 → 0.2.59
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 +7657 -7564
- package/dist/szld-components.umd.js +42 -42
- package/es/hooks/useDetailRender.d.ts +19 -0
- package/es/hooks/useDetailRender.js +125 -0
- package/es/main.d.ts +2 -1
- package/es/main.js +2 -0
- package/lib/hooks/useDetailRender.d.ts +19 -0
- package/lib/hooks/useDetailRender.js +124 -0
- package/lib/main.d.ts +2 -1
- package/lib/main.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 宠物详情渲染 Hook
|
|
3
|
+
* @param dogInfo 宠物详情数据
|
|
4
|
+
* @param config 配置信息(用于文件预览地址)
|
|
5
|
+
* @returns 渲染函数
|
|
6
|
+
*/
|
|
7
|
+
interface IDetailRenderProps {
|
|
8
|
+
detailInfo: any;
|
|
9
|
+
mainApplicationDomain: string;
|
|
10
|
+
labelSpan?: number;
|
|
11
|
+
valueSpan?: number;
|
|
12
|
+
imgWidth?: number;
|
|
13
|
+
imgHeight?: number;
|
|
14
|
+
useGrid?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default function useDetailRenderer({ detailInfo, labelSpan, valueSpan, imgWidth, imgHeight, useGrid, mainApplicationDomain, }: IDetailRenderProps): {
|
|
17
|
+
renderDetail: () => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Row, Space, Image, Col } from "antd";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
function useDetailRenderer({
|
|
5
|
+
detailInfo,
|
|
6
|
+
labelSpan = 3,
|
|
7
|
+
valueSpan = 9,
|
|
8
|
+
imgWidth = 93,
|
|
9
|
+
imgHeight = 93,
|
|
10
|
+
useGrid = true,
|
|
11
|
+
mainApplicationDomain = ""
|
|
12
|
+
}) {
|
|
13
|
+
const handlePreviewFile = (filePath) => {
|
|
14
|
+
var _a;
|
|
15
|
+
(_a = window.parent) == null ? void 0 : _a.postMessage({ type: "previewDoc", docurl: filePath }, mainApplicationDomain);
|
|
16
|
+
};
|
|
17
|
+
const renderImageAttr = (item) => {
|
|
18
|
+
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
19
|
+
return;
|
|
20
|
+
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
21
|
+
const renderItem = /* @__PURE__ */ jsx(Space, { children: attrvalues.map((el, index) => /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
style: {
|
|
25
|
+
border: "1px solid rgba(0, 0, 0, 0.15)",
|
|
26
|
+
borderRadius: 4
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ jsx(
|
|
29
|
+
Image,
|
|
30
|
+
{
|
|
31
|
+
style: { objectFit: "cover", padding: 5 },
|
|
32
|
+
width: imgWidth,
|
|
33
|
+
height: imgHeight,
|
|
34
|
+
src: el == null ? void 0 : el.FilePath,
|
|
35
|
+
alt: (item == null ? void 0 : item.attrname) || "-"
|
|
36
|
+
},
|
|
37
|
+
index
|
|
38
|
+
)
|
|
39
|
+
},
|
|
40
|
+
index
|
|
41
|
+
)) });
|
|
42
|
+
if (!useGrid) {
|
|
43
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Col, { span: labelSpan, children: [
|
|
44
|
+
item == null ? void 0 : item.attrname,
|
|
45
|
+
":",
|
|
46
|
+
renderItem
|
|
47
|
+
] }) }, item.attrid);
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
51
|
+
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: renderItem })
|
|
52
|
+
] }, item.attrid);
|
|
53
|
+
};
|
|
54
|
+
const renderFileAttr = (item) => {
|
|
55
|
+
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
56
|
+
return;
|
|
57
|
+
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
58
|
+
const renderItem = /* @__PURE__ */ jsx(Space, { children: attrvalues.map((el, index) => /* @__PURE__ */ jsx("a", { onClick: () => handlePreviewFile(el == null ? void 0 : el.FilePath), children: (el == null ? void 0 : el.FileName) || "-" }, index)) });
|
|
59
|
+
if (!useGrid) {
|
|
60
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Col, { span: labelSpan, style: { wordWrap: "break-word" }, children: [
|
|
61
|
+
item == null ? void 0 : item.attrname,
|
|
62
|
+
":",
|
|
63
|
+
renderItem
|
|
64
|
+
] }) }, item.attrid);
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
68
|
+
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: renderItem })
|
|
69
|
+
] }, item.attrid);
|
|
70
|
+
};
|
|
71
|
+
const renderTextAttr = (item) => {
|
|
72
|
+
if (!useGrid) {
|
|
73
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Col, { span: labelSpan, style: { wordWrap: "break-word" }, children: [
|
|
74
|
+
item == null ? void 0 : item.attrname,
|
|
75
|
+
":",
|
|
76
|
+
(item == null ? void 0 : item.attrvalue) || "-"
|
|
77
|
+
] }) }, item.attrid);
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
81
|
+
/* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: (item == null ? void 0 : item.attrvalue) || "-" })
|
|
82
|
+
] }, item.attrid);
|
|
83
|
+
};
|
|
84
|
+
const renderDetail = () => {
|
|
85
|
+
if (!detailInfo)
|
|
86
|
+
return null;
|
|
87
|
+
const renderAttrItems = (items) => {
|
|
88
|
+
var _a;
|
|
89
|
+
return (_a = items == null ? void 0 : items.filter((item) => (item == null ? void 0 : item.attrtype) === 0)) == null ? void 0 : _a.map((item) => {
|
|
90
|
+
const info = (item == null ? void 0 : item.json) || (item == null ? void 0 : item.info) && JSON.parse(item.info);
|
|
91
|
+
let content;
|
|
92
|
+
if ((info == null ? void 0 : info.input) === "image") {
|
|
93
|
+
content = renderImageAttr(item);
|
|
94
|
+
} else if (["file", "audio", "video"].includes(info == null ? void 0 : info.input)) {
|
|
95
|
+
content = renderFileAttr(item);
|
|
96
|
+
} else {
|
|
97
|
+
content = renderTextAttr(item);
|
|
98
|
+
}
|
|
99
|
+
if ((item == null ? void 0 : item.children) && item.children.length > 0) {
|
|
100
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
|
+
content,
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
style: {
|
|
106
|
+
marginLeft: "16px",
|
|
107
|
+
marginTop: "8px",
|
|
108
|
+
borderLeft: "2px dashed #e8e8e8",
|
|
109
|
+
paddingLeft: "16px"
|
|
110
|
+
},
|
|
111
|
+
children: renderAttrItems(item.children)
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }, item.attrid);
|
|
115
|
+
}
|
|
116
|
+
return content;
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return /* @__PURE__ */ jsx(Row, { gutter: [15, 15], children: renderAttrItems(detailInfo == null ? void 0 : detailInfo.attr_list) });
|
|
120
|
+
};
|
|
121
|
+
return { renderDetail };
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
useDetailRenderer as default
|
|
125
|
+
};
|
package/es/main.d.ts
CHANGED
|
@@ -24,4 +24,5 @@ import useChangePwd from './hooks/useChangePwd';
|
|
|
24
24
|
import useConfig from './hooks/useConfig';
|
|
25
25
|
import useRemember from './hooks/useRemember';
|
|
26
26
|
import useRowSelection from './hooks/useRowSelection';
|
|
27
|
-
|
|
27
|
+
import useDetailRender from './hooks/useDetailRender';
|
|
28
|
+
export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, EditTable, HmacSHA512, HmacSM3, LoopSlide, SearchTable, showWorkFlow, UploadFile, DynamicForm, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, WorkFlowNode, CustomPagination, useDetailRender, utils, download, fileType, FormRules, verfyCode, method, };
|
package/es/main.js
CHANGED
|
@@ -24,6 +24,7 @@ import { default as default18 } from "./hooks/useChangePwd";
|
|
|
24
24
|
import { default as default19 } from "./hooks/useConfig";
|
|
25
25
|
import { default as default20 } from "./hooks/useRemember";
|
|
26
26
|
import { default as default21 } from "./hooks/useRowSelection";
|
|
27
|
+
import { default as default22 } from "./hooks/useDetailRender";
|
|
27
28
|
export {
|
|
28
29
|
default14 as AES,
|
|
29
30
|
default7 as AuthButton,
|
|
@@ -48,6 +49,7 @@ export {
|
|
|
48
49
|
default17 as useCaptcha,
|
|
49
50
|
default18 as useChangePwd,
|
|
50
51
|
default19 as useConfig,
|
|
52
|
+
default22 as useDetailRender,
|
|
51
53
|
default20 as useRemember,
|
|
52
54
|
default21 as useRowSelection,
|
|
53
55
|
index as utils,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 宠物详情渲染 Hook
|
|
3
|
+
* @param dogInfo 宠物详情数据
|
|
4
|
+
* @param config 配置信息(用于文件预览地址)
|
|
5
|
+
* @returns 渲染函数
|
|
6
|
+
*/
|
|
7
|
+
interface IDetailRenderProps {
|
|
8
|
+
detailInfo: any;
|
|
9
|
+
mainApplicationDomain: string;
|
|
10
|
+
labelSpan?: number;
|
|
11
|
+
valueSpan?: number;
|
|
12
|
+
imgWidth?: number;
|
|
13
|
+
imgHeight?: number;
|
|
14
|
+
useGrid?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default function useDetailRenderer({ detailInfo, labelSpan, valueSpan, imgWidth, imgHeight, useGrid, mainApplicationDomain, }: IDetailRenderProps): {
|
|
17
|
+
renderDetail: () => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const antd = require("antd");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
function useDetailRenderer({
|
|
6
|
+
detailInfo,
|
|
7
|
+
labelSpan = 3,
|
|
8
|
+
valueSpan = 9,
|
|
9
|
+
imgWidth = 93,
|
|
10
|
+
imgHeight = 93,
|
|
11
|
+
useGrid = true,
|
|
12
|
+
mainApplicationDomain = ""
|
|
13
|
+
}) {
|
|
14
|
+
const handlePreviewFile = (filePath) => {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = window.parent) == null ? void 0 : _a.postMessage({ type: "previewDoc", docurl: filePath }, mainApplicationDomain);
|
|
17
|
+
};
|
|
18
|
+
const renderImageAttr = (item) => {
|
|
19
|
+
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
20
|
+
return;
|
|
21
|
+
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
22
|
+
const renderItem = /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { children: attrvalues.map((el, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
style: {
|
|
26
|
+
border: "1px solid rgba(0, 0, 0, 0.15)",
|
|
27
|
+
borderRadius: 4
|
|
28
|
+
},
|
|
29
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
antd.Image,
|
|
31
|
+
{
|
|
32
|
+
style: { objectFit: "cover", padding: 5 },
|
|
33
|
+
width: imgWidth,
|
|
34
|
+
height: imgHeight,
|
|
35
|
+
src: el == null ? void 0 : el.FilePath,
|
|
36
|
+
alt: (item == null ? void 0 : item.attrname) || "-"
|
|
37
|
+
},
|
|
38
|
+
index
|
|
39
|
+
)
|
|
40
|
+
},
|
|
41
|
+
index
|
|
42
|
+
)) });
|
|
43
|
+
if (!useGrid) {
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Col, { span: labelSpan, children: [
|
|
45
|
+
item == null ? void 0 : item.attrname,
|
|
46
|
+
":",
|
|
47
|
+
renderItem
|
|
48
|
+
] }) }, item.attrid);
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: renderItem })
|
|
53
|
+
] }, item.attrid);
|
|
54
|
+
};
|
|
55
|
+
const renderFileAttr = (item) => {
|
|
56
|
+
if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
|
|
57
|
+
return;
|
|
58
|
+
const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
|
|
59
|
+
const renderItem = /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { children: attrvalues.map((el, index) => /* @__PURE__ */ jsxRuntime.jsx("a", { onClick: () => handlePreviewFile(el == null ? void 0 : el.FilePath), children: (el == null ? void 0 : el.FileName) || "-" }, index)) });
|
|
60
|
+
if (!useGrid) {
|
|
61
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Col, { span: labelSpan, style: { wordWrap: "break-word" }, children: [
|
|
62
|
+
item == null ? void 0 : item.attrname,
|
|
63
|
+
":",
|
|
64
|
+
renderItem
|
|
65
|
+
] }) }, item.attrid);
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
69
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: renderItem })
|
|
70
|
+
] }, item.attrid);
|
|
71
|
+
};
|
|
72
|
+
const renderTextAttr = (item) => {
|
|
73
|
+
if (!useGrid) {
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Col, { span: labelSpan, style: { wordWrap: "break-word" }, children: [
|
|
75
|
+
item == null ? void 0 : item.attrname,
|
|
76
|
+
":",
|
|
77
|
+
(item == null ? void 0 : item.attrvalue) || "-"
|
|
78
|
+
] }) }, item.attrid);
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
|
|
82
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: (item == null ? void 0 : item.attrvalue) || "-" })
|
|
83
|
+
] }, item.attrid);
|
|
84
|
+
};
|
|
85
|
+
const renderDetail = () => {
|
|
86
|
+
if (!detailInfo)
|
|
87
|
+
return null;
|
|
88
|
+
const renderAttrItems = (items) => {
|
|
89
|
+
var _a;
|
|
90
|
+
return (_a = items == null ? void 0 : items.filter((item) => (item == null ? void 0 : item.attrtype) === 0)) == null ? void 0 : _a.map((item) => {
|
|
91
|
+
const info = (item == null ? void 0 : item.json) || (item == null ? void 0 : item.info) && JSON.parse(item.info);
|
|
92
|
+
let content;
|
|
93
|
+
if ((info == null ? void 0 : info.input) === "image") {
|
|
94
|
+
content = renderImageAttr(item);
|
|
95
|
+
} else if (["file", "audio", "video"].includes(info == null ? void 0 : info.input)) {
|
|
96
|
+
content = renderFileAttr(item);
|
|
97
|
+
} else {
|
|
98
|
+
content = renderTextAttr(item);
|
|
99
|
+
}
|
|
100
|
+
if ((item == null ? void 0 : item.children) && item.children.length > 0) {
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
102
|
+
content,
|
|
103
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
style: {
|
|
107
|
+
marginLeft: "16px",
|
|
108
|
+
marginTop: "8px",
|
|
109
|
+
borderLeft: "2px dashed #e8e8e8",
|
|
110
|
+
paddingLeft: "16px"
|
|
111
|
+
},
|
|
112
|
+
children: renderAttrItems(item.children)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }, item.attrid);
|
|
116
|
+
}
|
|
117
|
+
return content;
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: [15, 15], children: renderAttrItems(detailInfo == null ? void 0 : detailInfo.attr_list) });
|
|
121
|
+
};
|
|
122
|
+
return { renderDetail };
|
|
123
|
+
}
|
|
124
|
+
module.exports = useDetailRenderer;
|
package/lib/main.d.ts
CHANGED
|
@@ -24,4 +24,5 @@ import useChangePwd from './hooks/useChangePwd';
|
|
|
24
24
|
import useConfig from './hooks/useConfig';
|
|
25
25
|
import useRemember from './hooks/useRemember';
|
|
26
26
|
import useRowSelection from './hooks/useRowSelection';
|
|
27
|
-
|
|
27
|
+
import useDetailRender from './hooks/useDetailRender';
|
|
28
|
+
export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, EditTable, HmacSHA512, HmacSM3, LoopSlide, SearchTable, showWorkFlow, UploadFile, DynamicForm, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, WorkFlowNode, CustomPagination, useDetailRender, utils, download, fileType, FormRules, verfyCode, method, };
|
package/lib/main.js
CHANGED
|
@@ -26,6 +26,7 @@ const useChangePwd = require("./hooks/useChangePwd");
|
|
|
26
26
|
const useConfig = require("./hooks/useConfig");
|
|
27
27
|
const useRemember = require("./hooks/useRemember");
|
|
28
28
|
const useRowSelection = require("./hooks/useRowSelection");
|
|
29
|
+
const useDetailRender = require("./hooks/useDetailRender");
|
|
29
30
|
function _interopNamespaceDefault(e) {
|
|
30
31
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
31
32
|
if (e) {
|
|
@@ -78,3 +79,4 @@ exports.useChangePwd = useChangePwd;
|
|
|
78
79
|
exports.useConfig = useConfig;
|
|
79
80
|
exports.useRemember = useRemember;
|
|
80
81
|
exports.useRowSelection = useRowSelection;
|
|
82
|
+
exports.useDetailRender = useDetailRender;
|