@hw-component/table 0.0.3-beta-v7 → 0.0.3-beta-v9
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/es/HTableBody/index.d.ts +2 -1
- package/es/HTableBody/index.js +7 -2
- package/es/HTablePagination/index.d.ts +3 -1
- package/es/HTablePagination/index.js +8 -10
- package/es/Table.d.ts +1 -1
- package/es/Table.js +4 -2
- package/es/index.css +8 -0
- package/es/modal.d.ts +1 -0
- package/lib/HTableBody/index.d.ts +2 -1
- package/lib/HTableBody/index.js +7 -2
- package/lib/HTablePagination/index.d.ts +3 -1
- package/lib/HTablePagination/index.js +8 -10
- package/lib/Table.d.ts +1 -1
- package/lib/Table.js +4 -2
- package/lib/index.css +8 -0
- package/lib/modal.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/HTableBody/index.tsx +6 -1
- package/src/components/HTablePagination/index.tsx +7 -3
- package/src/components/Table.tsx +2 -1
- package/src/components/TableCustomize.tsx +2 -1
- package/src/components/hooks/useReq.ts +6 -6
- package/src/components/index.less +8 -0
- package/src/components/modal.ts +5 -4
- package/src/pages/TableCustomize/index.tsx +7 -4
package/es/HTableBody/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource"> {
|
|
|
8
8
|
emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
9
9
|
errorRender?: (tableInstance: HTableInstance, error: Error) => React.ReactNode;
|
|
10
10
|
tableStyle?: React.CSSProperties;
|
|
11
|
+
paginationStyle?: React.CSSProperties;
|
|
11
12
|
}
|
|
12
|
-
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, ...props }: HTableBodyProps) => JSX.Element;
|
|
13
|
+
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, ...props }: HTableBodyProps) => JSX.Element;
|
|
13
14
|
export default _default;
|
package/es/HTableBody/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { useHTableConfigContext } from '../TableConfig.js';
|
|
|
19
19
|
import HTablePagination from '../HTablePagination/index.js';
|
|
20
20
|
import { useClassName } from '../hooks/index.js';
|
|
21
21
|
|
|
22
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle"];
|
|
22
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle"];
|
|
23
23
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
25
|
var defaultRender = function defaultRender() {
|
|
@@ -39,6 +39,7 @@ var Body = (function (_ref) {
|
|
|
39
39
|
emptyRender = _ref.emptyRender,
|
|
40
40
|
errorRender = _ref.errorRender,
|
|
41
41
|
tableStyle = _ref.tableStyle,
|
|
42
|
+
paginationStyle = _ref.paginationStyle,
|
|
42
43
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
44
|
var selectedRowKeys = rowSelection.selectedRowKeys,
|
|
44
45
|
onChange = rowSelection.onChange;
|
|
@@ -91,6 +92,9 @@ var Body = (function (_ref) {
|
|
|
91
92
|
columns: cols,
|
|
92
93
|
tableAlertRender: false,
|
|
93
94
|
search: false,
|
|
95
|
+
options: {
|
|
96
|
+
reload: tableInstance.table.reloadWithParams
|
|
97
|
+
},
|
|
94
98
|
tableStyle: {
|
|
95
99
|
paddingBottom: 0
|
|
96
100
|
},
|
|
@@ -103,7 +107,8 @@ var Body = (function (_ref) {
|
|
|
103
107
|
dataSource: records,
|
|
104
108
|
pagination: false
|
|
105
109
|
})), pagination !== false && jsx(HTablePagination, _objectSpread({
|
|
106
|
-
onPageChange: onPageChange
|
|
110
|
+
onPageChange: onPageChange,
|
|
111
|
+
paginationStyle: paginationStyle
|
|
107
112
|
}, pagination))]
|
|
108
113
|
})
|
|
109
114
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PaginationProps } from "antd";
|
|
2
2
|
import type { ParamsModal } from "@/components/modal";
|
|
3
|
+
import React from "react";
|
|
3
4
|
interface IPaginationProps extends PaginationProps {
|
|
4
5
|
onPageChange?: (params: ParamsModal) => void;
|
|
6
|
+
paginationStyle?: React.CSSProperties;
|
|
5
7
|
}
|
|
6
|
-
declare const _default: ({ onPageChange, ...props }: IPaginationProps) => JSX.Element;
|
|
8
|
+
declare const _default: ({ onPageChange, paginationStyle, ...props }: IPaginationProps) => JSX.Element;
|
|
7
9
|
export default _default;
|
|
@@ -15,17 +15,18 @@ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/con
|
|
|
15
15
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
16
16
|
import { Row, Pagination } from 'antd';
|
|
17
17
|
import { useHTableContext } from '../context.js';
|
|
18
|
+
import { useClassName } from '../hooks/index.js';
|
|
18
19
|
|
|
19
|
-
var _excluded = ["onPageChange"];
|
|
20
|
+
var _excluded = ["onPageChange", "paginationStyle"];
|
|
20
21
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
23
|
var HTablePagination = (function (_ref) {
|
|
23
24
|
var onPageChange = _ref.onPageChange,
|
|
25
|
+
paginationStyle = _ref.paginationStyle,
|
|
24
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
var _useHTableContext = useHTableContext(),
|
|
26
|
-
contextOnPageChange = _useHTableContext.onPageChange
|
|
27
|
-
_useHTableContext.
|
|
28
|
-
var data = _useHTableContext.data;
|
|
28
|
+
contextOnPageChange = _useHTableContext.onPageChange,
|
|
29
|
+
data = _useHTableContext.data;
|
|
29
30
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
30
31
|
var _ref2 = data || {},
|
|
31
32
|
size = _ref2.size,
|
|
@@ -34,15 +35,12 @@ var HTablePagination = (function (_ref) {
|
|
|
34
35
|
var pageCurrent = _Number$parseInt(current || "1", 10);
|
|
35
36
|
var pageSize = _Number$parseInt(size || "10", 10);
|
|
36
37
|
var pageTotal = _Number$parseInt(total || "0", 10);
|
|
38
|
+
var className = useClassName("hw-table-pagination");
|
|
37
39
|
if (data) {
|
|
38
40
|
return jsx(Row, {
|
|
39
41
|
justify: "end",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
paddingRight: 24,
|
|
43
|
-
paddingLeft: 24,
|
|
44
|
-
backgroundColor: "#fff"
|
|
45
|
-
},
|
|
42
|
+
className: className,
|
|
43
|
+
style: paginationStyle,
|
|
46
44
|
children: jsx(Pagination, _objectSpread({
|
|
47
45
|
size: "small",
|
|
48
46
|
showQuickJumper: true,
|
package/es/Table.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HTableProps } from "./modal";
|
|
2
|
-
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, className, ...props }: HTableProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, className, paginationStyle, ...props }: HTableProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
package/es/Table.js
CHANGED
|
@@ -20,7 +20,7 @@ import { Space } from 'antd';
|
|
|
20
20
|
import useReq from './hooks/useReq.js';
|
|
21
21
|
import useDispatch from './hooks/useDispatch.js';
|
|
22
22
|
|
|
23
|
-
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize", "className"];
|
|
23
|
+
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle"];
|
|
24
24
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
26
|
var Table = (function (_ref) {
|
|
@@ -42,6 +42,7 @@ var Table = (function (_ref) {
|
|
|
42
42
|
_ref$spaceSize = _ref.spaceSize,
|
|
43
43
|
spaceSize = _ref$spaceSize === void 0 ? 15 : _ref$spaceSize,
|
|
44
44
|
className = _ref.className,
|
|
45
|
+
paginationStyle = _ref.paginationStyle,
|
|
45
46
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
47
|
var _useReq = useReq({
|
|
47
48
|
request: request
|
|
@@ -91,7 +92,8 @@ var Table = (function (_ref) {
|
|
|
91
92
|
searchSpan: searchSpan,
|
|
92
93
|
headerStyle: headerStyle
|
|
93
94
|
}), jsx(Body, _objectSpread({
|
|
94
|
-
tableStyle: tableStyle
|
|
95
|
+
tableStyle: tableStyle,
|
|
96
|
+
paginationStyle: paginationStyle
|
|
95
97
|
}, props)), footerRender !== false && jsx(Footer, {
|
|
96
98
|
actionRender: actionRender,
|
|
97
99
|
footerRender: footerRender,
|
package/es/index.css
CHANGED
package/es/modal.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
49
49
|
reload?: (params: any) => Promise<any>;
|
|
50
50
|
manual?: boolean;
|
|
51
51
|
dataSource?: ResultModal;
|
|
52
|
+
paginationStyle?: React.CSSProperties;
|
|
52
53
|
}
|
|
53
54
|
export interface TableInstance {
|
|
54
55
|
reload: (params?: ParamsModal) => Promise<any>;
|
|
@@ -8,6 +8,7 @@ interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource"> {
|
|
|
8
8
|
emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
9
9
|
errorRender?: (tableInstance: HTableInstance, error: Error) => React.ReactNode;
|
|
10
10
|
tableStyle?: React.CSSProperties;
|
|
11
|
+
paginationStyle?: React.CSSProperties;
|
|
11
12
|
}
|
|
12
|
-
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, ...props }: HTableBodyProps) => JSX.Element;
|
|
13
|
+
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, ...props }: HTableBodyProps) => JSX.Element;
|
|
13
14
|
export default _default;
|
package/lib/HTableBody/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var TableConfig = require('../TableConfig.js');
|
|
|
22
22
|
var index$1 = require('../HTablePagination/index.js');
|
|
23
23
|
var index = require('../hooks/index.js');
|
|
24
24
|
|
|
25
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle"];
|
|
25
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle"];
|
|
26
26
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
27
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
28
|
var defaultRender = function defaultRender() {
|
|
@@ -42,6 +42,7 @@ var Body = (function (_ref) {
|
|
|
42
42
|
emptyRender = _ref.emptyRender,
|
|
43
43
|
errorRender = _ref.errorRender,
|
|
44
44
|
tableStyle = _ref.tableStyle,
|
|
45
|
+
paginationStyle = _ref.paginationStyle,
|
|
45
46
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
47
|
var selectedRowKeys = rowSelection.selectedRowKeys,
|
|
47
48
|
onChange = rowSelection.onChange;
|
|
@@ -94,6 +95,9 @@ var Body = (function (_ref) {
|
|
|
94
95
|
columns: cols,
|
|
95
96
|
tableAlertRender: false,
|
|
96
97
|
search: false,
|
|
98
|
+
options: {
|
|
99
|
+
reload: tableInstance.table.reloadWithParams
|
|
100
|
+
},
|
|
97
101
|
tableStyle: {
|
|
98
102
|
paddingBottom: 0
|
|
99
103
|
},
|
|
@@ -106,7 +110,8 @@ var Body = (function (_ref) {
|
|
|
106
110
|
dataSource: records,
|
|
107
111
|
pagination: false
|
|
108
112
|
})), pagination !== false && jsxRuntime.jsx(index$1.default, _objectSpread({
|
|
109
|
-
onPageChange: onPageChange
|
|
113
|
+
onPageChange: onPageChange,
|
|
114
|
+
paginationStyle: paginationStyle
|
|
110
115
|
}, pagination))]
|
|
111
116
|
})
|
|
112
117
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PaginationProps } from "antd";
|
|
2
2
|
import type { ParamsModal } from "@/components/modal";
|
|
3
|
+
import React from "react";
|
|
3
4
|
interface IPaginationProps extends PaginationProps {
|
|
4
5
|
onPageChange?: (params: ParamsModal) => void;
|
|
6
|
+
paginationStyle?: React.CSSProperties;
|
|
5
7
|
}
|
|
6
|
-
declare const _default: ({ onPageChange, ...props }: IPaginationProps) => JSX.Element;
|
|
8
|
+
declare const _default: ({ onPageChange, paginationStyle, ...props }: IPaginationProps) => JSX.Element;
|
|
7
9
|
export default _default;
|
|
@@ -18,17 +18,18 @@ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/c
|
|
|
18
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
19
19
|
var antd = require('antd');
|
|
20
20
|
var context = require('../context.js');
|
|
21
|
+
var index = require('../hooks/index.js');
|
|
21
22
|
|
|
22
|
-
var _excluded = ["onPageChange"];
|
|
23
|
+
var _excluded = ["onPageChange", "paginationStyle"];
|
|
23
24
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
26
|
var HTablePagination = (function (_ref) {
|
|
26
27
|
var onPageChange = _ref.onPageChange,
|
|
28
|
+
paginationStyle = _ref.paginationStyle,
|
|
27
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
30
|
var _useHTableContext = context.useHTableContext(),
|
|
29
|
-
contextOnPageChange = _useHTableContext.onPageChange
|
|
30
|
-
_useHTableContext.
|
|
31
|
-
var data = _useHTableContext.data;
|
|
31
|
+
contextOnPageChange = _useHTableContext.onPageChange,
|
|
32
|
+
data = _useHTableContext.data;
|
|
32
33
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
33
34
|
var _ref2 = data || {},
|
|
34
35
|
size = _ref2.size,
|
|
@@ -37,15 +38,12 @@ var HTablePagination = (function (_ref) {
|
|
|
37
38
|
var pageCurrent = _Number$parseInt(current || "1", 10);
|
|
38
39
|
var pageSize = _Number$parseInt(size || "10", 10);
|
|
39
40
|
var pageTotal = _Number$parseInt(total || "0", 10);
|
|
41
|
+
var className = index.useClassName("hw-table-pagination");
|
|
40
42
|
if (data) {
|
|
41
43
|
return jsxRuntime.jsx(antd.Row, {
|
|
42
44
|
justify: "end",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
paddingRight: 24,
|
|
46
|
-
paddingLeft: 24,
|
|
47
|
-
backgroundColor: "#fff"
|
|
48
|
-
},
|
|
45
|
+
className: className,
|
|
46
|
+
style: paginationStyle,
|
|
49
47
|
children: jsxRuntime.jsx(antd.Pagination, _objectSpread({
|
|
50
48
|
size: "small",
|
|
51
49
|
showQuickJumper: true,
|
package/lib/Table.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HTableProps } from "./modal";
|
|
2
|
-
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, className, ...props }: HTableProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, className, paginationStyle, ...props }: HTableProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
package/lib/Table.js
CHANGED
|
@@ -23,7 +23,7 @@ var antd = require('antd');
|
|
|
23
23
|
var useReq = require('./hooks/useReq.js');
|
|
24
24
|
var useDispatch = require('./hooks/useDispatch.js');
|
|
25
25
|
|
|
26
|
-
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize", "className"];
|
|
26
|
+
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle"];
|
|
27
27
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
29
|
var Table = (function (_ref) {
|
|
@@ -45,6 +45,7 @@ var Table = (function (_ref) {
|
|
|
45
45
|
_ref$spaceSize = _ref.spaceSize,
|
|
46
46
|
spaceSize = _ref$spaceSize === void 0 ? 15 : _ref$spaceSize,
|
|
47
47
|
className = _ref.className,
|
|
48
|
+
paginationStyle = _ref.paginationStyle,
|
|
48
49
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
50
|
var _useReq = useReq.default({
|
|
50
51
|
request: request
|
|
@@ -94,7 +95,8 @@ var Table = (function (_ref) {
|
|
|
94
95
|
searchSpan: searchSpan,
|
|
95
96
|
headerStyle: headerStyle
|
|
96
97
|
}), jsxRuntime.jsx(index$1.default, _objectSpread({
|
|
97
|
-
tableStyle: tableStyle
|
|
98
|
+
tableStyle: tableStyle,
|
|
99
|
+
paginationStyle: paginationStyle
|
|
98
100
|
}, props)), footerRender !== false && jsxRuntime.jsx(index$2.default, {
|
|
99
101
|
actionRender: actionRender,
|
|
100
102
|
footerRender: footerRender,
|
package/lib/index.css
CHANGED
package/lib/modal.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
49
49
|
reload?: (params: any) => Promise<any>;
|
|
50
50
|
manual?: boolean;
|
|
51
51
|
dataSource?: ResultModal;
|
|
52
|
+
paginationStyle?: React.CSSProperties;
|
|
52
53
|
}
|
|
53
54
|
export interface TableInstance {
|
|
54
55
|
reload: (params?: ParamsModal) => Promise<any>;
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource"> {
|
|
|
18
18
|
error: Error
|
|
19
19
|
) => React.ReactNode;
|
|
20
20
|
tableStyle?: React.CSSProperties;
|
|
21
|
+
paginationStyle?: React.CSSProperties;
|
|
21
22
|
}
|
|
22
23
|
const defaultRender = () => {
|
|
23
24
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
@@ -31,6 +32,7 @@ export default ({
|
|
|
31
32
|
emptyRender,
|
|
32
33
|
errorRender,
|
|
33
34
|
tableStyle,
|
|
35
|
+
paginationStyle,
|
|
34
36
|
...props
|
|
35
37
|
}: HTableBodyProps) => {
|
|
36
38
|
// @ts-ignore
|
|
@@ -74,6 +76,9 @@ export default ({
|
|
|
74
76
|
columns={cols}
|
|
75
77
|
tableAlertRender={false}
|
|
76
78
|
search={false}
|
|
79
|
+
options={{
|
|
80
|
+
reload:tableInstance.table.reloadWithParams
|
|
81
|
+
}}
|
|
77
82
|
tableStyle={{
|
|
78
83
|
paddingBottom: 0,
|
|
79
84
|
}}
|
|
@@ -88,7 +93,7 @@ export default ({
|
|
|
88
93
|
pagination={false}
|
|
89
94
|
/>
|
|
90
95
|
{pagination !== false && (
|
|
91
|
-
<HTablePagination onPageChange={onPageChange} {...pagination} />
|
|
96
|
+
<HTablePagination onPageChange={onPageChange} paginationStyle={paginationStyle} {...pagination} />
|
|
92
97
|
)}
|
|
93
98
|
</ConfigProvider>
|
|
94
99
|
</div>
|
|
@@ -2,13 +2,15 @@ import type { PaginationProps} from "antd";
|
|
|
2
2
|
import { Pagination, Row } from "antd";
|
|
3
3
|
import { useHTableContext } from "../context";
|
|
4
4
|
import type { ParamsModal } from "@/components/modal";
|
|
5
|
+
import {useClassName} from "../hooks";
|
|
6
|
+
import React from "react";
|
|
5
7
|
interface IPaginationProps extends PaginationProps {
|
|
6
8
|
onPageChange?: (params: ParamsModal) => void;
|
|
9
|
+
paginationStyle?: React.CSSProperties;
|
|
7
10
|
}
|
|
8
|
-
export default ({ onPageChange, ...props }: IPaginationProps) => {
|
|
11
|
+
export default ({ onPageChange,paginationStyle, ...props }: IPaginationProps) => {
|
|
9
12
|
const {
|
|
10
13
|
onPageChange: contextOnPageChange,
|
|
11
|
-
configData: contextConfigData,
|
|
12
14
|
data,
|
|
13
15
|
} = useHTableContext();
|
|
14
16
|
const tableOnPageChange = onPageChange || contextOnPageChange;
|
|
@@ -16,11 +18,13 @@ export default ({ onPageChange, ...props }: IPaginationProps) => {
|
|
|
16
18
|
const pageCurrent = Number.parseInt(current || "1", 10);
|
|
17
19
|
const pageSize = Number.parseInt(size || "10", 10);
|
|
18
20
|
const pageTotal = Number.parseInt(total || "0", 10);
|
|
21
|
+
const className = useClassName("hw-table-pagination");
|
|
19
22
|
if (data) {
|
|
20
23
|
return (
|
|
21
24
|
<Row
|
|
22
25
|
justify={"end"}
|
|
23
|
-
|
|
26
|
+
className={className}
|
|
27
|
+
style={paginationStyle}
|
|
24
28
|
>
|
|
25
29
|
<Pagination
|
|
26
30
|
size={"small"}
|
package/src/components/Table.tsx
CHANGED
|
@@ -22,6 +22,7 @@ export default ({
|
|
|
22
22
|
action = {},
|
|
23
23
|
spaceSize = 15,
|
|
24
24
|
className,
|
|
25
|
+
paginationStyle,
|
|
25
26
|
...props
|
|
26
27
|
}: HTableProps) => {
|
|
27
28
|
const { run, loading, data, error, saveParams } = useReq({ request });
|
|
@@ -61,7 +62,7 @@ export default ({
|
|
|
61
62
|
{!hideHeader && (
|
|
62
63
|
<Header searchSpan={searchSpan} headerStyle={headerStyle} />
|
|
63
64
|
)}
|
|
64
|
-
<Body tableStyle={tableStyle} {...props} />
|
|
65
|
+
<Body tableStyle={tableStyle} paginationStyle={paginationStyle} {...props} />
|
|
65
66
|
{footerRender !== false && (
|
|
66
67
|
<Footer
|
|
67
68
|
actionRender={actionRender}
|
|
@@ -2,7 +2,8 @@ import useCurrentTable from "./hooks/useCurrentTable";
|
|
|
2
2
|
import useRowObj from "./hooks/useRowObj";
|
|
3
3
|
import { HTableContext } from "./context";
|
|
4
4
|
import type { HTableProps } from "./modal";
|
|
5
|
-
import
|
|
5
|
+
import type {IParamsModal} from "./hooks/useReq";
|
|
6
|
+
import useReq from "./hooks/useReq";
|
|
6
7
|
import useDispatch from "./hooks/useDispatch";
|
|
7
8
|
import React from "react";
|
|
8
9
|
const Index: React.FC<HTableProps> = ({
|
|
@@ -3,11 +3,11 @@ import { useRequest } from "ahooks";
|
|
|
3
3
|
import type { ParamsModal, ResultModal } from "@/components/modal";
|
|
4
4
|
export interface IParamsModal {
|
|
5
5
|
request?: (params: ParamsModal) => Promise<ResultModal>;
|
|
6
|
-
loading?:boolean;
|
|
7
|
-
error?:Error;
|
|
8
|
-
reload?:(params:any)=>Promise<any>;
|
|
9
|
-
dataSource?:any;
|
|
10
|
-
manual?:boolean
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
error?: Error;
|
|
8
|
+
reload?: (params: any) => Promise<any>;
|
|
9
|
+
dataSource?: any;
|
|
10
|
+
manual?: boolean
|
|
11
11
|
}
|
|
12
12
|
export default ({ request ,loading,error,reload,dataSource,manual=false}: IParamsModal) => {
|
|
13
13
|
const saveParams = useMemo(() => {
|
|
@@ -15,7 +15,7 @@ export default ({ request ,loading,error,reload,dataSource,manual=false}: IParam
|
|
|
15
15
|
old: {},
|
|
16
16
|
};
|
|
17
17
|
}, []);
|
|
18
|
-
const reloadFn=async (params:Record<string, any>={})=>{
|
|
18
|
+
const reloadFn=async (params: Record<string, any>={})=>{
|
|
19
19
|
const { size = "10", current = "1", ...oParams } = params;
|
|
20
20
|
const reqParams = { size, current, ...oParams };
|
|
21
21
|
return reload?.(reqParams);
|
package/src/components/modal.ts
CHANGED
|
@@ -64,10 +64,11 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"|"da
|
|
|
64
64
|
footerStyle?: React.CSSProperties;
|
|
65
65
|
spaceSize?: number;
|
|
66
66
|
className?: string;
|
|
67
|
-
error?:Error;
|
|
68
|
-
reload?:(params:any)=>Promise<any>;
|
|
69
|
-
manual?:boolean;
|
|
70
|
-
dataSource?:ResultModal
|
|
67
|
+
error?: Error;
|
|
68
|
+
reload?: (params: any) => Promise<any>;
|
|
69
|
+
manual?: boolean;
|
|
70
|
+
dataSource?: ResultModal;
|
|
71
|
+
paginationStyle?: React.CSSProperties
|
|
71
72
|
}
|
|
72
73
|
export interface TableInstance {
|
|
73
74
|
reload: (params?: ParamsModal) => Promise<any>;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
HTablePagination,
|
|
7
7
|
} from "../../components";
|
|
8
8
|
import {useRequest} from "ahooks";
|
|
9
|
+
import {Space} from "antd";
|
|
9
10
|
|
|
10
11
|
const configData = [
|
|
11
12
|
{
|
|
@@ -49,10 +50,12 @@ export default () => {
|
|
|
49
50
|
dataSource={data}
|
|
50
51
|
reload={run}
|
|
51
52
|
>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
<Space direction={"vertical"} style={{width:"100%"}}>
|
|
54
|
+
<HTableHeader />
|
|
55
|
+
<HTableBody pagination={false} />
|
|
56
|
+
<HTablePagination />
|
|
57
|
+
<HTableFooter />
|
|
58
|
+
</Space>
|
|
56
59
|
</TableCustomize>
|
|
57
60
|
);
|
|
58
61
|
};
|