szld-libs 0.2.98 → 0.3.1

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 (106) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +32089 -20004
  3. package/dist/szld-components.umd.js +72 -60
  4. package/es/components/DynamicForm/index.d.ts +2 -0
  5. package/es/components/DynamicForm/index.js +3 -2
  6. package/es/components/DynamicForm/selectModel/index.js +1 -1
  7. package/es/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +27 -0
  8. package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +242 -0
  9. package/es/components/DynamicForm/selectModelBackfillFormItem/vite.svg +1 -0
  10. package/es/components/DynamicForm/useDynamicForm.js +22 -1
  11. package/es/components/DynamicFormMobile/func.d.ts +35 -0
  12. package/es/components/DynamicFormMobile/func.js +204 -0
  13. package/es/components/DynamicFormMobile/index.d.ts +116 -0
  14. package/es/components/DynamicFormMobile/index.js +134 -0
  15. package/es/components/DynamicFormMobile/myCascader/index.d.ts +17 -0
  16. package/es/components/DynamicFormMobile/myCascader/index.js +196 -0
  17. package/es/components/DynamicFormMobile/myCascader/vite.svg +1 -0
  18. package/es/components/DynamicFormMobile/myCheckbox/index.d.ts +19 -0
  19. package/es/components/DynamicFormMobile/myCheckbox/index.js +109 -0
  20. package/es/components/DynamicFormMobile/myCheckbox/vite.svg +1 -0
  21. package/es/components/DynamicFormMobile/myRadio/index.d.ts +20 -0
  22. package/es/components/DynamicFormMobile/myRadio/index.js +107 -0
  23. package/es/components/DynamicFormMobile/myRadio/vite.svg +1 -0
  24. package/es/components/DynamicFormMobile/mySelect/index.css +31 -0
  25. package/es/components/DynamicFormMobile/mySelect/index.d.ts +16 -0
  26. package/es/components/DynamicFormMobile/mySelect/index.js +147 -0
  27. package/es/components/DynamicFormMobile/mySelect/vite.svg +1 -0
  28. package/es/components/DynamicFormMobile/myUpload/index.css +3 -0
  29. package/es/components/DynamicFormMobile/myUpload/index.d.ts +16 -0
  30. package/es/components/DynamicFormMobile/myUpload/index.js +103 -0
  31. package/es/components/DynamicFormMobile/myUpload/vite.svg +1 -0
  32. package/es/components/DynamicFormMobile/radioCard/index.d.ts +12 -0
  33. package/es/components/DynamicFormMobile/radioCard/index.js +142 -0
  34. package/es/components/DynamicFormMobile/radioCard/vite.svg +1 -0
  35. package/es/components/DynamicFormMobile/selectModel/index.d.ts +22 -0
  36. package/es/components/DynamicFormMobile/selectModel/index.js +235 -0
  37. package/es/components/DynamicFormMobile/selectModel/vite.svg +1 -0
  38. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +27 -0
  39. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +242 -0
  40. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/vite.svg +1 -0
  41. package/es/components/DynamicFormMobile/useDynamicForm.d.ts +43 -0
  42. package/es/components/DynamicFormMobile/useDynamicForm.js +772 -0
  43. package/es/components/DynamicFormMobile/vite.svg +1 -0
  44. package/es/index.css +1 -0
  45. package/es/index.d.ts +1 -1
  46. package/es/index.js +36 -30
  47. package/es/main.d.ts +2 -1
  48. package/es/main.js +22 -20
  49. package/es/mock/index.d.ts +1 -305
  50. package/es/mock/index.js +20 -364
  51. package/es/services/index.js +3 -5
  52. package/es/services/request.js +2 -2
  53. package/es/utils/method.d.ts +4 -1
  54. package/es/utils/method.js +25 -8
  55. package/lib/components/DynamicForm/index.d.ts +2 -0
  56. package/lib/components/DynamicForm/index.js +3 -2
  57. package/lib/components/DynamicForm/selectModel/index.js +1 -1
  58. package/lib/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +27 -0
  59. package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +242 -0
  60. package/lib/components/DynamicForm/selectModelBackfillFormItem/vite.svg +1 -0
  61. package/lib/components/DynamicForm/useDynamicForm.js +22 -1
  62. package/lib/components/DynamicFormMobile/func.d.ts +35 -0
  63. package/lib/components/DynamicFormMobile/func.js +204 -0
  64. package/lib/components/DynamicFormMobile/index.d.ts +116 -0
  65. package/lib/components/DynamicFormMobile/index.js +133 -0
  66. package/lib/components/DynamicFormMobile/myCascader/index.d.ts +17 -0
  67. package/lib/components/DynamicFormMobile/myCascader/index.js +195 -0
  68. package/lib/components/DynamicFormMobile/myCascader/vite.svg +1 -0
  69. package/lib/components/DynamicFormMobile/myCheckbox/index.d.ts +19 -0
  70. package/lib/components/DynamicFormMobile/myCheckbox/index.js +108 -0
  71. package/lib/components/DynamicFormMobile/myCheckbox/vite.svg +1 -0
  72. package/lib/components/DynamicFormMobile/myRadio/index.d.ts +20 -0
  73. package/lib/components/DynamicFormMobile/myRadio/index.js +106 -0
  74. package/lib/components/DynamicFormMobile/myRadio/vite.svg +1 -0
  75. package/lib/components/DynamicFormMobile/mySelect/index.css +31 -0
  76. package/lib/components/DynamicFormMobile/mySelect/index.d.ts +16 -0
  77. package/lib/components/DynamicFormMobile/mySelect/index.js +146 -0
  78. package/lib/components/DynamicFormMobile/mySelect/vite.svg +1 -0
  79. package/lib/components/DynamicFormMobile/myUpload/index.css +3 -0
  80. package/lib/components/DynamicFormMobile/myUpload/index.d.ts +16 -0
  81. package/lib/components/DynamicFormMobile/myUpload/index.js +102 -0
  82. package/lib/components/DynamicFormMobile/myUpload/vite.svg +1 -0
  83. package/lib/components/DynamicFormMobile/radioCard/index.d.ts +12 -0
  84. package/lib/components/DynamicFormMobile/radioCard/index.js +141 -0
  85. package/lib/components/DynamicFormMobile/radioCard/vite.svg +1 -0
  86. package/lib/components/DynamicFormMobile/selectModel/index.d.ts +22 -0
  87. package/lib/components/DynamicFormMobile/selectModel/index.js +235 -0
  88. package/lib/components/DynamicFormMobile/selectModel/vite.svg +1 -0
  89. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +27 -0
  90. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +242 -0
  91. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/vite.svg +1 -0
  92. package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +43 -0
  93. package/lib/components/DynamicFormMobile/useDynamicForm.js +771 -0
  94. package/lib/components/DynamicFormMobile/vite.svg +1 -0
  95. package/lib/index.css +1 -0
  96. package/lib/index.d.ts +1 -1
  97. package/lib/index.js +36 -30
  98. package/lib/main.d.ts +2 -1
  99. package/lib/main.js +2 -0
  100. package/lib/mock/index.d.ts +1 -305
  101. package/lib/mock/index.js +19 -363
  102. package/lib/services/index.js +3 -5
  103. package/lib/services/request.js +2 -2
  104. package/lib/utils/method.d.ts +4 -1
  105. package/lib/utils/method.js +25 -8
  106. package/package.json +1 -1
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const reactVant = require("react-vant");
4
+ const func = require("../func");
5
+ const react = require("react");
6
+ const antd = require("antd");
7
+ const checkboxGroup = "index-module_checkbox-group_4684b";
8
+ const checkboxGroupHeader = "index-module_checkbox-group-header_192bd";
9
+ const checkboxGroupContent = "index-module_checkbox-group-content_f81a1";
10
+ const checkboxItem = "index-module_checkbox-item_1b36c";
11
+ const checkboxGroupCancel = "index-module_checkbox-group-cancel_c5cfb";
12
+ const styles = {
13
+ "checkbox-group": "index-module_checkbox-group_4684b",
14
+ checkboxGroup,
15
+ "checkbox-group-header": "index-module_checkbox-group-header_192bd",
16
+ checkboxGroupHeader,
17
+ "checkbox-group-content": "index-module_checkbox-group-content_f81a1",
18
+ checkboxGroupContent,
19
+ "checkbox-item": "index-module_checkbox-item_1b36c",
20
+ checkboxItem,
21
+ "checkbox-group-cancel": "index-module_checkbox-group-cancel_c5cfb",
22
+ checkboxGroupCancel
23
+ };
24
+ const MySelect = ({
25
+ item,
26
+ readonly,
27
+ style,
28
+ commonRequestWidthParams,
29
+ commonRequest,
30
+ value,
31
+ onChange,
32
+ interfaceTypeDict,
33
+ interfaceTypeSysDict,
34
+ actionUrlKey,
35
+ actionUrlExtraParams
36
+ }) => {
37
+ const [options, setOptions] = react.useState([]);
38
+ react.useEffect(() => {
39
+ if (item.input === "mult-select" && value && Array.isArray(value)) {
40
+ setSelectedValues(value || []);
41
+ setConfirmValues(value || []);
42
+ }
43
+ }, [value]);
44
+ react.useEffect(() => {
45
+ handleLoadOptions();
46
+ }, [item.inputType, item.classify, item.data, item.options]);
47
+ const handleLoadOptions = async () => {
48
+ const list = await func.handleSelectOptions({
49
+ commonRequestWidthParams,
50
+ commonRequest,
51
+ interfaceTypeDict,
52
+ interfaceTypeSysDict,
53
+ actionUrlKey,
54
+ actionUrlExtraParams,
55
+ item
56
+ });
57
+ setOptions(list);
58
+ };
59
+ const [showPopup, setShowPopup] = react.useState(false);
60
+ const [selectedValues, setSelectedValues] = react.useState([]);
61
+ const [confirmValues, setConfirmValues] = react.useState([]);
62
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: item.input === "mult-select" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", ...style }, children: [
63
+ /* @__PURE__ */ jsxRuntime.jsx(
64
+ reactVant.Field,
65
+ {
66
+ style: { padding: 0 },
67
+ isLink: true,
68
+ readOnly: true,
69
+ value: (confirmValues == null ? void 0 : confirmValues.length) ? confirmValues == null ? void 0 : confirmValues.join(",") : "",
70
+ onClick: () => {
71
+ if (readonly)
72
+ return;
73
+ setSelectedValues([...confirmValues]);
74
+ setShowPopup(true);
75
+ },
76
+ placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsxRuntime.jsx(
80
+ reactVant.Popup,
81
+ {
82
+ visible: showPopup,
83
+ round: true,
84
+ position: "bottom",
85
+ style: { height: "60vh" },
86
+ onClose: () => setShowPopup(false),
87
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles["checkbox-group"], children: [
88
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", className: styles["checkbox-group-header"], children: [
89
+ /* @__PURE__ */ jsxRuntime.jsx("a", { className: styles["checkbox-group-cancel"], onClick: () => setShowPopup(false), children: "取消" }),
90
+ /* @__PURE__ */ jsxRuntime.jsx(
91
+ "a",
92
+ {
93
+ onClick: () => {
94
+ setShowPopup(false);
95
+ setConfirmValues([...selectedValues]);
96
+ onChange((selectedValues == null ? void 0 : selectedValues.length) ? selectedValues == null ? void 0 : selectedValues.join(",") : "");
97
+ },
98
+ children: "确定"
99
+ }
100
+ )
101
+ ] }),
102
+ /* @__PURE__ */ jsxRuntime.jsx(
103
+ "div",
104
+ {
105
+ style: {
106
+ height: " calc(60vh - 70px)"
107
+ },
108
+ className: styles["checkbox-group-content"],
109
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactVant.Checkbox.Group, { iconSize: "18", onChange: (v) => setSelectedValues(v), value: selectedValues, children: options.map((item2) => /* @__PURE__ */ jsxRuntime.jsx(reactVant.Checkbox, { shape: "square", className: styles["checkbox-item"], name: item2.value, children: item2.label }, item2.value)) })
110
+ }
111
+ )
112
+ ] })
113
+ }
114
+ )
115
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
116
+ reactVant.Picker,
117
+ {
118
+ popup: true,
119
+ columns: options,
120
+ placeholder: "",
121
+ columnsFieldNames: {
122
+ text: "value"
123
+ },
124
+ onConfirm: onChange,
125
+ children: (val, _, actions) => {
126
+ return /* @__PURE__ */ jsxRuntime.jsx(
127
+ reactVant.Field,
128
+ {
129
+ style: { padding: 0, ...style },
130
+ isLink: true,
131
+ readOnly: true,
132
+ clickable: true,
133
+ placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择",
134
+ value: Array.isArray(val) ? val.join(",") : val || value,
135
+ onClick: () => {
136
+ if (readonly)
137
+ return;
138
+ actions.open();
139
+ }
140
+ }
141
+ );
142
+ }
143
+ }
144
+ ) });
145
+ };
146
+ 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_5ec38 a {
2
+ color: #252525 !important;
3
+ }
@@ -0,0 +1,16 @@
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
+ relatedidKey: string;
14
+ }
15
+ declare const MyUpload: (props: IMYUpload) => import("react/jsx-runtime").JSX.Element;
16
+ export default MyUpload;
@@ -0,0 +1,102 @@
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_5ec38";
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
+ relatedidKey
28
+ } = props;
29
+ const { message } = antd.App.useApp();
30
+ const accept = (item == null ? void 0 : item["upload-accept"]) || "*";
31
+ const input = item == null ? void 0 : item["input"];
32
+ const size = item == null ? void 0 : item["upload-size"];
33
+ const maxCount = (item == null ? void 0 : item["upload-max-count"]) || 1;
34
+ const [listType, setListType] = react.useState(input === "image" ? "picture-card" : "text");
35
+ const [fileList, setFileList] = react.useState([]);
36
+ const [previewOpen, setPreviewOpen] = react.useState(false);
37
+ const [previewImage, setPreviewImage] = react.useState("");
38
+ react.useEffect(() => {
39
+ if (list && list.length) {
40
+ setFileList(list);
41
+ }
42
+ }, [list]);
43
+ const handlePreview = async (file) => {
44
+ if (uploadType !== "image")
45
+ return;
46
+ if (!file.url && !file.preview) {
47
+ file.preview = await getBase64(file.originFileObj);
48
+ }
49
+ setPreviewImage(file.url || file.preview);
50
+ setPreviewOpen(true);
51
+ };
52
+ const handleChange = ({ fileList: newFileList }) => {
53
+ setFileList(newFileList);
54
+ onChange && onChange(newFileList);
55
+ };
56
+ const handleBeforeUpload = (file) => {
57
+ if (!size)
58
+ return true;
59
+ const isLt = file.size / 1024 / 1024 < Number(size);
60
+ if (!isLt) {
61
+ message.error(`请上传不超过${size}MB的文件`);
62
+ }
63
+ return isLt;
64
+ };
65
+ const uploadButton = input === "image" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { style: { border: 0, background: "none" }, type: "button", children: [
66
+ /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
67
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8 }, children: "Upload" })
68
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UploadOutlined, {}), children: uploadText }) });
69
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx(
71
+ antd.Upload,
72
+ {
73
+ action,
74
+ beforeUpload: handleBeforeUpload,
75
+ listType,
76
+ accept,
77
+ fileList,
78
+ onPreview: handlePreview,
79
+ data: { [relatedidKey]: relatedid },
80
+ maxCount,
81
+ onChange: handleChange,
82
+ onRemove,
83
+ disabled: readonly,
84
+ className: styles.customUpload,
85
+ children: fileList.length >= maxCount ? null : uploadButton
86
+ }
87
+ ),
88
+ previewImage && /* @__PURE__ */ jsxRuntime.jsx(
89
+ antd.Image,
90
+ {
91
+ wrapperStyle: { display: "none" },
92
+ preview: {
93
+ visible: previewOpen,
94
+ onVisibleChange: (visible) => setPreviewOpen(visible),
95
+ afterOpenChange: (visible) => !visible && setPreviewImage("")
96
+ },
97
+ src: previewImage
98
+ }
99
+ )
100
+ ] });
101
+ };
102
+ 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: ""
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: "0px" }, 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,22 @@
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
+ CustomModalComponent?: React.FC<ICustomModal>;
13
+ }
14
+ declare function SelectModel(props: SelectModelProps): import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ *
17
+ * @param selectedRows 选中的行数据
18
+ * @param attributeEnrollFormat 配置信息
19
+ * @returns 构建后的字符串
20
+ */
21
+ export declare function buildValueFromSelectedRows(selectedRows: any[], attributeEnrollFormat: Ijson): Promise<string>;
22
+ export default SelectModel;