yuand 1.0.0

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 (80) hide show
  1. package/README.md +23 -0
  2. package/es/components/Table/index.d.ts +12 -0
  3. package/es/components/Table/index.js +326 -0
  4. package/es/components/Table/style.css +3 -0
  5. package/es/components/Table/types.d.ts +101 -0
  6. package/es/components/Table/types.js +1 -0
  7. package/es/components/Table/useTable.d.ts +3 -0
  8. package/es/components/Table/useTable.js +76 -0
  9. package/es/components/TableConfig/index.d.ts +11 -0
  10. package/es/components/TableConfig/index.js +19 -0
  11. package/es/components/TableUseFetch/index.d.ts +12 -0
  12. package/es/components/TableUseFetch/index.js +283 -0
  13. package/es/components/TableUseFetch/style.css +3 -0
  14. package/es/components/TableUseFetch/types.d.ts +100 -0
  15. package/es/components/TableUseFetch/types.js +1 -0
  16. package/es/components/TableUseFetch/useTable.d.ts +3 -0
  17. package/es/components/TableUseFetch/useTable.js +78 -0
  18. package/es/components/index.d.ts +3 -0
  19. package/es/components/index.js +3 -0
  20. package/es/fetch.d.ts +137 -0
  21. package/es/fetch.js +534 -0
  22. package/es/hooks/index.d.ts +4 -0
  23. package/es/hooks/index.js +4 -0
  24. package/es/hooks/useFetch.d.ts +17 -0
  25. package/es/hooks/useFetch.js +41 -0
  26. package/es/hooks/useMutation.d.ts +14 -0
  27. package/es/hooks/useMutation.js +26 -0
  28. package/es/hooks/useQuery.d.ts +14 -0
  29. package/es/hooks/useQuery.js +40 -0
  30. package/es/hooks/useX.d.ts +1 -0
  31. package/es/hooks/useX.js +13 -0
  32. package/es/index.d.ts +4 -0
  33. package/es/index.js +4 -0
  34. package/es/utils/index.d.ts +6 -0
  35. package/es/utils/index.js +23 -0
  36. package/es/utils/table.d.ts +15 -0
  37. package/es/utils/table.js +106 -0
  38. package/es/utils/util.d.ts +2 -0
  39. package/es/utils/util.js +6 -0
  40. package/lang/en_US.json +6 -0
  41. package/lang/zh_CN.json +6 -0
  42. package/lib/components/Table/index.d.ts +12 -0
  43. package/lib/components/Table/index.js +330 -0
  44. package/lib/components/Table/style.css +3 -0
  45. package/lib/components/Table/types.d.ts +101 -0
  46. package/lib/components/Table/types.js +17 -0
  47. package/lib/components/Table/useTable.d.ts +3 -0
  48. package/lib/components/Table/useTable.js +85 -0
  49. package/lib/components/TableConfig/index.d.ts +11 -0
  50. package/lib/components/TableConfig/index.js +55 -0
  51. package/lib/components/TableUseFetch/index.d.ts +12 -0
  52. package/lib/components/TableUseFetch/index.js +303 -0
  53. package/lib/components/TableUseFetch/style.css +3 -0
  54. package/lib/components/TableUseFetch/types.d.ts +100 -0
  55. package/lib/components/TableUseFetch/types.js +17 -0
  56. package/lib/components/TableUseFetch/useTable.d.ts +3 -0
  57. package/lib/components/TableUseFetch/useTable.js +86 -0
  58. package/lib/components/index.d.ts +3 -0
  59. package/lib/components/index.js +45 -0
  60. package/lib/fetch.d.ts +137 -0
  61. package/lib/fetch.js +366 -0
  62. package/lib/hooks/index.d.ts +4 -0
  63. package/lib/hooks/index.js +48 -0
  64. package/lib/hooks/useFetch.d.ts +17 -0
  65. package/lib/hooks/useFetch.js +62 -0
  66. package/lib/hooks/useMutation.d.ts +14 -0
  67. package/lib/hooks/useMutation.js +43 -0
  68. package/lib/hooks/useQuery.d.ts +14 -0
  69. package/lib/hooks/useQuery.js +57 -0
  70. package/lib/hooks/useX.d.ts +1 -0
  71. package/lib/hooks/useX.js +37 -0
  72. package/lib/index.d.ts +4 -0
  73. package/lib/index.js +29 -0
  74. package/lib/utils/index.d.ts +6 -0
  75. package/lib/utils/index.js +60 -0
  76. package/lib/utils/table.d.ts +15 -0
  77. package/lib/utils/table.js +124 -0
  78. package/lib/utils/util.d.ts +2 -0
  79. package/lib/utils/util.js +32 -0
  80. package/package.json +46 -0
