@hw-component/table 1.10.52 → 1.10.53
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.js +10 -4
- package/es/HTableBody/modal.d.ts +2 -0
- package/es/HTableHeader/index.d.ts +1 -1
- package/es/HTableHeader/index.js +6 -3
- package/es/HTableHeader/modal.d.ts +1 -0
- package/es/HTablePagination/index.d.ts +2 -1
- package/es/HTablePagination/index.js +8 -5
- package/es/Table.d.ts +1 -1
- package/es/Table.js +14 -3
- package/es/modal.d.ts +4 -0
- package/lib/HTableBody/index.js +10 -4
- package/lib/HTableBody/modal.d.ts +2 -0
- package/lib/HTableHeader/index.d.ts +1 -1
- package/lib/HTableHeader/index.js +6 -3
- package/lib/HTableHeader/modal.d.ts +1 -0
- package/lib/HTablePagination/index.d.ts +2 -1
- package/lib/HTablePagination/index.js +8 -5
- package/lib/Table.d.ts +1 -1
- package/lib/Table.js +14 -3
- package/lib/modal.d.ts +4 -0
- package/package.json +1 -1
- package/src/components/HTableBody/index.tsx +5 -2
- package/src/components/HTableBody/modal.ts +2 -0
- package/src/components/HTableHeader/index.tsx +3 -2
- package/src/components/HTableHeader/modal.ts +1 -0
- package/src/components/HTablePagination/index.tsx +5 -3
- package/src/components/Table.tsx +10 -1
- package/src/components/modal.ts +4 -0
- package/src/pages/Table/index.tsx +0 -1
package/es/HTableBody/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
|
|
|
9
9
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
10
10
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
12
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
14
|
import ProTable from '@ant-design/pro-table';
|
|
14
15
|
import { useSize, useSynchronousKeys, useAlwaysShowAlert, useTableChange } from './hooks/useControl.js';
|
|
@@ -25,11 +26,12 @@ import { emptyDefaultRender, errorDefaultRender } from './defaultRender.js';
|
|
|
25
26
|
import useRowClassName from './hooks/useRowClassName.js';
|
|
26
27
|
import useColMk from './hooks/useColMk.js';
|
|
27
28
|
|
|
28
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange", "bordered", "rowClassName", "configItemRender"],
|
|
29
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange", "bordered", "rowClassName", "configItemRender", "className", "footerClassName"],
|
|
29
30
|
_excluded2 = ["value", "onChange", "resetCol", "dropChange"];
|
|
30
31
|
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; }
|
|
31
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
32
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
33
|
var Body = (function (bodyProps) {
|
|
34
|
+
var _context;
|
|
33
35
|
var configData = bodyProps.configData,
|
|
34
36
|
_bodyProps$pagination = bodyProps.pagination,
|
|
35
37
|
pagination = _bodyProps$pagination === void 0 ? {} : _bodyProps$pagination,
|
|
@@ -59,6 +61,9 @@ var Body = (function (bodyProps) {
|
|
|
59
61
|
bordered = bodyProps.bordered;
|
|
60
62
|
bodyProps.rowClassName;
|
|
61
63
|
var configItemRender = bodyProps.configItemRender,
|
|
64
|
+
className = bodyProps.className,
|
|
65
|
+
_bodyProps$footerClas = bodyProps.footerClassName,
|
|
66
|
+
footerClassName = _bodyProps$footerClas === void 0 ? "" : _bodyProps$footerClas,
|
|
62
67
|
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
63
68
|
var _ref = rowSelection || {},
|
|
64
69
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
@@ -128,7 +133,7 @@ var Body = (function (bodyProps) {
|
|
|
128
133
|
}));
|
|
129
134
|
var defaultOptionsNode = optionsRender ? optionsRender(optionsNode) : optionsNode;
|
|
130
135
|
var alwaysShowAlert = useAlwaysShowAlert(selectedRowData, configAlwaysShowAlert);
|
|
131
|
-
var
|
|
136
|
+
var bodyClassName = useClassName("hw-table-body");
|
|
132
137
|
var _useHTableConfigConte4 = useHTableConfigContext({
|
|
133
138
|
tableStyle: tableStyle
|
|
134
139
|
}),
|
|
@@ -142,7 +147,7 @@ var Body = (function (bodyProps) {
|
|
|
142
147
|
var rowClassNameFn = useRowClassName(bodyProps);
|
|
143
148
|
return jsx("div", {
|
|
144
149
|
style: defaultTableStyle,
|
|
145
|
-
className: "hw_table_body ".concat(className),
|
|
150
|
+
className: _concatInstanceProperty(_context = "hw_table_body ".concat(bodyClassName, " ")).call(_context, className),
|
|
146
151
|
children: jsxs(Space, {
|
|
147
152
|
size: 16,
|
|
148
153
|
direction: "vertical",
|
|
@@ -191,6 +196,7 @@ var Body = (function (bodyProps) {
|
|
|
191
196
|
}
|
|
192
197
|
}) : jsx(HTablePagination, _objectSpread({
|
|
193
198
|
onPageChange: onPageChange,
|
|
199
|
+
className: footerClassName,
|
|
194
200
|
paginationStyle: paginationStyle,
|
|
195
201
|
affixProps: affixProps,
|
|
196
202
|
goTop: goTop,
|
package/es/HTableBody/modal.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
26
26
|
table?: HTableInstance;
|
|
27
27
|
pagination?: IPaginationProps | false;
|
|
28
28
|
configItemRender?: (data: ConfigItemModal) => ConfigItemModal;
|
|
29
|
+
className?: string;
|
|
30
|
+
footerClassName?: string;
|
|
29
31
|
}
|
|
30
32
|
export interface RowRadioSelectionProps {
|
|
31
33
|
data: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IHeaderProps } from "./modal";
|
|
3
|
-
declare const _default: ({ searchSpan, headerStyle, initValues, onReset, ...props }: IHeaderProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ searchSpan, headerStyle, initValues, onReset, className, ...props }: IHeaderProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
package/es/HTableHeader/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
3
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
3
4
|
import { jsx } from 'react/jsx-runtime';
|
|
4
5
|
import { Card } from 'antd';
|
|
5
6
|
import { HForm } from '@hw-component/form';
|
|
@@ -9,7 +10,7 @@ import { HeaderProvider } from './Context.js';
|
|
|
9
10
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
10
11
|
import useHideMoreTitle from './hooks/useHideMoreTitle.js';
|
|
11
12
|
|
|
12
|
-
var _excluded = ["searchSpan", "headerStyle", "initValues", "onReset"];
|
|
13
|
+
var _excluded = ["searchSpan", "headerStyle", "initValues", "onReset", "className"];
|
|
13
14
|
var defaultSearchSpan = {
|
|
14
15
|
xxl: 4,
|
|
15
16
|
xl: 6,
|
|
@@ -18,11 +19,13 @@ var defaultSearchSpan = {
|
|
|
18
19
|
sm: 24
|
|
19
20
|
};
|
|
20
21
|
var Header = (function (_ref) {
|
|
22
|
+
var _context;
|
|
21
23
|
var _ref$searchSpan = _ref.searchSpan,
|
|
22
24
|
searchSpan = _ref$searchSpan === void 0 ? defaultSearchSpan : _ref$searchSpan,
|
|
23
25
|
headerStyle = _ref.headerStyle,
|
|
24
26
|
initValues = _ref.initValues,
|
|
25
27
|
onReset = _ref.onReset,
|
|
28
|
+
className = _ref.className,
|
|
26
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
30
|
var _useHeaderDefaultProp = useHeaderDefaultProps(props),
|
|
28
31
|
tableLabelWidth = _useHeaderDefaultProp.tableLabelWidth,
|
|
@@ -37,7 +40,7 @@ var Header = (function (_ref) {
|
|
|
37
40
|
configData: headerConfigData,
|
|
38
41
|
table: tableInstance
|
|
39
42
|
});
|
|
40
|
-
var
|
|
43
|
+
var defaultClassName = useClassName("hw-table-header");
|
|
41
44
|
var _useHTableConfigConte = useHTableConfigContext({
|
|
42
45
|
headerStyle: headerStyle
|
|
43
46
|
}),
|
|
@@ -45,7 +48,7 @@ var Header = (function (_ref) {
|
|
|
45
48
|
return jsx(Card, {
|
|
46
49
|
style: defaultHeaderStyle,
|
|
47
50
|
bordered: false,
|
|
48
|
-
className: "hw_table_header ".concat(className),
|
|
51
|
+
className: _concatInstanceProperty(_context = "hw_table_header ".concat(defaultClassName, " ")).call(_context, className),
|
|
49
52
|
bodyStyle: {
|
|
50
53
|
paddingBottom: 0
|
|
51
54
|
},
|
|
@@ -11,6 +11,7 @@ export interface IPaginationProps extends Omit<PaginationProps, "showTotal"> {
|
|
|
11
11
|
table?: HTableInstance;
|
|
12
12
|
showTotal?: false | PaginationProps["showTotal"];
|
|
13
13
|
data?: Record<string, any>;
|
|
14
|
+
className?: string;
|
|
14
15
|
}
|
|
15
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, showTotal, data, ...props }: IPaginationProps) => JSX.Element;
|
|
16
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, showTotal, data, className, ...props }: IPaginationProps) => JSX.Element;
|
|
16
17
|
export default _default;
|
|
@@ -20,10 +20,10 @@ import { useState } from 'react';
|
|
|
20
20
|
import GoTop from '../GoTop/index.js';
|
|
21
21
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
22
22
|
|
|
23
|
-
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table", "showTotal", "data"],
|
|
23
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table", "showTotal", "data", "className"],
|
|
24
24
|
_excluded2 = ["offsetBottom"];
|
|
25
25
|
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; }
|
|
26
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
26
|
+
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; }
|
|
27
27
|
var defaultShowTotal = function defaultShowTotal(totalNum, _ref) {
|
|
28
28
|
var _context, _context2;
|
|
29
29
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -32,6 +32,7 @@ var defaultShowTotal = function defaultShowTotal(totalNum, _ref) {
|
|
|
32
32
|
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\u7B2C".concat(showCurrent, "-")).call(_context2, showCurrentEnd, "/\u603B\u5171")).call(_context, totalNum, "\u6761");
|
|
33
33
|
};
|
|
34
34
|
var HTablePagination = (function (_ref3) {
|
|
35
|
+
var _context4;
|
|
35
36
|
var onPageChange = _ref3.onPageChange,
|
|
36
37
|
paginationStyle = _ref3.paginationStyle,
|
|
37
38
|
affixProps = _ref3.affixProps,
|
|
@@ -41,6 +42,7 @@ var HTablePagination = (function (_ref3) {
|
|
|
41
42
|
_ref3$showTotal = _ref3.showTotal,
|
|
42
43
|
showTotal = _ref3$showTotal === void 0 ? defaultShowTotal : _ref3$showTotal,
|
|
43
44
|
data = _ref3.data,
|
|
45
|
+
className = _ref3.className,
|
|
44
46
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
45
47
|
var _useHTableContext = useHTableContext(),
|
|
46
48
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
@@ -60,7 +62,7 @@ var HTablePagination = (function (_ref3) {
|
|
|
60
62
|
var pageCurrent = _Number$parseInt(current || "1", 10);
|
|
61
63
|
var pageSize = _Number$parseInt(size || "10", 10);
|
|
62
64
|
var pageTotal = _Number$parseInt(total || "0", 10);
|
|
63
|
-
var
|
|
65
|
+
var footerClassName = useClassName("hw-table-pagination");
|
|
64
66
|
var _useState = useState({}),
|
|
65
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
66
68
|
style = _useState2[0],
|
|
@@ -70,10 +72,11 @@ var HTablePagination = (function (_ref3) {
|
|
|
70
72
|
return jsx(Fragment, {});
|
|
71
73
|
}
|
|
72
74
|
if (affixProps === false) {
|
|
75
|
+
var _context3;
|
|
73
76
|
return jsxs(Row, {
|
|
74
77
|
justify: "space-between",
|
|
75
78
|
align: "middle",
|
|
76
|
-
className: className,
|
|
79
|
+
className: _concatInstanceProperty(_context3 = "".concat(footerClassName, " ")).call(_context3, className),
|
|
77
80
|
style: defaultPaginationStyle,
|
|
78
81
|
children: [jsx("div", {
|
|
79
82
|
children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
|
|
@@ -112,7 +115,7 @@ var HTablePagination = (function (_ref3) {
|
|
|
112
115
|
}, afProps), {}, {
|
|
113
116
|
children: jsxs(Row, {
|
|
114
117
|
justify: "space-between",
|
|
115
|
-
className: className,
|
|
118
|
+
className: _concatInstanceProperty(_context4 = "".concat(footerClassName, " ")).call(_context4, className),
|
|
116
119
|
align: "middle",
|
|
117
120
|
style: _objectSpread(_objectSpread({}, defaultPaginationStyle), style),
|
|
118
121
|
children: [jsx("div", {
|
package/es/Table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HTableProps } from "./modal";
|
|
3
|
-
declare const _default: ({ request, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, onReset, style, dataSource, reload, loading: propsLoading, error: propsError, rowSelection, defaultHeaderOpen, ...props }: HTableProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ request, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, onReset, style, dataSource, reload, loading: propsLoading, error: propsError, rowSelection, defaultHeaderOpen, headerClassName, bodyClassName, onOpenChange, ...props }: HTableProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
package/es/Table.js
CHANGED
|
@@ -22,7 +22,7 @@ import { useState } from 'react';
|
|
|
22
22
|
import { useClassName } from './hooks/index.js';
|
|
23
23
|
import Index from './TableProvider.js';
|
|
24
24
|
|
|
25
|
-
var _excluded = ["request", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "onReset", "style", "dataSource", "reload", "loading", "error", "rowSelection", "defaultHeaderOpen"];
|
|
25
|
+
var _excluded = ["request", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "onReset", "style", "dataSource", "reload", "loading", "error", "rowSelection", "defaultHeaderOpen", "headerClassName", "bodyClassName", "onOpenChange"];
|
|
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 _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
28
|
var Table = (function (_ref) {
|
|
@@ -52,6 +52,11 @@ var Table = (function (_ref) {
|
|
|
52
52
|
propsError = _ref.error,
|
|
53
53
|
rowSelection = _ref.rowSelection,
|
|
54
54
|
defaultHeaderOpen = _ref.defaultHeaderOpen,
|
|
55
|
+
_ref$headerClassName = _ref.headerClassName,
|
|
56
|
+
headerClassName = _ref$headerClassName === void 0 ? "" : _ref$headerClassName,
|
|
57
|
+
_ref$bodyClassName = _ref.bodyClassName,
|
|
58
|
+
bodyClassName = _ref$bodyClassName === void 0 ? "" : _ref$bodyClassName,
|
|
59
|
+
onOpenChange = _ref.onOpenChange,
|
|
55
60
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
61
|
var _useReq = useReq({
|
|
57
62
|
request: request,
|
|
@@ -104,6 +109,10 @@ var Table = (function (_ref) {
|
|
|
104
109
|
dataSource: data
|
|
105
110
|
});
|
|
106
111
|
var contentClassName = useClassName("hw-table-content");
|
|
112
|
+
var setHeaderOpen = function setHeaderOpen(open) {
|
|
113
|
+
setOpen(open);
|
|
114
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
|
|
115
|
+
};
|
|
107
116
|
return jsx(Index, _objectSpread(_objectSpread({}, props), {}, {
|
|
108
117
|
tableInstance: tableInstance,
|
|
109
118
|
onFinish: function onFinish(value) {
|
|
@@ -126,7 +135,7 @@ var Table = (function (_ref) {
|
|
|
126
135
|
setSelectedRowData: setSelectedRowData,
|
|
127
136
|
rowKey: rowKey,
|
|
128
137
|
headerOpen: open,
|
|
129
|
-
setHeaderOpen:
|
|
138
|
+
setHeaderOpen: setHeaderOpen,
|
|
130
139
|
rowSelection: rowSelection,
|
|
131
140
|
children: jsxs("div", {
|
|
132
141
|
style: _objectSpread({}, style),
|
|
@@ -136,12 +145,14 @@ var Table = (function (_ref) {
|
|
|
136
145
|
headerStyle: headerStyle,
|
|
137
146
|
onFinish: onFinish,
|
|
138
147
|
initValues: formInitValues,
|
|
139
|
-
onReset: onReset
|
|
148
|
+
onReset: onReset,
|
|
149
|
+
className: headerClassName
|
|
140
150
|
}), jsx(Body, _objectSpread({
|
|
141
151
|
tableStyle: hideHeader ? _objectSpread({
|
|
142
152
|
paddingTop: 24
|
|
143
153
|
}, tableStyle) : tableStyle,
|
|
144
154
|
paginationStyle: paginationStyle,
|
|
155
|
+
className: bodyClassName,
|
|
145
156
|
rowKey: rowKey,
|
|
146
157
|
rowSelection: rowSelection
|
|
147
158
|
}, props))]
|
package/es/modal.d.ts
CHANGED
|
@@ -89,6 +89,10 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
89
89
|
options?: OptionModal | false;
|
|
90
90
|
pagination?: IPaginationProps | false;
|
|
91
91
|
defaultHeaderOpen?: boolean;
|
|
92
|
+
headerClassName?: string;
|
|
93
|
+
bodyClassName?: string;
|
|
94
|
+
footerClassName?: string;
|
|
95
|
+
onOpenChange?: (open: boolean) => void;
|
|
92
96
|
}
|
|
93
97
|
interface ColCheckResultKeys {
|
|
94
98
|
keys?: string[];
|
package/lib/HTableBody/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
|
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
14
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
15
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
15
16
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
17
|
var ProTable = require('@ant-design/pro-table');
|
|
17
18
|
var useControl = require('./hooks/useControl.js');
|
|
@@ -28,11 +29,12 @@ var defaultRender = require('./defaultRender.js');
|
|
|
28
29
|
var useRowClassName = require('./hooks/useRowClassName.js');
|
|
29
30
|
var useColMk = require('./hooks/useColMk.js');
|
|
30
31
|
|
|
31
|
-
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange", "bordered", "rowClassName", "configItemRender"],
|
|
32
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange", "bordered", "rowClassName", "configItemRender", "className", "footerClassName"],
|
|
32
33
|
_excluded2 = ["value", "onChange", "resetCol", "dropChange"];
|
|
33
34
|
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; }
|
|
34
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
36
|
var Body = (function (bodyProps) {
|
|
37
|
+
var _context;
|
|
36
38
|
var configData = bodyProps.configData,
|
|
37
39
|
_bodyProps$pagination = bodyProps.pagination,
|
|
38
40
|
pagination = _bodyProps$pagination === void 0 ? {} : _bodyProps$pagination,
|
|
@@ -62,6 +64,9 @@ var Body = (function (bodyProps) {
|
|
|
62
64
|
bordered = bodyProps.bordered;
|
|
63
65
|
bodyProps.rowClassName;
|
|
64
66
|
var configItemRender = bodyProps.configItemRender,
|
|
67
|
+
className = bodyProps.className,
|
|
68
|
+
_bodyProps$footerClas = bodyProps.footerClassName,
|
|
69
|
+
footerClassName = _bodyProps$footerClas === void 0 ? "" : _bodyProps$footerClas,
|
|
65
70
|
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
66
71
|
var _ref = rowSelection || {},
|
|
67
72
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
@@ -131,7 +136,7 @@ var Body = (function (bodyProps) {
|
|
|
131
136
|
}));
|
|
132
137
|
var defaultOptionsNode = optionsRender ? optionsRender(optionsNode) : optionsNode;
|
|
133
138
|
var alwaysShowAlert = useControl.useAlwaysShowAlert(selectedRowData, configAlwaysShowAlert);
|
|
134
|
-
var
|
|
139
|
+
var bodyClassName = index$1.useClassName("hw-table-body");
|
|
135
140
|
var _useHTableConfigConte4 = TableConfig.useHTableConfigContext({
|
|
136
141
|
tableStyle: tableStyle
|
|
137
142
|
}),
|
|
@@ -145,7 +150,7 @@ var Body = (function (bodyProps) {
|
|
|
145
150
|
var rowClassNameFn = useRowClassName.default(bodyProps);
|
|
146
151
|
return jsxRuntime.jsx("div", {
|
|
147
152
|
style: defaultTableStyle,
|
|
148
|
-
className: "hw_table_body ".concat(className),
|
|
153
|
+
className: _concatInstanceProperty(_context = "hw_table_body ".concat(bodyClassName, " ")).call(_context, className),
|
|
149
154
|
children: jsxRuntime.jsxs(antd.Space, {
|
|
150
155
|
size: 16,
|
|
151
156
|
direction: "vertical",
|
|
@@ -194,6 +199,7 @@ var Body = (function (bodyProps) {
|
|
|
194
199
|
}
|
|
195
200
|
}) : jsxRuntime.jsx(index$3.default, _objectSpread({
|
|
196
201
|
onPageChange: onPageChange,
|
|
202
|
+
className: footerClassName,
|
|
197
203
|
paginationStyle: paginationStyle,
|
|
198
204
|
affixProps: affixProps,
|
|
199
205
|
goTop: goTop,
|
|
@@ -26,6 +26,8 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
26
26
|
table?: HTableInstance;
|
|
27
27
|
pagination?: IPaginationProps | false;
|
|
28
28
|
configItemRender?: (data: ConfigItemModal) => ConfigItemModal;
|
|
29
|
+
className?: string;
|
|
30
|
+
footerClassName?: string;
|
|
29
31
|
}
|
|
30
32
|
export interface RowRadioSelectionProps {
|
|
31
33
|
data: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IHeaderProps } from "./modal";
|
|
3
|
-
declare const _default: ({ searchSpan, headerStyle, initValues, onReset, ...props }: IHeaderProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ searchSpan, headerStyle, initValues, onReset, className, ...props }: IHeaderProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
6
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var antd = require('antd');
|
|
8
9
|
var form = require('@hw-component/form');
|
|
@@ -12,7 +13,7 @@ var Context = require('./Context.js');
|
|
|
12
13
|
var TableConfig = require('../TableConfig.js');
|
|
13
14
|
var useHideMoreTitle = require('./hooks/useHideMoreTitle.js');
|
|
14
15
|
|
|
15
|
-
var _excluded = ["searchSpan", "headerStyle", "initValues", "onReset"];
|
|
16
|
+
var _excluded = ["searchSpan", "headerStyle", "initValues", "onReset", "className"];
|
|
16
17
|
var defaultSearchSpan = {
|
|
17
18
|
xxl: 4,
|
|
18
19
|
xl: 6,
|
|
@@ -21,11 +22,13 @@ var defaultSearchSpan = {
|
|
|
21
22
|
sm: 24
|
|
22
23
|
};
|
|
23
24
|
var Header = (function (_ref) {
|
|
25
|
+
var _context;
|
|
24
26
|
var _ref$searchSpan = _ref.searchSpan,
|
|
25
27
|
searchSpan = _ref$searchSpan === void 0 ? defaultSearchSpan : _ref$searchSpan,
|
|
26
28
|
headerStyle = _ref.headerStyle,
|
|
27
29
|
initValues = _ref.initValues,
|
|
28
30
|
onReset = _ref.onReset,
|
|
31
|
+
className = _ref.className,
|
|
29
32
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
33
|
var _useHeaderDefaultProp = useHeaderDefaultProps.default(props),
|
|
31
34
|
tableLabelWidth = _useHeaderDefaultProp.tableLabelWidth,
|
|
@@ -40,7 +43,7 @@ var Header = (function (_ref) {
|
|
|
40
43
|
configData: headerConfigData,
|
|
41
44
|
table: tableInstance
|
|
42
45
|
});
|
|
43
|
-
var
|
|
46
|
+
var defaultClassName = index.useClassName("hw-table-header");
|
|
44
47
|
var _useHTableConfigConte = TableConfig.useHTableConfigContext({
|
|
45
48
|
headerStyle: headerStyle
|
|
46
49
|
}),
|
|
@@ -48,7 +51,7 @@ var Header = (function (_ref) {
|
|
|
48
51
|
return jsxRuntime.jsx(antd.Card, {
|
|
49
52
|
style: defaultHeaderStyle,
|
|
50
53
|
bordered: false,
|
|
51
|
-
className: "hw_table_header ".concat(className),
|
|
54
|
+
className: _concatInstanceProperty(_context = "hw_table_header ".concat(defaultClassName, " ")).call(_context, className),
|
|
52
55
|
bodyStyle: {
|
|
53
56
|
paddingBottom: 0
|
|
54
57
|
},
|
|
@@ -11,6 +11,7 @@ export interface IPaginationProps extends Omit<PaginationProps, "showTotal"> {
|
|
|
11
11
|
table?: HTableInstance;
|
|
12
12
|
showTotal?: false | PaginationProps["showTotal"];
|
|
13
13
|
data?: Record<string, any>;
|
|
14
|
+
className?: string;
|
|
14
15
|
}
|
|
15
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, showTotal, data, ...props }: IPaginationProps) => JSX.Element;
|
|
16
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, showTotal, data, className, ...props }: IPaginationProps) => JSX.Element;
|
|
16
17
|
export default _default;
|
|
@@ -23,10 +23,10 @@ var React = require('react');
|
|
|
23
23
|
var index$1 = require('../GoTop/index.js');
|
|
24
24
|
var TableConfig = require('../TableConfig.js');
|
|
25
25
|
|
|
26
|
-
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table", "showTotal", "data"],
|
|
26
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table", "showTotal", "data", "className"],
|
|
27
27
|
_excluded2 = ["offsetBottom"];
|
|
28
28
|
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; }
|
|
29
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
29
|
+
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; }
|
|
30
30
|
var defaultShowTotal = function defaultShowTotal(totalNum, _ref) {
|
|
31
31
|
var _context, _context2;
|
|
32
32
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -35,6 +35,7 @@ var defaultShowTotal = function defaultShowTotal(totalNum, _ref) {
|
|
|
35
35
|
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\u7B2C".concat(showCurrent, "-")).call(_context2, showCurrentEnd, "/\u603B\u5171")).call(_context, totalNum, "\u6761");
|
|
36
36
|
};
|
|
37
37
|
var HTablePagination = (function (_ref3) {
|
|
38
|
+
var _context4;
|
|
38
39
|
var onPageChange = _ref3.onPageChange,
|
|
39
40
|
paginationStyle = _ref3.paginationStyle,
|
|
40
41
|
affixProps = _ref3.affixProps,
|
|
@@ -44,6 +45,7 @@ var HTablePagination = (function (_ref3) {
|
|
|
44
45
|
_ref3$showTotal = _ref3.showTotal,
|
|
45
46
|
showTotal = _ref3$showTotal === void 0 ? defaultShowTotal : _ref3$showTotal,
|
|
46
47
|
data = _ref3.data,
|
|
48
|
+
className = _ref3.className,
|
|
47
49
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
48
50
|
var _useHTableContext = context.useHTableContext(),
|
|
49
51
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
@@ -63,7 +65,7 @@ var HTablePagination = (function (_ref3) {
|
|
|
63
65
|
var pageCurrent = _Number$parseInt(current || "1", 10);
|
|
64
66
|
var pageSize = _Number$parseInt(size || "10", 10);
|
|
65
67
|
var pageTotal = _Number$parseInt(total || "0", 10);
|
|
66
|
-
var
|
|
68
|
+
var footerClassName = index.useClassName("hw-table-pagination");
|
|
67
69
|
var _useState = React.useState({}),
|
|
68
70
|
_useState2 = _slicedToArray(_useState, 2),
|
|
69
71
|
style = _useState2[0],
|
|
@@ -73,10 +75,11 @@ var HTablePagination = (function (_ref3) {
|
|
|
73
75
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
74
76
|
}
|
|
75
77
|
if (affixProps === false) {
|
|
78
|
+
var _context3;
|
|
76
79
|
return jsxRuntime.jsxs(antd.Row, {
|
|
77
80
|
justify: "space-between",
|
|
78
81
|
align: "middle",
|
|
79
|
-
className: className,
|
|
82
|
+
className: _concatInstanceProperty(_context3 = "".concat(footerClassName, " ")).call(_context3, className),
|
|
80
83
|
style: defaultPaginationStyle,
|
|
81
84
|
children: [jsxRuntime.jsx("div", {
|
|
82
85
|
children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
|
|
@@ -115,7 +118,7 @@ var HTablePagination = (function (_ref3) {
|
|
|
115
118
|
}, afProps), {}, {
|
|
116
119
|
children: jsxRuntime.jsxs(antd.Row, {
|
|
117
120
|
justify: "space-between",
|
|
118
|
-
className: className,
|
|
121
|
+
className: _concatInstanceProperty(_context4 = "".concat(footerClassName, " ")).call(_context4, className),
|
|
119
122
|
align: "middle",
|
|
120
123
|
style: _objectSpread(_objectSpread({}, defaultPaginationStyle), style),
|
|
121
124
|
children: [jsxRuntime.jsx("div", {
|
package/lib/Table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HTableProps } from "./modal";
|
|
3
|
-
declare const _default: ({ request, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, onReset, style, dataSource, reload, loading: propsLoading, error: propsError, rowSelection, defaultHeaderOpen, ...props }: HTableProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ request, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, onReset, style, dataSource, reload, loading: propsLoading, error: propsError, rowSelection, defaultHeaderOpen, headerClassName, bodyClassName, onOpenChange, ...props }: HTableProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
package/lib/Table.js
CHANGED
|
@@ -25,7 +25,7 @@ var React = require('react');
|
|
|
25
25
|
var index = require('./hooks/index.js');
|
|
26
26
|
var TableProvider = require('./TableProvider.js');
|
|
27
27
|
|
|
28
|
-
var _excluded = ["request", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "onReset", "style", "dataSource", "reload", "loading", "error", "rowSelection", "defaultHeaderOpen"];
|
|
28
|
+
var _excluded = ["request", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "onReset", "style", "dataSource", "reload", "loading", "error", "rowSelection", "defaultHeaderOpen", "headerClassName", "bodyClassName", "onOpenChange"];
|
|
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 _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
31
|
var Table = (function (_ref) {
|
|
@@ -55,6 +55,11 @@ var Table = (function (_ref) {
|
|
|
55
55
|
propsError = _ref.error,
|
|
56
56
|
rowSelection = _ref.rowSelection,
|
|
57
57
|
defaultHeaderOpen = _ref.defaultHeaderOpen,
|
|
58
|
+
_ref$headerClassName = _ref.headerClassName,
|
|
59
|
+
headerClassName = _ref$headerClassName === void 0 ? "" : _ref$headerClassName,
|
|
60
|
+
_ref$bodyClassName = _ref.bodyClassName,
|
|
61
|
+
bodyClassName = _ref$bodyClassName === void 0 ? "" : _ref$bodyClassName,
|
|
62
|
+
onOpenChange = _ref.onOpenChange,
|
|
58
63
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
59
64
|
var _useReq = useReq.default({
|
|
60
65
|
request: request,
|
|
@@ -107,6 +112,10 @@ var Table = (function (_ref) {
|
|
|
107
112
|
dataSource: data
|
|
108
113
|
});
|
|
109
114
|
var contentClassName = index.useClassName("hw-table-content");
|
|
115
|
+
var setHeaderOpen = function setHeaderOpen(open) {
|
|
116
|
+
setOpen(open);
|
|
117
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
|
|
118
|
+
};
|
|
110
119
|
return jsxRuntime.jsx(TableProvider.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
111
120
|
tableInstance: tableInstance,
|
|
112
121
|
onFinish: function onFinish(value) {
|
|
@@ -129,7 +138,7 @@ var Table = (function (_ref) {
|
|
|
129
138
|
setSelectedRowData: setSelectedRowData,
|
|
130
139
|
rowKey: rowKey,
|
|
131
140
|
headerOpen: open,
|
|
132
|
-
setHeaderOpen:
|
|
141
|
+
setHeaderOpen: setHeaderOpen,
|
|
133
142
|
rowSelection: rowSelection,
|
|
134
143
|
children: jsxRuntime.jsxs("div", {
|
|
135
144
|
style: _objectSpread({}, style),
|
|
@@ -139,12 +148,14 @@ var Table = (function (_ref) {
|
|
|
139
148
|
headerStyle: headerStyle,
|
|
140
149
|
onFinish: onFinish,
|
|
141
150
|
initValues: formInitValues,
|
|
142
|
-
onReset: onReset
|
|
151
|
+
onReset: onReset,
|
|
152
|
+
className: headerClassName
|
|
143
153
|
}), jsxRuntime.jsx(index$2.default, _objectSpread({
|
|
144
154
|
tableStyle: hideHeader ? _objectSpread({
|
|
145
155
|
paddingTop: 24
|
|
146
156
|
}, tableStyle) : tableStyle,
|
|
147
157
|
paginationStyle: paginationStyle,
|
|
158
|
+
className: bodyClassName,
|
|
148
159
|
rowKey: rowKey,
|
|
149
160
|
rowSelection: rowSelection
|
|
150
161
|
}, props))]
|
package/lib/modal.d.ts
CHANGED
|
@@ -89,6 +89,10 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
89
89
|
options?: OptionModal | false;
|
|
90
90
|
pagination?: IPaginationProps | false;
|
|
91
91
|
defaultHeaderOpen?: boolean;
|
|
92
|
+
headerClassName?: string;
|
|
93
|
+
bodyClassName?: string;
|
|
94
|
+
footerClassName?: string;
|
|
95
|
+
onOpenChange?: (open: boolean) => void;
|
|
92
96
|
}
|
|
93
97
|
interface ColCheckResultKeys {
|
|
94
98
|
keys?: string[];
|
package/package.json
CHANGED
|
@@ -47,6 +47,8 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
47
47
|
bordered,
|
|
48
48
|
rowClassName = "",
|
|
49
49
|
configItemRender,
|
|
50
|
+
className,
|
|
51
|
+
footerClassName="",
|
|
50
52
|
...props
|
|
51
53
|
} = bodyProps;
|
|
52
54
|
|
|
@@ -122,7 +124,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
122
124
|
selectedRowData,
|
|
123
125
|
configAlwaysShowAlert
|
|
124
126
|
);
|
|
125
|
-
const
|
|
127
|
+
const bodyClassName = useClassName("hw-table-body");
|
|
126
128
|
const { tableStyle: defaultTableStyle } = useHTableConfigContext({
|
|
127
129
|
tableStyle,
|
|
128
130
|
});
|
|
@@ -134,7 +136,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
134
136
|
});
|
|
135
137
|
const rowClassNameFn = useRowClassName(bodyProps);
|
|
136
138
|
return (
|
|
137
|
-
<div style={defaultTableStyle} className={`hw_table_body ${className}`}>
|
|
139
|
+
<div style={defaultTableStyle} className={`hw_table_body ${bodyClassName} ${className}`}>
|
|
138
140
|
<Space size={16} direction={"vertical"} style={{ width: "100%" }}>
|
|
139
141
|
{tableExtraRender ? tableExtraRender(props, records || []) : null}
|
|
140
142
|
{alwaysShowAlert && (
|
|
@@ -178,6 +180,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
178
180
|
) : (
|
|
179
181
|
<HTablePagination
|
|
180
182
|
onPageChange={onPageChange}
|
|
183
|
+
className={footerClassName}
|
|
181
184
|
paginationStyle={paginationStyle}
|
|
182
185
|
affixProps={affixProps}
|
|
183
186
|
goTop={goTop}
|
|
@@ -40,6 +40,8 @@ export interface HTableBodyProps
|
|
|
40
40
|
table?: HTableInstance;
|
|
41
41
|
pagination?: IPaginationProps | false;
|
|
42
42
|
configItemRender?: (data: ConfigItemModal) => ConfigItemModal;
|
|
43
|
+
className?: string;
|
|
44
|
+
footerClassName?: string;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface RowRadioSelectionProps {
|
|
@@ -20,6 +20,7 @@ export default ({
|
|
|
20
20
|
headerStyle,
|
|
21
21
|
initValues,
|
|
22
22
|
onReset,
|
|
23
|
+
className,
|
|
23
24
|
...props
|
|
24
25
|
}: IHeaderProps) => {
|
|
25
26
|
const {
|
|
@@ -36,7 +37,7 @@ export default ({
|
|
|
36
37
|
configData: headerConfigData,
|
|
37
38
|
table: tableInstance,
|
|
38
39
|
});
|
|
39
|
-
const
|
|
40
|
+
const defaultClassName = useClassName("hw-table-header");
|
|
40
41
|
const { headerStyle: defaultHeaderStyle } = useHTableConfigContext({
|
|
41
42
|
headerStyle,
|
|
42
43
|
});
|
|
@@ -44,7 +45,7 @@ export default ({
|
|
|
44
45
|
<Card
|
|
45
46
|
style={defaultHeaderStyle}
|
|
46
47
|
bordered={false}
|
|
47
|
-
className={`hw_table_header ${className}`}
|
|
48
|
+
className={`hw_table_header ${defaultClassName} ${className}`}
|
|
48
49
|
bodyStyle={{ paddingBottom: 0 }}
|
|
49
50
|
>
|
|
50
51
|
<HeaderProvider value={{ onReset }}>
|
|
@@ -17,6 +17,7 @@ export interface IPaginationProps extends Omit<PaginationProps, "showTotal"> {
|
|
|
17
17
|
table?: HTableInstance;
|
|
18
18
|
showTotal?: false | PaginationProps["showTotal"];
|
|
19
19
|
data?: Record<string, any>;
|
|
20
|
+
className?: string;
|
|
20
21
|
}
|
|
21
22
|
const defaultShowTotal = (totalNum: number, [showCurrent, showCurrentEnd]) => {
|
|
22
23
|
return `第${showCurrent}-${showCurrentEnd}/总共${totalNum}条`;
|
|
@@ -30,6 +31,7 @@ export default ({
|
|
|
30
31
|
table,
|
|
31
32
|
showTotal = defaultShowTotal,
|
|
32
33
|
data,
|
|
34
|
+
className,
|
|
33
35
|
...props
|
|
34
36
|
}: IPaginationProps) => {
|
|
35
37
|
const {
|
|
@@ -47,7 +49,7 @@ export default ({
|
|
|
47
49
|
const pageCurrent = Number.parseInt(current || "1", 10);
|
|
48
50
|
const pageSize = Number.parseInt(size || "10", 10);
|
|
49
51
|
const pageTotal = Number.parseInt(total || "0", 10);
|
|
50
|
-
const
|
|
52
|
+
const footerClassName = useClassName("hw-table-pagination");
|
|
51
53
|
const [style, setStyle] = useState({});
|
|
52
54
|
const cuShowTotal = showTotal === false ? undefined : showTotal;
|
|
53
55
|
if (!cuData) {
|
|
@@ -58,7 +60,7 @@ export default ({
|
|
|
58
60
|
<Row
|
|
59
61
|
justify={"space-between"}
|
|
60
62
|
align={"middle"}
|
|
61
|
-
className={className}
|
|
63
|
+
className={`${footerClassName} ${className}`}
|
|
62
64
|
style={defaultPaginationStyle}
|
|
63
65
|
>
|
|
64
66
|
<div>{actionRender?.(tableInstance)}</div>
|
|
@@ -95,7 +97,7 @@ export default ({
|
|
|
95
97
|
>
|
|
96
98
|
<Row
|
|
97
99
|
justify={"space-between"}
|
|
98
|
-
className={className}
|
|
100
|
+
className={`${footerClassName} ${className}`}
|
|
99
101
|
align={"middle"}
|
|
100
102
|
style={{ ...defaultPaginationStyle, ...style }}
|
|
101
103
|
>
|
package/src/components/Table.tsx
CHANGED
|
@@ -32,6 +32,9 @@ export default ({
|
|
|
32
32
|
error: propsError,
|
|
33
33
|
rowSelection,
|
|
34
34
|
defaultHeaderOpen,
|
|
35
|
+
headerClassName="",
|
|
36
|
+
bodyClassName="",
|
|
37
|
+
onOpenChange,
|
|
35
38
|
...props
|
|
36
39
|
}: HTableProps) => {
|
|
37
40
|
const { run, loading, data, error, saveParams } = useReq({
|
|
@@ -82,6 +85,10 @@ export default ({
|
|
|
82
85
|
dataSource: data,
|
|
83
86
|
});
|
|
84
87
|
const contentClassName = useClassName("hw-table-content");
|
|
88
|
+
const setHeaderOpen = (open)=>{
|
|
89
|
+
setOpen(open);
|
|
90
|
+
onOpenChange?.(open);
|
|
91
|
+
}
|
|
85
92
|
return (
|
|
86
93
|
<TableProvider
|
|
87
94
|
{...props}
|
|
@@ -103,7 +110,7 @@ export default ({
|
|
|
103
110
|
setSelectedRowData={setSelectedRowData}
|
|
104
111
|
rowKey={rowKey}
|
|
105
112
|
headerOpen={open}
|
|
106
|
-
setHeaderOpen={
|
|
113
|
+
setHeaderOpen={setHeaderOpen}
|
|
107
114
|
rowSelection={rowSelection}
|
|
108
115
|
>
|
|
109
116
|
<div style={{ ...style }} className={`${contentClassName} ${className}`}>
|
|
@@ -114,6 +121,7 @@ export default ({
|
|
|
114
121
|
onFinish={onFinish}
|
|
115
122
|
initValues={formInitValues}
|
|
116
123
|
onReset={onReset}
|
|
124
|
+
className={headerClassName}
|
|
117
125
|
/>
|
|
118
126
|
)}
|
|
119
127
|
<Body
|
|
@@ -121,6 +129,7 @@ export default ({
|
|
|
121
129
|
hideHeader ? { paddingTop: 24, ...tableStyle } : tableStyle
|
|
122
130
|
}
|
|
123
131
|
paginationStyle={paginationStyle}
|
|
132
|
+
className={bodyClassName}
|
|
124
133
|
rowKey={rowKey}
|
|
125
134
|
rowSelection={rowSelection}
|
|
126
135
|
{...props}
|
package/src/components/modal.ts
CHANGED
|
@@ -122,6 +122,10 @@ export interface HTableProps
|
|
|
122
122
|
options?: OptionModal | false;
|
|
123
123
|
pagination?: IPaginationProps | false;
|
|
124
124
|
defaultHeaderOpen?: boolean;
|
|
125
|
+
headerClassName?: string;
|
|
126
|
+
bodyClassName?: string;
|
|
127
|
+
footerClassName?: string;
|
|
128
|
+
onOpenChange?: (open:boolean) => void;
|
|
125
129
|
}
|
|
126
130
|
interface ColCheckResultKeys {
|
|
127
131
|
keys?: string[];
|