szld-libs 0.2.52 → 0.2.54

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.
Files changed (66) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +17007 -15272
  3. package/dist/szld-components.umd.js +55 -55
  4. package/es/components/DynamicForm/index.d.ts +102 -0
  5. package/es/components/DynamicForm/index.js +55 -0
  6. package/es/components/DynamicForm/myCascader/index.d.ts +13 -0
  7. package/es/components/DynamicForm/myCascader/index.js +186 -0
  8. package/es/components/DynamicForm/myCascader/vite.svg +1 -0
  9. package/es/components/DynamicForm/myCheckbox/index.d.ts +15 -0
  10. package/es/components/DynamicForm/myCheckbox/index.js +102 -0
  11. package/es/components/DynamicForm/myCheckbox/vite.svg +1 -0
  12. package/es/components/DynamicForm/myRadio/index.d.ts +16 -0
  13. package/es/components/DynamicForm/myRadio/index.js +100 -0
  14. package/es/components/DynamicForm/myRadio/vite.svg +1 -0
  15. package/es/components/DynamicForm/mySelect/index.d.ts +13 -0
  16. package/es/components/DynamicForm/mySelect/index.js +126 -0
  17. package/es/components/DynamicForm/mySelect/vite.svg +1 -0
  18. package/es/components/DynamicForm/myUpload/index.css +3 -0
  19. package/es/components/DynamicForm/myUpload/index.d.ts +15 -0
  20. package/es/components/DynamicForm/myUpload/index.js +102 -0
  21. package/es/components/DynamicForm/myUpload/vite.svg +1 -0
  22. package/es/components/DynamicForm/radioCard/index.d.ts +12 -0
  23. package/es/components/DynamicForm/radioCard/index.js +142 -0
  24. package/es/components/DynamicForm/radioCard/vite.svg +1 -0
  25. package/es/components/DynamicForm/selectModel/index.d.ts +21 -0
  26. package/es/components/DynamicForm/selectModel/index.js +197 -0
  27. package/es/components/DynamicForm/selectModel/vite.svg +1 -0
  28. package/es/components/DynamicForm/useDynamicForm.d.ts +26 -0
  29. package/es/components/DynamicForm/useDynamicForm.js +554 -0
  30. package/es/components/DynamicForm/vite.svg +1 -0
  31. package/es/main.d.ts +3 -1
  32. package/es/main.js +22 -18
  33. package/es/utils/method.d.ts +21 -0
  34. package/es/utils/method.js +186 -0
  35. package/lib/components/DynamicForm/index.d.ts +102 -0
  36. package/lib/components/DynamicForm/index.js +54 -0
  37. package/lib/components/DynamicForm/myCascader/index.d.ts +13 -0
  38. package/lib/components/DynamicForm/myCascader/index.js +185 -0
  39. package/lib/components/DynamicForm/myCascader/vite.svg +1 -0
  40. package/lib/components/DynamicForm/myCheckbox/index.d.ts +15 -0
  41. package/lib/components/DynamicForm/myCheckbox/index.js +101 -0
  42. package/lib/components/DynamicForm/myCheckbox/vite.svg +1 -0
  43. package/lib/components/DynamicForm/myRadio/index.d.ts +16 -0
  44. package/lib/components/DynamicForm/myRadio/index.js +99 -0
  45. package/lib/components/DynamicForm/myRadio/vite.svg +1 -0
  46. package/lib/components/DynamicForm/mySelect/index.d.ts +13 -0
  47. package/lib/components/DynamicForm/mySelect/index.js +125 -0
  48. package/lib/components/DynamicForm/mySelect/vite.svg +1 -0
  49. package/lib/components/DynamicForm/myUpload/index.css +3 -0
  50. package/lib/components/DynamicForm/myUpload/index.d.ts +15 -0
  51. package/lib/components/DynamicForm/myUpload/index.js +101 -0
  52. package/lib/components/DynamicForm/myUpload/vite.svg +1 -0
  53. package/lib/components/DynamicForm/radioCard/index.d.ts +12 -0
  54. package/lib/components/DynamicForm/radioCard/index.js +141 -0
  55. package/lib/components/DynamicForm/radioCard/vite.svg +1 -0
  56. package/lib/components/DynamicForm/selectModel/index.d.ts +21 -0
  57. package/lib/components/DynamicForm/selectModel/index.js +197 -0
  58. package/lib/components/DynamicForm/selectModel/vite.svg +1 -0
  59. package/lib/components/DynamicForm/useDynamicForm.d.ts +26 -0
  60. package/lib/components/DynamicForm/useDynamicForm.js +553 -0
  61. package/lib/components/DynamicForm/vite.svg +1 -0
  62. package/lib/main.d.ts +3 -1
  63. package/lib/main.js +5 -0
  64. package/lib/utils/method.d.ts +21 -0
  65. package/lib/utils/method.js +186 -0
  66. package/package.json +3 -1
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const antd = require("antd");
4
+ const react = require("react");
5
+ const MyRadio = (props) => {
6
+ const {
7
+ item,
8
+ onChange,
9
+ readonly = false,
10
+ options,
11
+ radioAlign = "horizontal",
12
+ commonRequestWidthParams,
13
+ commonRequest,
14
+ handleUrlOptions,
15
+ value
16
+ } = props;
17
+ const { message } = antd.App.useApp();
18
+ const [list, setList] = react.useState([]);
19
+ react.useEffect(() => {
20
+ if ((item == null ? void 0 : item.inputType) === "local") {
21
+ const arr = (item == null ? void 0 : item.data) || [];
22
+ setList(arr.map((v) => ({ value: v, label: v })));
23
+ } else if ((item == null ? void 0 : item.inputType) === "dictionary") {
24
+ getList(item.classify);
25
+ } else if ((item == null ? void 0 : item.inputType) === "url") {
26
+ getUrlList();
27
+ }
28
+ }, [item == null ? void 0 : item.inputType]);
29
+ const getList = async (id) => {
30
+ var _a;
31
+ if (!id) {
32
+ return;
33
+ }
34
+ const res = await commonRequest("YLZDDictList", { asctypeid: id });
35
+ if ((res == null ? void 0 : res.ReturnValue) === 1) {
36
+ const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
37
+ setList(
38
+ arr.map((v) => {
39
+ const value2 = v.dicid + "-" + v.info;
40
+ return { value: value2, label: value2 };
41
+ })
42
+ );
43
+ }
44
+ };
45
+ const getUrlList = async () => {
46
+ var _a, _b;
47
+ try {
48
+ const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
49
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
50
+ if (!keyFieldList.length) {
51
+ message.error("请配置key-field");
52
+ return;
53
+ }
54
+ if (!commonRequestWidthParams)
55
+ return;
56
+ const response = await commonRequestWidthParams(
57
+ {
58
+ PageName: "dns_relay",
59
+ Controlname: "CallActionUrl",
60
+ InterfaceType: "DPGLSysemName"
61
+ },
62
+ {
63
+ "action-url": item == null ? void 0 : item["action-url"]
64
+ }
65
+ );
66
+ if (response == null ? void 0 : response.data) {
67
+ const data = response == null ? void 0 : response.data;
68
+ const list2 = data == null ? void 0 : data.list;
69
+ let urlData = [];
70
+ if (Array.isArray(data)) {
71
+ urlData = data;
72
+ }
73
+ if (Array.isArray(list2)) {
74
+ urlData = list2;
75
+ }
76
+ const urlOptions = urlData.map((val) => ({
77
+ label: handleUrlOptions(val, delimiter, keyFieldList),
78
+ value: handleUrlOptions(val, delimiter, keyFieldList)
79
+ }));
80
+ setList([...urlOptions]);
81
+ }
82
+ } catch (error) {
83
+ message.error("加载选项失败");
84
+ } finally {
85
+ }
86
+ };
87
+ return /* @__PURE__ */ jsxRuntime.jsx(
88
+ antd.Radio.Group,
89
+ {
90
+ ...options,
91
+ options: list,
92
+ onChange,
93
+ disabled: readonly,
94
+ value,
95
+ style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" }
96
+ }
97
+ );
98
+ };
99
+ module.exports = MyRadio;
@@ -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>
@@ -0,0 +1,13 @@
1
+ import { Ijson } from '../index.d';
2
+ import { AxiosResponse } from 'axios';
3
+ declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, }: {
4
+ item: Ijson;
5
+ readonly?: boolean | undefined;
6
+ style?: any;
7
+ handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
8
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
9
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
10
+ value: string | number | (string | number)[];
11
+ onChange: (val: string | number | (string | number)[]) => void;
12
+ }) => import("react/jsx-runtime").JSX.Element;
13
+ export default MySelect;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ const antd = require("antd");
5
+ const MySelect = ({
6
+ item,
7
+ readonly,
8
+ style,
9
+ handleUrlOptions,
10
+ commonRequestWidthParams,
11
+ commonRequest,
12
+ value,
13
+ onChange
14
+ }) => {
15
+ const { message } = antd.App.useApp();
16
+ const [options, setOptions] = react.useState([]);
17
+ const [loading, setLoading] = react.useState(false);
18
+ react.useEffect(() => {
19
+ handleLoadOptions();
20
+ }, [item.inputType, item.classify, item.data, item.options]);
21
+ const handleLoadOptions = async () => {
22
+ var _a, _b, _c;
23
+ if (item.inputType === "local") {
24
+ let localOptions = [];
25
+ if (item.data && Array.isArray(item.data)) {
26
+ localOptions = item.data.map((val) => ({
27
+ label: val,
28
+ value: val
29
+ }));
30
+ } else if (item.options && Array.isArray(item.options)) {
31
+ localOptions = item.options;
32
+ }
33
+ setOptions(localOptions);
34
+ } else if (item.inputType === "dictionary") {
35
+ if (item.classify) {
36
+ setLoading(true);
37
+ try {
38
+ const response = await commonRequest("YLZDDictList", {
39
+ asctypeid: item.classify
40
+ });
41
+ if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
42
+ const dictionaryOptions = response.data.list.map((dictItem) => ({
43
+ label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
44
+ value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
45
+ }));
46
+ setOptions(dictionaryOptions);
47
+ }
48
+ } catch (error) {
49
+ message.error("加载选项失败");
50
+ } finally {
51
+ setLoading(false);
52
+ }
53
+ }
54
+ } else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
55
+ try {
56
+ const keyFieldList = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.list) || [];
57
+ const delimiter = ((_c = item == null ? void 0 : item["key-field"]) == null ? void 0 : _c.delimiter) || "";
58
+ if (!keyFieldList.length) {
59
+ message.error("请配置key-field");
60
+ return;
61
+ }
62
+ const response = await commonRequestWidthParams(
63
+ {
64
+ PageName: "dns_relay",
65
+ Controlname: "CallActionUrl",
66
+ InterfaceType: "DPGLSysemName"
67
+ },
68
+ {
69
+ "action-url": item == null ? void 0 : item["action-url"]
70
+ }
71
+ );
72
+ if (response == null ? void 0 : response.data) {
73
+ const data = response == null ? void 0 : response.data;
74
+ const list = data == null ? void 0 : data.list;
75
+ let urlData = [];
76
+ if (Array.isArray(data)) {
77
+ urlData = data;
78
+ }
79
+ if (Array.isArray(list)) {
80
+ urlData = list;
81
+ }
82
+ const urlOptions = urlData.map((val) => ({
83
+ label: handleUrlOptions(val, delimiter, keyFieldList),
84
+ value: handleUrlOptions(val, delimiter, keyFieldList)
85
+ }));
86
+ setOptions([...urlOptions]);
87
+ }
88
+ } catch (error) {
89
+ }
90
+ } else {
91
+ let defaultOptions = [];
92
+ if (item.data && Array.isArray(item.data)) {
93
+ defaultOptions = item.data.map((val) => ({
94
+ label: val,
95
+ value: val
96
+ }));
97
+ } else if (item.options && Array.isArray(item.options)) {
98
+ defaultOptions = item.options;
99
+ }
100
+ setOptions(defaultOptions);
101
+ }
102
+ };
103
+ return /* @__PURE__ */ jsxRuntime.jsx(
104
+ antd.Select,
105
+ {
106
+ placeholder: "请选择",
107
+ mode: item.input === "mult-select" ? "multiple" : void 0,
108
+ disabled: readonly,
109
+ loading,
110
+ showSearch: true,
111
+ value,
112
+ filterOption: (inputValue, option) => {
113
+ var _a;
114
+ return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().indexOf(inputValue.toLowerCase())) >= 0;
115
+ },
116
+ options,
117
+ style: { ...style },
118
+ allowClear: true,
119
+ onChange: (val) => {
120
+ onChange(val);
121
+ }
122
+ }
123
+ );
124
+ };
125
+ module.exports = MySelect;
@@ -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>
@@ -0,0 +1,3 @@
1
+ .myUpload-module_customUpload_7c7d3 a {
2
+ color: #252525 !important;
3
+ }
@@ -0,0 +1,15 @@
1
+ import { UploadFile } from 'antd/es/upload/interface';
2
+ import { Ijson } from '../index.d';
3
+ interface IMYUpload {
4
+ action?: string;
5
+ onChange?: (checkedValue: any[]) => void;
6
+ onRemove?: (file: UploadFile) => void;
7
+ item: Ijson;
8
+ relatedid?: string;
9
+ readonly?: boolean;
10
+ list?: UploadFile[];
11
+ uploadText?: string;
12
+ uploadType?: string;
13
+ }
14
+ declare const MyUpload: (props: IMYUpload) => import("react/jsx-runtime").JSX.Element;
15
+ export default MyUpload;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const icons = require("@ant-design/icons");
4
+ const antd = require("antd");
5
+ const react = require("react");
6
+ const customUpload = "myUpload-module_customUpload_7c7d3";
7
+ const styles = {
8
+ customUpload
9
+ };
10
+ const getBase64 = (file) => new Promise((resolve, reject) => {
11
+ const reader = new FileReader();
12
+ reader.readAsDataURL(file);
13
+ reader.onload = () => resolve(reader.result);
14
+ reader.onerror = (error) => reject(error);
15
+ });
16
+ const MyUpload = (props) => {
17
+ const {
18
+ action,
19
+ item,
20
+ onChange,
21
+ readonly = false,
22
+ relatedid,
23
+ uploadText = "上传文件",
24
+ onRemove,
25
+ list = [],
26
+ uploadType
27
+ } = props;
28
+ const { message } = antd.App.useApp();
29
+ const accept = (item == null ? void 0 : item["upload-accept"]) || "*";
30
+ const input = item == null ? void 0 : item["input"];
31
+ const size = item == null ? void 0 : item["upload-size"];
32
+ const maxCount = (item == null ? void 0 : item["upload-max-count"]) || 1;
33
+ const [listType, setListType] = react.useState(input === "image" ? "picture-card" : "text");
34
+ const [fileList, setFileList] = react.useState([]);
35
+ const [previewOpen, setPreviewOpen] = react.useState(false);
36
+ const [previewImage, setPreviewImage] = react.useState("");
37
+ react.useEffect(() => {
38
+ if (list && list.length) {
39
+ setFileList(list);
40
+ }
41
+ }, [list]);
42
+ const handlePreview = async (file) => {
43
+ if (uploadType !== "image")
44
+ return;
45
+ if (!file.url && !file.preview) {
46
+ file.preview = await getBase64(file.originFileObj);
47
+ }
48
+ setPreviewImage(file.url || file.preview);
49
+ setPreviewOpen(true);
50
+ };
51
+ const handleChange = ({ fileList: newFileList }) => {
52
+ setFileList(newFileList);
53
+ onChange && onChange(newFileList);
54
+ };
55
+ const handleBeforeUpload = (file) => {
56
+ if (!size)
57
+ return true;
58
+ const isLt = file.size / 1024 / 1024 < Number(size);
59
+ if (!isLt) {
60
+ message.error(`请上传不超过${size}MB的文件`);
61
+ }
62
+ return isLt;
63
+ };
64
+ const uploadButton = input === "image" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { style: { border: 0, background: "none" }, type: "button", children: [
65
+ /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
66
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8 }, children: "Upload" })
67
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UploadOutlined, {}), children: uploadText }) });
68
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
69
+ /* @__PURE__ */ jsxRuntime.jsx(
70
+ antd.Upload,
71
+ {
72
+ action,
73
+ beforeUpload: handleBeforeUpload,
74
+ listType,
75
+ accept,
76
+ fileList,
77
+ onPreview: handlePreview,
78
+ data: { relatedid },
79
+ maxCount,
80
+ onChange: handleChange,
81
+ onRemove,
82
+ disabled: readonly,
83
+ className: styles.customUpload,
84
+ children: fileList.length >= maxCount ? null : uploadButton
85
+ }
86
+ ),
87
+ previewImage && /* @__PURE__ */ jsxRuntime.jsx(
88
+ antd.Image,
89
+ {
90
+ wrapperStyle: { display: "none" },
91
+ preview: {
92
+ visible: previewOpen,
93
+ onVisibleChange: (visible) => setPreviewOpen(visible),
94
+ afterOpenChange: (visible) => !visible && setPreviewImage("")
95
+ },
96
+ src: previewImage
97
+ }
98
+ )
99
+ ] });
100
+ };
101
+ module.exports = MyUpload;
@@ -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>
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { AxiosResponse } from 'axios';
3
+ interface RadioCardProps {
4
+ item: any;
5
+ readonly?: boolean;
6
+ value?: string;
7
+ onChange?: (value: any) => void;
8
+ style?: React.CSSProperties;
9
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
10
+ }
11
+ declare const RadioCard: ({ item, readonly, value, onChange, style, commonRequestWidthParams }: RadioCardProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default RadioCard;
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const icons = require("@ant-design/icons");
4
+ const react = require("react");
5
+ const antd = require("antd");
6
+ const RadioCard = ({ item, readonly, value, onChange, style, commonRequestWidthParams }) => {
7
+ const [cardData, setCardData] = react.useState([]);
8
+ const [loading, setLoading] = react.useState(false);
9
+ react.useEffect(() => {
10
+ const loadCardData = async () => {
11
+ var _a;
12
+ if (item.inputType === "url" && item["action-url"]) {
13
+ setLoading(true);
14
+ try {
15
+ const response = await commonRequestWidthParams(
16
+ {
17
+ PageName: "dns_relay",
18
+ Controlname: "CallActionUrl",
19
+ InterfaceType: "DPGLSysemName"
20
+ },
21
+ {
22
+ "action-url": item == null ? void 0 : item["action-url"]
23
+ }
24
+ );
25
+ if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
26
+ setCardData(response.data.list);
27
+ } else if ((response == null ? void 0 : response.data) && Array.isArray(response.data)) {
28
+ setCardData(response.data);
29
+ } else if (Array.isArray(response == null ? void 0 : response.list)) {
30
+ setCardData(response.list);
31
+ } else if ((response == null ? void 0 : response.ReturnValue) === 1 && (response == null ? void 0 : response.data)) {
32
+ if (Array.isArray(response.data)) {
33
+ setCardData(response.data);
34
+ } else {
35
+ setCardData([response.data]);
36
+ }
37
+ }
38
+ } catch (error) {
39
+ } finally {
40
+ setLoading(false);
41
+ }
42
+ } else if (item.data && Array.isArray(item.data)) {
43
+ setCardData(item.data);
44
+ }
45
+ };
46
+ loadCardData();
47
+ }, [item.inputType, item["action-url"], item.data]);
48
+ const buildValue = (record) => {
49
+ return JSON.stringify(record);
50
+ };
51
+ const isSelected = (record) => {
52
+ const recordValue = buildValue(record);
53
+ return value === recordValue;
54
+ };
55
+ const handleCardClick = (record) => {
56
+ if (readonly)
57
+ return;
58
+ const recordValue = buildValue(record);
59
+ onChange && onChange(recordValue);
60
+ };
61
+ const imageWidth = item["card-image-width"] || 200;
62
+ const imageHeight = item["card-image-height"] || 100;
63
+ const imageField = item["card-image-field"];
64
+ const infoField = item["card-info-field"];
65
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...style }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", padding: "20px" }, children: "加载中..." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "50px" }, children: cardData.map((record, index) => {
66
+ const selected = isSelected(record);
67
+ return /* @__PURE__ */ jsxRuntime.jsxs(
68
+ "div",
69
+ {
70
+ onClick: () => handleCardClick(record),
71
+ style: {
72
+ flex: "1 1 auto",
73
+ width: `${imageWidth}px`,
74
+ padding: "12px",
75
+ cursor: readonly ? "not-allowed" : "pointer",
76
+ opacity: readonly ? 0.6 : 1,
77
+ transition: "all 0.3s"
78
+ },
79
+ children: [
80
+ record[imageField] && /* @__PURE__ */ jsxRuntime.jsx(
81
+ "img",
82
+ {
83
+ src: record.picurl,
84
+ alt: record[infoField] || "",
85
+ style: {
86
+ width: `${imageWidth}px`,
87
+ height: `${imageHeight}px`,
88
+ objectFit: "cover",
89
+ borderRadius: "4px",
90
+ marginBottom: "8px"
91
+ },
92
+ onError: (e) => {
93
+ e.currentTarget.style.display = "none";
94
+ }
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsxRuntime.jsx(
98
+ "div",
99
+ {
100
+ style: {
101
+ fontSize: "14px",
102
+ color: "#333333"
103
+ },
104
+ children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 6, children: [
105
+ /* @__PURE__ */ jsxRuntime.jsx(
106
+ "div",
107
+ {
108
+ style: {
109
+ width: "16px",
110
+ height: "16px",
111
+ borderRadius: "50%",
112
+ border: selected ? "none" : "1px solid #d9d9d9",
113
+ backgroundColor: selected ? "var(--color-primary)" : "transparent",
114
+ display: "flex",
115
+ alignItems: "center",
116
+ justifyContent: "center",
117
+ flexShrink: 0,
118
+ cursor: readonly ? "not-allowed" : "pointer"
119
+ },
120
+ children: selected && /* @__PURE__ */ jsxRuntime.jsx(
121
+ icons.CheckOutlined,
122
+ {
123
+ style: {
124
+ fontSize: "12px",
125
+ color: "#fff"
126
+ }
127
+ }
128
+ )
129
+ }
130
+ ),
131
+ record[infoField] || ""
132
+ ] })
133
+ }
134
+ )
135
+ ]
136
+ },
137
+ index
138
+ );
139
+ }) }) });
140
+ };
141
+ module.exports = RadioCard;
@@ -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>
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { AxiosResponse } from 'axios';
3
+ import { Ijson } from '../index.d';
4
+ interface SelectModelProps {
5
+ item: Ijson;
6
+ onSure: (value: string) => void;
7
+ value: string;
8
+ disabled: boolean;
9
+ style?: React.CSSProperties;
10
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
11
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
12
+ }
13
+ declare function SelectModel(props: SelectModelProps): import("react/jsx-runtime").JSX.Element;
14
+ /**
15
+ *
16
+ * @param selectedRows 选中的行数据
17
+ * @param attributeEnrollFormat 配置信息
18
+ * @returns 构建后的字符串
19
+ */
20
+ export declare function buildValueFromSelectedRows(selectedRows: any[], attributeEnrollFormat: Ijson): Promise<string>;
21
+ export default SelectModel;