szld-libs 0.2.99 → 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 (94) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/szld-components.es.js +32001 -20129
  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 +36 -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 +4 -1
  48. package/es/utils/method.js +25 -8
  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 +36 -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 +4 -1
  93. package/lib/utils/method.js +25 -8
  94. package/package.json +1 -1
@@ -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;
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const reactVant = require("react-vant");
4
+ const func = require("../func");
5
+ const react = require("react");
6
+ const antd = require("antd");
7
+ const checkboxGroup = "index-module_checkbox-group_4684b";
8
+ const checkboxGroupHeader = "index-module_checkbox-group-header_192bd";
9
+ const checkboxGroupContent = "index-module_checkbox-group-content_f81a1";
10
+ const checkboxItem = "index-module_checkbox-item_1b36c";
11
+ const checkboxGroupCancel = "index-module_checkbox-group-cancel_c5cfb";
12
+ const styles = {
13
+ "checkbox-group": "index-module_checkbox-group_4684b",
14
+ checkboxGroup,
15
+ "checkbox-group-header": "index-module_checkbox-group-header_192bd",
16
+ checkboxGroupHeader,
17
+ "checkbox-group-content": "index-module_checkbox-group-content_f81a1",
18
+ checkboxGroupContent,
19
+ "checkbox-item": "index-module_checkbox-item_1b36c",
20
+ checkboxItem,
21
+ "checkbox-group-cancel": "index-module_checkbox-group-cancel_c5cfb",
22
+ checkboxGroupCancel
23
+ };
24
+ const MySelect = ({
25
+ item,
26
+ readonly,
27
+ style,
28
+ commonRequestWidthParams,
29
+ commonRequest,
30
+ value,
31
+ onChange,
32
+ interfaceTypeDict,
33
+ interfaceTypeSysDict,
34
+ actionUrlKey,
35
+ actionUrlExtraParams
36
+ }) => {
37
+ const [options, setOptions] = react.useState([]);
38
+ react.useEffect(() => {
39
+ if (item.input === "mult-select" && value && Array.isArray(value)) {
40
+ setSelectedValues(value || []);
41
+ setConfirmValues(value || []);
42
+ }
43
+ }, [value]);
44
+ react.useEffect(() => {
45
+ handleLoadOptions();
46
+ }, [item.inputType, item.classify, item.data, item.options]);
47
+ const handleLoadOptions = async () => {
48
+ const list = await func.handleSelectOptions({
49
+ commonRequestWidthParams,
50
+ commonRequest,
51
+ interfaceTypeDict,
52
+ interfaceTypeSysDict,
53
+ actionUrlKey,
54
+ actionUrlExtraParams,
55
+ item
56
+ });
57
+ setOptions(list);
58
+ };
59
+ const [showPopup, setShowPopup] = react.useState(false);
60
+ const [selectedValues, setSelectedValues] = react.useState([]);
61
+ const [confirmValues, setConfirmValues] = react.useState([]);
62
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: item.input === "mult-select" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", ...style }, children: [
63
+ /* @__PURE__ */ jsxRuntime.jsx(
64
+ reactVant.Field,
65
+ {
66
+ style: { padding: 0 },
67
+ isLink: true,
68
+ readOnly: true,
69
+ value: (confirmValues == null ? void 0 : confirmValues.length) ? confirmValues == null ? void 0 : confirmValues.join(",") : "",
70
+ onClick: () => {
71
+ if (readonly)
72
+ return;
73
+ setSelectedValues([...confirmValues]);
74
+ setShowPopup(true);
75
+ },
76
+ placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsxRuntime.jsx(
80
+ reactVant.Popup,
81
+ {
82
+ visible: showPopup,
83
+ round: true,
84
+ position: "bottom",
85
+ style: { height: "60vh" },
86
+ onClose: () => setShowPopup(false),
87
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles["checkbox-group"], children: [
88
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", className: styles["checkbox-group-header"], children: [
89
+ /* @__PURE__ */ jsxRuntime.jsx("a", { className: styles["checkbox-group-cancel"], onClick: () => setShowPopup(false), children: "取消" }),
90
+ /* @__PURE__ */ jsxRuntime.jsx(
91
+ "a",
92
+ {
93
+ onClick: () => {
94
+ setShowPopup(false);
95
+ setConfirmValues([...selectedValues]);
96
+ onChange((selectedValues == null ? void 0 : selectedValues.length) ? selectedValues == null ? void 0 : selectedValues.join(",") : "");
97
+ },
98
+ children: "确定"
99
+ }
100
+ )
101
+ ] }),
102
+ /* @__PURE__ */ jsxRuntime.jsx(
103
+ "div",
104
+ {
105
+ style: {
106
+ height: " calc(60vh - 70px)"
107
+ },
108
+ className: styles["checkbox-group-content"],
109
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactVant.Checkbox.Group, { iconSize: "18", onChange: (v) => setSelectedValues(v), value: selectedValues, children: options.map((item2) => /* @__PURE__ */ jsxRuntime.jsx(reactVant.Checkbox, { shape: "square", className: styles["checkbox-item"], name: item2.value, children: item2.label }, item2.value)) })
110
+ }
111
+ )
112
+ ] })
113
+ }
114
+ )
115
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
116
+ reactVant.Picker,
117
+ {
118
+ popup: true,
119
+ columns: options,
120
+ placeholder: "",
121
+ columnsFieldNames: {
122
+ text: "value"
123
+ },
124
+ onConfirm: onChange,
125
+ children: (val, _, actions) => {
126
+ return /* @__PURE__ */ jsxRuntime.jsx(
127
+ reactVant.Field,
128
+ {
129
+ style: { padding: 0, ...style },
130
+ isLink: true,
131
+ readOnly: true,
132
+ clickable: true,
133
+ placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择",
134
+ value: Array.isArray(val) ? val.join(",") : val || value,
135
+ onClick: () => {
136
+ if (readonly)
137
+ return;
138
+ actions.open();
139
+ }
140
+ }
141
+ );
142
+ }
143
+ }
144
+ ) });
145
+ };
146
+ module.exports = MySelect;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,3 @@
1
+ .myUpload-module_customUpload_5ec38 a {
2
+ color: #252525 !important;
3
+ }
@@ -0,0 +1,16 @@
1
+ import { UploadFile } from 'antd/es/upload/interface';
2
+ import { Ijson } from '../index.d';
3
+ interface IMYUpload {
4
+ action?: string;
5
+ onChange?: (checkedValue: any[]) => void;
6
+ onRemove?: (file: UploadFile) => void;
7
+ item: Ijson;
8
+ relatedid?: string;
9
+ readonly?: boolean;
10
+ list?: UploadFile[];
11
+ uploadText?: string;
12
+ uploadType?: string;
13
+ relatedidKey: string;
14
+ }
15
+ declare const MyUpload: (props: IMYUpload) => import("react/jsx-runtime").JSX.Element;
16
+ export default MyUpload;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const icons = require("@ant-design/icons");
4
+ const antd = require("antd");
5
+ const react = require("react");
6
+ const customUpload = "myUpload-module_customUpload_5ec38";
7
+ const styles = {
8
+ customUpload
9
+ };
10
+ const getBase64 = (file) => new Promise((resolve, reject) => {
11
+ const reader = new FileReader();
12
+ reader.readAsDataURL(file);
13
+ reader.onload = () => resolve(reader.result);
14
+ reader.onerror = (error) => reject(error);
15
+ });
16
+ const MyUpload = (props) => {
17
+ const {
18
+ action,
19
+ item,
20
+ onChange,
21
+ readonly = false,
22
+ relatedid,
23
+ uploadText = "上传文件",
24
+ onRemove,
25
+ list = [],
26
+ uploadType,
27
+ relatedidKey
28
+ } = props;
29
+ const { message } = antd.App.useApp();
30
+ const accept = (item == null ? void 0 : item["upload-accept"]) || "*";
31
+ const input = item == null ? void 0 : item["input"];
32
+ const size = item == null ? void 0 : item["upload-size"];
33
+ const maxCount = (item == null ? void 0 : item["upload-max-count"]) || 1;
34
+ const [listType, setListType] = react.useState(input === "image" ? "picture-card" : "text");
35
+ const [fileList, setFileList] = react.useState([]);
36
+ const [previewOpen, setPreviewOpen] = react.useState(false);
37
+ const [previewImage, setPreviewImage] = react.useState("");
38
+ react.useEffect(() => {
39
+ if (list && list.length) {
40
+ setFileList(list);
41
+ }
42
+ }, [list]);
43
+ const handlePreview = async (file) => {
44
+ if (uploadType !== "image")
45
+ return;
46
+ if (!file.url && !file.preview) {
47
+ file.preview = await getBase64(file.originFileObj);
48
+ }
49
+ setPreviewImage(file.url || file.preview);
50
+ setPreviewOpen(true);
51
+ };
52
+ const handleChange = ({ fileList: newFileList }) => {
53
+ setFileList(newFileList);
54
+ onChange && onChange(newFileList);
55
+ };
56
+ const handleBeforeUpload = (file) => {
57
+ if (!size)
58
+ return true;
59
+ const isLt = file.size / 1024 / 1024 < Number(size);
60
+ if (!isLt) {
61
+ message.error(`请上传不超过${size}MB的文件`);
62
+ }
63
+ return isLt;
64
+ };
65
+ const uploadButton = input === "image" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { style: { border: 0, background: "none" }, type: "button", children: [
66
+ /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
67
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8 }, children: "Upload" })
68
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UploadOutlined, {}), children: uploadText }) });
69
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx(
71
+ antd.Upload,
72
+ {
73
+ action,
74
+ beforeUpload: handleBeforeUpload,
75
+ listType,
76
+ accept,
77
+ fileList,
78
+ onPreview: handlePreview,
79
+ data: { [relatedidKey]: relatedid },
80
+ maxCount,
81
+ onChange: handleChange,
82
+ onRemove,
83
+ disabled: readonly,
84
+ className: styles.customUpload,
85
+ children: fileList.length >= maxCount ? null : uploadButton
86
+ }
87
+ ),
88
+ previewImage && /* @__PURE__ */ jsxRuntime.jsx(
89
+ antd.Image,
90
+ {
91
+ wrapperStyle: { display: "none" },
92
+ preview: {
93
+ visible: previewOpen,
94
+ onVisibleChange: (visible) => setPreviewOpen(visible),
95
+ afterOpenChange: (visible) => !visible && setPreviewImage("")
96
+ },
97
+ src: previewImage
98
+ }
99
+ )
100
+ ] });
101
+ };
102
+ module.exports = MyUpload;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { AxiosResponse } from 'axios';
3
+ interface RadioCardProps {
4
+ item: any;
5
+ readonly?: boolean;
6
+ value?: string;
7
+ onChange?: (value: any) => void;
8
+ style?: React.CSSProperties;
9
+ commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
10
+ }
11
+ declare const RadioCard: ({ item, readonly, value, onChange, style, commonRequestWidthParams }: RadioCardProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default RadioCard;