szld-libs 0.2.51 → 0.2.53

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 (70) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +17010 -15271
  3. package/dist/szld-components.umd.js +55 -55
  4. package/es/components/BackHeader/index.d.ts +2 -0
  5. package/es/components/BackHeader/index.js +5 -1
  6. package/es/components/DynamicForm/index.d.ts +102 -0
  7. package/es/components/DynamicForm/index.js +55 -0
  8. package/es/components/DynamicForm/myCascader/index.d.ts +13 -0
  9. package/es/components/DynamicForm/myCascader/index.js +186 -0
  10. package/es/components/DynamicForm/myCascader/vite.svg +1 -0
  11. package/es/components/DynamicForm/myCheckbox/index.d.ts +15 -0
  12. package/es/components/DynamicForm/myCheckbox/index.js +102 -0
  13. package/es/components/DynamicForm/myCheckbox/vite.svg +1 -0
  14. package/es/components/DynamicForm/myRadio/index.d.ts +16 -0
  15. package/es/components/DynamicForm/myRadio/index.js +100 -0
  16. package/es/components/DynamicForm/myRadio/vite.svg +1 -0
  17. package/es/components/DynamicForm/mySelect/index.d.ts +13 -0
  18. package/es/components/DynamicForm/mySelect/index.js +126 -0
  19. package/es/components/DynamicForm/mySelect/vite.svg +1 -0
  20. package/es/components/DynamicForm/myUpload/index.css +3 -0
  21. package/es/components/DynamicForm/myUpload/index.d.ts +15 -0
  22. package/es/components/DynamicForm/myUpload/index.js +102 -0
  23. package/es/components/DynamicForm/myUpload/vite.svg +1 -0
  24. package/es/components/DynamicForm/radioCard/index.d.ts +12 -0
  25. package/es/components/DynamicForm/radioCard/index.js +142 -0
  26. package/es/components/DynamicForm/radioCard/vite.svg +1 -0
  27. package/es/components/DynamicForm/selectModel/index.d.ts +21 -0
  28. package/es/components/DynamicForm/selectModel/index.js +197 -0
  29. package/es/components/DynamicForm/selectModel/vite.svg +1 -0
  30. package/es/components/DynamicForm/useDynamicForm.d.ts +26 -0
  31. package/es/components/DynamicForm/useDynamicForm.js +554 -0
  32. package/es/components/DynamicForm/vite.svg +1 -0
  33. package/es/main.d.ts +3 -1
  34. package/es/main.js +22 -18
  35. package/es/utils/method.d.ts +18 -0
  36. package/es/utils/method.js +186 -0
  37. package/lib/components/BackHeader/index.d.ts +2 -0
  38. package/lib/components/BackHeader/index.js +5 -1
  39. package/lib/components/DynamicForm/index.d.ts +102 -0
  40. package/lib/components/DynamicForm/index.js +54 -0
  41. package/lib/components/DynamicForm/myCascader/index.d.ts +13 -0
  42. package/lib/components/DynamicForm/myCascader/index.js +185 -0
  43. package/lib/components/DynamicForm/myCascader/vite.svg +1 -0
  44. package/lib/components/DynamicForm/myCheckbox/index.d.ts +15 -0
  45. package/lib/components/DynamicForm/myCheckbox/index.js +101 -0
  46. package/lib/components/DynamicForm/myCheckbox/vite.svg +1 -0
  47. package/lib/components/DynamicForm/myRadio/index.d.ts +16 -0
  48. package/lib/components/DynamicForm/myRadio/index.js +99 -0
  49. package/lib/components/DynamicForm/myRadio/vite.svg +1 -0
  50. package/lib/components/DynamicForm/mySelect/index.d.ts +13 -0
  51. package/lib/components/DynamicForm/mySelect/index.js +125 -0
  52. package/lib/components/DynamicForm/mySelect/vite.svg +1 -0
  53. package/lib/components/DynamicForm/myUpload/index.css +3 -0
  54. package/lib/components/DynamicForm/myUpload/index.d.ts +15 -0
  55. package/lib/components/DynamicForm/myUpload/index.js +101 -0
  56. package/lib/components/DynamicForm/myUpload/vite.svg +1 -0
  57. package/lib/components/DynamicForm/radioCard/index.d.ts +12 -0
  58. package/lib/components/DynamicForm/radioCard/index.js +141 -0
  59. package/lib/components/DynamicForm/radioCard/vite.svg +1 -0
  60. package/lib/components/DynamicForm/selectModel/index.d.ts +21 -0
  61. package/lib/components/DynamicForm/selectModel/index.js +197 -0
  62. package/lib/components/DynamicForm/selectModel/vite.svg +1 -0
  63. package/lib/components/DynamicForm/useDynamicForm.d.ts +26 -0
  64. package/lib/components/DynamicForm/useDynamicForm.js +553 -0
  65. package/lib/components/DynamicForm/vite.svg +1 -0
  66. package/lib/main.d.ts +3 -1
  67. package/lib/main.js +5 -0
  68. package/lib/utils/method.d.ts +18 -0
  69. package/lib/utils/method.js +186 -0
  70. package/package.json +3 -1