@@ -0,0 +1,40 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["queryKey", "ignoreError", "returnData", "method", "headers", "onLogout", "onBefore", "useSignal"];
5
+ import { useQuery } from "@tanstack/react-query";
6
+ import { rq } from "../fetch";
7
+ function useQueryHooks(options) {
8
+ var _ref = options || {},
9
+ queryKey = _ref.queryKey,
10
+ ignoreError = _ref.ignoreError,
11
+ returnData = _ref.returnData,
12
+ method = _ref.method,
13
+ headers = _ref.headers,
14
+ onLogout = _ref.onLogout,
15
+ onBefore = _ref.onBefore,
16
+ _ref$useSignal = _ref.useSignal,
17
+ useSignal = _ref$useSignal === void 0 ? false : _ref$useSignal,
18
+ others = _objectWithoutProperties(_ref, _excluded);
19
+ return useQuery(_objectSpread({
20
+ queryKey: queryKey,
21
+ queryFn: function queryFn(_ref2) {
22
+ var queryKey = _ref2.queryKey,
23
+ signal = _ref2.signal;
24
+ onBefore === null || onBefore === void 0 || onBefore();
25
+ var _queryKey = _slicedToArray(queryKey, 2),
26
+ url = _queryKey[0],
27
+ json = _queryKey[1];
28
+ return rq.request(url, {
29
+ json: json,
30
+ returnData: returnData,
31
+ method: method,
32
+ ignoreError: ignoreError,
33
+ signal: useSignal ? signal : undefined,
34
+ headers: headers,
35
+ onLogout: onLogout
36
+ });
37
+ }
38
+ }, others));
39
+ }
40
+ export default useQueryHooks;
@@ -0,0 +1 @@
1
+ export default function useX(column: any[] | ((data: any) => any[])): number;
@@ -0,0 +1,13 @@
1
+ import { useMemo } from "react";
2
+ export default function useX(column) {
3
+ if (!Array.isArray(column)) return 0;
4
+ return useMemo(function () {
5
+ if (!column.length) return 0;
6
+ var columns = column.filter(function (item) {
7
+ return !item.hidden;
8
+ });
9
+ return columns.reduce(function (a, b) {
10
+ return a + parseInt(b.width || 0);
11
+ }, 0);
12
+ }, [column]);
13
+ }
package/es/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./components";
2
+ export * from "./utils";
3
+ export * from "./hooks";
4
+ export * from "./fetch";
package/es/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./components";
2
+ export * from "./utils";
3
+ export * from "./hooks";
4
+ export * from "./fetch";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 格式化秒数为天、小时、分钟、秒的字符串
3
+ * @param seconds 秒数
4
+ * @returns 格式化后的字符串
5
+ */
6
+ export declare function formatDuration(seconds: number): string;
@@ -0,0 +1,23 @@
1
+ import dayjs from 'dayjs';
2
+ import duration from 'dayjs/plugin/duration';
3
+ dayjs.extend(duration);
4
+
5
+ /**
6
+ * 格式化秒数为天、小时、分钟、秒的字符串
7
+ * @param seconds 秒数
8
+ * @returns 格式化后的字符串
9
+ */
10
+ export function formatDuration(seconds) {
11
+ if (!seconds || seconds === 0) return '0秒';
12
+ var duration = dayjs.duration(seconds, 'seconds');
13
+ var days = Math.floor(duration.asDays());
14
+ var hours = duration.hours();
15
+ var minutes = duration.minutes();
16
+ var secs = duration.seconds();
17
+ var result = '';
18
+ if (days > 0) result += "".concat(days, "\u5929");
19
+ if (hours > 0) result += "".concat(hours, "\u5C0F\u65F6");
20
+ if (minutes > 0) result += "".concat(minutes, "\u5206");
21
+ if (secs > 0) result += "".concat(secs, "\u79D2");
22
+ return result || '0秒';
23
+ }
@@ -0,0 +1,15 @@
1
+ export interface GetQueryProps {
2
+ page: number;
3
+ size: number;
4
+ sorter: {
5
+ field?: string;
6
+ order?: string;
7
+ };
8
+ search: Record<string, unknown>;
9
+ params: Record<string, unknown>;
10
+ }
11
+ export declare const getDataSource: <T extends Record<string, unknown>>(data: T, key: string) => T[];
12
+ export declare const getQuery: ({ page, size, sorter, search, params, }: GetQueryProps) => Record<string, unknown>;
13
+ export declare const getTotal: <T = unknown>(key: string, data: T) => number;
14
+ export declare const formatDate: (key: string, data: Record<string, any>, format?: string) => Record<string, any>;
15
+ export declare const removeEmpty: (data: Record<string, any>) => Record<string, any>;
@@ -0,0 +1,106 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ var isObject = function isObject(oj) {
4
+ return Object.prototype.toString.call(oj) === "[object Object]";
5
+ };
6
+
7
+ //获取key对应的数据
8
+ export var getDataSource = function getDataSource(data, key) {
9
+ if (Array.isArray(data)) return data;
10
+ if (key.includes(".")) {
11
+ var keys = key.split(".");
12
+ var source = data;
13
+ keys.forEach(function (it) {
14
+ if (source) {
15
+ source = source[it];
16
+ }
17
+ });
18
+ if (Array.isArray(source)) {
19
+ return source;
20
+ }
21
+ return [];
22
+ }
23
+ return data[key];
24
+ };
25
+
26
+ //描述table api 最终的参数组合方式
27
+ export var getQuery = function getQuery(_ref) {
28
+ var page = _ref.page,
29
+ size = _ref.size,
30
+ _ref$sorter = _ref.sorter,
31
+ sorter = _ref$sorter === void 0 ? {} : _ref$sorter,
32
+ _ref$search = _ref.search,
33
+ search = _ref$search === void 0 ? {} : _ref$search,
34
+ _ref$params = _ref.params,
35
+ params = _ref$params === void 0 ? {} : _ref$params;
36
+ var sort = sorter.order ? {
37
+ orderField: sorter.field,
38
+ isAsc: sorter.order === "ascend"
39
+ } : {};
40
+ return _objectSpread(_objectSpread(_objectSpread({
41
+ page: page,
42
+ size: size
43
+ }, sort), params), search);
44
+ };
45
+
46
+ //总数量,可以动态指定读取的Key
47
+ export var getTotal = function getTotal(key, data) {
48
+ if (Array.isArray(data)) return 0;
49
+ if (key.includes(".")) {
50
+ var keys = key.split(".");
51
+ var source = data;
52
+ keys.forEach(function (it) {
53
+ if (source) {
54
+ source = source[it];
55
+ }
56
+ });
57
+ return source;
58
+ }
59
+ return data[key] || 0;
60
+ };
61
+ var formatValue = function formatValue(key, data) {
62
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "YYYY-MM-DD";
63
+ var it = data[key];
64
+ if (Array.isArray(it) && it.length > 0) {
65
+ data[key] = it.map(function (item) {
66
+ return item.format(format);
67
+ });
68
+ } else {
69
+ data[key] = it.format(format);
70
+ }
71
+ };
72
+ export var formatDate = function formatDate(key, data) {
73
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "YYYY-MM-DD";
74
+ if (!isObject(data)) return data;
75
+ if (typeof key === "string" && key in data) {
76
+ formatValue(key, data, format);
77
+ return data;
78
+ }
79
+ if (Array.isArray(key)) {
80
+ var _iterator = _createForOfIteratorHelper(key),
81
+ _step;
82
+ try {
83
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
84
+ var it = _step.value;
85
+ if (it in data) {
86
+ formatValue(it, data, format);
87
+ }
88
+ }
89
+ } catch (err) {
90
+ _iterator.e(err);
91
+ } finally {
92
+ _iterator.f();
93
+ }
94
+ return data;
95
+ }
96
+ return data;
97
+ };
98
+ export var removeEmpty = function removeEmpty(data) {
99
+ if (!isObject(data)) return data;
100
+ Object.keys(data).forEach(function (key) {
101
+ if (data[key] === "" || Array.isArray(data[key]) && data[key].toString() === "") {
102
+ delete data[key];
103
+ }
104
+ });
105
+ return data;
106
+ };
@@ -0,0 +1,2 @@
1
+ export declare const isObject: (oj: unknown) => boolean;
2
+ export declare const isFunction: (oj: unknown) => boolean;
@@ -0,0 +1,6 @@
1
+ export var isObject = function isObject(oj) {
2
+ return Object.prototype.toString.call(oj) === '[object Object]';
3
+ };
4
+ export var isFunction = function isFunction(oj) {
5
+ return Object.prototype.toString.call(oj) === '[object Function]';
6
+ };
@@ -0,0 +1,6 @@
1
+ {
2
+ "搜索": "Search",
3
+ "重置": "Reset",
4
+ "共": "Total",
5
+ "条记录": "Items"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "搜索": "搜索",
3
+ "重置": "重置",
4
+ "共": "共",
5
+ "条记录": "条记录"
6
+ }
@@ -0,0 +1,12 @@
1
+ import type { ProTableProps, ProTableConfigOptions } from "./types";
2
+ import "./style.css";
3
+ declare const ProTable: {
4
+ <T extends Record<string, any>>(props: ProTableProps<T>): import("react/jsx-runtime").JSX.Element;
5
+ useTable: (options?: import("./types").UseTableProps) => import("./types").TableInstance<any>[];
6
+ getQuery: ({ page, size, sorter, search, params, }: import("../../utils/table").GetQueryProps) => Record<string, unknown>;
7
+ formatDate: (key: string, data: Record<string, any>, format?: string) => Record<string, any>;
8
+ removeEmpty: (data: Record<string, any>) => Record<string, any>;
9
+ pageSizeOptions: number[];
10
+ config(options: ProTableConfigOptions): void;
11
+ };
12
+ export default ProTable;
@@ -0,0 +1,330 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/Table/index.tsx
30
+ var Table_exports = {};
31
+ __export(Table_exports, {
32
+ default: () => Table_default
33
+ });
34
+ module.exports = __toCommonJS(Table_exports);
35
+ var import_fetch = require("../../fetch");
36
+ var import_TableConfig = require("../TableConfig");
37
+ var import_shallow = require("zustand/react/shallow");
38
+ var import_react_query = require("@tanstack/react-query");
39
+ var import_react = require("react");
40
+ var import_antd = require("antd");
41
+ var import_util = require("../../utils/util");
42
+ var import_table = require("../../utils/table");
43
+ var import_useX = __toESM(require("../../hooks/useX"));
44
+ var import_useTable = __toESM(require("./useTable"));
45
+ var import_style = require("./style.css");
46
+ var import_jsx_runtime = require("react/jsx-runtime");
47
+ var defaultClassNames = {
48
+ root: "main-container",
49
+ form: "search-form",
50
+ table: "main-table"
51
+ };
52
+ var defaultStyles = {
53
+ root: {},
54
+ form: {
55
+ display: "flex",
56
+ justifyContent: "space-between"
57
+ },
58
+ table: {},
59
+ toolbar: {
60
+ marginBottom: 15
61
+ }
62
+ };
63
+ var DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
64
+ var ProTable = (props) => {
65
+ const {
66
+ request = {},
67
+ classNames = defaultClassNames,
68
+ styles = defaultStyles,
69
+ table,
70
+ locale,
71
+ dataKey = "data",
72
+ totalKey = "total",
73
+ manual = false,
74
+ nostyle,
75
+ columns,
76
+ form = {},
77
+ alert,
78
+ toolbar = null,
79
+ pageSizeOptions,
80
+ pagination,
81
+ scroll,
82
+ useData,
83
+ ...prop
84
+ } = props;
85
+ const { lang } = (0, import_react.useContext)(import_TableConfig.I18nContext);
86
+ const {
87
+ title: formTitle,
88
+ extra: formExtra,
89
+ right: formRight,
90
+ formItem,
91
+ layout = "inline",
92
+ items,
93
+ reset: formReset,
94
+ dataForm,
95
+ handleValues: formHandleValues,
96
+ onResetBefore: formOnResetBefore,
97
+ ...otherFormProps
98
+ } = form;
99
+ const forceKey = (0, import_react.useRef)(0);
100
+ const formItems = formItem || items;
101
+ const queryClient = (0, import_react_query.useQueryClient)();
102
+ const { page, size, sorter, search, ready, setState } = table.useStore(
103
+ (0, import_shallow.useShallow)((state) => {
104
+ return {
105
+ page: state.page,
106
+ size: state.size,
107
+ sorter: state.sorter,
108
+ search: state.search,
109
+ ready: state.ready,
110
+ setState: state.setState
111
+ };
112
+ })
113
+ );
114
+ const queryKey = (0, import_react.useMemo)(
115
+ () => [
116
+ request.url,
117
+ ProTable.getQuery({
118
+ page,
119
+ size,
120
+ sorter,
121
+ search,
122
+ params: request.params
123
+ }),
124
+ forceKey.current
125
+ ],
126
+ [request, page, size, sorter, search]
127
+ );
128
+ const {
129
+ data = {},
130
+ isLoading,
131
+ refetch
132
+ } = (0, import_react_query.useQuery)({
133
+ queryKey,
134
+ queryFn: async ({ queryKey: queryKey2 }) => {
135
+ var _a, _b;
136
+ if (!request.url)
137
+ return Promise.resolve({});
138
+ (_a = request.onBefore) == null ? void 0 : _a.call(request);
139
+ const [url, json] = queryKey2;
140
+ const lowerMethod = (_b = request.method) == null ? void 0 : _b.toLocaleUpperCase();
141
+ return import_fetch.rq.request(url, {
142
+ method: lowerMethod,
143
+ json,
144
+ onSuccess: request.onSuccess
145
+ });
146
+ },
147
+ enabled: ready
148
+ });
149
+ (0, import_react.useEffect)(() => {
150
+ if (useData) {
151
+ setState({
152
+ data
153
+ });
154
+ }
155
+ }, [data]);
156
+ const { dataSource, total, column, renderAlert } = (0, import_react.useMemo)(() => {
157
+ return {
158
+ column: typeof columns === "function" ? columns(data) : columns,
159
+ dataSource: (0, import_table.getDataSource)(data, dataKey),
160
+ renderAlert: typeof alert === "function" ? alert(data) : alert,
161
+ total: (0, import_table.getTotal)(totalKey, data)
162
+ };
163
+ }, [columns, data, dataKey, totalKey]);
164
+ const onSearch = () => {
165
+ if (formItems) {
166
+ table.form.submit();
167
+ } else {
168
+ setState({
169
+ ready: true
170
+ });
171
+ }
172
+ };
173
+ const onReset = () => {
174
+ setState({
175
+ size: (pageSizeOptions == null ? void 0 : pageSizeOptions[0]) || ProTable.pageSizeOptions[0],
176
+ sorter: {}
177
+ });
178
+ if (formItems) {
179
+ if ((formOnResetBefore == null ? void 0 : formOnResetBefore()) === false)
180
+ return;
181
+ table.form.resetFields();
182
+ if (formReset === void 0 || formReset === true) {
183
+ table.form.submit();
184
+ }
185
+ }
186
+ };
187
+ (0, import_react.useEffect)(() => {
188
+ if (table) {
189
+ table.run = onSearch;
190
+ table.queryKey = queryKey;
191
+ table.clear = () => queryClient.setQueryData(queryKey, {});
192
+ table.refresh = refetch;
193
+ table.reset = () => {
194
+ if (formItems) {
195
+ onReset();
196
+ }
197
+ };
198
+ }
199
+ }, [table, queryKey]);
200
+ (0, import_react.useEffect)(() => {
201
+ if (manual)
202
+ return;
203
+ if (formItems) {
204
+ table.form.submit();
205
+ } else {
206
+ setState({
207
+ ready: true
208
+ });
209
+ }
210
+ }, []);
211
+ (0, import_react.useEffect)(() => {
212
+ return () => {
213
+ table.resetStore();
214
+ };
215
+ }, [table]);
216
+ const onFinish = (0, import_react.useCallback)((values) => {
217
+ if (formHandleValues) {
218
+ values = formHandleValues(values);
219
+ }
220
+ if (!values)
221
+ return;
222
+ forceKey.current += 1;
223
+ setState({
224
+ page: 1,
225
+ search: values,
226
+ ready: true
227
+ });
228
+ }, []);
229
+ const tableChange = (0, import_react.useCallback)((pagination2, sorter2) => {
230
+ setState({
231
+ page: pagination2.current,
232
+ size: pagination2.pageSize,
233
+ sorter: sorter2,
234
+ ready: true
235
+ });
236
+ }, []);
237
+ const x = (scroll == null ? void 0 : scroll.x) ?? (0, import_useX.default)(column);
238
+ const y = scroll == null ? void 0 : scroll.y;
239
+ const renderTable = () => {
240
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
241
+ import_antd.Table,
242
+ {
243
+ columns: column,
244
+ loading: isLoading,
245
+ scroll: { x, y },
246
+ locale,
247
+ onChange: (p, _, sorter2) => tableChange(p, sorter2),
248
+ pagination: {
249
+ current: page,
250
+ pageSize: size,
251
+ showQuickJumper: pagination ? pagination.showQuickJumper : true,
252
+ showSizeChanger: pagination ? pagination.showSizeChanger : true,
253
+ hideOnSinglePage: pagination ? pagination.hideOnSinglePage : false,
254
+ pageSizeOptions: pageSizeOptions || ProTable.pageSizeOptions,
255
+ total,
256
+ showTotal(total2) {
257
+ return `${(0, import_TableConfig.t)("共", lang)} ${total2} ${(0, import_TableConfig.t)("条记录", lang)}`;
258
+ }
259
+ },
260
+ dataSource,
261
+ ...prop
262
+ }
263
+ );
264
+ };
265
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
266
+ "div",
267
+ {
268
+ className: (classNames == null ? void 0 : classNames.root) ?? defaultClassNames.root,
269
+ style: styles.root,
270
+ children: [
271
+ !!formItems && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
272
+ "div",
273
+ {
274
+ className: (classNames == null ? void 0 : classNames.form) ?? defaultClassNames.form,
275
+ style: styles.form,
276
+ children: [
277
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
278
+ import_antd.Form,
279
+ {
280
+ form: table.form,
281
+ layout,
282
+ onFinish,
283
+ ...otherFormProps,
284
+ children: [
285
+ formTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Form.Item, { children: formTitle }),
286
+ formItems,
287
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Space, { children: [
288
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { type: "primary", loading: isLoading, htmlType: "submit", children: (0, import_TableConfig.t)("搜索", lang) }),
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { onClick: onReset, disabled: isLoading, children: (0, import_TableConfig.t)("重置", lang) }),
290
+ formExtra
291
+ ] }) })
292
+ ]
293
+ }
294
+ ),
295
+ formRight
296
+ ]
297
+ }
298
+ ),
299
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
300
+ "div",
301
+ {
302
+ className: (classNames == null ? void 0 : classNames.table) ?? defaultClassNames.table,
303
+ style: styles.table,
304
+ children: [
305
+ toolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: styles.toolbar, children: toolbar }),
306
+ renderAlert,
307
+ !!dataForm ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Form, { ...dataForm, children: renderTable() }) : renderTable()
308
+ ]
309
+ }
310
+ )
311
+ ]
312
+ }
313
+ );
314
+ };
315
+ ProTable.useTable = import_useTable.default;
316
+ ProTable.getQuery = import_table.getQuery;
317
+ ProTable.formatDate = import_table.formatDate;
318
+ ProTable.removeEmpty = import_table.removeEmpty;
319
+ ProTable.pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS;
320
+ ProTable.config = (options) => {
321
+ if (!options || !(0, import_util.isObject)(options))
322
+ return;
323
+ if (options.getQuery) {
324
+ ProTable.getQuery = options.getQuery;
325
+ }
326
+ if (options.pageSizeOptions) {
327
+ ProTable.pageSizeOptions = options.pageSizeOptions;
328
+ }
329
+ };
330
+ var Table_default = ProTable;
@@ -0,0 +1,3 @@
1
+ .search-form .ant-form-item {
2
+ margin-bottom: 20px!important;
3
+ }