szld-libs 0.2.99 → 0.3.2

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 (94) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +32023 -20148
  3. package/dist/szld-components.umd.js +72 -60
  4. package/es/components/DynamicForm/index.js +3 -2
  5. package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +8 -7
  6. package/es/components/DynamicFormMobile/func.d.ts +35 -0
  7. package/es/components/DynamicFormMobile/func.js +204 -0
  8. package/es/components/DynamicFormMobile/index.d.ts +116 -0
  9. package/es/components/DynamicFormMobile/index.js +134 -0
  10. package/es/components/DynamicFormMobile/myCascader/index.d.ts +17 -0
  11. package/es/components/DynamicFormMobile/myCascader/index.js +196 -0
  12. package/es/components/DynamicFormMobile/myCascader/vite.svg +1 -0
  13. package/es/components/DynamicFormMobile/myCheckbox/index.d.ts +19 -0
  14. package/es/components/DynamicFormMobile/myCheckbox/index.js +109 -0
  15. package/es/components/DynamicFormMobile/myCheckbox/vite.svg +1 -0
  16. package/es/components/DynamicFormMobile/myRadio/index.d.ts +20 -0
  17. package/es/components/DynamicFormMobile/myRadio/index.js +107 -0
  18. package/es/components/DynamicFormMobile/myRadio/vite.svg +1 -0
  19. package/es/components/DynamicFormMobile/mySelect/index.css +31 -0
  20. package/es/components/DynamicFormMobile/mySelect/index.d.ts +16 -0
  21. package/es/components/DynamicFormMobile/mySelect/index.js +147 -0
  22. package/es/components/DynamicFormMobile/mySelect/vite.svg +1 -0
  23. package/es/components/DynamicFormMobile/myUpload/index.css +3 -0
  24. package/es/components/DynamicFormMobile/myUpload/index.d.ts +16 -0
  25. package/es/components/DynamicFormMobile/myUpload/index.js +103 -0
  26. package/es/components/DynamicFormMobile/myUpload/vite.svg +1 -0
  27. package/es/components/DynamicFormMobile/radioCard/index.d.ts +12 -0
  28. package/es/components/DynamicFormMobile/radioCard/index.js +142 -0
  29. package/es/components/DynamicFormMobile/radioCard/vite.svg +1 -0
  30. package/es/components/DynamicFormMobile/selectModel/index.d.ts +22 -0
  31. package/es/components/DynamicFormMobile/selectModel/index.js +235 -0
  32. package/es/components/DynamicFormMobile/selectModel/vite.svg +1 -0
  33. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +27 -0
  34. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +242 -0
  35. package/es/components/DynamicFormMobile/selectModelBackfillFormItem/vite.svg +1 -0
  36. package/es/components/DynamicFormMobile/useDynamicForm.d.ts +43 -0
  37. package/es/components/DynamicFormMobile/useDynamicForm.js +772 -0
  38. package/es/components/DynamicFormMobile/vite.svg +1 -0
  39. package/es/index.css +1 -0
  40. package/es/index.d.ts +1 -1
  41. package/es/index.js +35 -29
  42. package/es/main.d.ts +2 -1
  43. package/es/main.js +22 -20
  44. package/es/mock/index.js +20 -59
  45. package/es/services/index.js +3 -5
  46. package/es/services/request.js +2 -2
  47. package/es/utils/method.d.ts +6 -1
  48. package/es/utils/method.js +60 -34
  49. package/lib/components/DynamicForm/index.js +3 -2
  50. package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +8 -7
  51. package/lib/components/DynamicFormMobile/func.d.ts +35 -0
  52. package/lib/components/DynamicFormMobile/func.js +204 -0
  53. package/lib/components/DynamicFormMobile/index.d.ts +116 -0
  54. package/lib/components/DynamicFormMobile/index.js +133 -0
  55. package/lib/components/DynamicFormMobile/myCascader/index.d.ts +17 -0
  56. package/lib/components/DynamicFormMobile/myCascader/index.js +195 -0
  57. package/lib/components/DynamicFormMobile/myCascader/vite.svg +1 -0
  58. package/lib/components/DynamicFormMobile/myCheckbox/index.d.ts +19 -0
  59. package/lib/components/DynamicFormMobile/myCheckbox/index.js +108 -0
  60. package/lib/components/DynamicFormMobile/myCheckbox/vite.svg +1 -0
  61. package/lib/components/DynamicFormMobile/myRadio/index.d.ts +20 -0
  62. package/lib/components/DynamicFormMobile/myRadio/index.js +106 -0
  63. package/lib/components/DynamicFormMobile/myRadio/vite.svg +1 -0
  64. package/lib/components/DynamicFormMobile/mySelect/index.css +31 -0
  65. package/lib/components/DynamicFormMobile/mySelect/index.d.ts +16 -0
  66. package/lib/components/DynamicFormMobile/mySelect/index.js +146 -0
  67. package/lib/components/DynamicFormMobile/mySelect/vite.svg +1 -0
  68. package/lib/components/DynamicFormMobile/myUpload/index.css +3 -0
  69. package/lib/components/DynamicFormMobile/myUpload/index.d.ts +16 -0
  70. package/lib/components/DynamicFormMobile/myUpload/index.js +102 -0
  71. package/lib/components/DynamicFormMobile/myUpload/vite.svg +1 -0
  72. package/lib/components/DynamicFormMobile/radioCard/index.d.ts +12 -0
  73. package/lib/components/DynamicFormMobile/radioCard/index.js +141 -0
  74. package/lib/components/DynamicFormMobile/radioCard/vite.svg +1 -0
  75. package/lib/components/DynamicFormMobile/selectModel/index.d.ts +22 -0
  76. package/lib/components/DynamicFormMobile/selectModel/index.js +235 -0
  77. package/lib/components/DynamicFormMobile/selectModel/vite.svg +1 -0
  78. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +27 -0
  79. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +242 -0
  80. package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/vite.svg +1 -0
  81. package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +43 -0
  82. package/lib/components/DynamicFormMobile/useDynamicForm.js +771 -0
  83. package/lib/components/DynamicFormMobile/vite.svg +1 -0
  84. package/lib/index.css +1 -0
  85. package/lib/index.d.ts +1 -1
  86. package/lib/index.js +35 -29
  87. package/lib/main.d.ts +2 -1
  88. package/lib/main.js +2 -0
  89. package/lib/mock/index.js +20 -59
  90. package/lib/services/index.js +3 -5
  91. package/lib/services/request.js +2 -2
  92. package/lib/utils/method.d.ts +6 -1
  93. package/lib/utils/method.js +60 -34
  94. package/package.json +1 -1
