szld-libs 0.0.16 → 0.0.17

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 (118) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/{index.js → szld-components.es.js} +402 -402
  3. package/dist/szld-components.umd.js +220 -0
  4. package/{@types → es}/components/AuthButton/index.d.ts +0 -0
  5. package/es/components/AuthButton/index.js +12 -0
  6. package/es/components/AuthButton/vite.svg +1 -0
  7. package/es/components/BackHeader/index.css +14 -0
  8. package/{@types → es}/components/BackHeader/index.d.ts +0 -0
  9. package/es/components/BackHeader/index.js +55 -0
  10. package/es/components/BackHeader/vite.svg +1 -0
  11. package/es/components/CreateForm/index.css +39 -0
  12. package/{@types → es}/components/CreateForm/index.d.ts +0 -0
  13. package/es/components/CreateForm/index.js +227 -0
  14. package/es/components/CreateForm/vite.svg +1 -0
  15. package/es/components/Echarts/index.css +5 -0
  16. package/{@types → es}/components/Echarts/index.d.ts +0 -0
  17. package/es/components/Echarts/index.js +65 -0
  18. package/es/components/Echarts/vite.svg +1 -0
  19. package/es/components/EditTable/index.css +9 -0
  20. package/{@types → es}/components/EditTable/index.d.ts +0 -0
  21. package/es/components/EditTable/index.js +99 -0
  22. package/es/components/EditTable/vite.svg +1 -0
  23. package/es/components/Loading/index.css +22 -0
  24. package/{@types → es}/components/Loading/index.d.ts +0 -0
  25. package/es/components/Loading/index.js +44 -0
  26. package/es/components/Loading/vite.svg +1 -0
  27. package/es/components/SearchTable/index.css +3 -0
  28. package/{@types → es}/components/SearchTable/index.d.ts +0 -0
  29. package/es/components/SearchTable/index.js +34 -0
  30. package/es/components/SearchTable/vite.svg +1 -0
  31. package/{@types → es}/components/Upload/index.d.ts +0 -0
  32. package/es/components/Upload/index.js +125 -0
  33. package/es/components/Upload/vite.svg +1 -0
  34. package/es/components/VirtualTable/index.css +18 -0
  35. package/{@types → es}/components/VirtualTable/index.d.ts +0 -0
  36. package/es/components/VirtualTable/index.js +172 -0
  37. package/es/components/VirtualTable/vite.svg +1 -0
  38. package/es/components/WorkFlowNode/index.css +110 -0
  39. package/{@types → es}/components/WorkFlowNode/index.d.ts +0 -0
  40. package/es/components/WorkFlowNode/index.js +125 -0
  41. package/es/components/WorkFlowNode/vite.svg +1 -0
  42. package/{@types → es}/components/common/403.d.ts +0 -0
  43. package/es/components/common/403.js +18 -0
  44. package/{@types → es}/components/common/404.d.ts +0 -0
  45. package/es/components/common/404.js +18 -0
  46. package/es/components/common/vite.svg +1 -0
  47. package/{@types → es}/index.d.ts +0 -0
  48. package/es/index.js +144 -0
  49. package/{@types → es}/main.d.ts +0 -0
  50. package/es/main.js +28 -0
  51. package/{@types → es}/utils/download.d.ts +0 -0
  52. package/es/utils/download.js +59 -0
  53. package/{@types → es}/utils/filetype.d.ts +0 -0
  54. package/es/utils/filetype.js +41 -0
  55. package/{@types → es}/utils/index.d.ts +0 -0
  56. package/es/utils/index.js +114 -0
  57. package/{@types → es}/utils/verify-code.d.ts +0 -0
  58. package/es/utils/verify-code.js +115 -0
  59. package/es/utils/vite.svg +1 -0
  60. package/es/vite.svg +1 -0
  61. package/lib/components/AuthButton/index.d.ts +7 -0
  62. package/lib/components/AuthButton/index.js +11 -0
  63. package/lib/components/AuthButton/vite.svg +1 -0
  64. package/lib/components/BackHeader/index.css +14 -0
  65. package/lib/components/BackHeader/index.d.ts +11 -0
  66. package/lib/components/BackHeader/index.js +54 -0
  67. package/lib/components/BackHeader/vite.svg +1 -0
  68. package/lib/components/CreateForm/index.css +39 -0
  69. package/lib/components/CreateForm/index.d.ts +48 -0
  70. package/lib/components/CreateForm/index.js +227 -0
  71. package/lib/components/CreateForm/vite.svg +1 -0
  72. package/lib/components/Echarts/index.css +5 -0
  73. package/lib/components/Echarts/index.d.ts +14 -0
  74. package/lib/components/Echarts/index.js +81 -0
  75. package/lib/components/Echarts/vite.svg +1 -0
  76. package/lib/components/EditTable/index.css +9 -0
  77. package/lib/components/EditTable/index.d.ts +17 -0
  78. package/lib/components/EditTable/index.js +98 -0
  79. package/lib/components/EditTable/vite.svg +1 -0
  80. package/lib/components/Loading/index.css +22 -0
  81. package/lib/components/Loading/index.d.ts +4 -0
  82. package/lib/components/Loading/index.js +43 -0
  83. package/lib/components/Loading/vite.svg +1 -0
  84. package/lib/components/SearchTable/index.css +3 -0
  85. package/lib/components/SearchTable/index.d.ts +16 -0
  86. package/lib/components/SearchTable/index.js +33 -0
  87. package/lib/components/SearchTable/vite.svg +1 -0
  88. package/lib/components/Upload/index.d.ts +9 -0
  89. package/lib/components/Upload/index.js +124 -0
  90. package/lib/components/Upload/vite.svg +1 -0
  91. package/lib/components/VirtualTable/index.css +18 -0
  92. package/lib/components/VirtualTable/index.d.ts +4 -0
  93. package/lib/components/VirtualTable/index.js +171 -0
  94. package/lib/components/VirtualTable/vite.svg +1 -0
  95. package/lib/components/WorkFlowNode/index.css +110 -0
  96. package/lib/components/WorkFlowNode/index.d.ts +9 -0
  97. package/lib/components/WorkFlowNode/index.js +124 -0
  98. package/lib/components/WorkFlowNode/vite.svg +1 -0
  99. package/lib/components/common/403.d.ts +3 -0
  100. package/lib/components/common/403.js +17 -0
  101. package/lib/components/common/404.d.ts +3 -0
  102. package/lib/components/common/404.js +17 -0
  103. package/lib/components/common/vite.svg +1 -0
  104. package/lib/index.d.ts +1 -0
  105. package/lib/index.js +145 -0
  106. package/lib/main.d.ts +14 -0
  107. package/lib/main.js +48 -0
  108. package/lib/utils/download.d.ts +3 -0
  109. package/lib/utils/download.js +59 -0
  110. package/lib/utils/filetype.d.ts +35 -0
  111. package/lib/utils/filetype.js +41 -0
  112. package/lib/utils/index.d.ts +12 -0
  113. package/lib/utils/index.js +114 -0
  114. package/lib/utils/verify-code.d.ts +27 -0
  115. package/lib/utils/verify-code.js +115 -0
  116. package/lib/utils/vite.svg +1 -0
  117. package/lib/vite.svg +1 -0
  118. package/package.json +10 -7