@@ -0,0 +1,126 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { App, Select } from "antd";
4
+ const MySelect = ({
5
+ item,
6
+ readonly,
7
+ style,
8
+ handleUrlOptions,
9
+ commonRequestWidthParams,
10
+ commonRequest,
11
+ value,
12
+ onChange
13
+ }) => {
14
+ const { message } = App.useApp();
15
+ const [options, setOptions] = useState([]);
16
+ const [loading, setLoading] = useState(false);
17
+ useEffect(() => {
18
+ handleLoadOptions();
19
+ }, [item.inputType, item.classify, item.data, item.options]);
20
+ const handleLoadOptions = async () => {
21
+ var _a, _b, _c;
22
+ if (item.inputType === "local") {
23
+ let localOptions = [];
24
+ if (item.data && Array.isArray(item.data)) {
25
+ localOptions = item.data.map((val) => ({
26
+ label: val,
27
+ value: val
28
+ }));
29
+ } else if (item.options && Array.isArray(item.options)) {
30
+ localOptions = item.options;
31
+ }
32
+ setOptions(localOptions);
33
+ } else if (item.inputType === "dictionary") {
34
+ if (item.classify) {
35
+ setLoading(true);
36
+ try {
37
+ const response = await commonRequest("YLZDDictList", {
38
+ asctypeid: item.classify
39
+ });
40
+ if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
41
+ const dictionaryOptions = response.data.list.map((dictItem) => ({
42
+ label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
43
+ value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
44
+ }));
45
+ setOptions(dictionaryOptions);
46
+ }
47
+ } catch (error) {
48
+ message.error("加载选项失败");
49
+ } finally {
50
+ setLoading(false);
51
+ }
52
+ }
53
+ } else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
54
+ try {
55
+ const keyFieldList = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.list) || [];
56
+ const delimiter = ((_c = item == null ? void 0 : item["key-field"]) == null ? void 0 : _c.delimiter) || "";
57
+ if (!keyFieldList.length) {
58
+ message.error("请配置key-field");
59
+ return;
60
+ }
61
+ const response = await commonRequestWidthParams(
62
+ {
63
+ PageName: "dns_relay",
64
+ Controlname: "CallActionUrl",
65
+ InterfaceType: "DPGLSysemName"
66
+ },
67
+ {
68
+ "action-url": item == null ? void 0 : item["action-url"]
69
+ }
70
+ );
71
+ if (response == null ? void 0 : response.data) {
72
+ const data = response == null ? void 0 : response.data;
73
+ const list = data == null ? void 0 : data.list;
74
+ let urlData = [];
75
+ if (Array.isArray(data)) {
76
+ urlData = data;
77
+ }
78
+ if (Array.isArray(list)) {
79
+ urlData = list;
80
+ }
81
+ const urlOptions = urlData.map((val) => ({
82
+ label: handleUrlOptions(val, delimiter, keyFieldList),
83
+ value: handleUrlOptions(val, delimiter, keyFieldList)
84
+ }));
85
+ setOptions([...urlOptions]);
86
+ }
87
+ } catch (error) {
88
+ }
89
+ } else {
90
+ let defaultOptions = [];
91
+ if (item.data && Array.isArray(item.data)) {
92
+ defaultOptions = item.data.map((val) => ({
93
+ label: val,
94
+ value: val
95
+ }));
96
+ } else if (item.options && Array.isArray(item.options)) {
97
+ defaultOptions = item.options;
98
+ }
99
+ setOptions(defaultOptions);
100
+ }
101
+ };
102
+ return /* @__PURE__ */ jsx(
103
+ Select,
104
+ {
105
+ placeholder: "请选择",
106
+ mode: item.input === "mult-select" ? "multiple" : void 0,
107
+ disabled: readonly,
108
+ loading,
109
+ showSearch: true,
110
+ value,
111
+ filterOption: (inputValue, option) => {
112
+ var _a;
113
+ return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().indexOf(inputValue.toLowerCase())) >= 0;
114
+ },
115
+ options,
116
+ style: { ...style },
117
+ allowClear: true,
118
+ onChange: (val) => {
119
+ onChange(val);
120
+ }
121
+ }
122
+ );
123
+ };
124
+ export {
125
+ MySelect as default
126
+ };
@@ -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,102 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { PlusOutlined, UploadOutlined } from "@ant-design/icons";
3
+ import { App, Upload, Image, Button } from "antd";
4
+ import { useState, useEffect } from "react";
5
+ const customUpload = "myUpload-module_customUpload_7c7d3";
6
+ const styles = {
7
+ customUpload
8
+ };
9
+ const getBase64 = (file) => new Promise((resolve, reject) => {
10
+ const reader = new FileReader();
11
+ reader.readAsDataURL(file);
12
+ reader.onload = () => resolve(reader.result);
13
+ reader.onerror = (error) => reject(error);
14
+ });
15
+ const MyUpload = (props) => {
16
+ const {
17
+ action,
18
+ item,
19
+ onChange,
20
+ readonly = false,
21
+ relatedid,
22
+ uploadText = "上传文件",
23
+ onRemove,
24
+ list = [],
25
+ uploadType
26
+ } = props;
27
+ const { message } = App.useApp();
28
+ const accept = (item == null ? void 0 : item["upload-accept"]) || "*";
29
+ const input = item == null ? void 0 : item["input"];
30
+ const size = item == null ? void 0 : item["upload-size"];
31
+ const maxCount = (item == null ? void 0 : item["upload-max-count"]) || 1;
32
+ const [listType, setListType] = useState(input === "image" ? "picture-card" : "text");
33
+ const [fileList, setFileList] = useState([]);
34
+ const [previewOpen, setPreviewOpen] = useState(false);
35
+ const [previewImage, setPreviewImage] = useState("");
36
+ useEffect(() => {
37
+ if (list && list.length) {
38
+ setFileList(list);
39
+ }
40
+ }, [list]);
41
+ const handlePreview = async (file) => {
42
+ if (uploadType !== "image")
43
+ return;
44
+ if (!file.url && !file.preview) {
45
+ file.preview = await getBase64(file.originFileObj);
46
+ }
47
+ setPreviewImage(file.url || file.preview);
48
+ setPreviewOpen(true);
49
+ };
50
+ const handleChange = ({ fileList: newFileList }) => {
51
+ setFileList(newFileList);
52
+ onChange && onChange(newFileList);
53
+ };
54
+ const handleBeforeUpload = (file) => {
55
+ if (!size)
56
+ return true;
57
+ const isLt = file.size / 1024 / 1024 < Number(size);
58
+ if (!isLt) {
59
+ message.error(`请上传不超过${size}MB的文件`);
60
+ }
61
+ return isLt;
62
+ };
63
+ const uploadButton = input === "image" ? /* @__PURE__ */ jsxs("button", { style: { border: 0, background: "none" }, type: "button", children: [
64
+ /* @__PURE__ */ jsx(PlusOutlined, {}),
65
+ /* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: "Upload" })
66
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(UploadOutlined, {}), children: uploadText }) });
67
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx(
69
+ Upload,
70
+ {
71
+ action,
72
+ beforeUpload: handleBeforeUpload,
73
+ listType,
74
+ accept,
75
+ fileList,
76
+ onPreview: handlePreview,
77
+ data: { relatedid },
78
+ maxCount,
79
+ onChange: handleChange,
80
+ onRemove,
81
+ disabled: readonly,
82
+ className: styles.customUpload,
83
+ children: fileList.length >= maxCount ? null : uploadButton
84
+ }
85
+ ),
86
+ previewImage && /* @__PURE__ */ jsx(
87
+ Image,
88
+ {
89
+ wrapperStyle: { display: "none" },
90
+ preview: {
91
+ visible: previewOpen,
92
+ onVisibleChange: (visible) => setPreviewOpen(visible),
93
+ afterOpenChange: (visible) => !visible && setPreviewImage("")
94
+ },
95
+ src: previewImage
96
+ }
97
+ )
98
+ ] });
99
+ };
100
+ export {
101
+ MyUpload as default
102
+ };
@@ -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,142 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { CheckOutlined } from "@ant-design/icons";
3
+ import { useState, useEffect } from "react";
4
+ import { Space } from "antd";
5
+ const RadioCard = ({ item, readonly, value, onChange, style, commonRequestWidthParams }) => {
6
+ const [cardData, setCardData] = useState([]);
7
+ const [loading, setLoading] = useState(false);
8
+ useEffect(() => {
9
+ const loadCardData = async () => {
10
+ var _a;
11
+ if (item.inputType === "url" && item["action-url"]) {
12
+ setLoading(true);
13
+ try {
14
+ const response = await commonRequestWidthParams(
15
+ {
16
+ PageName: "dns_relay",
17
+ Controlname: "CallActionUrl",
18
+ InterfaceType: "DPGLSysemName"
19
+ },
20
+ {
21
+ "action-url": item == null ? void 0 : item["action-url"]
22
+ }
23
+ );
24
+ if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
25
+ setCardData(response.data.list);
26
+ } else if ((response == null ? void 0 : response.data) && Array.isArray(response.data)) {
27
+ setCardData(response.data);
28
+ } else if (Array.isArray(response == null ? void 0 : response.list)) {
29
+ setCardData(response.list);
30
+ } else if ((response == null ? void 0 : response.ReturnValue) === 1 && (response == null ? void 0 : response.data)) {
31
+ if (Array.isArray(response.data)) {
32
+ setCardData(response.data);
33
+ } else {
34
+ setCardData([response.data]);
35
+ }
36
+ }
37
+ } catch (error) {
38
+ } finally {
39
+ setLoading(false);
40
+ }
41
+ } else if (item.data && Array.isArray(item.data)) {
42
+ setCardData(item.data);
43
+ }
44
+ };
45
+ loadCardData();
46
+ }, [item.inputType, item["action-url"], item.data]);
47
+ const buildValue = (record) => {
48
+ return JSON.stringify(record);
49
+ };
50
+ const isSelected = (record) => {
51
+ const recordValue = buildValue(record);
52
+ return value === recordValue;
53
+ };
54
+ const handleCardClick = (record) => {
55
+ if (readonly)
56
+ return;
57
+ const recordValue = buildValue(record);
58
+ onChange && onChange(recordValue);
59
+ };
60
+ const imageWidth = item["card-image-width"] || 200;
61
+ const imageHeight = item["card-image-height"] || 100;
62
+ const imageField = item["card-image-field"];
63
+ const infoField = item["card-info-field"];
64
+ return /* @__PURE__ */ jsx("div", { style: { ...style }, children: loading ? /* @__PURE__ */ jsx("div", { style: { textAlign: "center", padding: "20px" }, children: "加载中..." }) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "50px" }, children: cardData.map((record, index) => {
65
+ const selected = isSelected(record);
66
+ return /* @__PURE__ */ jsxs(
67
+ "div",
68
+ {
69
+ onClick: () => handleCardClick(record),
70
+ style: {
71
+ flex: "1 1 auto",
72
+ width: `${imageWidth}px`,
73
+ padding: "12px",
74
+ cursor: readonly ? "not-allowed" : "pointer",
75
+ opacity: readonly ? 0.6 : 1,
76
+ transition: "all 0.3s"
77
+ },
78
+ children: [
79
+ record[imageField] && /* @__PURE__ */ jsx(
80
+ "img",
81
+ {
82
+ src: record.picurl,
83
+ alt: record[infoField] || "",
84
+ style: {
85
+ width: `${imageWidth}px`,
86
+ height: `${imageHeight}px`,
87
+ objectFit: "cover",
88
+ borderRadius: "4px",
89
+ marginBottom: "8px"
90
+ },
91
+ onError: (e) => {
92
+ e.currentTarget.style.display = "none";
93
+ }
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(
97
+ "div",
98
+ {
99
+ style: {
100
+ fontSize: "14px",
101
+ color: "#333333"
102
+ },
103
+ children: /* @__PURE__ */ jsxs(Space, { size: 6, children: [
104
+ /* @__PURE__ */ jsx(
105
+ "div",
106
+ {
107
+ style: {
108
+ width: "16px",
109
+ height: "16px",
110
+ borderRadius: "50%",
111
+ border: selected ? "none" : "1px solid #d9d9d9",
112
+ backgroundColor: selected ? "var(--color-primary)" : "transparent",
113
+ display: "flex",
114
+ alignItems: "center",
115
+ justifyContent: "center",
116
+ flexShrink: 0,
117
+ cursor: readonly ? "not-allowed" : "pointer"
118
+ },
119
+ children: selected && /* @__PURE__ */ jsx(
120
+ CheckOutlined,
121
+ {
122
+ style: {
123
+ fontSize: "12px",
124
+ color: "#fff"
125
+ }
126
+ }
127
+ )
128
+ }
129
+ ),
130
+ record[infoField] || ""
131
+ ] })
132
+ }
133
+ )
134
+ ]
135
+ },
136
+ index
137
+ );
138
+ }) }) });
139
+ };
140
+ export {
141
+ RadioCard as default
142
+ };
@@ -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;
@@ -0,0 +1,197 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { App, Select, Modal, Table } from "antd";
3
+ import { useState, useEffect } from "react";
4
+ function SelectModel(props) {
5
+ const { item, disabled, style, commonRequestWidthParams } = props;
6
+ const { message } = App.useApp();
7
+ const mode = item.input;
8
+ const [value, setValue] = useState(props.value);
9
+ const [modalVisible, setModalVisible] = useState(false);
10
+ const [selectedRowKeys, setSelectedRowKeys] = useState([]);
11
+ const [selectedRecords, setSelectedRecords] = useState([]);
12
+ const [loading, setLoading] = useState(false);
13
+ const [params, setParams] = useState({
14
+ PageNum: 1,
15
+ PageSize: 10
16
+ });
17
+ const [dataSource, setDataSource] = useState([]);
18
+ const [total, setTotal] = useState(0);
19
+ const columns = buildColumns();
20
+ useEffect(() => {
21
+ getData();
22
+ }, [modalVisible]);
23
+ const onSelectChange = (keys, selectedRows) => {
24
+ setSelectedRowKeys(keys);
25
+ setSelectedRecords(selectedRows);
26
+ };
27
+ const getData = async () => {
28
+ var _a;
29
+ if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
30
+ setLoading(true);
31
+ try {
32
+ const response = await commonRequestWidthParams(
33
+ {
34
+ PageName: "dns_relay",
35
+ Controlname: "CallActionUrl",
36
+ InterfaceType: "DPGLSysemName"
37
+ },
38
+ {
39
+ "action-url": item == null ? void 0 : item["action-url"],
40
+ ...params
41
+ }
42
+ );
43
+ if ((response == null ? void 0 : response.ReturnValue) === 0) {
44
+ message.error(response.msg);
45
+ setLoading(false);
46
+ return;
47
+ }
48
+ const data = response == null ? void 0 : response.data;
49
+ const tempData = (_a = data == null ? void 0 : data.list) == null ? void 0 : _a.map((item2, index) => {
50
+ const _rowKey = (params.PageNum - 1) * params.PageSize + index;
51
+ return {
52
+ ...item2,
53
+ _rowKey
54
+ };
55
+ });
56
+ const tempSelectedRecords = (tempData == null ? void 0 : tempData.filter((item2) => selectedRowKeys.includes(item2._rowKey))) || [];
57
+ setSelectedRecords(tempSelectedRecords);
58
+ setDataSource([...tempData || []]);
59
+ setTotal((data == null ? void 0 : data.number) || 0);
60
+ setLoading(false);
61
+ } catch (error) {
62
+ setLoading(false);
63
+ message.error(error.msg || "参数错误");
64
+ }
65
+ return;
66
+ }
67
+ message.error("请配置action-url");
68
+ };
69
+ const openModal = () => {
70
+ var _a, _b, _c;
71
+ if (disabled) {
72
+ return;
73
+ }
74
+ if (value) {
75
+ const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) ?? [];
76
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) ?? "-";
77
+ if (!keyFieldList.length) {
78
+ message.error("请配置key-field");
79
+ return;
80
+ }
81
+ switch (mode) {
82
+ case "modal-select":
83
+ const id = (_c = value == null ? void 0 : value.split("-")) == null ? void 0 : _c[0];
84
+ const index = dataSource == null ? void 0 : dataSource.findIndex((item2) => item2.typeid === id);
85
+ setSelectedRowKeys([index]);
86
+ case "modal-mult-select":
87
+ const values = value == null ? void 0 : value.split(",");
88
+ const tempKeys = values == null ? void 0 : values.map((item2) => {
89
+ var _a2;
90
+ const id2 = (_a2 = item2.split(delimiter)) == null ? void 0 : _a2[0];
91
+ return dataSource == null ? void 0 : dataSource.findIndex((item3) => item3.typeid === id2);
92
+ });
93
+ setSelectedRowKeys(tempKeys);
94
+ break;
95
+ }
96
+ }
97
+ setModalVisible(true);
98
+ };
99
+ const handleOk = async () => {
100
+ try {
101
+ const value2 = await buildValueFromSelectedRows(selectedRecords, item);
102
+ setValue(value2);
103
+ props.onSure(value2);
104
+ setModalVisible(false);
105
+ } catch (error) {
106
+ message.error(error.msg || "参数错误");
107
+ }
108
+ };
109
+ const handleCancel = () => {
110
+ setModalVisible(false);
111
+ };
112
+ function buildColumns() {
113
+ const modalFieldList = item["modal-field-list"];
114
+ let columns2 = [];
115
+ for (let fieldName in modalFieldList) {
116
+ let title = modalFieldList[fieldName];
117
+ const column = { dataIndex: fieldName, title };
118
+ columns2 = [...columns2, column];
119
+ }
120
+ return columns2;
121
+ }
122
+ const onPageChange = (pageNum) => {
123
+ setParams({
124
+ ...params,
125
+ PageNum: pageNum
126
+ });
127
+ };
128
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
129
+ /* @__PURE__ */ jsx(
130
+ Select,
131
+ {
132
+ placeholder: "请选择",
133
+ onClick: openModal,
134
+ value,
135
+ open: false,
136
+ disabled,
137
+ style
138
+ }
139
+ ),
140
+ /* @__PURE__ */ jsx(
141
+ Modal,
142
+ {
143
+ title: item["modal-caption"],
144
+ open: modalVisible,
145
+ onOk: handleOk,
146
+ onCancel: handleCancel,
147
+ width: item["modal-width"] ?? 600,
148
+ okButtonProps: { disabled: selectedRowKeys.length === 0 },
149
+ children: /* @__PURE__ */ jsx(
150
+ Table,
151
+ {
152
+ columns,
153
+ loading,
154
+ dataSource,
155
+ rowKey: (record) => record._rowKey,
156
+ rowSelection: {
157
+ type: mode === "modal-select" ? "radio" : "checkbox",
158
+ selectedRowKeys,
159
+ onChange: onSelectChange
160
+ },
161
+ pagination: {
162
+ total,
163
+ current: params.PageNum,
164
+ pageSize: params.PageSize,
165
+ onChange: onPageChange
166
+ }
167
+ }
168
+ )
169
+ }
170
+ )
171
+ ] });
172
+ }
173
+ function buildValueFromSelectedRows(selectedRows, attributeEnrollFormat) {
174
+ return new Promise((resolve, reject) => {
175
+ try {
176
+ var keyfields = attributeEnrollFormat["key-field"];
177
+ if (!keyfields) {
178
+ reject({ msg: "请配置key-field" });
179
+ return;
180
+ }
181
+ var fields = (keyfields == null ? void 0 : keyfields.list) ?? [];
182
+ let result = selectedRows.map((item) => {
183
+ let itemResult = fields.map((field) => {
184
+ return item[field];
185
+ }).join((keyfields == null ? void 0 : keyfields.delimiter) || "-");
186
+ return itemResult;
187
+ }).join(",");
188
+ resolve(result);
189
+ } catch (error) {
190
+ reject({ msg: "key-field参数配置错误" });
191
+ }
192
+ });
193
+ }
194
+ export {
195
+ buildValueFromSelectedRows,
196
+ SelectModel as default
197
+ };
@@ -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,26 @@
1
+ import { IformConfigItem, IformItemStyle } from './index.d';
2
+ import { AxiosResponse } from 'axios';
3
+ import { FormInstance, UploadFile } from 'antd';
4
+ interface IDynamicFormProps {
5
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
6
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
7
+ uploadAction: (PageName?: string | undefined) => string;
8
+ formConfig?: IformConfigItem[];
9
+ setFormConfig?: (config: IformConfigItem[]) => void;
10
+ interfaceTypeChildren?: string;
11
+ updateDelFileList: (file: UploadFile) => void;
12
+ }
13
+ declare function useDynamicForm(props: IDynamicFormProps): {
14
+ handleRenderItem: ({ item, readonly, colNum, instructionShowMode, relatedid, form, defaultWidth, formItemStyle, radioAlign, }: {
15
+ item: IformConfigItem;
16
+ readonly: boolean;
17
+ colNum: number;
18
+ instructionShowMode?: "flex" | "icon" | undefined;
19
+ relatedid?: string | undefined;
20
+ form: FormInstance;
21
+ defaultWidth?: number | undefined;
22
+ formItemStyle: IformItemStyle[] | undefined;
23
+ radioAlign?: "horizontal" | "vertical" | undefined;
24
+ }) => import("react/jsx-runtime").JSX.Element | null;
25
+ };
26
+ export default useDynamicForm;