@@ -0,0 +1,196 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { App, Cascader } from "antd";
3
+ import { useState, useEffect } from "react";
4
+ const MyCascader = ({
5
+ item,
6
+ readonly,
7
+ value,
8
+ onChange,
9
+ style,
10
+ commonRequestWidthParams,
11
+ commonRequest,
12
+ interfaceTypeDict,
13
+ interfaceTypeSysDict,
14
+ actionUrlKey,
15
+ actionUrlExtraParams
16
+ }) => {
17
+ const [options, setOptions] = useState([]);
18
+ const [loading, setLoading] = useState(false);
19
+ const { message } = App.useApp();
20
+ useEffect(() => {
21
+ handleLoadOptions();
22
+ }, [item.inputType, item.classify, item.data, item.options]);
23
+ const handleLoadOptions = async () => {
24
+ if (item.inputType === "local") {
25
+ let localOptions = [];
26
+ if (item.data && Array.isArray(item.data)) {
27
+ localOptions = item.data.map((val) => ({
28
+ label: val,
29
+ value: val
30
+ }));
31
+ } else if (item.options && Array.isArray(item.options)) {
32
+ localOptions = item.options;
33
+ }
34
+ setOptions(localOptions);
35
+ } else if (item.inputType === "dictionary") {
36
+ await getDict(interfaceTypeSysDict);
37
+ } else if (item.inputType === "system-dictionary") {
38
+ getDict(interfaceTypeSysDict);
39
+ } else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
40
+ const res = await handleGetUrlData();
41
+ if (res && Array.isArray(res)) {
42
+ setOptions(res);
43
+ }
44
+ } else {
45
+ let defaultOptions = [];
46
+ if (item.data && Array.isArray(item.data)) {
47
+ defaultOptions = item.data.map((val) => ({
48
+ label: val,
49
+ value: val
50
+ }));
51
+ } else if (item.options && Array.isArray(item.options)) {
52
+ defaultOptions = item.options;
53
+ }
54
+ setOptions(defaultOptions);
55
+ }
56
+ };
57
+ const getDict = async (interfaceType) => {
58
+ var _a;
59
+ if (item.classify) {
60
+ setLoading(true);
61
+ try {
62
+ const response = await commonRequest(interfaceType, {
63
+ asctypeid: item.classify
64
+ });
65
+ if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
66
+ const dictionaryOptions = response.data.list.map((dictItem) => ({
67
+ label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
68
+ value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
69
+ }));
70
+ setOptions(dictionaryOptions);
71
+ }
72
+ } catch (error) {
73
+ message.error("加载选项失败");
74
+ } finally {
75
+ setLoading(false);
76
+ }
77
+ }
78
+ };
79
+ const handleChange = (value2, selectedOptions) => {
80
+ if (onChange) {
81
+ onChange(value2);
82
+ }
83
+ };
84
+ const handleGetUrlData = async (targetOption) => {
85
+ return new Promise(async (resolve, reject) => {
86
+ var _a, _b, _c;
87
+ const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
88
+ const searchFields = (item == null ? void 0 : item["search-field"]) || [];
89
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "-";
90
+ if (!list.length) {
91
+ message.error("请配置key-field");
92
+ return;
93
+ }
94
+ const params = {
95
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
96
+ ...actionUrlExtraParams
97
+ };
98
+ if (targetOption) {
99
+ searchFields.forEach((field) => {
100
+ params[field] = targetOption[field] || "";
101
+ });
102
+ params["level"] = Number(targetOption.level || 0) + 1 || "";
103
+ }
104
+ setLoading(true);
105
+ try {
106
+ const response = await commonRequestWidthParams(
107
+ {
108
+ PageName: "dns_relay",
109
+ Controlname: "CallActionUrl",
110
+ InterfaceType: ""
111
+ },
112
+ params
113
+ );
114
+ if (((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.list) && Array.isArray(response.data.list)) {
115
+ const dictionaryOptions = response.data.list.map((item2) => ({
116
+ ...item2,
117
+ label: `${item2[list[0]] || ""}${delimiter}${item2[list[1]] || ""}`,
118
+ value: `${item2[list[0]] || ""}${delimiter}${item2[list[1]] || ""}`,
119
+ children: [],
120
+ isLeaf: (item2 == null ? void 0 : item2.subcount) === 0
121
+ }));
122
+ resolve(dictionaryOptions);
123
+ }
124
+ reject([]);
125
+ } catch (error) {
126
+ message.error("加载选项失败");
127
+ reject([]);
128
+ } finally {
129
+ reject([]);
130
+ setLoading(false);
131
+ }
132
+ });
133
+ };
134
+ const loadData = async (selectedOptions) => {
135
+ const targetOption = selectedOptions[selectedOptions.length - 1];
136
+ const children = await handleGetUrlData(targetOption) || [];
137
+ targetOption.children = children;
138
+ setOptions([...options]);
139
+ return children;
140
+ };
141
+ const filter = (inputValue, path) => path.some((option) => option.label.toLowerCase().includes(inputValue.toLowerCase()));
142
+ return /* @__PURE__ */ jsx(
143
+ Cascader,
144
+ {
145
+ showSearch: { filter },
146
+ loading,
147
+ placeholder: "请选择",
148
+ loadData,
149
+ disabled: readonly,
150
+ onChange: handleChange,
151
+ style: { ...style },
152
+ options,
153
+ value,
154
+ onOpenChange: async (visible) => {
155
+ var _a;
156
+ if (visible && (value == null ? void 0 : value.length)) {
157
+ const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
158
+ const searchFields = (item == null ? void 0 : item["search-field"]) || [];
159
+ if (!list.length || !searchFields.length) {
160
+ message.error("请配置key-field和search-field");
161
+ return;
162
+ }
163
+ const targetFieldIndex = list.findIndex((item2) => item2 === searchFields[0]);
164
+ if (targetFieldIndex === -1) {
165
+ message.error("key-field与search-field配置不匹配");
166
+ return;
167
+ }
168
+ const values = value.map((v) => {
169
+ const arr = v.split("-");
170
+ return arr[targetFieldIndex] || "";
171
+ }).filter(Boolean);
172
+ let children = options;
173
+ for (const [index, el] of values.entries()) {
174
+ if (index === values.length - 1) {
175
+ break;
176
+ }
177
+ const selectedOptions = children.filter((item2) => item2[searchFields[0]] === el);
178
+ if (selectedOptions.length === 0) {
179
+ break;
180
+ }
181
+ const targetOption = selectedOptions[0];
182
+ if (targetOption.children && targetOption.children.length > 0) {
183
+ children = targetOption.children;
184
+ continue;
185
+ }
186
+ const newChildren = await loadData(selectedOptions);
187
+ children = newChildren;
188
+ }
189
+ }
190
+ }
191
+ }
192
+ );
193
+ };
194
+ export {
195
+ MyCascader as default
196
+ };
@@ -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,19 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { Ijson } from '../index.d';
3
+ export interface IMYRadio {
4
+ value?: (string | number)[];
5
+ onChange?: (checkedValue: any[]) => void;
6
+ item: Ijson;
7
+ readonly?: boolean;
8
+ options?: any;
9
+ radioAlign?: 'vertical' | 'horizontal';
10
+ handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
11
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
12
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
13
+ interfaceTypeDict: string;
14
+ interfaceTypeSysDict: string;
15
+ actionUrlKey: string;
16
+ actionUrlExtraParams: object;
17
+ }
18
+ declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
19
+ export default MyCheckbox;
@@ -0,0 +1,109 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { App, Checkbox } from "antd";
4
+ const MyCheckbox = (props) => {
5
+ const {
6
+ item,
7
+ onChange,
8
+ readonly = false,
9
+ options,
10
+ radioAlign = "horizontal",
11
+ commonRequestWidthParams,
12
+ commonRequest,
13
+ handleUrlOptions,
14
+ value,
15
+ interfaceTypeDict,
16
+ interfaceTypeSysDict,
17
+ actionUrlKey,
18
+ actionUrlExtraParams
19
+ } = props;
20
+ const { message } = App.useApp();
21
+ const [list, setList] = useState([]);
22
+ const [val, setVal] = useState(value || []);
23
+ useEffect(() => {
24
+ if ((item == null ? void 0 : item.inputType) === "local") {
25
+ const arr = (item == null ? void 0 : item.data) || [];
26
+ setList(arr.map((v) => ({ value: v, label: v })));
27
+ } else if ((item == null ? void 0 : item.inputType) === "dictionary") {
28
+ getList(item.classify, interfaceTypeDict);
29
+ } else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
30
+ getList(item.classify, interfaceTypeSysDict);
31
+ } else if ((item == null ? void 0 : item.inputType) === "url") {
32
+ getUrlList();
33
+ }
34
+ }, [item == null ? void 0 : item.inputType]);
35
+ const getList = async (id, interfaceType) => {
36
+ var _a;
37
+ if (!id) {
38
+ return;
39
+ }
40
+ const res = await commonRequest(interfaceType, { asctypeid: id });
41
+ if ((res == null ? void 0 : res.ReturnValue) === 1) {
42
+ const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
43
+ setList(
44
+ arr.map((v) => {
45
+ const value2 = v.dicid + "-" + v.info;
46
+ return { value: value2, label: value2 };
47
+ })
48
+ );
49
+ }
50
+ };
51
+ const getUrlList = async () => {
52
+ var _a, _b;
53
+ try {
54
+ const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
55
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
56
+ if (!keyFieldList.length) {
57
+ message.error("请配置key-field");
58
+ return;
59
+ }
60
+ const response = await commonRequestWidthParams(
61
+ {
62
+ PageName: "dns_relay",
63
+ Controlname: "CallActionUrl",
64
+ InterfaceType: ""
65
+ },
66
+ {
67
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
68
+ ...actionUrlExtraParams
69
+ }
70
+ );
71
+ if (response == null ? void 0 : response.data) {
72
+ const data = response == null ? void 0 : response.data;
73
+ const list2 = data == null ? void 0 : data.list;
74
+ let urlData = [];
75
+ if (Array.isArray(data)) {
76
+ urlData = data;
77
+ }
78
+ if (Array.isArray(list2)) {
79
+ urlData = list2;
80
+ }
81
+ const urlOptions = urlData.map((val2) => ({
82
+ label: handleUrlOptions(val2, delimiter, keyFieldList),
83
+ value: handleUrlOptions(val2, delimiter, keyFieldList)
84
+ }));
85
+ setList([...urlOptions]);
86
+ }
87
+ } catch (error) {
88
+ message.error("加载选项失败");
89
+ } finally {
90
+ }
91
+ };
92
+ return /* @__PURE__ */ jsx(
93
+ Checkbox.Group,
94
+ {
95
+ ...options,
96
+ options: list,
97
+ value: val,
98
+ style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" },
99
+ onChange: (val2) => {
100
+ setVal(val2);
101
+ onChange == null ? void 0 : onChange(val2);
102
+ },
103
+ disabled: readonly
104
+ }
105
+ );
106
+ };
107
+ export {
108
+ MyCheckbox as default
109
+ };
@@ -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,20 @@
1
+ import { RadioChangeEvent } from 'antd';
2
+ import { AxiosResponse } from 'axios';
3
+ import { Ijson } from '../index.d';
4
+ export interface IMYRadio {
5
+ onChange?: (e: RadioChangeEvent) => void;
6
+ value?: string | number;
7
+ item: Ijson;
8
+ readonly?: boolean;
9
+ options?: any;
10
+ radioAlign?: 'vertical' | 'horizontal';
11
+ handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
12
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
13
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
14
+ interfaceTypeDict: string;
15
+ interfaceTypeSysDict: string;
16
+ actionUrlKey: string;
17
+ actionUrlExtraParams: object;
18
+ }
19
+ declare const MyRadio: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
20
+ export default MyRadio;
@@ -0,0 +1,107 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { App, Radio } from "antd";
3
+ import { useState, useEffect } from "react";
4
+ const MyRadio = (props) => {
5
+ const {
6
+ item,
7
+ onChange,
8
+ readonly = false,
9
+ options,
10
+ radioAlign = "horizontal",
11
+ commonRequestWidthParams,
12
+ commonRequest,
13
+ handleUrlOptions,
14
+ value,
15
+ interfaceTypeDict,
16
+ interfaceTypeSysDict,
17
+ actionUrlKey,
18
+ actionUrlExtraParams
19
+ } = props;
20
+ const { message } = App.useApp();
21
+ const [list, setList] = useState([]);
22
+ useEffect(() => {
23
+ if ((item == null ? void 0 : item.inputType) === "local") {
24
+ const arr = (item == null ? void 0 : item.data) || [];
25
+ setList(arr.map((v) => ({ value: v, label: v })));
26
+ } else if ((item == null ? void 0 : item.inputType) === "dictionary") {
27
+ getList(item.classify, interfaceTypeDict);
28
+ } else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
29
+ getList(item.classify, interfaceTypeSysDict);
30
+ } else if ((item == null ? void 0 : item.inputType) === "url") {
31
+ getUrlList();
32
+ }
33
+ }, [item == null ? void 0 : item.inputType]);
34
+ const getList = async (id, interfaceType) => {
35
+ var _a;
36
+ if (!id) {
37
+ return;
38
+ }
39
+ const res = await commonRequest(interfaceType, { asctypeid: id });
40
+ if ((res == null ? void 0 : res.ReturnValue) === 1) {
41
+ const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
42
+ setList(
43
+ arr.map((v) => {
44
+ const value2 = v.dicid + "-" + v.info;
45
+ return { value: value2, label: value2 };
46
+ })
47
+ );
48
+ }
49
+ };
50
+ const getUrlList = async () => {
51
+ var _a, _b;
52
+ try {
53
+ const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
54
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
55
+ if (!keyFieldList.length) {
56
+ message.error("请配置key-field");
57
+ return;
58
+ }
59
+ if (!commonRequestWidthParams)
60
+ return;
61
+ const response = await commonRequestWidthParams(
62
+ {
63
+ PageName: "dns_relay",
64
+ Controlname: "CallActionUrl",
65
+ InterfaceType: ""
66
+ },
67
+ {
68
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
69
+ ...actionUrlExtraParams
70
+ }
71
+ );
72
+ if (response == null ? void 0 : response.data) {
73
+ const data = response == null ? void 0 : response.data;
74
+ const list2 = data == null ? void 0 : data.list;
75
+ let urlData = [];
76
+ if (Array.isArray(data)) {
77
+ urlData = data;
78
+ }
79
+ if (Array.isArray(list2)) {
80
+ urlData = list2;
81
+ }
82
+ const urlOptions = urlData.map((val) => ({
83
+ label: handleUrlOptions(val, delimiter, keyFieldList),
84
+ value: handleUrlOptions(val, delimiter, keyFieldList)
85
+ }));
86
+ setList([...urlOptions]);
87
+ }
88
+ } catch (error) {
89
+ message.error("加载选项失败");
90
+ } finally {
91
+ }
92
+ };
93
+ return /* @__PURE__ */ jsx(
94
+ Radio.Group,
95
+ {
96
+ ...options,
97
+ options: list,
98
+ onChange,
99
+ disabled: readonly,
100
+ value,
101
+ style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" }
102
+ }
103
+ );
104
+ };
105
+ export {
106
+ MyRadio as default
107
+ };
@@ -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,31 @@
1
+ .index-module_checkbox-group_4684b {
2
+ padding: 16px;
3
+ display: flex;
4
+ flex-direction: column;
5
+ font-size: 14px;
6
+ overflow: hidden;
7
+ position: relative;
8
+ }
9
+ .index-module_checkbox-group_4684b .index-module_checkbox-group-header_192bd {
10
+ font-size: 14px;
11
+ margin-bottom: 20px;
12
+ flex-shrink: 0;
13
+ position: absolute;
14
+ padding: 16px;
15
+ background-color: #fff;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ }
20
+ .index-module_checkbox-group_4684b .index-module_checkbox-group-content_f81a1 {
21
+ overflow-y: auto;
22
+ margin-top: 34px;
23
+ }
24
+ .index-module_checkbox-group_4684b .index-module_checkbox-group-content_f81a1 .index-module_checkbox-item_1b36c {
25
+ font-size: 14px;
26
+ margin-bottom: 12px;
27
+ }
28
+ .index-module_checkbox-group_4684b .index-module_checkbox-group-cancel_c5cfb {
29
+ font-size: 14px;
30
+ color: #999;
31
+ }
@@ -0,0 +1,16 @@
1
+ import { Ijson } from '../index.d';
2
+ import { AxiosResponse } from 'axios';
3
+ declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, }: {
4
+ item: Ijson;
5
+ readonly?: boolean | undefined;
6
+ style?: any;
7
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
8
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
9
+ value: string | number | (string | number)[];
10
+ onChange: (val: string | number | (string | number)) => void;
11
+ interfaceTypeDict: string;
12
+ interfaceTypeSysDict: string;
13
+ actionUrlKey: string;
14
+ actionUrlExtraParams: object;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ export default MySelect;
@@ -0,0 +1,147 @@
1
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
+ import { Field, Popup, Checkbox, Picker } from "react-vant";
3
+ import { handleSelectOptions } from "../func";
4
+ import { useState, useEffect } from "react";
5
+ import { Flex } from "antd";
6
+ const checkboxGroup = "index-module_checkbox-group_4684b";
7
+ const checkboxGroupHeader = "index-module_checkbox-group-header_192bd";
8
+ const checkboxGroupContent = "index-module_checkbox-group-content_f81a1";
9
+ const checkboxItem = "index-module_checkbox-item_1b36c";
10
+ const checkboxGroupCancel = "index-module_checkbox-group-cancel_c5cfb";
11
+ const styles = {
12
+ "checkbox-group": "index-module_checkbox-group_4684b",
13
+ checkboxGroup,
14
+ "checkbox-group-header": "index-module_checkbox-group-header_192bd",
15
+ checkboxGroupHeader,
16
+ "checkbox-group-content": "index-module_checkbox-group-content_f81a1",
17
+ checkboxGroupContent,
18
+ "checkbox-item": "index-module_checkbox-item_1b36c",
19
+ checkboxItem,
20
+ "checkbox-group-cancel": "index-module_checkbox-group-cancel_c5cfb",
21
+ checkboxGroupCancel
22
+ };
23
+ const MySelect = ({
24
+ item,
25
+ readonly,
26
+ style,
27
+ commonRequestWidthParams,
28
+ commonRequest,
29
+ value,
30
+ onChange,
31
+ interfaceTypeDict,
32
+ interfaceTypeSysDict,
33
+ actionUrlKey,
34
+ actionUrlExtraParams
35
+ }) => {
36
+ const [options, setOptions] = useState([]);
37
+ useEffect(() => {
38
+ if (item.input === "mult-select" && value && Array.isArray(value)) {
39
+ setSelectedValues(value || []);
40
+ setConfirmValues(value || []);
41
+ }
42
+ }, [value]);
43
+ useEffect(() => {
44
+ handleLoadOptions();
45
+ }, [item.inputType, item.classify, item.data, item.options]);
46
+ const handleLoadOptions = async () => {
47
+ const list = await handleSelectOptions({
48
+ commonRequestWidthParams,
49
+ commonRequest,
50
+ interfaceTypeDict,
51
+ interfaceTypeSysDict,
52
+ actionUrlKey,
53
+ actionUrlExtraParams,
54
+ item
55
+ });
56
+ setOptions(list);
57
+ };
58
+ const [showPopup, setShowPopup] = useState(false);
59
+ const [selectedValues, setSelectedValues] = useState([]);
60
+ const [confirmValues, setConfirmValues] = useState([]);
61
+ return /* @__PURE__ */ jsx(Fragment, { children: item.input === "mult-select" ? /* @__PURE__ */ jsxs("div", { style: { width: "100%", ...style }, children: [
62
+ /* @__PURE__ */ jsx(
63
+ Field,
64
+ {
65
+ style: { padding: 0 },
66
+ isLink: true,
67
+ readOnly: true,
68
+ value: (confirmValues == null ? void 0 : confirmValues.length) ? confirmValues == null ? void 0 : confirmValues.join(",") : "",
69
+ onClick: () => {
70
+ if (readonly)
71
+ return;
72
+ setSelectedValues([...confirmValues]);
73
+ setShowPopup(true);
74
+ },
75
+ placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择"
76
+ }
77
+ ),
78
+ /* @__PURE__ */ jsx(
79
+ Popup,
80
+ {
81
+ visible: showPopup,
82
+ round: true,
83
+ position: "bottom",
84
+ style: { height: "60vh" },
85
+ onClose: () => setShowPopup(false),
86
+ children: /* @__PURE__ */ jsxs("div", { className: styles["checkbox-group"], children: [
87
+ /* @__PURE__ */ jsxs(Flex, { justify: "space-between", className: styles["checkbox-group-header"], children: [
88
+ /* @__PURE__ */ jsx("a", { className: styles["checkbox-group-cancel"], onClick: () => setShowPopup(false), children: "取消" }),
89
+ /* @__PURE__ */ jsx(
90
+ "a",
91
+ {
92
+ onClick: () => {
93
+ setShowPopup(false);
94
+ setConfirmValues([...selectedValues]);
95
+ onChange((selectedValues == null ? void 0 : selectedValues.length) ? selectedValues == null ? void 0 : selectedValues.join(",") : "");
96
+ },
97
+ children: "确定"
98
+ }
99
+ )
100
+ ] }),
101
+ /* @__PURE__ */ jsx(
102
+ "div",
103
+ {
104
+ style: {
105
+ height: " calc(60vh - 70px)"
106
+ },
107
+ className: styles["checkbox-group-content"],
108
+ children: /* @__PURE__ */ jsx(Checkbox.Group, { iconSize: "18", onChange: (v) => setSelectedValues(v), value: selectedValues, children: options.map((item2) => /* @__PURE__ */ jsx(Checkbox, { shape: "square", className: styles["checkbox-item"], name: item2.value, children: item2.label }, item2.value)) })
109
+ }
110
+ )
111
+ ] })
112
+ }
113
+ )
114
+ ] }) : /* @__PURE__ */ jsx(
115
+ Picker,
116
+ {
117
+ popup: true,
118
+ columns: options,
119
+ placeholder: "",
120
+ columnsFieldNames: {
121
+ text: "value"
122
+ },
123
+ onConfirm: onChange,
124
+ children: (val, _, actions) => {
125
+ return /* @__PURE__ */ jsx(
126
+ Field,
127
+ {
128
+ style: { padding: 0, ...style },
129
+ isLink: true,
130
+ readOnly: true,
131
+ clickable: true,
132
+ placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择",
133
+ value: Array.isArray(val) ? val.join(",") : val || value,
134
+ onClick: () => {
135
+ if (readonly)
136
+ return;
137
+ actions.open();
138
+ }
139
+ }
140
+ );
141
+ }
142
+ }
143
+ ) });
144
+ };
145
+ export {
146
+ MySelect as default
147
+ };
@@ -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
+ }