@@ -0,0 +1,48 @@
1
+ import { FormProps, FormItemProps, ColProps, RowProps, InputProps, SelectProps, InputNumberProps, RadioGroupProps, SwitchProps, TimePickerProps, ButtonProps, CascaderProps } from "antd";
2
+ import { DefaultOptionType } from "antd/es/cascader";
3
+ import { CheckboxGroupProps } from "antd/es/checkbox";
4
+ import { DatePickerProps, RangePickerProps } from "antd/es/date-picker";
5
+ import { PasswordProps, TextAreaProps } from "antd/es/input";
6
+ import React, { ReactNode } from "react";
7
+ import { UploadFileProps } from "../Upload";
8
+ export type ValueType = "rangePicker" | "select" | "input" | "password" | "textarea" | "radio" | "inputNumber" | "switch" | "checkbox" | "timePicker" | "datePicker" | "cascader" | "upload" | "modal" | "btns";
9
+ interface ValueBtnProps extends ButtonProps {
10
+ title: string;
11
+ btnType: "submit" | "reset" | "cancel";
12
+ }
13
+ interface ValueModalProps {
14
+ onClear?: () => void;
15
+ onToggle: (bol: boolean) => void;
16
+ placeholder?: string;
17
+ labelKey: string;
18
+ value?: any;
19
+ }
20
+ export type ValueProps<T> = T extends "checkbox" ? CheckboxGroupProps : T extends "select" ? SelectProps : T extends "inputNumber" ? InputNumberProps : T extends "textarea" ? TextAreaProps : T extends "radio" ? RadioGroupProps : T extends "switch" ? SwitchProps : T extends "rangePicker" ? RangePickerProps : T extends "datePicker" ? DatePickerProps : T extends "timePicker" ? TimePickerProps : T extends "input" ? InputProps : T extends "cascader" ? CascaderProps<DefaultOptionType> : T extends "upload" ? UploadFileProps : T extends "modal" ? ValueModalProps : T extends "btns" ? ValueBtnProps[] : T extends "password" ? PasswordProps : InputProps;
21
+ export interface CreateFormItemProps<T> {
22
+ formItemProps?: FormItemProps;
23
+ valueType?: T;
24
+ valueProps?: ValueProps<T>;
25
+ colProps?: ColProps;
26
+ dataIndex: string;
27
+ title?: string;
28
+ onChange?: (e: any) => void;
29
+ hidden?: boolean;
30
+ readonly?: boolean;
31
+ value?: string | ReactNode;
32
+ }
33
+ export interface CreateFormProps {
34
+ items: CreateFormItemProps<ValueType>[];
35
+ rowProps?: RowProps;
36
+ formProps?: FormProps;
37
+ readonly?: boolean;
38
+ hiddenTitle?: boolean;
39
+ }
40
+ declare const CreateForm: (props: CreateFormProps) => JSX.Element;
41
+ interface FormFieldsProps extends Pick<CreateFormItemProps<ValueType>, "valueType" | "valueProps"> {
42
+ onChange?: (e: any) => void;
43
+ value?: any;
44
+ onBtnClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, item: ValueBtnProps) => void;
45
+ inputRef?: any;
46
+ }
47
+ export declare const FormFields: (props: FormFieldsProps) => React.FunctionComponentElement<any>;
48
+ export default CreateForm;
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const antd = require("antd");
6
+ const icons = require("@ant-design/icons");
7
+ const _ = require("lodash");
8
+ const UploadFile = require("../Upload");
9
+ const fieldModal = "szld-fieldModal";
10
+ const content = "szld-content";
11
+ const suffix = "szld-suffix";
12
+ const placeholder = "szld-placeholder";
13
+ const styles = {
14
+ fieldModal,
15
+ content,
16
+ suffix,
17
+ placeholder
18
+ };
19
+ const formLayout = {
20
+ labelCol: {
21
+ span: 4
22
+ },
23
+ wrapperCol: {
24
+ span: 20
25
+ }
26
+ };
27
+ const getValuePropName = (valueType) => {
28
+ switch (valueType) {
29
+ case "upload":
30
+ return "fileList";
31
+ case "switch":
32
+ return "checked";
33
+ default:
34
+ return "value";
35
+ }
36
+ };
37
+ const CreateForm = (props) => {
38
+ const {
39
+ items,
40
+ rowProps,
41
+ formProps,
42
+ readonly = false,
43
+ hiddenTitle = false
44
+ } = props;
45
+ const onBtnClick = (e, item) => {
46
+ var _a, _b;
47
+ if (item.btnType === "submit") {
48
+ (_a = formProps == null ? void 0 : formProps.form) == null ? void 0 : _a.validateFields().then((values) => {
49
+ item.onClick && item.onClick(values);
50
+ });
51
+ return;
52
+ }
53
+ if (item.btnType === "reset") {
54
+ (_b = formProps == null ? void 0 : formProps.form) == null ? void 0 : _b.resetFields();
55
+ item.onClick && item.onClick(e);
56
+ return;
57
+ }
58
+ if (item.btnType === "cancel") {
59
+ item.onClick && item.onClick(e);
60
+ }
61
+ };
62
+ const normFile = (e) => {
63
+ if (Array.isArray(e)) {
64
+ return e;
65
+ }
66
+ return e && e.fileList;
67
+ };
68
+ return /* @__PURE__ */ jsxRuntime.jsx(
69
+ antd.Form,
70
+ {
71
+ layout: "horizontal",
72
+ form: formProps == null ? void 0 : formProps.form,
73
+ ...formLayout,
74
+ ...formProps || {},
75
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item) => {
76
+ var _a, _b;
77
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { ...item.colProps || { span: 24 }, children: /* @__PURE__ */ jsxRuntime.jsx(
78
+ antd.Form.Item,
79
+ {
80
+ ...item.valueType === "upload" ? {
81
+ getValueFromEvent: normFile
82
+ } : {},
83
+ label: !hiddenTitle ? item.title : "",
84
+ name: item.valueType === "btns" ? void 0 : item.dataIndex,
85
+ ...item.formItemProps,
86
+ children: item.readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || ((_b = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _b[item.dataIndex]) }) : /* @__PURE__ */ jsxRuntime.jsx(
87
+ FormFields,
88
+ {
89
+ onChange: (e) => {
90
+ var _a2;
91
+ return (_a2 = item == null ? void 0 : item.onChange) == null ? void 0 : _a2.call(item, e);
92
+ },
93
+ valueType: item.valueType,
94
+ onBtnClick,
95
+ valueProps: item.valueProps
96
+ }
97
+ )
98
+ }
99
+ ) }, item.dataIndex);
100
+ }) })
101
+ }
102
+ );
103
+ };
104
+ const FormFields = (props) => {
105
+ const { valueType, valueProps, value, onChange, onBtnClick, inputRef } = props;
106
+ const children = React.useMemo(() => {
107
+ let result = /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入", ...valueProps, allowClear: true });
108
+ switch (valueType) {
109
+ case "password":
110
+ result = /* @__PURE__ */ jsxRuntime.jsx(antd.Input.Password, { ...valueProps });
111
+ break;
112
+ case "modal":
113
+ result = /* @__PURE__ */ jsxRuntime.jsx(FieldModal, { ...valueProps });
114
+ break;
115
+ case "checkbox":
116
+ result = /* @__PURE__ */ jsxRuntime.jsx(antd.Checkbox.Group, { ...valueProps });
117
+ break;
118
+ case "select":
119
+ result = /* @__PURE__ */ jsxRuntime.jsx(
120
+ antd.Select,
121
+ {
122
+ placeholder: "请选择",
123
+ ...valueProps,
124
+ allowClear: true
125
+ }
126
+ );
127
+ break;
128
+ case "inputNumber":
129
+ result = /* @__PURE__ */ jsxRuntime.jsx(
130
+ antd.InputNumber,
131
+ {
132
+ style: { width: "100%" },
133
+ placeholder: "请输入",
134
+ ...valueProps
135
+ }
136
+ );
137
+ break;
138
+ case "textarea":
139
+ result = /* @__PURE__ */ jsxRuntime.jsx(
140
+ antd.Input.TextArea,
141
+ {
142
+ placeholder: "请输入",
143
+ ...valueProps,
144
+ allowClear: true
145
+ }
146
+ );
147
+ break;
148
+ case "radio":
149
+ result = /* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Group, { ...valueProps });
150
+ break;
151
+ case "switch":
152
+ result = /* @__PURE__ */ jsxRuntime.jsx(antd.Switch, { ...valueProps });
153
+ break;
154
+ case "datePicker":
155
+ result = /* @__PURE__ */ jsxRuntime.jsx(
156
+ antd.DatePicker,
157
+ {
158
+ style: { width: "100%" },
159
+ ...valueProps,
160
+ allowClear: true
161
+ }
162
+ );
163
+ break;
164
+ case "rangePicker":
165
+ result = /* @__PURE__ */ jsxRuntime.jsx(
166
+ antd.DatePicker.RangePicker,
167
+ {
168
+ style: { width: "100%" },
169
+ ...valueProps,
170
+ allowClear: true
171
+ }
172
+ );
173
+ break;
174
+ case "timePicker":
175
+ result = /* @__PURE__ */ jsxRuntime.jsx(
176
+ antd.TimePicker,
177
+ {
178
+ style: { width: "100%" },
179
+ ...valueProps,
180
+ allowClear: true
181
+ }
182
+ );
183
+ break;
184
+ case "cascader":
185
+ result = /* @__PURE__ */ jsxRuntime.jsx(
186
+ antd.Cascader,
187
+ {
188
+ ...valueProps,
189
+ allowClear: true
190
+ }
191
+ );
192
+ break;
193
+ case "upload":
194
+ result = /* @__PURE__ */ jsxRuntime.jsx(UploadFile, { ...valueProps });
195
+ break;
196
+ case "btns":
197
+ result = /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { children: valueProps == null ? void 0 : valueProps.map((item) => /* @__PURE__ */ React.createElement(
198
+ antd.Button,
199
+ {
200
+ type: item.btnType === "submit" ? "primary" : "default",
201
+ ..._.omit(item, ["btnType"]),
202
+ key: item.btnType,
203
+ onClick: (e) => {
204
+ onBtnClick == null ? void 0 : onBtnClick(e, item);
205
+ }
206
+ },
207
+ item.title
208
+ )) });
209
+ break;
210
+ }
211
+ return result;
212
+ }, [valueType, valueProps, onChange, value]);
213
+ return React.cloneElement(children, {
214
+ [getValuePropName(valueType || "input")]: value,
215
+ onChange,
216
+ ref: inputRef
217
+ });
218
+ };
219
+ const FieldModal = (props) => {
220
+ const { placeholder: placeholder2, labelKey, onToggle, value, onClear } = props;
221
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.fieldModal, children: [
222
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, onClick: () => onToggle(true), children: !value ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.placeholder, children: placeholder2 }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: value[labelKey] }) }),
223
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.suffix, onClick: onClear, children: value && /* @__PURE__ */ jsxRuntime.jsx(icons.CloseCircleFilled, {}) })
224
+ ] });
225
+ };
226
+ exports.FormFields = FormFields;
227
+ exports.default = CreateForm;
@@ -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,5 @@
1
+ .szld-main {
2
+ width: 100%;
3
+ height: 100%;
4
+ position: relative;
5
+ }
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import * as echarts from 'echarts/core';
3
+ import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
4
+ import { TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';
5
+ type ECOption = echarts.ComposeOption<BarSeriesOption | LineSeriesOption | TitleComponentOption | TooltipComponentOption | GridComponentOption | DatasetComponentOption>;
6
+ export interface EchartsProps {
7
+ option: ECOption;
8
+ }
9
+ /**
10
+ * @param props : EchartsProps 传入图标配置项
11
+ * 外部包裹一层dom元素定义width和height,内部自动占满
12
+ */
13
+ declare const Echarts: (props: EchartsProps) => JSX.Element;
14
+ export default Echarts;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const echarts = require("echarts/core");
4
+ const charts = require("echarts/charts");
5
+ const components = require("echarts/components");
6
+ const features = require("echarts/features");
7
+ const renderers = require("echarts/renderers");
8
+ const react = require("react");
9
+ const ahooks = require("ahooks");
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const echarts__namespace = /* @__PURE__ */ _interopNamespaceDefault(echarts);
27
+ const main = "szld-main";
28
+ const classes = {
29
+ main
30
+ };
31
+ echarts__namespace.use([
32
+ components.TitleComponent,
33
+ components.TooltipComponent,
34
+ components.GridComponent,
35
+ components.DatasetComponent,
36
+ components.TransformComponent,
37
+ charts.BarChart,
38
+ features.LabelLayout,
39
+ features.UniversalTransition,
40
+ renderers.CanvasRenderer
41
+ ]);
42
+ const Echarts = (props) => {
43
+ const ref = react.useRef(null);
44
+ const eRef = react.useRef(null);
45
+ const resizeRef = react.useRef(null);
46
+ react.useEffect(() => {
47
+ if (ref.current && eRef.current) {
48
+ resizeRef.current = new ResizeObserver((entries) => {
49
+ for (const entry of entries) {
50
+ if (entry.target === ref.current) {
51
+ run();
52
+ }
53
+ }
54
+ });
55
+ resizeRef.current.observe(ref.current);
56
+ }
57
+ return () => {
58
+ var _a;
59
+ ref.current && ((_a = resizeRef.current) == null ? void 0 : _a.unobserve(ref.current));
60
+ resizeRef.current = null;
61
+ };
62
+ }, [ref.current, eRef.current]);
63
+ react.useEffect(() => {
64
+ if (ref.current && !eRef.current) {
65
+ eRef.current = echarts__namespace.init(ref.current);
66
+ }
67
+ }, [ref.current]);
68
+ react.useEffect(() => {
69
+ if (eRef.current && ref.current) {
70
+ eRef.current.setOption(props.option);
71
+ }
72
+ }, [eRef.current]);
73
+ const onResize = () => {
74
+ if (eRef.current) {
75
+ eRef.current.resize();
76
+ }
77
+ };
78
+ const { run } = ahooks.useDebounceFn(onResize, { wait: 300 });
79
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: classes.main });
80
+ };
81
+ module.exports = Echarts;
@@ -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,9 @@
1
+ .szld-editableCellValueWrap {
2
+ padding: 4px 11px;
3
+ border: 1px solid #d9d9d9;
4
+ border-radius: 6px;
5
+ cursor: pointer;
6
+ }
7
+ [data-theme='dark'] .szld-editableCellValueWrap:hover {
8
+ border: 1px solid #434343;
9
+ }
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { TableProps } from "antd";
3
+ import { Rule } from "antd/es/form";
4
+ import { ColumnType } from "antd/es/table";
5
+ import { ValueProps, ValueType } from "../CreateForm";
6
+ export type ColumnsType<RecordType> = ColumnType<RecordType> & {
7
+ editable?: boolean;
8
+ rules?: Rule[];
9
+ type?: ValueType;
10
+ valueProps?: ValueProps<RecordType>;
11
+ };
12
+ export interface EditTableProps<RecordType> extends Omit<TableProps<RecordType>, "columns" | "onChange"> {
13
+ columns: ColumnsType<RecordType>[];
14
+ onChange?: (row: RecordType) => void;
15
+ }
16
+ declare function EditTable<DataType extends object = any>(props: EditTableProps<DataType>): JSX.Element;
17
+ export default EditTable;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const antd = require("antd");
4
+ const React = require("react");
5
+ const CreateForm = require("../CreateForm");
6
+ const editableCellValueWrap = "szld-editableCellValueWrap";
7
+ const classes = {
8
+ editableCellValueWrap
9
+ };
10
+ const EditableContext = React.createContext(null);
11
+ const EditableRow = ({ index, ...props }) => {
12
+ const [form] = antd.Form.useForm();
13
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, component: false, children: /* @__PURE__ */ jsxRuntime.jsx(EditableContext.Provider, { value: form, children: /* @__PURE__ */ jsxRuntime.jsx("tr", { ...props }) }) });
14
+ };
15
+ function EditableCell(props) {
16
+ const {
17
+ title,
18
+ editable,
19
+ children,
20
+ dataIndex,
21
+ record,
22
+ rules,
23
+ onChange,
24
+ type = "input",
25
+ valueProps,
26
+ ...restProps
27
+ } = props;
28
+ const inputRef = React.useRef(null);
29
+ const form = React.useContext(EditableContext);
30
+ const save = async () => {
31
+ try {
32
+ const values = await form.validateFields();
33
+ onChange({ ...record, ...values });
34
+ } catch (errInfo) {
35
+ console.log("Save failed:", errInfo);
36
+ }
37
+ };
38
+ const renderItem = () => {
39
+ return /* @__PURE__ */ jsxRuntime.jsx(
40
+ CreateForm.FormFields,
41
+ {
42
+ valueType: type,
43
+ valueProps: {
44
+ ...valueProps,
45
+ onBlur: save,
46
+ onPressEnter: save
47
+ },
48
+ inputRef
49
+ }
50
+ );
51
+ };
52
+ let childNode = children;
53
+ if (editable) {
54
+ childNode = /* @__PURE__ */ jsxRuntime.jsx(
55
+ antd.Form.Item,
56
+ {
57
+ style: { margin: 0 },
58
+ initialValue: record[dataIndex],
59
+ name: dataIndex,
60
+ rules,
61
+ children: renderItem()
62
+ }
63
+ );
64
+ }
65
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { children: childNode });
66
+ }
67
+ function EditTable(props) {
68
+ const { columns, onChange, ...rest } = props;
69
+ const components = {
70
+ body: {
71
+ row: EditableRow,
72
+ cell: EditableCell
73
+ }
74
+ };
75
+ const mergeColumns = columns == null ? void 0 : columns.map((col) => {
76
+ if (!col.editable) {
77
+ return col;
78
+ }
79
+ return {
80
+ ...col,
81
+ onCell: (record) => ({
82
+ ...col,
83
+ record,
84
+ onChange
85
+ })
86
+ };
87
+ });
88
+ return /* @__PURE__ */ jsxRuntime.jsx(
89
+ antd.Table,
90
+ {
91
+ ...rest,
92
+ components,
93
+ rowClassName: () => classes.editableRow,
94
+ columns: mergeColumns
95
+ }
96
+ );
97
+ }
98
+ module.exports = EditTable;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,22 @@
1
+ .szld-loadingWrapper .szld-loadingRoot {
2
+ background-color: rgba(0, 0, 0, 0.6);
3
+ position: fixed;
4
+ width: 100%;
5
+ height: 100%;
6
+ z-index: 1000;
7
+ inset: 0;
8
+ }
9
+ .szld-loadingWrapper .szld-loadingBody {
10
+ position: fixed;
11
+ overflow: hidden;
12
+ inset: 0;
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ z-index: 1000;
17
+ }
18
+ .szld-loadingWrapper .szld-loadingBody .szld-content {
19
+ width: 100px;
20
+ height: 100px;
21
+ border-radius: 20px;
22
+ }
@@ -0,0 +1,4 @@
1
+ declare const Loading: () => {
2
+ close: () => void;
3
+ };
4
+ export default Loading;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const icons = require("@ant-design/icons");
4
+ const antd = require("antd");
5
+ const ReactDOM = require("react-dom/client");
6
+ const loadingWrapper = "szld-loadingWrapper";
7
+ const loadingRoot = "szld-loadingRoot";
8
+ const loadingBody = "szld-loadingBody";
9
+ const content = "szld-content";
10
+ const classes = {
11
+ loadingWrapper,
12
+ loadingRoot,
13
+ loadingBody,
14
+ content
15
+ };
16
+ const antIcon = /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { fontSize: 40 }, spin: true });
17
+ const Loading = () => {
18
+ const div = document.createElement("div");
19
+ const style = document.createElement("style");
20
+ const loading = ReactDOM.createRoot(div);
21
+ const Container = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.loadingWrapper, children: [
22
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.loadingRoot }),
23
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.loadingBody, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.content, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: antIcon }) }) })
24
+ ] });
25
+ const hiddenScroll = () => {
26
+ const styleContent = `body { overflow-y: hidden; }`;
27
+ style.textContent = styleContent;
28
+ document.head.appendChild(style);
29
+ };
30
+ const render = () => {
31
+ document.body.appendChild(div);
32
+ hiddenScroll();
33
+ loading.render(/* @__PURE__ */ jsxRuntime.jsx(Container, {}));
34
+ };
35
+ const close = () => {
36
+ loading.unmount();
37
+ document.body.removeChild(div);
38
+ document.head.removeChild(style);
39
+ };
40
+ render();
41
+ return { close };
42
+ };
43
+ module.exports = Loading;
@@ -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
+ .szld-search {
2
+ margin-bottom: 20px;
3
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { TableProps } from "antd";
3
+ import { ColumnType } from "antd/es/table";
4
+ import { CreateFormProps } from "../CreateForm";
5
+ export interface TableColumnProps<T> extends ColumnType<T> {
6
+ hidden?: boolean;
7
+ }
8
+ export interface MTableProps<T> extends Omit<TableProps<T>, "columns"> {
9
+ columns?: TableColumnProps<T>[];
10
+ }
11
+ export interface SearchTableProps<RecordType> {
12
+ searchProps?: CreateFormProps;
13
+ tableProps?: MTableProps<RecordType>;
14
+ }
15
+ declare function SearchTable<RecordType extends object = any>(props: SearchTableProps<RecordType>): JSX.Element;
16
+ export default SearchTable;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const antd = require("antd");
4
+ const classNames = require("classnames");
5
+ const CreateForm = require("../CreateForm");
6
+ const search = "szld-search";
7
+ const classes = {
8
+ search
9
+ };
10
+ function SearchTable(props) {
11
+ const { tableProps = {}, searchProps } = props;
12
+ const { columns = [], ...rest } = tableProps;
13
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14
+ searchProps && /* @__PURE__ */ jsxRuntime.jsx(CreateForm, { hiddenTitle: true, ...searchProps, items: searchProps.items }),
15
+ /* @__PURE__ */ jsxRuntime.jsx(
16
+ antd.Table,
17
+ {
18
+ columns: columns.filter((v) => !v.hidden),
19
+ ...rest,
20
+ className: classNames(classes.table, tableProps == null ? void 0 : tableProps.className),
21
+ pagination: typeof (tableProps == null ? void 0 : tableProps.pagination) === "boolean" ? tableProps.pagination : {
22
+ hideOnSinglePage: true,
23
+ showPrevNextJumpers: true,
24
+ showQuickJumper: true,
25
+ showSizeChanger: true,
26
+ showTotal: (total) => `共 ${total} 条`,
27
+ ...tableProps == null ? void 0 : tableProps.pagination
28
+ }
29
+ }
30
+ )
31
+ ] });
32
+ }
33
+ module.exports = SearchTable;
@@ -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>