@hw-component/table 0.0.9-beta-v3 → 0.0.9-beta-v7
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/HeaderTitle/index.d.ts +9 -0
- package/es/HTableBody/HeaderTitle/index.js +38 -0
- package/es/HTableBody/Options/index.js +0 -2
- package/es/HTableBody/Options/utils.d.ts +1 -1
- package/es/HTableBody/index.d.ts +2 -1
- package/es/HTableBody/index.js +21 -20
- package/es/HTablePagination/index.d.ts +3 -1
- package/es/HTablePagination/index.js +16 -8
- package/es/index.css +12 -3
- package/es/modal.d.ts +1 -0
- package/lib/HTableBody/HeaderTitle/index.d.ts +9 -0
- package/lib/HTableBody/HeaderTitle/index.js +41 -0
- package/lib/HTableBody/Options/index.js +0 -2
- package/lib/HTableBody/Options/utils.d.ts +1 -1
- package/lib/HTableBody/index.d.ts +2 -1
- package/lib/HTableBody/index.js +22 -21
- package/lib/HTablePagination/index.d.ts +3 -1
- package/lib/HTablePagination/index.js +16 -8
- package/lib/index.css +12 -3
- package/lib/modal.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/HTableBody/HeaderTitle/index.tsx +31 -0
- package/src/components/HTableBody/Options/index.tsx +1 -2
- package/src/components/HTableBody/index.tsx +10 -10
- package/src/components/HTablePagination/index.tsx +13 -3
- package/src/components/index.less +6 -4
- package/src/components/modal.ts +1 -0
- package/src/pages/Table/index.tsx +5 -21
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTableBodyProps } from "../index";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface IProps {
|
|
4
|
+
headerTitle: HTableBodyProps["headerTitle"];
|
|
5
|
+
contentStyle?: React.CSSProperties;
|
|
6
|
+
rNode?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: ({ headerTitle, contentStyle, rNode }: IProps) => JSX.Element | null;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Row } from 'antd';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useHTableContext } from '../../context.js';
|
|
6
|
+
import { useClassName } from '../../hooks/index.js';
|
|
7
|
+
|
|
8
|
+
var HeaderTitle = (function (_ref) {
|
|
9
|
+
var headerTitle = _ref.headerTitle,
|
|
10
|
+
contentStyle = _ref.contentStyle,
|
|
11
|
+
rNode = _ref.rNode;
|
|
12
|
+
var _useHTableContext = useHTableContext(),
|
|
13
|
+
tableInstance = _useHTableContext.tableInstance,
|
|
14
|
+
selectedRowData = _useHTableContext.selectedRowData,
|
|
15
|
+
rowOnChange = _useHTableContext.rowOnChange,
|
|
16
|
+
allSelectChange = _useHTableContext.allSelectChange;
|
|
17
|
+
var headerBox = useClassName('hw-table-header-title-box');
|
|
18
|
+
if (!headerTitle && !rNode) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return jsxs(Row, {
|
|
22
|
+
justify: "space-between",
|
|
23
|
+
align: "middle",
|
|
24
|
+
style: contentStyle,
|
|
25
|
+
children: [jsx("div", {
|
|
26
|
+
className: headerBox,
|
|
27
|
+
children: headerTitle && /*#__PURE__*/React.cloneElement(headerTitle, {
|
|
28
|
+
selectedRowData: selectedRowData,
|
|
29
|
+
allSelectChange: allSelectChange,
|
|
30
|
+
rowOnChange: rowOnChange,
|
|
31
|
+
tableInstance: tableInstance
|
|
32
|
+
})
|
|
33
|
+
}), rNode && rNode]
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { HeaderTitle as default };
|
|
38
|
+
// powered by hdj
|
|
@@ -20,7 +20,6 @@ var Options = (function (_ref) {
|
|
|
20
20
|
setSizeChange = _ref.setSizeChange,
|
|
21
21
|
columns = _ref.columns,
|
|
22
22
|
onChange = _ref.onChange;
|
|
23
|
-
var className = useClassName("hw-table-body-option");
|
|
24
23
|
var pointer = useClassName(["hw-table-pointer", "hw-table-body-option-icon"]);
|
|
25
24
|
var ref = useRef(null);
|
|
26
25
|
var _useState = useState([]),
|
|
@@ -69,7 +68,6 @@ var Options = (function (_ref) {
|
|
|
69
68
|
};
|
|
70
69
|
return jsx(Row, {
|
|
71
70
|
justify: "end",
|
|
72
|
-
className: className,
|
|
73
71
|
ref: ref,
|
|
74
72
|
children: jsxs(Space, {
|
|
75
73
|
size: 20,
|
|
@@ -55,7 +55,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
55
55
|
render?: ((dom: React.ReactNode, data: any, index: number, tableInstance: import("../../modal").HTableInstance) => React.ReactNode) | undefined;
|
|
56
56
|
showSearch?: boolean | undefined;
|
|
57
57
|
searchType?: string | undefined;
|
|
58
|
-
searchRender?: ((
|
|
58
|
+
searchRender?: ((item: import("@hw-component/form/es/Form/modal").HItemProps, node: React.ReactNode, form: import("antd").FormInstance<any>, tableInstance: import("../../modal").HTableInstance) => React.ReactNode) | undefined;
|
|
59
59
|
rowSelectionTitle?: boolean | undefined;
|
|
60
60
|
index?: number | undefined;
|
|
61
61
|
filters?: boolean | import("antd/lib/table/interface").ColumnFilterItem[] | undefined;
|
package/es/HTableBody/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
16
16
|
affixProps?: AffixProps | false;
|
|
17
17
|
goTop?: boolean;
|
|
18
18
|
optionsRender?: (node: React.ReactNode) => React.ReactNode;
|
|
19
|
+
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
19
20
|
}
|
|
20
|
-
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, ...props }: HTableBodyProps) => JSX.Element;
|
|
21
|
+
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, paginationActionRender, ...props }: HTableBodyProps) => JSX.Element;
|
|
21
22
|
export default _default;
|
package/es/HTableBody/index.js
CHANGED
|
@@ -14,15 +14,15 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
14
14
|
import ProTable from '@ant-design/pro-table';
|
|
15
15
|
import { useSize, useCols, useSynchronousKeys } from './hooks.js';
|
|
16
16
|
import { useHTableContext } from '../context.js';
|
|
17
|
-
import
|
|
18
|
-
import { Row, Alert, ConfigProvider, Empty } from 'antd';
|
|
17
|
+
import { Alert, ConfigProvider, Empty } from 'antd';
|
|
19
18
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
20
19
|
import HTablePagination from '../HTablePagination/index.js';
|
|
21
20
|
import { useClassName } from '../hooks/index.js';
|
|
22
21
|
import AlertMsg from './AlertMsg.js';
|
|
23
22
|
import Options from './Options/index.js';
|
|
23
|
+
import HeaderTitle from './HeaderTitle/index.js';
|
|
24
24
|
|
|
25
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender"];
|
|
25
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender"];
|
|
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() {
|
|
@@ -56,6 +56,7 @@ var Body = (function (_ref) {
|
|
|
56
56
|
goTop = _ref$goTop === void 0 ? true : _ref$goTop,
|
|
57
57
|
size = _ref.size,
|
|
58
58
|
optionsRender = _ref.optionsRender,
|
|
59
|
+
paginationActionRender = _ref.paginationActionRender,
|
|
59
60
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
60
61
|
var _ref2 = rowSelection || {},
|
|
61
62
|
selectedRowKeys = _ref2.selectedRowKeys,
|
|
@@ -64,11 +65,11 @@ var Body = (function (_ref) {
|
|
|
64
65
|
tableInstance = _useHTableContext.tableInstance,
|
|
65
66
|
contextConfigData = _useHTableContext.configData,
|
|
66
67
|
data = _useHTableContext.data,
|
|
67
|
-
selectedRowData = _useHTableContext.selectedRowData
|
|
68
|
-
|
|
69
|
-
error = _useHTableContext.error,
|
|
70
|
-
loading = _useHTableContext.loading
|
|
71
|
-
|
|
68
|
+
selectedRowData = _useHTableContext.selectedRowData;
|
|
69
|
+
_useHTableContext.rowOnChange;
|
|
70
|
+
var error = _useHTableContext.error,
|
|
71
|
+
loading = _useHTableContext.loading;
|
|
72
|
+
_useHTableContext.allSelectChange;
|
|
72
73
|
var _useHTableConfigConte = useHTableConfigContext({
|
|
73
74
|
emptyRender: emptyRender,
|
|
74
75
|
errorRender: errorRender
|
|
@@ -108,21 +109,13 @@ var Body = (function (_ref) {
|
|
|
108
109
|
var _selectedRowData$keys = _keysInstanceProperty(selectedRowData),
|
|
109
110
|
keys = _selectedRowData$keys === void 0 ? [] : _selectedRowData$keys,
|
|
110
111
|
selectAll = selectedRowData.selectAll;
|
|
112
|
+
var defaultOptionsNode = optionsRender ? optionsRender(optionsNode) : optionsNode;
|
|
111
113
|
var alwaysShowAlert = keys.length > 0 || selectAll || configAlwaysShowAlert;
|
|
112
114
|
var className = useClassName("hw-table-body");
|
|
113
115
|
return jsxs("div", {
|
|
114
116
|
style: tableStyle,
|
|
115
117
|
className: "hw_table_body ".concat(className),
|
|
116
|
-
children: [
|
|
117
|
-
gutter: [0, 8],
|
|
118
|
-
style: contentStyle,
|
|
119
|
-
children: /*#__PURE__*/React.cloneElement(headerTitle, {
|
|
120
|
-
selectedRowData: selectedRowData,
|
|
121
|
-
allSelectChange: allSelectChange,
|
|
122
|
-
rowOnChange: rowOnChange,
|
|
123
|
-
tableInstance: tableInstance
|
|
124
|
-
})
|
|
125
|
-
}), alwaysShowAlert && jsx("div", {
|
|
118
|
+
children: [alwaysShowAlert && jsx("div", {
|
|
126
119
|
style: contentStyle,
|
|
127
120
|
children: jsx(Alert, {
|
|
128
121
|
message: jsx(AlertMsg, {
|
|
@@ -130,7 +123,11 @@ var Body = (function (_ref) {
|
|
|
130
123
|
}),
|
|
131
124
|
type: "info"
|
|
132
125
|
})
|
|
133
|
-
}),
|
|
126
|
+
}), jsx(HeaderTitle, {
|
|
127
|
+
headerTitle: headerTitle,
|
|
128
|
+
contentStyle: contentStyle,
|
|
129
|
+
rNode: defaultOptionsNode
|
|
130
|
+
}), jsxs(ConfigProvider, {
|
|
134
131
|
renderEmpty: function renderEmpty() {
|
|
135
132
|
if (error) {
|
|
136
133
|
return tableErrorRender === null || tableErrorRender === void 0 ? void 0 : tableErrorRender(tableInstance, error);
|
|
@@ -141,6 +138,9 @@ var Body = (function (_ref) {
|
|
|
141
138
|
columns: cols,
|
|
142
139
|
size: cuSize,
|
|
143
140
|
search: false,
|
|
141
|
+
onChange: function onChange(pagination, filters, sorter) {
|
|
142
|
+
console.log(filters, sorter);
|
|
143
|
+
},
|
|
144
144
|
options: false,
|
|
145
145
|
tableStyle: {
|
|
146
146
|
paddingBottom: 0
|
|
@@ -154,7 +154,8 @@ var Body = (function (_ref) {
|
|
|
154
154
|
onPageChange: onPageChange,
|
|
155
155
|
paginationStyle: paginationStyle,
|
|
156
156
|
affixProps: affixProps,
|
|
157
|
-
goTop: goTop
|
|
157
|
+
goTop: goTop,
|
|
158
|
+
actionRender: paginationActionRender
|
|
158
159
|
}, pagination))]
|
|
159
160
|
})]
|
|
160
161
|
});
|
|
@@ -2,11 +2,13 @@ import type { PaginationProps } from "antd";
|
|
|
2
2
|
import type { ParamsModal } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
|
+
import { HTableInstance } from "../modal";
|
|
5
6
|
export interface IPaginationProps extends PaginationProps {
|
|
6
7
|
onPageChange?: (params: ParamsModal) => void;
|
|
7
8
|
paginationStyle?: React.CSSProperties;
|
|
8
9
|
affixProps?: AffixProps | false;
|
|
9
10
|
goTop?: boolean;
|
|
11
|
+
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
10
12
|
}
|
|
11
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, ...props }: IPaginationProps) => JSX.Element;
|
|
13
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, ...props }: IPaginationProps) => JSX.Element;
|
|
12
14
|
export default _default;
|
|
@@ -19,7 +19,7 @@ import { useClassName } from '../hooks/index.js';
|
|
|
19
19
|
import { useState } from 'react';
|
|
20
20
|
import GoTop from '../GoTop/index.js';
|
|
21
21
|
|
|
22
|
-
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop"],
|
|
22
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender"],
|
|
23
23
|
_excluded2 = ["offsetBottom"];
|
|
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 _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -28,10 +28,12 @@ var HTablePagination = (function (_ref) {
|
|
|
28
28
|
paginationStyle = _ref.paginationStyle,
|
|
29
29
|
affixProps = _ref.affixProps,
|
|
30
30
|
goTop = _ref.goTop,
|
|
31
|
+
actionRender = _ref.actionRender,
|
|
31
32
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
33
|
var _useHTableContext = useHTableContext(),
|
|
33
34
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
34
|
-
data = _useHTableContext.data
|
|
35
|
+
data = _useHTableContext.data,
|
|
36
|
+
tableInstance = _useHTableContext.tableInstance;
|
|
35
37
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
36
38
|
var _ref2 = data || {},
|
|
37
39
|
size = _ref2.size,
|
|
@@ -49,11 +51,14 @@ var HTablePagination = (function (_ref) {
|
|
|
49
51
|
return jsx(Fragment, {});
|
|
50
52
|
}
|
|
51
53
|
if (affixProps === false) {
|
|
52
|
-
return
|
|
53
|
-
justify: "
|
|
54
|
+
return jsxs(Row, {
|
|
55
|
+
justify: "space-between",
|
|
56
|
+
align: "middle",
|
|
54
57
|
className: className,
|
|
55
58
|
style: paginationStyle,
|
|
56
|
-
children: jsx(
|
|
59
|
+
children: [jsx("div", {
|
|
60
|
+
children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
|
|
61
|
+
}), jsx(Pagination, _objectSpread({
|
|
57
62
|
size: "small",
|
|
58
63
|
showQuickJumper: true,
|
|
59
64
|
pageSize: pageSize,
|
|
@@ -72,7 +77,7 @@ var HTablePagination = (function (_ref) {
|
|
|
72
77
|
current: pn
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
|
-
}, props))
|
|
80
|
+
}, props))]
|
|
76
81
|
});
|
|
77
82
|
}
|
|
78
83
|
var _ref5 = affixProps || {},
|
|
@@ -93,10 +98,13 @@ var HTablePagination = (function (_ref) {
|
|
|
93
98
|
}
|
|
94
99
|
}, afProps), {}, {
|
|
95
100
|
children: jsxs(Row, {
|
|
96
|
-
justify: "
|
|
101
|
+
justify: "space-between",
|
|
97
102
|
className: className,
|
|
103
|
+
align: "middle",
|
|
98
104
|
style: _objectSpread(_objectSpread({}, paginationStyle), style),
|
|
99
|
-
children: [jsx(
|
|
105
|
+
children: [jsx("div", {
|
|
106
|
+
children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
|
|
107
|
+
}), jsx(Pagination, _objectSpread({
|
|
100
108
|
size: "small",
|
|
101
109
|
showQuickJumper: true,
|
|
102
110
|
pageSize: pageSize,
|
package/es/index.css
CHANGED
|
@@ -41,9 +41,6 @@
|
|
|
41
41
|
.ant-hw-table-header .ant-hw-table-header-item-hide {
|
|
42
42
|
display: none;
|
|
43
43
|
}
|
|
44
|
-
.ant-hw-table-body-option {
|
|
45
|
-
padding: 0px 24px 16px 24px;
|
|
46
|
-
}
|
|
47
44
|
.ant-hw-table-body-option-icon {
|
|
48
45
|
font-size: 16px;
|
|
49
46
|
}
|
|
@@ -84,3 +81,15 @@
|
|
|
84
81
|
.ant-hw-table-pointer:hover {
|
|
85
82
|
color: #1890ff;
|
|
86
83
|
}
|
|
84
|
+
.ant-hw-table-header-title-box {
|
|
85
|
+
-webkit-box-flex: 1;
|
|
86
|
+
-webkit-flex: 1;
|
|
87
|
+
-ms-flex: 1;
|
|
88
|
+
flex: 1;
|
|
89
|
+
display: -webkit-box;
|
|
90
|
+
display: -webkit-flex;
|
|
91
|
+
display: -ms-flexbox;
|
|
92
|
+
display: flex;
|
|
93
|
+
position: relative;
|
|
94
|
+
margin-right: 12px;
|
|
95
|
+
}
|
package/es/modal.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
70
70
|
goTop?: boolean;
|
|
71
71
|
optionsRender?: (node: React.ReactNode) => React.ReactNode;
|
|
72
72
|
onFinish?: (value: any) => Promise<any>;
|
|
73
|
+
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
73
74
|
}
|
|
74
75
|
export interface TableInstance {
|
|
75
76
|
reload: (params?: ParamsModal) => Promise<any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTableBodyProps } from "../index";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface IProps {
|
|
4
|
+
headerTitle: HTableBodyProps["headerTitle"];
|
|
5
|
+
contentStyle?: React.CSSProperties;
|
|
6
|
+
rNode?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: ({ headerTitle, contentStyle, rNode }: IProps) => JSX.Element | null;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var context = require('../../context.js');
|
|
9
|
+
var index = require('../../hooks/index.js');
|
|
10
|
+
|
|
11
|
+
var HeaderTitle = (function (_ref) {
|
|
12
|
+
var headerTitle = _ref.headerTitle,
|
|
13
|
+
contentStyle = _ref.contentStyle,
|
|
14
|
+
rNode = _ref.rNode;
|
|
15
|
+
var _useHTableContext = context.useHTableContext(),
|
|
16
|
+
tableInstance = _useHTableContext.tableInstance,
|
|
17
|
+
selectedRowData = _useHTableContext.selectedRowData,
|
|
18
|
+
rowOnChange = _useHTableContext.rowOnChange,
|
|
19
|
+
allSelectChange = _useHTableContext.allSelectChange;
|
|
20
|
+
var headerBox = index.useClassName('hw-table-header-title-box');
|
|
21
|
+
if (!headerTitle && !rNode) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return jsxRuntime.jsxs(antd.Row, {
|
|
25
|
+
justify: "space-between",
|
|
26
|
+
align: "middle",
|
|
27
|
+
style: contentStyle,
|
|
28
|
+
children: [jsxRuntime.jsx("div", {
|
|
29
|
+
className: headerBox,
|
|
30
|
+
children: headerTitle && /*#__PURE__*/React.cloneElement(headerTitle, {
|
|
31
|
+
selectedRowData: selectedRowData,
|
|
32
|
+
allSelectChange: allSelectChange,
|
|
33
|
+
rowOnChange: rowOnChange,
|
|
34
|
+
tableInstance: tableInstance
|
|
35
|
+
})
|
|
36
|
+
}), rNode && rNode]
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
exports.default = HeaderTitle;
|
|
41
|
+
// powered by h
|
|
@@ -23,7 +23,6 @@ var Options = (function (_ref) {
|
|
|
23
23
|
setSizeChange = _ref.setSizeChange,
|
|
24
24
|
columns = _ref.columns,
|
|
25
25
|
onChange = _ref.onChange;
|
|
26
|
-
var className = index.useClassName("hw-table-body-option");
|
|
27
26
|
var pointer = index.useClassName(["hw-table-pointer", "hw-table-body-option-icon"]);
|
|
28
27
|
var ref = React.useRef(null);
|
|
29
28
|
var _useState = React.useState([]),
|
|
@@ -72,7 +71,6 @@ var Options = (function (_ref) {
|
|
|
72
71
|
};
|
|
73
72
|
return jsxRuntime.jsx(antd.Row, {
|
|
74
73
|
justify: "end",
|
|
75
|
-
className: className,
|
|
76
74
|
ref: ref,
|
|
77
75
|
children: jsxRuntime.jsxs(antd.Space, {
|
|
78
76
|
size: 20,
|
|
@@ -55,7 +55,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
55
55
|
render?: ((dom: React.ReactNode, data: any, index: number, tableInstance: import("../../modal").HTableInstance) => React.ReactNode) | undefined;
|
|
56
56
|
showSearch?: boolean | undefined;
|
|
57
57
|
searchType?: string | undefined;
|
|
58
|
-
searchRender?: ((
|
|
58
|
+
searchRender?: ((item: import("@hw-component/form/es/Form/modal").HItemProps, node: React.ReactNode, form: import("antd").FormInstance<any>, tableInstance: import("../../modal").HTableInstance) => React.ReactNode) | undefined;
|
|
59
59
|
rowSelectionTitle?: boolean | undefined;
|
|
60
60
|
index?: number | undefined;
|
|
61
61
|
filters?: boolean | import("antd/lib/table/interface").ColumnFilterItem[] | undefined;
|
|
@@ -16,6 +16,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
16
16
|
affixProps?: AffixProps | false;
|
|
17
17
|
goTop?: boolean;
|
|
18
18
|
optionsRender?: (node: React.ReactNode) => React.ReactNode;
|
|
19
|
+
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
19
20
|
}
|
|
20
|
-
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, ...props }: HTableBodyProps) => JSX.Element;
|
|
21
|
+
declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, paginationActionRender, ...props }: HTableBodyProps) => JSX.Element;
|
|
21
22
|
export default _default;
|
package/lib/HTableBody/index.js
CHANGED
|
@@ -17,15 +17,15 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
17
17
|
var ProTable = require('@ant-design/pro-table');
|
|
18
18
|
var hooks = require('./hooks.js');
|
|
19
19
|
var context = require('../context.js');
|
|
20
|
-
var React = require('react');
|
|
21
20
|
var antd = require('antd');
|
|
22
21
|
var TableConfig = require('../TableConfig.js');
|
|
23
|
-
var index$
|
|
22
|
+
var index$3 = require('../HTablePagination/index.js');
|
|
24
23
|
var index$1 = require('../hooks/index.js');
|
|
25
24
|
var AlertMsg = require('./AlertMsg.js');
|
|
26
25
|
var index = require('./Options/index.js');
|
|
26
|
+
var index$2 = require('./HeaderTitle/index.js');
|
|
27
27
|
|
|
28
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender"];
|
|
28
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender"];
|
|
29
29
|
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; }
|
|
30
30
|
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; }
|
|
31
31
|
var defaultRender = function defaultRender() {
|
|
@@ -59,6 +59,7 @@ var Body = (function (_ref) {
|
|
|
59
59
|
goTop = _ref$goTop === void 0 ? true : _ref$goTop,
|
|
60
60
|
size = _ref.size,
|
|
61
61
|
optionsRender = _ref.optionsRender,
|
|
62
|
+
paginationActionRender = _ref.paginationActionRender,
|
|
62
63
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
63
64
|
var _ref2 = rowSelection || {},
|
|
64
65
|
selectedRowKeys = _ref2.selectedRowKeys,
|
|
@@ -67,11 +68,11 @@ var Body = (function (_ref) {
|
|
|
67
68
|
tableInstance = _useHTableContext.tableInstance,
|
|
68
69
|
contextConfigData = _useHTableContext.configData,
|
|
69
70
|
data = _useHTableContext.data,
|
|
70
|
-
selectedRowData = _useHTableContext.selectedRowData
|
|
71
|
-
|
|
72
|
-
error = _useHTableContext.error,
|
|
73
|
-
loading = _useHTableContext.loading
|
|
74
|
-
|
|
71
|
+
selectedRowData = _useHTableContext.selectedRowData;
|
|
72
|
+
_useHTableContext.rowOnChange;
|
|
73
|
+
var error = _useHTableContext.error,
|
|
74
|
+
loading = _useHTableContext.loading;
|
|
75
|
+
_useHTableContext.allSelectChange;
|
|
75
76
|
var _useHTableConfigConte = TableConfig.useHTableConfigContext({
|
|
76
77
|
emptyRender: emptyRender,
|
|
77
78
|
errorRender: errorRender
|
|
@@ -111,21 +112,13 @@ var Body = (function (_ref) {
|
|
|
111
112
|
var _selectedRowData$keys = _keysInstanceProperty(selectedRowData),
|
|
112
113
|
keys = _selectedRowData$keys === void 0 ? [] : _selectedRowData$keys,
|
|
113
114
|
selectAll = selectedRowData.selectAll;
|
|
115
|
+
var defaultOptionsNode = optionsRender ? optionsRender(optionsNode) : optionsNode;
|
|
114
116
|
var alwaysShowAlert = keys.length > 0 || selectAll || configAlwaysShowAlert;
|
|
115
117
|
var className = index$1.useClassName("hw-table-body");
|
|
116
118
|
return jsxRuntime.jsxs("div", {
|
|
117
119
|
style: tableStyle,
|
|
118
120
|
className: "hw_table_body ".concat(className),
|
|
119
|
-
children: [
|
|
120
|
-
gutter: [0, 8],
|
|
121
|
-
style: contentStyle,
|
|
122
|
-
children: /*#__PURE__*/React.cloneElement(headerTitle, {
|
|
123
|
-
selectedRowData: selectedRowData,
|
|
124
|
-
allSelectChange: allSelectChange,
|
|
125
|
-
rowOnChange: rowOnChange,
|
|
126
|
-
tableInstance: tableInstance
|
|
127
|
-
})
|
|
128
|
-
}), alwaysShowAlert && jsxRuntime.jsx("div", {
|
|
121
|
+
children: [alwaysShowAlert && jsxRuntime.jsx("div", {
|
|
129
122
|
style: contentStyle,
|
|
130
123
|
children: jsxRuntime.jsx(antd.Alert, {
|
|
131
124
|
message: jsxRuntime.jsx(AlertMsg.default, {
|
|
@@ -133,7 +126,11 @@ var Body = (function (_ref) {
|
|
|
133
126
|
}),
|
|
134
127
|
type: "info"
|
|
135
128
|
})
|
|
136
|
-
}),
|
|
129
|
+
}), jsxRuntime.jsx(index$2.default, {
|
|
130
|
+
headerTitle: headerTitle,
|
|
131
|
+
contentStyle: contentStyle,
|
|
132
|
+
rNode: defaultOptionsNode
|
|
133
|
+
}), jsxRuntime.jsxs(antd.ConfigProvider, {
|
|
137
134
|
renderEmpty: function renderEmpty() {
|
|
138
135
|
if (error) {
|
|
139
136
|
return tableErrorRender === null || tableErrorRender === void 0 ? void 0 : tableErrorRender(tableInstance, error);
|
|
@@ -144,6 +141,9 @@ var Body = (function (_ref) {
|
|
|
144
141
|
columns: cols,
|
|
145
142
|
size: cuSize,
|
|
146
143
|
search: false,
|
|
144
|
+
onChange: function onChange(pagination, filters, sorter) {
|
|
145
|
+
console.log(filters, sorter);
|
|
146
|
+
},
|
|
147
147
|
options: false,
|
|
148
148
|
tableStyle: {
|
|
149
149
|
paddingBottom: 0
|
|
@@ -153,11 +153,12 @@ var Body = (function (_ref) {
|
|
|
153
153
|
rowKey: rowKey,
|
|
154
154
|
dataSource: records,
|
|
155
155
|
pagination: false
|
|
156
|
-
})), pagination !== false && jsxRuntime.jsx(index$
|
|
156
|
+
})), pagination !== false && jsxRuntime.jsx(index$3.default, _objectSpread({
|
|
157
157
|
onPageChange: onPageChange,
|
|
158
158
|
paginationStyle: paginationStyle,
|
|
159
159
|
affixProps: affixProps,
|
|
160
|
-
goTop: goTop
|
|
160
|
+
goTop: goTop,
|
|
161
|
+
actionRender: paginationActionRender
|
|
161
162
|
}, pagination))]
|
|
162
163
|
})]
|
|
163
164
|
});
|
|
@@ -2,11 +2,13 @@ import type { PaginationProps } from "antd";
|
|
|
2
2
|
import type { ParamsModal } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
|
+
import { HTableInstance } from "../modal";
|
|
5
6
|
export interface IPaginationProps extends PaginationProps {
|
|
6
7
|
onPageChange?: (params: ParamsModal) => void;
|
|
7
8
|
paginationStyle?: React.CSSProperties;
|
|
8
9
|
affixProps?: AffixProps | false;
|
|
9
10
|
goTop?: boolean;
|
|
11
|
+
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
10
12
|
}
|
|
11
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, ...props }: IPaginationProps) => JSX.Element;
|
|
13
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, ...props }: IPaginationProps) => JSX.Element;
|
|
12
14
|
export default _default;
|
|
@@ -22,7 +22,7 @@ var index = require('../hooks/index.js');
|
|
|
22
22
|
var React = require('react');
|
|
23
23
|
var index$1 = require('../GoTop/index.js');
|
|
24
24
|
|
|
25
|
-
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop"],
|
|
25
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender"],
|
|
26
26
|
_excluded2 = ["offsetBottom"];
|
|
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 _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -31,10 +31,12 @@ var HTablePagination = (function (_ref) {
|
|
|
31
31
|
paginationStyle = _ref.paginationStyle,
|
|
32
32
|
affixProps = _ref.affixProps,
|
|
33
33
|
goTop = _ref.goTop,
|
|
34
|
+
actionRender = _ref.actionRender,
|
|
34
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
36
|
var _useHTableContext = context.useHTableContext(),
|
|
36
37
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
37
|
-
data = _useHTableContext.data
|
|
38
|
+
data = _useHTableContext.data,
|
|
39
|
+
tableInstance = _useHTableContext.tableInstance;
|
|
38
40
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
39
41
|
var _ref2 = data || {},
|
|
40
42
|
size = _ref2.size,
|
|
@@ -52,11 +54,14 @@ var HTablePagination = (function (_ref) {
|
|
|
52
54
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
53
55
|
}
|
|
54
56
|
if (affixProps === false) {
|
|
55
|
-
return jsxRuntime.
|
|
56
|
-
justify: "
|
|
57
|
+
return jsxRuntime.jsxs(antd.Row, {
|
|
58
|
+
justify: "space-between",
|
|
59
|
+
align: "middle",
|
|
57
60
|
className: className,
|
|
58
61
|
style: paginationStyle,
|
|
59
|
-
children: jsxRuntime.jsx(
|
|
62
|
+
children: [jsxRuntime.jsx("div", {
|
|
63
|
+
children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
|
|
64
|
+
}), jsxRuntime.jsx(antd.Pagination, _objectSpread({
|
|
60
65
|
size: "small",
|
|
61
66
|
showQuickJumper: true,
|
|
62
67
|
pageSize: pageSize,
|
|
@@ -75,7 +80,7 @@ var HTablePagination = (function (_ref) {
|
|
|
75
80
|
current: pn
|
|
76
81
|
});
|
|
77
82
|
}
|
|
78
|
-
}, props))
|
|
83
|
+
}, props))]
|
|
79
84
|
});
|
|
80
85
|
}
|
|
81
86
|
var _ref5 = affixProps || {},
|
|
@@ -96,10 +101,13 @@ var HTablePagination = (function (_ref) {
|
|
|
96
101
|
}
|
|
97
102
|
}, afProps), {}, {
|
|
98
103
|
children: jsxRuntime.jsxs(antd.Row, {
|
|
99
|
-
justify: "
|
|
104
|
+
justify: "space-between",
|
|
100
105
|
className: className,
|
|
106
|
+
align: "middle",
|
|
101
107
|
style: _objectSpread(_objectSpread({}, paginationStyle), style),
|
|
102
|
-
children: [jsxRuntime.jsx(
|
|
108
|
+
children: [jsxRuntime.jsx("div", {
|
|
109
|
+
children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
|
|
110
|
+
}), jsxRuntime.jsx(antd.Pagination, _objectSpread({
|
|
103
111
|
size: "small",
|
|
104
112
|
showQuickJumper: true,
|
|
105
113
|
pageSize: pageSize,
|
package/lib/index.css
CHANGED
|
@@ -41,9 +41,6 @@
|
|
|
41
41
|
.ant-hw-table-header .ant-hw-table-header-item-hide {
|
|
42
42
|
display: none;
|
|
43
43
|
}
|
|
44
|
-
.ant-hw-table-body-option {
|
|
45
|
-
padding: 0px 24px 16px 24px;
|
|
46
|
-
}
|
|
47
44
|
.ant-hw-table-body-option-icon {
|
|
48
45
|
font-size: 16px;
|
|
49
46
|
}
|
|
@@ -84,3 +81,15 @@
|
|
|
84
81
|
.ant-hw-table-pointer:hover {
|
|
85
82
|
color: #1890ff;
|
|
86
83
|
}
|
|
84
|
+
.ant-hw-table-header-title-box {
|
|
85
|
+
-webkit-box-flex: 1;
|
|
86
|
+
-webkit-flex: 1;
|
|
87
|
+
-ms-flex: 1;
|
|
88
|
+
flex: 1;
|
|
89
|
+
display: -webkit-box;
|
|
90
|
+
display: -webkit-flex;
|
|
91
|
+
display: -ms-flexbox;
|
|
92
|
+
display: flex;
|
|
93
|
+
position: relative;
|
|
94
|
+
margin-right: 12px;
|
|
95
|
+
}
|
package/lib/modal.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
70
70
|
goTop?: boolean;
|
|
71
71
|
optionsRender?: (node: React.ReactNode) => React.ReactNode;
|
|
72
72
|
onFinish?: (value: any) => Promise<any>;
|
|
73
|
+
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
73
74
|
}
|
|
74
75
|
export interface TableInstance {
|
|
75
76
|
reload: (params?: ParamsModal) => Promise<any>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {Row, Space} from "antd";
|
|
2
|
+
import {HTableBodyProps} from "../index";
|
|
3
|
+
import React, {DetailedReactHTMLElement} from "react";
|
|
4
|
+
import { useHTableContext } from "../../context";
|
|
5
|
+
import {useClassName} from "../../hooks";
|
|
6
|
+
interface IProps {
|
|
7
|
+
headerTitle:HTableBodyProps["headerTitle"];
|
|
8
|
+
contentStyle?:React.CSSProperties;
|
|
9
|
+
rNode?:React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export default ({headerTitle,contentStyle,rNode}:IProps)=>{
|
|
12
|
+
const {
|
|
13
|
+
tableInstance,
|
|
14
|
+
selectedRowData,
|
|
15
|
+
rowOnChange,
|
|
16
|
+
allSelectChange,
|
|
17
|
+
} = useHTableContext();
|
|
18
|
+
const headerBox=useClassName('hw-table-header-title-box');
|
|
19
|
+
if (!headerTitle&&!rNode){
|
|
20
|
+
return null
|
|
21
|
+
}
|
|
22
|
+
return <Row justify={"space-between"} align={"middle"} style={contentStyle}>
|
|
23
|
+
<div className={headerBox}>
|
|
24
|
+
{headerTitle && React.cloneElement(
|
|
25
|
+
headerTitle as DetailedReactHTMLElement<any, any>,
|
|
26
|
+
{ selectedRowData, allSelectChange, rowOnChange, tableInstance }
|
|
27
|
+
)}
|
|
28
|
+
</div>
|
|
29
|
+
{rNode&&rNode}
|
|
30
|
+
</Row>
|
|
31
|
+
}
|
|
@@ -20,7 +20,6 @@ export default ({
|
|
|
20
20
|
columns,
|
|
21
21
|
onChange,
|
|
22
22
|
}: IProps) => {
|
|
23
|
-
const className = useClassName("hw-table-body-option");
|
|
24
23
|
const pointer = useClassName([
|
|
25
24
|
"hw-table-pointer",
|
|
26
25
|
"hw-table-body-option-icon",
|
|
@@ -59,7 +58,7 @@ export default ({
|
|
|
59
58
|
);
|
|
60
59
|
};
|
|
61
60
|
return (
|
|
62
|
-
<Row justify={"end"}
|
|
61
|
+
<Row justify={"end"} ref={ref}>
|
|
63
62
|
<Space size={20}>
|
|
64
63
|
{reload && (
|
|
65
64
|
<Tooltip title="刷新">
|
|
@@ -14,6 +14,7 @@ import AlertMsg from "./AlertMsg";
|
|
|
14
14
|
import type { HRowSelection } from "../modal";
|
|
15
15
|
import type { AffixProps } from "antd/lib/affix";
|
|
16
16
|
import Options from "./Options";
|
|
17
|
+
import HeaderTitle from './HeaderTitle';
|
|
17
18
|
export interface HTableBodyProps
|
|
18
19
|
extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection"> {
|
|
19
20
|
configData?: ConfigDataModal;
|
|
@@ -30,6 +31,8 @@ export interface HTableBodyProps
|
|
|
30
31
|
affixProps?: AffixProps | false;
|
|
31
32
|
goTop?: boolean;
|
|
32
33
|
optionsRender?: (node: React.ReactNode) => React.ReactNode;
|
|
34
|
+
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
35
|
+
|
|
33
36
|
}
|
|
34
37
|
const defaultRender = () => {
|
|
35
38
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
@@ -56,6 +59,7 @@ export default ({
|
|
|
56
59
|
goTop = true,
|
|
57
60
|
size,
|
|
58
61
|
optionsRender,
|
|
62
|
+
paginationActionRender,
|
|
59
63
|
...props
|
|
60
64
|
}: HTableBodyProps) => {
|
|
61
65
|
// @ts-ignore
|
|
@@ -97,19 +101,11 @@ export default ({
|
|
|
97
101
|
/>
|
|
98
102
|
);
|
|
99
103
|
const { keys = [], selectAll } = selectedRowData;
|
|
100
|
-
|
|
104
|
+
const defaultOptionsNode=optionsRender ? optionsRender(optionsNode) : optionsNode;
|
|
101
105
|
const alwaysShowAlert = keys.length > 0 || selectAll || configAlwaysShowAlert;
|
|
102
106
|
const className = useClassName("hw-table-body");
|
|
103
107
|
return (
|
|
104
108
|
<div style={tableStyle} className={`hw_table_body ${className}`}>
|
|
105
|
-
{headerTitle && (
|
|
106
|
-
<Row gutter={[0, 8]} style={contentStyle}>
|
|
107
|
-
{React.cloneElement(
|
|
108
|
-
headerTitle as DetailedReactHTMLElement<any, any>,
|
|
109
|
-
{ selectedRowData, allSelectChange, rowOnChange, tableInstance }
|
|
110
|
-
)}
|
|
111
|
-
</Row>
|
|
112
|
-
)}
|
|
113
109
|
{alwaysShowAlert && (
|
|
114
110
|
<div style={contentStyle}>
|
|
115
111
|
<Alert
|
|
@@ -118,7 +114,7 @@ export default ({
|
|
|
118
114
|
/>
|
|
119
115
|
</div>
|
|
120
116
|
)}
|
|
121
|
-
{
|
|
117
|
+
<HeaderTitle headerTitle={headerTitle} contentStyle={contentStyle} rNode={defaultOptionsNode}/>
|
|
122
118
|
<ConfigProvider
|
|
123
119
|
renderEmpty={() => {
|
|
124
120
|
if (error) {
|
|
@@ -132,6 +128,9 @@ export default ({
|
|
|
132
128
|
columns={cols as any}
|
|
133
129
|
size={cuSize}
|
|
134
130
|
search={false}
|
|
131
|
+
onChange={(pagination, filters, sorter)=>{
|
|
132
|
+
console.log(filters,sorter)
|
|
133
|
+
}}
|
|
135
134
|
options={false}
|
|
136
135
|
tableStyle={{
|
|
137
136
|
paddingBottom: 0,
|
|
@@ -148,6 +147,7 @@ export default ({
|
|
|
148
147
|
paginationStyle={paginationStyle}
|
|
149
148
|
affixProps={affixProps}
|
|
150
149
|
goTop={goTop}
|
|
150
|
+
actionRender={paginationActionRender}
|
|
151
151
|
{...pagination}
|
|
152
152
|
/>
|
|
153
153
|
)}
|
|
@@ -6,20 +6,23 @@ import { useClassName } from "../hooks";
|
|
|
6
6
|
import React, { useState } from "react";
|
|
7
7
|
import type { AffixProps } from "antd/lib/affix";
|
|
8
8
|
import GoTop from "../GoTop";
|
|
9
|
+
import {HTableInstance} from "../modal";
|
|
9
10
|
export interface IPaginationProps extends PaginationProps {
|
|
10
11
|
onPageChange?: (params: ParamsModal) => void;
|
|
11
12
|
paginationStyle?: React.CSSProperties;
|
|
12
13
|
affixProps?: AffixProps | false;
|
|
13
14
|
goTop?: boolean;
|
|
15
|
+
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
14
16
|
}
|
|
15
17
|
export default ({
|
|
16
18
|
onPageChange,
|
|
17
19
|
paginationStyle,
|
|
18
20
|
affixProps,
|
|
19
21
|
goTop,
|
|
22
|
+
actionRender,
|
|
20
23
|
...props
|
|
21
24
|
}: IPaginationProps) => {
|
|
22
|
-
const { onPageChange: contextOnPageChange, data } = useHTableContext();
|
|
25
|
+
const { onPageChange: contextOnPageChange, data,tableInstance } = useHTableContext();
|
|
23
26
|
const tableOnPageChange = onPageChange || contextOnPageChange;
|
|
24
27
|
const { size, current, total } = data || {};
|
|
25
28
|
const pageCurrent = Number.parseInt(current || "1", 10);
|
|
@@ -32,7 +35,10 @@ export default ({
|
|
|
32
35
|
}
|
|
33
36
|
if (affixProps === false) {
|
|
34
37
|
return (
|
|
35
|
-
<Row justify={"
|
|
38
|
+
<Row justify={"space-between"} align={"middle"} className={className} style={paginationStyle}>
|
|
39
|
+
<div>
|
|
40
|
+
{actionRender?.(tableInstance)}
|
|
41
|
+
</div>
|
|
36
42
|
<Pagination
|
|
37
43
|
size={"small"}
|
|
38
44
|
showQuickJumper={true}
|
|
@@ -67,10 +73,14 @@ export default ({
|
|
|
67
73
|
{...afProps}
|
|
68
74
|
>
|
|
69
75
|
<Row
|
|
70
|
-
justify={"
|
|
76
|
+
justify={"space-between"}
|
|
71
77
|
className={className}
|
|
78
|
+
align={"middle"}
|
|
72
79
|
style={{ ...paginationStyle, ...style }}
|
|
73
80
|
>
|
|
81
|
+
<div>
|
|
82
|
+
{actionRender?.(tableInstance)}
|
|
83
|
+
</div>
|
|
74
84
|
<Pagination
|
|
75
85
|
size={"small"}
|
|
76
86
|
showQuickJumper={true}
|
|
@@ -44,10 +44,6 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.@{ant-prefix}-hw-table-body-option{
|
|
48
|
-
padding: 0px 24px 16px 24px;
|
|
49
|
-
|
|
50
|
-
}
|
|
51
47
|
.@{ant-prefix}-hw-table-body-option-icon{
|
|
52
48
|
font-size: 16px;
|
|
53
49
|
}
|
|
@@ -84,4 +80,10 @@
|
|
|
84
80
|
color:#1890ff;
|
|
85
81
|
}
|
|
86
82
|
}
|
|
83
|
+
.@{ant-prefix}-hw-table-header-title-box{
|
|
84
|
+
flex: 1;
|
|
85
|
+
display: flex;
|
|
86
|
+
position: relative;
|
|
87
|
+
margin-right: 12px;
|
|
88
|
+
}
|
|
87
89
|
|
package/src/components/modal.ts
CHANGED
|
@@ -103,6 +103,7 @@ export interface HTableProps
|
|
|
103
103
|
goTop?: boolean;
|
|
104
104
|
optionsRender?: (node: React.ReactNode) => React.ReactNode;
|
|
105
105
|
onFinish?: (value: any) => Promise<any>;
|
|
106
|
+
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
106
107
|
}
|
|
107
108
|
export interface TableInstance {
|
|
108
109
|
reload: (params?: ParamsModal) => Promise<any>;
|
|
@@ -7,16 +7,11 @@ const configData = [
|
|
|
7
7
|
title: "座位21321",
|
|
8
8
|
showSearch: true,
|
|
9
9
|
searchType: "select",
|
|
10
|
-
hideInTable: true,
|
|
11
10
|
dataIndex: "name",
|
|
11
|
+
sorter: true,
|
|
12
12
|
itemProps: {
|
|
13
13
|
options: [{ label: "1", value: 1 }],
|
|
14
14
|
},
|
|
15
|
-
searchRender:(item,node,form,tableInstance)=>{
|
|
16
|
-
return <div onClick={()=>{
|
|
17
|
-
tableInstance.table.dispatch("test",{name:"111"})
|
|
18
|
-
}}>点击</div>
|
|
19
|
-
}
|
|
20
15
|
},
|
|
21
16
|
{
|
|
22
17
|
title: "座位断开",
|
|
@@ -69,36 +64,25 @@ export default () => {
|
|
|
69
64
|
configData={configData}
|
|
70
65
|
rowKey={"id"}
|
|
71
66
|
table={hTable}
|
|
72
|
-
optionsRender={(node) => {
|
|
73
|
-
return <Space>ffff{node}</Space>;
|
|
74
|
-
}}
|
|
75
67
|
action={{
|
|
76
68
|
test:(params)=>{
|
|
77
69
|
console.log(params,"lllll")
|
|
78
70
|
}
|
|
79
71
|
}}
|
|
80
72
|
rowSelection={{
|
|
81
|
-
alwaysShowAlert: true,
|
|
82
73
|
allPageCheck: false,
|
|
83
74
|
}}
|
|
84
75
|
affixProps={{
|
|
85
76
|
target: () => document.querySelector(".body"),
|
|
86
77
|
}}
|
|
87
|
-
actionRender={() => {
|
|
88
|
-
return (
|
|
89
|
-
<Button
|
|
90
|
-
onClick={() => {
|
|
91
|
-
console.log(hTable.table.settingKeys);
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
你大爷
|
|
95
|
-
</Button>
|
|
96
|
-
);
|
|
97
|
-
}}
|
|
98
78
|
scroll={{
|
|
99
79
|
x: 1000,
|
|
100
80
|
}}
|
|
101
81
|
headerTitle={<Button type={"primary"}>操作</Button>}
|
|
82
|
+
options={false}
|
|
83
|
+
paginationActionRender={()=>{
|
|
84
|
+
return <div>你大爷</div>
|
|
85
|
+
}}
|
|
102
86
|
request={(params) => {
|
|
103
87
|
console.log(params,".....");
|
|
104
88
|
const { current = 1 } = params;
|