xmirror-components 1.0.39 → 1.0.40-alpha.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.
- package/build/dist/index.cjs +41 -109
- package/build/dist/index.mjs +4229 -10397
- package/build/es/components/AntdApp/index.d.ts +1 -2
- package/build/es/components/AntdApp/index.js +2 -5
- package/build/es/components/CheckboxValue/index.d.ts +1 -1
- package/build/es/components/CheckboxValue/index.js +2 -2
- package/build/es/components/ConfigProvider/index.d.ts +1 -1
- package/build/es/components/ConfigProvider/index.js +3 -3
- package/build/es/components/GlobalLoading/index.d.ts +1 -2
- package/build/es/components/GlobalLoading/index.js +8 -19
- package/build/es/components/IconButton/index.js +5 -6
- package/build/es/components/IconFont/index.js +5 -5
- package/build/es/components/IntlProvider/index.d.ts +1 -1
- package/build/es/components/IntlProvider/index.js +3 -2
- package/build/es/components/SearchArea/Item/index.d.ts +2 -2
- package/build/es/components/SearchArea/Item/index.js +4 -2
- package/build/es/components/SearchArea/ToggleButton/index.d.ts +1 -2
- package/build/es/components/SearchArea/ToggleButton/index.js +3 -4
- package/build/es/components/SearchArea/index.js +13 -24
- package/build/es/components/SwitchValue/index.d.ts +1 -1
- package/build/es/components/SwitchValue/index.js +2 -2
- package/build/es/components/Table/Footer/index.d.ts +1 -2
- package/build/es/components/Table/Footer/index.js +10 -20
- package/build/es/components/Table/PopoverSetColumns/index.d.ts +1 -2
- package/build/es/components/Table/PopoverSetColumns/index.js +9 -12
- package/build/es/components/Table/PopoverSetColumns/styles.d.ts +0 -4
- package/build/es/components/Table/PopoverSetColumns/styles.js +2 -3
- package/build/es/components/Table/ResizableColumns/index.js +4 -5
- package/build/es/components/Table/index.js +8 -11
- package/build/es/components/TagGroup/index.d.ts +40 -0
- package/build/es/components/TagGroup/index.js +33 -0
- package/build/es/hooks/useTable/index.js +30 -14
- package/build/lib/components/AntdApp/index.js +2 -5
- package/build/lib/components/CheckboxValue/index.js +2 -5
- package/build/lib/components/ConfigProvider/index.js +3 -3
- package/build/lib/components/GlobalLoading/index.js +8 -52
- package/build/lib/components/IconButton/index.js +5 -6
- package/build/lib/components/IconFont/index.js +5 -38
- package/build/lib/components/IntlProvider/index.js +3 -2
- package/build/lib/components/SearchArea/Item/index.js +4 -2
- package/build/lib/components/SearchArea/ToggleButton/index.js +3 -37
- package/build/lib/components/SearchArea/index.js +13 -57
- package/build/lib/components/SwitchValue/index.js +2 -5
- package/build/lib/components/Table/Footer/index.js +10 -53
- package/build/lib/components/Table/PopoverSetColumns/index.js +9 -45
- package/build/lib/components/Table/PopoverSetColumns/styles.js +3 -4
- package/build/lib/components/Table/ResizableColumns/index.js +4 -38
- package/build/lib/components/Table/index.js +8 -44
- package/build/lib/components/TagGroup/index.js +35 -0
- package/build/lib/hooks/useTable/index.js +30 -14
- package/build/lib/index.d.ts +9 -7
- package/build/package.json +9 -7
- package/build/types/components/AntdApp/index.d.ts +1 -2
- package/build/types/components/CheckboxValue/index.d.ts +1 -1
- package/build/types/components/ConfigProvider/index.d.ts +1 -1
- package/build/types/components/GlobalLoading/index.d.ts +1 -2
- package/build/types/components/IntlProvider/index.d.ts +1 -1
- package/build/types/components/SearchArea/Item/index.d.ts +2 -2
- package/build/types/components/SearchArea/ToggleButton/index.d.ts +1 -2
- package/build/types/components/SwitchValue/index.d.ts +1 -1
- package/build/types/components/Table/Footer/index.d.ts +1 -2
- package/build/types/components/Table/PopoverSetColumns/index.d.ts +1 -2
- package/build/types/components/Table/PopoverSetColumns/styles.d.ts +0 -4
- package/build/types/components/TagGroup/index.d.ts +40 -0
- package/package.json +9 -7
|
@@ -14,39 +14,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
14
14
|
};
|
|
15
15
|
return __assign.apply(this, arguments);
|
|
16
16
|
};
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
-
var ownKeys = function(o) {
|
|
35
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
-
var ar = [];
|
|
37
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
-
return ar;
|
|
39
|
-
};
|
|
40
|
-
return ownKeys(o);
|
|
41
|
-
};
|
|
42
|
-
return function (mod) {
|
|
43
|
-
if (mod && mod.__esModule) return mod;
|
|
44
|
-
var result = {};
|
|
45
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
-
__setModuleDefault(result, mod);
|
|
47
|
-
return result;
|
|
48
|
-
};
|
|
49
|
-
})();
|
|
50
17
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
51
18
|
var t = {};
|
|
52
19
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -62,7 +29,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
62
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
30
|
};
|
|
64
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
var
|
|
32
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
33
|
+
var react_1 = require("react");
|
|
66
34
|
var antd_1 = require("antd");
|
|
67
35
|
var icons_1 = require("@ant-design/icons");
|
|
68
36
|
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
@@ -132,29 +100,17 @@ function InternalSearchArea(_a) {
|
|
|
132
100
|
toggle();
|
|
133
101
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
134
102
|
};
|
|
135
|
-
return (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
react_1.default.createElement(antd_1.Col, { flex: 1 },
|
|
147
|
-
react_1.default.createElement(SearchAreaHandle, null,
|
|
148
|
-
react_1.default.createElement(antd_1.Button, { loading: loading, type: "primary", onClick: submit },
|
|
149
|
-
react_1.default.createElement(IntlProvider_1.FormattedMessage, { id: "component.searcharea.submit", defaultMessage: '筛选' })),
|
|
150
|
-
react_1.default.createElement(antd_1.Button, { loading: loading, onClick: reset },
|
|
151
|
-
react_1.default.createElement(IntlProvider_1.FormattedMessage, { id: "component.searcharea.reset", defaultMessage: '重置' })),
|
|
152
|
-
react_1.default.createElement(antd_1.Button, { type: "link", style: {
|
|
153
|
-
paddingLeft: 0,
|
|
154
|
-
paddingRight: 0
|
|
155
|
-
}, onClick: close },
|
|
156
|
-
react_1.default.createElement(IntlProvider_1.FormattedMessage, { id: "component.searcharea.close", defaultMessage: '收起' }),
|
|
157
|
-
react_1.default.createElement(icons_1.UpOutlined, null))))))));
|
|
103
|
+
return ((0, jsx_runtime_1.jsx)(AnimatedContainer, { show: _show, children: (0, jsx_runtime_1.jsx)(StyledForm, __assign({ form: form, labelCol: { flex: '70px' }, wrapperCol: { flex: '1', style: { maxWidth: '280px' } } }, props, { children: (0, jsx_runtime_1.jsxs)(antd_1.Row, __assign({ gutter: 10, justify: "space-between" }, row, { children: [Array.isArray(children)
|
|
104
|
+
? children.map(function (item) {
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(antd_1.Col, __assign({ span: 6, xxl: 6,
|
|
106
|
+
xl: 8,
|
|
107
|
+
lg: 12,
|
|
108
|
+
xs: 24 }, col, { children: item }), item.props.name || item.key || item.props.label));
|
|
109
|
+
})
|
|
110
|
+
: children, (0, jsx_runtime_1.jsx)(antd_1.Col, { flex: 1, children: (0, jsx_runtime_1.jsxs)(SearchAreaHandle, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { loading: loading, type: "primary", onClick: submit, children: (0, jsx_runtime_1.jsx)(IntlProvider_1.FormattedMessage, { id: "component.searcharea.submit", defaultMessage: '筛选' }) }), (0, jsx_runtime_1.jsx)(antd_1.Button, { loading: loading, onClick: reset, children: (0, jsx_runtime_1.jsx)(IntlProvider_1.FormattedMessage, { id: "component.searcharea.reset", defaultMessage: '重置' }) }), (0, jsx_runtime_1.jsxs)(antd_1.Button, { type: "link", style: {
|
|
111
|
+
paddingLeft: 0,
|
|
112
|
+
paddingRight: 0
|
|
113
|
+
}, onClick: close, children: [(0, jsx_runtime_1.jsx)(IntlProvider_1.FormattedMessage, { id: "component.searcharea.close", defaultMessage: '收起' }), (0, jsx_runtime_1.jsx)(icons_1.UpOutlined, {})] })] }) })] })) })) }));
|
|
158
114
|
}
|
|
159
115
|
var SearchArea = InternalSearchArea;
|
|
160
116
|
function useSearchArea(defaultShow) {
|
|
@@ -21,11 +21,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
var
|
|
25
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
29
26
|
var antd_1 = require("antd");
|
|
30
27
|
/**
|
|
31
28
|
* Switch 可自定义 value
|
|
@@ -36,6 +33,6 @@ var Index = function (_a) {
|
|
|
36
33
|
var change = function (checked, event) {
|
|
37
34
|
onChange === null || onChange === void 0 ? void 0 : onChange(checked ? trueValue : falseValue, event);
|
|
38
35
|
};
|
|
39
|
-
return (
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(antd_1.Switch, __assign({ checked: _checked, onChange: change }, props)));
|
|
40
37
|
};
|
|
41
38
|
exports.default = Index;
|
|
@@ -1,39 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
var
|
|
3
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
var react_1 = require("react");
|
|
37
5
|
var IntlProvider_1 = require("../../IntlProvider");
|
|
38
6
|
var antd_1 = require("antd");
|
|
39
7
|
var react_transition_group_1 = require("react-transition-group");
|
|
@@ -92,7 +60,7 @@ function Index(props) {
|
|
|
92
60
|
var indeterminate = (0, react_1.useMemo)(function () {
|
|
93
61
|
var _a;
|
|
94
62
|
var selectedRowKeys = (_a = rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : [];
|
|
95
|
-
return
|
|
63
|
+
return (selectedRowKeys.length > 0 && selectedRowKeys.length < optionalNum);
|
|
96
64
|
}, [rowSelection.selectedRowKeys, optionalNum]);
|
|
97
65
|
/**
|
|
98
66
|
* checked 选中状态
|
|
@@ -101,24 +69,13 @@ function Index(props) {
|
|
|
101
69
|
var checked = (0, react_1.useMemo)(function () {
|
|
102
70
|
var _a;
|
|
103
71
|
var selectedRowKeys = (_a = rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : [];
|
|
104
|
-
return
|
|
72
|
+
return (selectedRowKeys.length > 0 && selectedRowKeys.length === optionalNum);
|
|
105
73
|
}, [rowSelection.selectedRowKeys, optionalNum]);
|
|
106
|
-
return (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
react_1.default.createElement(antd_1.Col, { style: { display: 'flex', alignItems: 'center' } },
|
|
113
|
-
react_1.default.createElement(antd_1.Checkbox, { checked: checked, indeterminate: indeterminate, onChange: changeCheckAll },
|
|
114
|
-
react_1.default.createElement(IntlProvider_1.FormattedMessage, { id: "component.table.selected", defaultMessage: '已选{length}条', values: {
|
|
115
|
-
length: (_b = (_a = rowSelection.selectedRowKeys) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0
|
|
116
|
-
} }))),
|
|
117
|
-
react_1.default.createElement(antd_1.Col, { style: { display: 'flex', alignItems: 'center' } },
|
|
118
|
-
selectionPopover,
|
|
119
|
-
react_1.default.createElement(styles_1.CloseButton, { onClick: function () { changeCheckAll({ target: { checked: false } }); } },
|
|
120
|
-
react_1.default.createElement(icons_1.CloseOutlined, null)))));
|
|
121
|
-
}),
|
|
122
|
-
pagination && (react_1.default.createElement(styles_1.TableFooterTotal, null, pagination.showTotal ? pagination.showTotal((_a = pagination.total) !== null && _a !== void 0 ? _a : 0, [0, 0]) : null)))));
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Global, { styles: styles_1.globalStyles }), (0, jsx_runtime_1.jsxs)(styles_1.TableFooterWrapper, { children: [(0, jsx_runtime_1.jsx)(react_transition_group_1.CSSTransition, { in: Boolean(props.rowSelection && props.selectionPopover && (checked || indeterminate)), nodeRef: transitionNodeRef, classNames: styles_1.zoomStyles, unmountOnExit: true, timeout: 300, children: function () {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.StyledRow, { ref: transitionNodeRef, justify: "space-between", children: [(0, jsx_runtime_1.jsx)(antd_1.Col, { style: { display: 'flex', alignItems: 'center' }, children: (0, jsx_runtime_1.jsx)(antd_1.Checkbox, { checked: checked, indeterminate: indeterminate, onChange: changeCheckAll, children: (0, jsx_runtime_1.jsx)(IntlProvider_1.FormattedMessage, { id: "component.table.selected", defaultMessage: '已选{length}条', values: {
|
|
77
|
+
length: (_b = (_a = rowSelection.selectedRowKeys) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0
|
|
78
|
+
} }) }) }), (0, jsx_runtime_1.jsxs)(antd_1.Col, { style: { display: 'flex', alignItems: 'center' }, children: [selectionPopover, (0, jsx_runtime_1.jsx)(styles_1.CloseButton, { onClick: function () { changeCheckAll({ target: { checked: false } }); }, children: (0, jsx_runtime_1.jsx)(icons_1.CloseOutlined, {}) })] })] }));
|
|
79
|
+
} }), pagination && ((0, jsx_runtime_1.jsx)(styles_1.TableFooterTotal, { children: pagination.showTotal ? pagination.showTotal((_a = pagination.total) !== null && _a !== void 0 ? _a : 0, [0, 0]) : null }))] })] }));
|
|
123
80
|
}
|
|
124
81
|
exports.default = Index;
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
36
3
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
37
4
|
if (ar || !(i in from)) {
|
|
@@ -45,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
13
|
};
|
|
47
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
var
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
49
17
|
var antd_1 = require("antd");
|
|
50
18
|
var IntlProvider_1 = require("../../IntlProvider");
|
|
51
19
|
var icons_1 = require("@ant-design/icons");
|
|
@@ -122,7 +90,7 @@ function PopoverSetColumns(_a) {
|
|
|
122
90
|
var checked = _a.target.checked;
|
|
123
91
|
var dataIndex = _b.dataIndex;
|
|
124
92
|
if (visibleItems.length === 1 && !checked) {
|
|
125
|
-
AntdApp_1.message.error(
|
|
93
|
+
AntdApp_1.message.error((0, jsx_runtime_1.jsx)(IntlProvider_1.FormattedMessage, { id: "component.table.visibleError", defaultMessage: '列表最少保留一个字段' }));
|
|
126
94
|
return;
|
|
127
95
|
}
|
|
128
96
|
var id = Array.isArray(dataIndex) ? dataIndex.join(',') : dataIndex;
|
|
@@ -190,27 +158,23 @@ function PopoverSetColumns(_a) {
|
|
|
190
158
|
}
|
|
191
159
|
var checked = typeof id === 'string' && visibleItems.includes(id);
|
|
192
160
|
return column
|
|
193
|
-
? (
|
|
194
|
-
|
|
195
|
-
columnsVisible &&
|
|
196
|
-
react_1.default.createElement(antd_1.Checkbox, { style: { marginRight: '10px' }, checked: Boolean(checked), disabled: column.columnVisibleDisabled, onChange: function (event) { changeVisible(event, column); } }),
|
|
197
|
-
typeof column.title === 'function' ? column.title({}) : column.title))
|
|
161
|
+
? ((0, jsx_runtime_1.jsxs)("li", { draggable: draggable, onDragEnd: dragEnd, onDragStart: dragStart, "data-index": index, "data-id": Array.isArray(column.dataIndex) ? column.dataIndex.join(',') : String(column.dataIndex), children: [columnsSort && (0, jsx_runtime_1.jsx)(icons_1.HolderOutlined, { className: "icon-drag" }), columnsVisible &&
|
|
162
|
+
(0, jsx_runtime_1.jsx)(antd_1.Checkbox, { style: { marginRight: '10px' }, checked: Boolean(checked), disabled: column.columnVisibleDisabled, onChange: function (event) { changeVisible(event, column); } }), typeof column.title === 'function' ? column.title({}) : column.title] }, Array.isArray(column.dataIndex) ? column.dataIndex.join(',') : String(column.dataIndex)))
|
|
198
163
|
: null;
|
|
199
164
|
});
|
|
200
165
|
}, [order, visibleItems, columns, columnsSort, columnsVisible]);
|
|
201
|
-
return (
|
|
166
|
+
return ((0, jsx_runtime_1.jsx)(antd_1.Popover, { overlayClassName: "table-columns-setting-popover", content: (0, jsx_runtime_1.jsx)(styles_1.ColumnsSettingWrapper, { onDragOver: dragOver, children: renderList }), trigger: "click", align: {
|
|
202
167
|
offset: [-60, -14]
|
|
203
168
|
}, styles: {
|
|
204
|
-
|
|
169
|
+
container: {
|
|
205
170
|
padding: 0
|
|
206
171
|
}
|
|
207
|
-
}
|
|
208
|
-
react_1.default.createElement(IconFont_1.default, { type: "icon-setting", style: {
|
|
172
|
+
}, children: (0, jsx_runtime_1.jsx)(IconFont_1.default, { type: "icon-setting", style: {
|
|
209
173
|
float: 'right',
|
|
210
174
|
fontSize: '17px',
|
|
211
175
|
lineHeight: 1,
|
|
212
176
|
marginTop: '2px',
|
|
213
177
|
fontWeight: 500
|
|
214
|
-
} })));
|
|
178
|
+
} }) }));
|
|
215
179
|
}
|
|
216
180
|
exports.default = PopoverSetColumns;
|
|
@@ -7,11 +7,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ColumnsSettingWrapper =
|
|
10
|
+
exports.ColumnsSettingWrapper = void 0;
|
|
11
11
|
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
12
12
|
var react_1 = require("@emotion/react");
|
|
13
13
|
var dragUpAnimation = (0, react_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n margin-top: 0;\n }\n to {\n margin-top: 32px;\n }\n"], ["\n from {\n margin-top: 0;\n }\n to {\n margin-top: 32px;\n }\n"])));
|
|
14
14
|
var dragDownAnimation = (0, react_1.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n margin-top: 32px;\n margin-bottom: 0;\n }\n to {\n margin-top: 0;\n margin-bottom: 32px;\n }\n"], ["\n from {\n margin-top: 32px;\n margin-bottom: 0;\n }\n to {\n margin-top: 0;\n margin-bottom: 32px;\n }\n"])));
|
|
15
|
-
exports.
|
|
16
|
-
|
|
17
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
15
|
+
exports.ColumnsSettingWrapper = styled_1.default.ul(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 10px 0;\n\n .drag-up {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n .drag-down {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n li {\n width: 150px;\n padding: 5px 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n user-select: none;\n transition: background-color 0.5s;\n\n .icon-drag {\n margin-right: 10px;\n color: #999;\n cursor: move;\n }\n\n &[draggable=\"false\"] {\n .icon-drag {\n cursor: no-drop;\n opacity: 0.2;\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n"], ["\n padding: 10px 0;\n\n .drag-up {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n .drag-down {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n li {\n width: 150px;\n padding: 5px 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n user-select: none;\n transition: background-color 0.5s;\n\n .icon-drag {\n margin-right: 10px;\n color: #999;\n cursor: move;\n }\n\n &[draggable=\"false\"] {\n .icon-drag {\n cursor: no-drop;\n opacity: 0.2;\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n"])), dragUpAnimation, dragDownAnimation);
|
|
16
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -10,39 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
47
14
|
var t = {};
|
|
48
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -56,7 +23,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
23
|
};
|
|
57
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
25
|
exports.resizableColumns = exports.ResizableTitle = void 0;
|
|
59
|
-
var
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
var react_1 = require("react");
|
|
60
28
|
var ahooks_1 = require("ahooks");
|
|
61
29
|
var icons_1 = require("@ant-design/icons");
|
|
62
30
|
var react_resizable_1 = require("react-resizable");
|
|
@@ -66,7 +34,7 @@ var ResizableTitle = function (props) {
|
|
|
66
34
|
var onResize = props.onResize, width = props.width, restProps = __rest(props, ["onResize", "width"]);
|
|
67
35
|
var _a = (0, react_1.useState)(false), resizing = _a[0], setResizing = _a[1];
|
|
68
36
|
if (!width) {
|
|
69
|
-
return
|
|
37
|
+
return (0, jsx_runtime_1.jsx)("th", __assign({}, restProps));
|
|
70
38
|
}
|
|
71
39
|
var onResizeStart = function (_e) {
|
|
72
40
|
setResizing(true);
|
|
@@ -74,9 +42,7 @@ var ResizableTitle = function (props) {
|
|
|
74
42
|
var onResizeStop = function (_e) {
|
|
75
43
|
setResizing(false);
|
|
76
44
|
};
|
|
77
|
-
return (
|
|
78
|
-
react_1.default.createElement(icons_1.MenuOutlined, { className: "react-resizable-handle-icon" })), onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, draggableOpts: { enableUserSelectHack: false } },
|
|
79
|
-
react_1.default.createElement("th", __assign({}, restProps))));
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(react_resizable_1.Resizable, { width: width, height: 0, handle: (0, jsx_runtime_1.jsx)(styles_1.ResizableHandle, { className: resizing ? 'resizing' : '', onClick: function (e) { return e.stopPropagation(); }, children: (0, jsx_runtime_1.jsx)(icons_1.MenuOutlined, { className: "react-resizable-handle-icon" }) }), onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, draggableOpts: { enableUserSelectHack: false }, children: (0, jsx_runtime_1.jsx)("th", __assign({}, restProps)) }));
|
|
80
46
|
};
|
|
81
47
|
exports.ResizableTitle = ResizableTitle;
|
|
82
48
|
var resizableColumns = function (columns, tableId) {
|
|
@@ -10,44 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
15
|
};
|
|
49
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
var
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var react_1 = require("react");
|
|
51
19
|
var antd_1 = require("antd");
|
|
52
20
|
var ahooks_1 = require("ahooks");
|
|
53
21
|
var icons_1 = require("@ant-design/icons");
|
|
@@ -130,9 +98,7 @@ function Index(props, ref) {
|
|
|
130
98
|
var initSettingButton = function (column) {
|
|
131
99
|
var newColumn = __assign({}, column);
|
|
132
100
|
var columnTitleRender = function (children) {
|
|
133
|
-
return (
|
|
134
|
-
children,
|
|
135
|
-
react_1.default.createElement(PopoverSetColumns_1.default, { onChangeOrder: changeOrder, onChangeVisible: changeVisibleItems, order: order, columnsSort: columnsSort, visibleItems: visibleItems, columns: columns, columnsVisible: columnsVisible })));
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("span", { children: [children, (0, jsx_runtime_1.jsx)(PopoverSetColumns_1.default, { onChangeOrder: changeOrder, onChangeVisible: changeVisibleItems, order: order, columnsSort: columnsSort, visibleItems: visibleItems, columns: columns, columnsVisible: columnsVisible })] }));
|
|
136
102
|
};
|
|
137
103
|
if (typeof column.title === 'function') {
|
|
138
104
|
newColumn.title = function (props) {
|
|
@@ -146,8 +112,7 @@ function Index(props, ref) {
|
|
|
146
112
|
};
|
|
147
113
|
var renderDefaultColumn = function (value) {
|
|
148
114
|
return value !== null && value !== undefined && value !== ''
|
|
149
|
-
? (
|
|
150
|
-
react_1.default.createElement("span", { className: 'column-ellipsis' }, value)))
|
|
115
|
+
? ((0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: value, placement: "topLeft", children: (0, jsx_runtime_1.jsx)("span", { className: 'column-ellipsis', children: value }) }))
|
|
151
116
|
: '-';
|
|
152
117
|
};
|
|
153
118
|
/**
|
|
@@ -192,7 +157,7 @@ function Index(props, ref) {
|
|
|
192
157
|
}
|
|
193
158
|
return returnColumns.map(function (item) {
|
|
194
159
|
if (item.filters && !item.filterIcon) {
|
|
195
|
-
item.filterIcon = (
|
|
160
|
+
item.filterIcon = ((0, jsx_runtime_1.jsx)(icons_1.DownOutlined, { type: "icon-xiajiantou", style: { fontWeight: 500 } }));
|
|
196
161
|
}
|
|
197
162
|
if (item.ellipsis === false) {
|
|
198
163
|
item.ellipsis = false;
|
|
@@ -210,7 +175,7 @@ function Index(props, ref) {
|
|
|
210
175
|
var paginationProps = (0, react_1.useMemo)(function () {
|
|
211
176
|
if (props.pagination) {
|
|
212
177
|
return __assign(__assign({}, (pagination || {})), { showTotal: function () {
|
|
213
|
-
return dataSource && dataSource.length > 0 && (
|
|
178
|
+
return dataSource && dataSource.length > 0 && ((0, jsx_runtime_1.jsx)(Footer_1.default, __assign({}, props)));
|
|
214
179
|
} });
|
|
215
180
|
}
|
|
216
181
|
else {
|
|
@@ -220,9 +185,8 @@ function Index(props, ref) {
|
|
|
220
185
|
(0, react_1.useEffect)(function () {
|
|
221
186
|
initColumnsSort();
|
|
222
187
|
}, []);
|
|
223
|
-
return (
|
|
224
|
-
react_1.default.createElement(antd_1.Table, __assign({ ref: tableRef, scroll: {
|
|
188
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.TableWrapper, { ref: ref, children: (0, jsx_runtime_1.jsx)(antd_1.Table, __assign({ ref: tableRef, scroll: {
|
|
225
189
|
x: 900
|
|
226
|
-
}, components: { header: { cell: columnsResizable ? ResizableColumns_1.ResizableTitle : undefined } } }, props, { pagination: paginationProps, columns: columnsResizable ? (0, ResizableColumns_1.resizableColumns)(renderColumns, tableId) : renderColumns }))));
|
|
190
|
+
}, components: { header: { cell: columnsResizable ? ResizableColumns_1.ResizableTitle : undefined } } }, props, { pagination: paginationProps, columns: columnsResizable ? (0, ResizableColumns_1.resizableColumns)(renderColumns, tableId) : renderColumns })) }));
|
|
227
191
|
}
|
|
228
192
|
exports.default = (0, react_1.forwardRef)(Index);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
var antd_1 = require("antd");
|
|
27
|
+
var CheckboxValue = function (_a) {
|
|
28
|
+
var checked = _a.checked, onChange = _a.onChange, _b = _a.trueValue, trueValue = _b === void 0 ? true : _b, _c = _a.falseValue, falseValue = _c === void 0 ? false : _c, _d = _a.trueLabel, trueLabel = _d === void 0 ? '' : _d, _e = _a.falseLabel, falseLabel = _e === void 0 ? '' : _e, children = _a.children, props = __rest(_a, ["checked", "onChange", "trueValue", "falseValue", "trueLabel", "falseLabel", "children"]);
|
|
29
|
+
var _checked = checked === trueValue;
|
|
30
|
+
var change = function (e) {
|
|
31
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked ? trueValue : falseValue, e);
|
|
32
|
+
};
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(antd_1.Checkbox, __assign({ checked: _checked, onChange: change }, props, { children: children || (_checked ? trueLabel : falseLabel) })));
|
|
34
|
+
};
|
|
35
|
+
exports.default = CheckboxValue;
|
|
@@ -87,6 +87,7 @@ function useTable(request, options) {
|
|
|
87
87
|
var intl = (0, IntlProvider_1.useIntl)();
|
|
88
88
|
var _a = __assign(__assign({}, defaultOptions), options), rowKey = _a.rowKey, interval = _a.interval, immediate = _a.immediate, defaultPagination = _a.defaultPagination, showRowSelection = _a.showRowSelection, multiPageSelection = _a.multiPageSelection, onBeforeRequest = _a.onBeforeRequest, onAfterRequest = _a.onAfterRequest;
|
|
89
89
|
var tableTimerRef = (0, react_1.useRef)(null);
|
|
90
|
+
var latestRequestIdRef = (0, react_1.useRef)(0);
|
|
90
91
|
var _b = (0, react_1.useState)(false), loading = _b[0], setLoading = _b[1];
|
|
91
92
|
var _c = (0, react_1.useState)([]), tableData = _c[0], setTableData = _c[1];
|
|
92
93
|
var _d = (0, react_1.useState)(__assign({ current: 1, pageSize: 10, total: 0 }, defaultPagination)), pagination = _d[0], setPagination = _d[1];
|
|
@@ -112,7 +113,7 @@ function useTable(request, options) {
|
|
|
112
113
|
args_1[_i] = arguments[_i];
|
|
113
114
|
}
|
|
114
115
|
return __awaiter(_this, __spreadArray([], args_1, true), void 0, function (page, pageSize, auto) {
|
|
115
|
-
var requestParams, params, finalParams, response, _a, records,
|
|
116
|
+
var requestId, requestParams, params, finalParams, response, _a, records, total_1, current_1, size_1, data, list, maxPage, error_1, errorMessage;
|
|
116
117
|
if (page === void 0) { page = 1; }
|
|
117
118
|
if (pageSize === void 0) { pageSize = 10; }
|
|
118
119
|
return __generator(this, function (_b) {
|
|
@@ -126,6 +127,7 @@ function useTable(request, options) {
|
|
|
126
127
|
resetTableTimer(page, pageSize);
|
|
127
128
|
return [2 /*return*/];
|
|
128
129
|
}
|
|
130
|
+
requestId = ++latestRequestIdRef.current;
|
|
129
131
|
_b.label = 1;
|
|
130
132
|
case 1:
|
|
131
133
|
_b.trys.push([1, 5, 6, 7]);
|
|
@@ -137,35 +139,48 @@ function useTable(request, options) {
|
|
|
137
139
|
return [4 /*yield*/, request(finalParams)];
|
|
138
140
|
case 3:
|
|
139
141
|
response = _b.sent();
|
|
140
|
-
_a = response.data, records = _a.records,
|
|
142
|
+
_a = response.data, records = _a.records, total_1 = _a.total, current_1 = _a.current, size_1 = _a.size;
|
|
141
143
|
return [4 /*yield*/, (onAfterRequest === null || onAfterRequest === void 0 ? void 0 : onAfterRequest(response))];
|
|
142
144
|
case 4:
|
|
143
145
|
data = _b.sent();
|
|
144
146
|
list = Array.isArray(data) ? data : records;
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
total !== pagination.total) {
|
|
149
|
-
setPagination({
|
|
150
|
-
current: current,
|
|
151
|
-
pageSize: size,
|
|
152
|
-
total: total
|
|
153
|
-
});
|
|
147
|
+
// 仅处理最新请求,避免并发请求导致旧数据覆盖新状态
|
|
148
|
+
if (requestId !== latestRequestIdRef.current) {
|
|
149
|
+
return [2 /*return*/];
|
|
154
150
|
}
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
setTableData(list);
|
|
152
|
+
setPagination(function (prev) {
|
|
153
|
+
if (current_1 === prev.current &&
|
|
154
|
+
size_1 === prev.pageSize &&
|
|
155
|
+
total_1 === prev.total) {
|
|
156
|
+
return prev;
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
current: current_1,
|
|
160
|
+
pageSize: size_1,
|
|
161
|
+
total: total_1
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
if (list.length === 0 && current_1 && current_1 > 1 && total_1 && total_1 > 0) {
|
|
165
|
+
maxPage = Math.ceil(total_1 / size_1);
|
|
157
166
|
initList(maxPage, pageSize, auto);
|
|
158
167
|
}
|
|
159
168
|
else {
|
|
160
|
-
resetTableTimer(
|
|
169
|
+
resetTableTimer(current_1, size_1);
|
|
161
170
|
}
|
|
162
171
|
return [3 /*break*/, 7];
|
|
163
172
|
case 5:
|
|
164
173
|
error_1 = _b.sent();
|
|
174
|
+
if (requestId !== latestRequestIdRef.current) {
|
|
175
|
+
return [2 /*return*/];
|
|
176
|
+
}
|
|
165
177
|
errorMessage = error_1 instanceof Error ? error_1.message : '请求失败';
|
|
166
178
|
AntdApp_1.message.error(errorMessage);
|
|
167
179
|
return [3 /*break*/, 7];
|
|
168
180
|
case 6:
|
|
181
|
+
if (requestId !== latestRequestIdRef.current) {
|
|
182
|
+
return [2 /*return*/];
|
|
183
|
+
}
|
|
169
184
|
if (!multiPageSelection) {
|
|
170
185
|
setSelectedRows([]);
|
|
171
186
|
}
|
|
@@ -295,6 +310,7 @@ function useTable(request, options) {
|
|
|
295
310
|
// 使用当前分页值作为默认值,处理可能为 undefined 的情况
|
|
296
311
|
var currentPage = (_b = pagination.current) !== null && _b !== void 0 ? _b : paginationRef.current.current;
|
|
297
312
|
var currentPageSize = (_c = pagination.pageSize) !== null && _c !== void 0 ? _c : paginationRef.current.pageSize;
|
|
313
|
+
setPagination(function (prev) { return (__assign(__assign({}, prev), { current: currentPage, pageSize: currentPageSize })); });
|
|
298
314
|
initList(currentPage, currentPageSize);
|
|
299
315
|
}, [initList, searchParams]);
|
|
300
316
|
var reset = function () {
|