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,133 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ const antd = require("antd");
5
+ const useDynamicForm = require("./useDynamicForm");
6
+ const reactVant = require("react-vant");
7
+ const icons = require("@react-vant/icons");
8
+ const DynamicForm = react.forwardRef((props, ref) => {
9
+ const [form] = reactVant.Form.useForm();
10
+ const {
11
+ formConfig,
12
+ setFormConfig,
13
+ setAttrList,
14
+ readonly = false,
15
+ relatedid,
16
+ colNum = 1,
17
+ colSpace = [0, 0],
18
+ instructionShowMode = "flex",
19
+ defaultWidth = "100%",
20
+ commonRequestWidthParams,
21
+ uploadAction,
22
+ commonRequest,
23
+ formItemStyle = [],
24
+ radioAlign = "horizontal",
25
+ interfaceTypeChildren = "YLLRDetailAttrlist",
26
+ interfaceTypeDict = "YLZDDictList",
27
+ interfaceTypeSysDict = "YLZDSysConfigList",
28
+ relatedidKey = "relatedid",
29
+ actionUrlKey = "action-url",
30
+ actionUrlExtraParams = {},
31
+ CustomModalComponent,
32
+ hideAttrList = [],
33
+ formShowType = "form",
34
+ formListItemWidth,
35
+ formListItemName
36
+ } = props;
37
+ const delFileListRef = react.useRef([]);
38
+ const updateDelFileList = (file) => {
39
+ delFileListRef.current.push(file);
40
+ };
41
+ const { handleRenderItem } = useDynamicForm({
42
+ commonRequestWidthParams,
43
+ uploadAction,
44
+ commonRequest,
45
+ setFormConfig,
46
+ setAttrList,
47
+ updateDelFileList,
48
+ formConfig,
49
+ interfaceTypeChildren,
50
+ interfaceTypeDict,
51
+ interfaceTypeSysDict,
52
+ relatedidKey,
53
+ actionUrlKey,
54
+ actionUrlExtraParams,
55
+ CustomModalComponent,
56
+ hideAttrList
57
+ });
58
+ react.useImperativeHandle(ref, () => ({
59
+ getDelFileList: () => {
60
+ return delFileListRef.current;
61
+ },
62
+ submitForm: async () => {
63
+ try {
64
+ const values = await form.validateFields();
65
+ return values;
66
+ } catch (error) {
67
+ }
68
+ }
69
+ }));
70
+ return /* @__PURE__ */ jsxRuntime.jsx(reactVant.Form, { layout: "vertical", form, children: formShowType === "table" ? /* @__PURE__ */ jsxRuntime.jsx(reactVant.Form.List, { name: formListItemName || "customFormList", initialValue: [{}], children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
71
+ fields.map((field, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
72
+ "div",
73
+ {
74
+ className: "form-list-item",
75
+ style: {
76
+ borderRadius: 8,
77
+ marginBottom: 10
78
+ },
79
+ children: [
80
+ /* @__PURE__ */ jsxRuntime.jsxs(
81
+ antd.Flex,
82
+ {
83
+ justify: "space-between",
84
+ style: {
85
+ height: 44,
86
+ width: "calc(100vw - 32px)",
87
+ marginLeft: 16,
88
+ borderBottom: "1px solid #E3E3E3"
89
+ },
90
+ align: "center",
91
+ children: [
92
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#555555" }, children: [
93
+ "第",
94
+ idx + 1,
95
+ "条"
96
+ ] }),
97
+ /* @__PURE__ */ jsxRuntime.jsx("a", { style: { color: "#ff4d4f" }, onClick: () => remove(idx), children: "删除" })
98
+ ]
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "form-list-item__control", children: formConfig == null ? void 0 : formConfig.map((child, index) => {
102
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
103
+ item: child,
104
+ readonly,
105
+ colNum,
106
+ instructionShowMode,
107
+ relatedid,
108
+ form,
109
+ defaultWidth: (formListItemWidth == null ? void 0 : formListItemWidth[index]) || defaultWidth,
110
+ formItemStyle,
111
+ isFormListItem: true,
112
+ formListField: field,
113
+ isShowLabel: false
114
+ }) }, index);
115
+ }) })
116
+ ]
117
+ },
118
+ idx
119
+ )),
120
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 10 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactVant.Button, { plain: true, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}), style: { width: "100%" }, type: "primary", onClick: () => add({}), children: "新增" }) })
121
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: colSpace, children: formConfig.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
122
+ item,
123
+ readonly,
124
+ colNum,
125
+ instructionShowMode,
126
+ relatedid,
127
+ form,
128
+ defaultWidth,
129
+ formItemStyle,
130
+ radioAlign
131
+ }) }, item.attrid || `form-item-${index}`)) }) });
132
+ });
133
+ module.exports = DynamicForm;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { AxiosResponse } from 'axios';
3
+ interface MyCascaderProps {
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
+ commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
11
+ interfaceTypeDict: string;
12
+ interfaceTypeSysDict: string;
13
+ actionUrlKey: string;
14
+ actionUrlExtraParams: object;
15
+ }
16
+ declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default MyCascader;
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const antd = require("antd");
4
+ const react = require("react");
5
+ const MyCascader = ({
6
+ item,
7
+ readonly,
8
+ value,
9
+ onChange,
10
+ style,
11
+ commonRequestWidthParams,
12
+ commonRequest,
13
+ interfaceTypeDict,
14
+ interfaceTypeSysDict,
15
+ actionUrlKey,
16
+ actionUrlExtraParams
17
+ }) => {
18
+ const [options, setOptions] = react.useState([]);
19
+ const [loading, setLoading] = react.useState(false);
20
+ const { message } = antd.App.useApp();
21
+ react.useEffect(() => {
22
+ handleLoadOptions();
23
+ }, [item.inputType, item.classify, item.data, item.options]);
24
+ const handleLoadOptions = async () => {
25
+ if (item.inputType === "local") {
26
+ let localOptions = [];
27
+ if (item.data && Array.isArray(item.data)) {
28
+ localOptions = item.data.map((val) => ({
29
+ label: val,
30
+ value: val
31
+ }));
32
+ } else if (item.options && Array.isArray(item.options)) {
33
+ localOptions = item.options;
34
+ }
35
+ setOptions(localOptions);
36
+ } else if (item.inputType === "dictionary") {
37
+ await getDict(interfaceTypeSysDict);
38
+ } else if (item.inputType === "system-dictionary") {
39
+ getDict(interfaceTypeSysDict);
40
+ } else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
41
+ const res = await handleGetUrlData();
42
+ if (res && Array.isArray(res)) {
43
+ setOptions(res);
44
+ }
45
+ } else {
46
+ let defaultOptions = [];
47
+ if (item.data && Array.isArray(item.data)) {
48
+ defaultOptions = item.data.map((val) => ({
49
+ label: val,
50
+ value: val
51
+ }));
52
+ } else if (item.options && Array.isArray(item.options)) {
53
+ defaultOptions = item.options;
54
+ }
55
+ setOptions(defaultOptions);
56
+ }
57
+ };
58
+ const getDict = async (interfaceType) => {
59
+ var _a;
60
+ if (item.classify) {
61
+ setLoading(true);
62
+ try {
63
+ const response = await commonRequest(interfaceType, {
64
+ asctypeid: item.classify
65
+ });
66
+ if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
67
+ const dictionaryOptions = response.data.list.map((dictItem) => ({
68
+ label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
69
+ value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
70
+ }));
71
+ setOptions(dictionaryOptions);
72
+ }
73
+ } catch (error) {
74
+ message.error("加载选项失败");
75
+ } finally {
76
+ setLoading(false);
77
+ }
78
+ }
79
+ };
80
+ const handleChange = (value2, selectedOptions) => {
81
+ if (onChange) {
82
+ onChange(value2);
83
+ }
84
+ };
85
+ const handleGetUrlData = async (targetOption) => {
86
+ return new Promise(async (resolve, reject) => {
87
+ var _a, _b, _c;
88
+ const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
89
+ const searchFields = (item == null ? void 0 : item["search-field"]) || [];
90
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "-";
91
+ if (!list.length) {
92
+ message.error("请配置key-field");
93
+ return;
94
+ }
95
+ const params = {
96
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
97
+ ...actionUrlExtraParams
98
+ };
99
+ if (targetOption) {
100
+ searchFields.forEach((field) => {
101
+ params[field] = targetOption[field] || "";
102
+ });
103
+ params["level"] = Number(targetOption.level || 0) + 1 || "";
104
+ }
105
+ setLoading(true);
106
+ try {
107
+ const response = await commonRequestWidthParams(
108
+ {
109
+ PageName: "dns_relay",
110
+ Controlname: "CallActionUrl",
111
+ InterfaceType: ""
112
+ },
113
+ params
114
+ );
115
+ if (((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.list) && Array.isArray(response.data.list)) {
116
+ const dictionaryOptions = response.data.list.map((item2) => ({
117
+ ...item2,
118
+ label: `${item2[list[0]] || ""}${delimiter}${item2[list[1]] || ""}`,
119
+ value: `${item2[list[0]] || ""}${delimiter}${item2[list[1]] || ""}`,
120
+ children: [],
121
+ isLeaf: (item2 == null ? void 0 : item2.subcount) === 0
122
+ }));
123
+ resolve(dictionaryOptions);
124
+ }
125
+ reject([]);
126
+ } catch (error) {
127
+ message.error("加载选项失败");
128
+ reject([]);
129
+ } finally {
130
+ reject([]);
131
+ setLoading(false);
132
+ }
133
+ });
134
+ };
135
+ const loadData = async (selectedOptions) => {
136
+ const targetOption = selectedOptions[selectedOptions.length - 1];
137
+ const children = await handleGetUrlData(targetOption) || [];
138
+ targetOption.children = children;
139
+ setOptions([...options]);
140
+ return children;
141
+ };
142
+ const filter = (inputValue, path) => path.some((option) => option.label.toLowerCase().includes(inputValue.toLowerCase()));
143
+ return /* @__PURE__ */ jsxRuntime.jsx(
144
+ antd.Cascader,
145
+ {
146
+ showSearch: { filter },
147
+ loading,
148
+ placeholder: "请选择",
149
+ loadData,
150
+ disabled: readonly,
151
+ onChange: handleChange,
152
+ style: { ...style },
153
+ options,
154
+ value,
155
+ onOpenChange: async (visible) => {
156
+ var _a;
157
+ if (visible && (value == null ? void 0 : value.length)) {
158
+ const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
159
+ const searchFields = (item == null ? void 0 : item["search-field"]) || [];
160
+ if (!list.length || !searchFields.length) {
161
+ message.error("请配置key-field和search-field");
162
+ return;
163
+ }
164
+ const targetFieldIndex = list.findIndex((item2) => item2 === searchFields[0]);
165
+ if (targetFieldIndex === -1) {
166
+ message.error("key-field与search-field配置不匹配");
167
+ return;
168
+ }
169
+ const values = value.map((v) => {
170
+ const arr = v.split("-");
171
+ return arr[targetFieldIndex] || "";
172
+ }).filter(Boolean);
173
+ let children = options;
174
+ for (const [index, el] of values.entries()) {
175
+ if (index === values.length - 1) {
176
+ break;
177
+ }
178
+ const selectedOptions = children.filter((item2) => item2[searchFields[0]] === el);
179
+ if (selectedOptions.length === 0) {
180
+ break;
181
+ }
182
+ const targetOption = selectedOptions[0];
183
+ if (targetOption.children && targetOption.children.length > 0) {
184
+ children = targetOption.children;
185
+ continue;
186
+ }
187
+ const newChildren = await loadData(selectedOptions);
188
+ children = newChildren;
189
+ }
190
+ }
191
+ }
192
+ }
193
+ );
194
+ };
195
+ module.exports = MyCascader;
@@ -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,108 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ const antd = require("antd");
5
+ const MyCheckbox = (props) => {
6
+ const {
7
+ item,
8
+ onChange,
9
+ readonly = false,
10
+ options,
11
+ radioAlign = "horizontal",
12
+ commonRequestWidthParams,
13
+ commonRequest,
14
+ handleUrlOptions,
15
+ value,
16
+ interfaceTypeDict,
17
+ interfaceTypeSysDict,
18
+ actionUrlKey,
19
+ actionUrlExtraParams
20
+ } = props;
21
+ const { message } = antd.App.useApp();
22
+ const [list, setList] = react.useState([]);
23
+ const [val, setVal] = react.useState(value || []);
24
+ react.useEffect(() => {
25
+ if ((item == null ? void 0 : item.inputType) === "local") {
26
+ const arr = (item == null ? void 0 : item.data) || [];
27
+ setList(arr.map((v) => ({ value: v, label: v })));
28
+ } else if ((item == null ? void 0 : item.inputType) === "dictionary") {
29
+ getList(item.classify, interfaceTypeDict);
30
+ } else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
31
+ getList(item.classify, interfaceTypeSysDict);
32
+ } else if ((item == null ? void 0 : item.inputType) === "url") {
33
+ getUrlList();
34
+ }
35
+ }, [item == null ? void 0 : item.inputType]);
36
+ const getList = async (id, interfaceType) => {
37
+ var _a;
38
+ if (!id) {
39
+ return;
40
+ }
41
+ const res = await commonRequest(interfaceType, { asctypeid: id });
42
+ if ((res == null ? void 0 : res.ReturnValue) === 1) {
43
+ const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
44
+ setList(
45
+ arr.map((v) => {
46
+ const value2 = v.dicid + "-" + v.info;
47
+ return { value: value2, label: value2 };
48
+ })
49
+ );
50
+ }
51
+ };
52
+ const getUrlList = async () => {
53
+ var _a, _b;
54
+ try {
55
+ const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
56
+ const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.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: ""
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((val2) => ({
83
+ label: handleUrlOptions(val2, delimiter, keyFieldList),
84
+ value: handleUrlOptions(val2, delimiter, keyFieldList)
85
+ }));
86
+ setList([...urlOptions]);
87
+ }
88
+ } catch (error) {
89
+ message.error("加载选项失败");
90
+ } finally {
91
+ }
92
+ };
93
+ return /* @__PURE__ */ jsxRuntime.jsx(
94
+ antd.Checkbox.Group,
95
+ {
96
+ ...options,
97
+ options: list,
98
+ value: val,
99
+ style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" },
100
+ onChange: (val2) => {
101
+ setVal(val2);
102
+ onChange == null ? void 0 : onChange(val2);
103
+ },
104
+ disabled: readonly
105
+ }
106
+ );
107
+ };
108
+ module.exports = MyCheckbox;
@@ -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,106 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const antd = require("antd");
4
+ const react = require("react");
5
+ const MyRadio = (props) => {
6
+ const {
7
+ item,
8
+ onChange,
9
+ readonly = false,
10
+ options,
11
+ radioAlign = "horizontal",
12
+ commonRequestWidthParams,
13
+ commonRequest,
14
+ handleUrlOptions,
15
+ value,
16
+ interfaceTypeDict,
17
+ interfaceTypeSysDict,
18
+ actionUrlKey,
19
+ actionUrlExtraParams
20
+ } = props;
21
+ const { message } = antd.App.useApp();
22
+ const [list, setList] = react.useState([]);
23
+ react.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
+ if (!commonRequestWidthParams)
61
+ return;
62
+ const response = await commonRequestWidthParams(
63
+ {
64
+ PageName: "dns_relay",
65
+ Controlname: "CallActionUrl",
66
+ InterfaceType: ""
67
+ },
68
+ {
69
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
70
+ ...actionUrlExtraParams
71
+ }
72
+ );
73
+ if (response == null ? void 0 : response.data) {
74
+ const data = response == null ? void 0 : response.data;
75
+ const list2 = data == null ? void 0 : data.list;
76
+ let urlData = [];
77
+ if (Array.isArray(data)) {
78
+ urlData = data;
79
+ }
80
+ if (Array.isArray(list2)) {
81
+ urlData = list2;
82
+ }
83
+ const urlOptions = urlData.map((val) => ({
84
+ label: handleUrlOptions(val, delimiter, keyFieldList),
85
+ value: handleUrlOptions(val, delimiter, keyFieldList)
86
+ }));
87
+ setList([...urlOptions]);
88
+ }
89
+ } catch (error) {
90
+ message.error("加载选项失败");
91
+ } finally {
92
+ }
93
+ };
94
+ return /* @__PURE__ */ jsxRuntime.jsx(
95
+ antd.Radio.Group,
96
+ {
97
+ ...options,
98
+ options: list,
99
+ onChange,
100
+ disabled: readonly,
101
+ value,
102
+ style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" }
103
+ }
104
+ );
105
+ };
106
+ module.exports = MyRadio;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,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;