@hw-component/table 1.9.16 → 1.9.20
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 +1 -0
- package/es/HTableBody/index.js +10 -4
- package/es/HTableHeader/index.d.ts +2 -1
- package/es/HTableHeader/index.js +7 -4
- package/es/HTablePagination/index.d.ts +2 -1
- package/es/HTablePagination/index.js +4 -2
- package/es/TableCustomize.js +6 -2
- package/lib/HTableBody/index.d.ts +1 -0
- package/lib/HTableBody/index.js +10 -4
- package/lib/HTableHeader/index.d.ts +2 -1
- package/lib/HTableHeader/index.js +7 -4
- package/lib/HTablePagination/index.d.ts +2 -1
- package/lib/HTablePagination/index.js +4 -2
- package/lib/TableCustomize.js +6 -2
- package/package.json +1 -1
- package/src/components/HTableBody/index.tsx +10 -5
- package/src/components/HTableHeader/index.tsx +6 -3
- package/src/components/HTablePagination/index.tsx +4 -2
- package/src/components/TableCustomize.tsx +4 -0
- package/src/pages/Table/index.tsx +3 -0
- package/src/pages/TableCustomize/index.tsx +0 -2
package/es/HTableBody/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
21
21
|
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
22
22
|
localSorter?: boolean;
|
|
23
23
|
options?: OptionModal | false;
|
|
24
|
+
table?: HTableInstance;
|
|
24
25
|
}
|
|
25
26
|
declare const _default: (bodyProps: HTableBodyProps) => JSX.Element;
|
|
26
27
|
export default _default;
|
package/es/HTableBody/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import AlertMsg from './AlertMsg.js';
|
|
|
22
22
|
import Options from './Options/index.js';
|
|
23
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", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender"],
|
|
25
|
+
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender", "table", "onChange"],
|
|
26
26
|
_excluded2 = ["value", "onChange", "reset"];
|
|
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; }
|
|
@@ -56,12 +56,14 @@ var Body = (function (bodyProps) {
|
|
|
56
56
|
localSorter = bodyProps.localSorter,
|
|
57
57
|
columnsState = bodyProps.columnsState,
|
|
58
58
|
tableExtraRender = bodyProps.tableExtraRender,
|
|
59
|
+
table = bodyProps.table,
|
|
60
|
+
tableOnchange = bodyProps.onChange,
|
|
59
61
|
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
60
62
|
var _ref = rowSelection || {},
|
|
61
63
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
62
64
|
configAlwaysShowAlert = _ref.alwaysShowAlert;
|
|
63
65
|
var _useHTableContext = useHTableContext(),
|
|
64
|
-
|
|
66
|
+
contextTableInstance = _useHTableContext.tableInstance,
|
|
65
67
|
contextConfigData = _useHTableContext.configData,
|
|
66
68
|
data = _useHTableContext.data,
|
|
67
69
|
selectedRowData = _useHTableContext.selectedRowData,
|
|
@@ -81,6 +83,7 @@ var Body = (function (bodyProps) {
|
|
|
81
83
|
var bodyConfigData = configData || contextConfigData;
|
|
82
84
|
var _ref2 = data || {},
|
|
83
85
|
records = _ref2.records;
|
|
86
|
+
var tableInstance = table || contextTableInstance;
|
|
84
87
|
var _useCols = useCols({
|
|
85
88
|
configData: bodyConfigData,
|
|
86
89
|
table: tableInstance,
|
|
@@ -153,7 +156,10 @@ var Body = (function (bodyProps) {
|
|
|
153
156
|
columns: cols,
|
|
154
157
|
size: cuSize,
|
|
155
158
|
search: false,
|
|
156
|
-
onChange: function onChange(page, filters, sorter) {
|
|
159
|
+
onChange: function onChange(page, filters, sorter, extra) {
|
|
160
|
+
if (tableOnchange) {
|
|
161
|
+
return tableOnchange(page, filters, sorter, extra);
|
|
162
|
+
}
|
|
157
163
|
var field = sorter.field,
|
|
158
164
|
order = sorter.order,
|
|
159
165
|
column = sorter.column;
|
|
@@ -161,7 +167,6 @@ var Body = (function (bodyProps) {
|
|
|
161
167
|
if (localSorter || typeof colSorter === "function") {
|
|
162
168
|
return;
|
|
163
169
|
}
|
|
164
|
-
console.log(sorter);
|
|
165
170
|
var orderByField = typeof order === "undefined" ? undefined : field;
|
|
166
171
|
var asc = typeof order === "undefined" ? undefined : order === "ascend";
|
|
167
172
|
tableInstance.table.reloadWithParams({
|
|
@@ -184,6 +189,7 @@ var Body = (function (bodyProps) {
|
|
|
184
189
|
paginationStyle: paginationStyle,
|
|
185
190
|
affixProps: affixProps,
|
|
186
191
|
goTop: goTop,
|
|
192
|
+
table: tableInstance,
|
|
187
193
|
actionRender: paginationActionRender
|
|
188
194
|
}, pagination))]
|
|
189
195
|
})]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { IHeaderProps } from "./modal";
|
|
2
|
-
declare const _default: ({ configData, onFinish, searchSpan, headerStyle, initValues, hideLabel, labelWidth, onReset, }: IHeaderProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ configData, onFinish, searchSpan, headerStyle, initValues, hideLabel, labelWidth, onReset, table, loading, }: IHeaderProps) => JSX.Element;
|
|
3
4
|
export default _default;
|
package/es/HTableHeader/index.js
CHANGED
|
@@ -24,14 +24,17 @@ var Header = (function (_ref) {
|
|
|
24
24
|
initValues = _ref.initValues,
|
|
25
25
|
hideLabel = _ref.hideLabel,
|
|
26
26
|
labelWidth = _ref.labelWidth,
|
|
27
|
-
onReset = _ref.onReset
|
|
27
|
+
onReset = _ref.onReset,
|
|
28
|
+
table = _ref.table,
|
|
29
|
+
loading = _ref.loading;
|
|
28
30
|
var _useHTableContext = useHTableContext(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
contextTableInstance = _useHTableContext.tableInstance,
|
|
32
|
+
contextLoading = _useHTableContext.loading,
|
|
31
33
|
contextOnFinish = _useHTableContext.onFinish,
|
|
32
34
|
contextConfigData = _useHTableContext.configData,
|
|
33
35
|
contextHideLabel = _useHTableContext.hideLabel,
|
|
34
36
|
contextLabelWidth = _useHTableContext.labelWidth;
|
|
37
|
+
var tableInstance = table || contextTableInstance;
|
|
35
38
|
var headerConfigData = configData || contextConfigData;
|
|
36
39
|
var form = tableInstance.form;
|
|
37
40
|
var subOnFinish = onFinish || contextOnFinish;
|
|
@@ -61,7 +64,7 @@ var Header = (function (_ref) {
|
|
|
61
64
|
children: jsx(HForm, {
|
|
62
65
|
itemSpan: searchSpan,
|
|
63
66
|
onFinish: subOnFinish,
|
|
64
|
-
submitLoading: loading,
|
|
67
|
+
submitLoading: contextLoading || loading,
|
|
65
68
|
dismissOnPressEnter: false,
|
|
66
69
|
gutter: [20, 0],
|
|
67
70
|
initialValues: initValues,
|
|
@@ -8,6 +8,7 @@ export interface IPaginationProps extends PaginationProps {
|
|
|
8
8
|
affixProps?: AffixProps | false;
|
|
9
9
|
goTop?: boolean;
|
|
10
10
|
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
11
|
+
table?: HTableInstance;
|
|
11
12
|
}
|
|
12
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, ...props }: IPaginationProps) => JSX.Element;
|
|
13
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, ...props }: IPaginationProps) => JSX.Element;
|
|
13
14
|
export default _default;
|
|
@@ -20,7 +20,7 @@ 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"],
|
|
23
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table"],
|
|
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
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; }
|
|
@@ -30,15 +30,17 @@ var HTablePagination = (function (_ref) {
|
|
|
30
30
|
affixProps = _ref.affixProps,
|
|
31
31
|
goTop = _ref.goTop,
|
|
32
32
|
actionRender = _ref.actionRender,
|
|
33
|
+
table = _ref.table,
|
|
33
34
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
35
|
var _useHTableContext = useHTableContext(),
|
|
35
36
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
36
37
|
data = _useHTableContext.data,
|
|
37
|
-
|
|
38
|
+
contextTableInstance = _useHTableContext.tableInstance;
|
|
38
39
|
var _useHTableConfigConte = useHTableConfigContext({
|
|
39
40
|
paginationStyle: paginationStyle
|
|
40
41
|
}),
|
|
41
42
|
defaultPaginationStyle = _useHTableConfigConte.paginationStyle;
|
|
43
|
+
var tableInstance = table || contextTableInstance;
|
|
42
44
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
43
45
|
var _ref2 = data || {},
|
|
44
46
|
size = _ref2.size,
|
package/es/TableCustomize.js
CHANGED
|
@@ -18,7 +18,7 @@ import useReq from './hooks/useReq.js';
|
|
|
18
18
|
import useDispatch from './hooks/useDispatch.js';
|
|
19
19
|
import { useState } from 'react';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["request", "configData", "table", "action", "children", "rowKey"];
|
|
21
|
+
var _excluded = ["request", "configData", "table", "action", "children", "rowKey", "hideLabel", "labelWidth"];
|
|
22
22
|
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; }
|
|
23
23
|
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; }
|
|
24
24
|
var Index = function Index(_ref) {
|
|
@@ -29,6 +29,8 @@ var Index = function Index(_ref) {
|
|
|
29
29
|
action = _ref$action === void 0 ? {} : _ref$action,
|
|
30
30
|
children = _ref.children,
|
|
31
31
|
rowKey = _ref.rowKey,
|
|
32
|
+
hideLabel = _ref.hideLabel,
|
|
33
|
+
labelWidth = _ref.labelWidth,
|
|
32
34
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
35
|
var _useReq = useReq(_objectSpread({
|
|
34
36
|
request: request
|
|
@@ -89,7 +91,9 @@ var Index = function Index(_ref) {
|
|
|
89
91
|
setSelectedRowData: setSelectedRowData,
|
|
90
92
|
rowKey: rowKey,
|
|
91
93
|
headerOpen: open,
|
|
92
|
-
setHeaderOpen: setOpen
|
|
94
|
+
setHeaderOpen: setOpen,
|
|
95
|
+
hideLabel: hideLabel,
|
|
96
|
+
labelWidth: labelWidth
|
|
93
97
|
},
|
|
94
98
|
children: children
|
|
95
99
|
});
|
|
@@ -21,6 +21,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
21
21
|
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
22
22
|
localSorter?: boolean;
|
|
23
23
|
options?: OptionModal | false;
|
|
24
|
+
table?: HTableInstance;
|
|
24
25
|
}
|
|
25
26
|
declare const _default: (bodyProps: HTableBodyProps) => JSX.Element;
|
|
26
27
|
export default _default;
|
package/lib/HTableBody/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var AlertMsg = require('./AlertMsg.js');
|
|
|
25
25
|
var index = require('./Options/index.js');
|
|
26
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", "paginationActionRender", "localSorter", "columnsState", "tableExtraRender"],
|
|
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"],
|
|
29
29
|
_excluded2 = ["value", "onChange", "reset"];
|
|
30
30
|
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
31
|
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; }
|
|
@@ -59,12 +59,14 @@ var Body = (function (bodyProps) {
|
|
|
59
59
|
localSorter = bodyProps.localSorter,
|
|
60
60
|
columnsState = bodyProps.columnsState,
|
|
61
61
|
tableExtraRender = bodyProps.tableExtraRender,
|
|
62
|
+
table = bodyProps.table,
|
|
63
|
+
tableOnchange = bodyProps.onChange,
|
|
62
64
|
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
63
65
|
var _ref = rowSelection || {},
|
|
64
66
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
65
67
|
configAlwaysShowAlert = _ref.alwaysShowAlert;
|
|
66
68
|
var _useHTableContext = context.useHTableContext(),
|
|
67
|
-
|
|
69
|
+
contextTableInstance = _useHTableContext.tableInstance,
|
|
68
70
|
contextConfigData = _useHTableContext.configData,
|
|
69
71
|
data = _useHTableContext.data,
|
|
70
72
|
selectedRowData = _useHTableContext.selectedRowData,
|
|
@@ -84,6 +86,7 @@ var Body = (function (bodyProps) {
|
|
|
84
86
|
var bodyConfigData = configData || contextConfigData;
|
|
85
87
|
var _ref2 = data || {},
|
|
86
88
|
records = _ref2.records;
|
|
89
|
+
var tableInstance = table || contextTableInstance;
|
|
87
90
|
var _useCols = hooks.useCols({
|
|
88
91
|
configData: bodyConfigData,
|
|
89
92
|
table: tableInstance,
|
|
@@ -156,7 +159,10 @@ var Body = (function (bodyProps) {
|
|
|
156
159
|
columns: cols,
|
|
157
160
|
size: cuSize,
|
|
158
161
|
search: false,
|
|
159
|
-
onChange: function onChange(page, filters, sorter) {
|
|
162
|
+
onChange: function onChange(page, filters, sorter, extra) {
|
|
163
|
+
if (tableOnchange) {
|
|
164
|
+
return tableOnchange(page, filters, sorter, extra);
|
|
165
|
+
}
|
|
160
166
|
var field = sorter.field,
|
|
161
167
|
order = sorter.order,
|
|
162
168
|
column = sorter.column;
|
|
@@ -164,7 +170,6 @@ var Body = (function (bodyProps) {
|
|
|
164
170
|
if (localSorter || typeof colSorter === "function") {
|
|
165
171
|
return;
|
|
166
172
|
}
|
|
167
|
-
console.log(sorter);
|
|
168
173
|
var orderByField = typeof order === "undefined" ? undefined : field;
|
|
169
174
|
var asc = typeof order === "undefined" ? undefined : order === "ascend";
|
|
170
175
|
tableInstance.table.reloadWithParams({
|
|
@@ -187,6 +192,7 @@ var Body = (function (bodyProps) {
|
|
|
187
192
|
paginationStyle: paginationStyle,
|
|
188
193
|
affixProps: affixProps,
|
|
189
194
|
goTop: goTop,
|
|
195
|
+
table: tableInstance,
|
|
190
196
|
actionRender: paginationActionRender
|
|
191
197
|
}, pagination))]
|
|
192
198
|
})]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { IHeaderProps } from "./modal";
|
|
2
|
-
declare const _default: ({ configData, onFinish, searchSpan, headerStyle, initValues, hideLabel, labelWidth, onReset, }: IHeaderProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ configData, onFinish, searchSpan, headerStyle, initValues, hideLabel, labelWidth, onReset, table, loading, }: IHeaderProps) => JSX.Element;
|
|
3
4
|
export default _default;
|
|
@@ -27,14 +27,17 @@ var Header = (function (_ref) {
|
|
|
27
27
|
initValues = _ref.initValues,
|
|
28
28
|
hideLabel = _ref.hideLabel,
|
|
29
29
|
labelWidth = _ref.labelWidth,
|
|
30
|
-
onReset = _ref.onReset
|
|
30
|
+
onReset = _ref.onReset,
|
|
31
|
+
table = _ref.table,
|
|
32
|
+
loading = _ref.loading;
|
|
31
33
|
var _useHTableContext = context.useHTableContext(),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
contextTableInstance = _useHTableContext.tableInstance,
|
|
35
|
+
contextLoading = _useHTableContext.loading,
|
|
34
36
|
contextOnFinish = _useHTableContext.onFinish,
|
|
35
37
|
contextConfigData = _useHTableContext.configData,
|
|
36
38
|
contextHideLabel = _useHTableContext.hideLabel,
|
|
37
39
|
contextLabelWidth = _useHTableContext.labelWidth;
|
|
40
|
+
var tableInstance = table || contextTableInstance;
|
|
38
41
|
var headerConfigData = configData || contextConfigData;
|
|
39
42
|
var form$1 = tableInstance.form;
|
|
40
43
|
var subOnFinish = onFinish || contextOnFinish;
|
|
@@ -64,7 +67,7 @@ var Header = (function (_ref) {
|
|
|
64
67
|
children: jsxRuntime.jsx(form.HForm, {
|
|
65
68
|
itemSpan: searchSpan,
|
|
66
69
|
onFinish: subOnFinish,
|
|
67
|
-
submitLoading: loading,
|
|
70
|
+
submitLoading: contextLoading || loading,
|
|
68
71
|
dismissOnPressEnter: false,
|
|
69
72
|
gutter: [20, 0],
|
|
70
73
|
initialValues: initValues,
|
|
@@ -8,6 +8,7 @@ export interface IPaginationProps extends PaginationProps {
|
|
|
8
8
|
affixProps?: AffixProps | false;
|
|
9
9
|
goTop?: boolean;
|
|
10
10
|
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
11
|
+
table?: HTableInstance;
|
|
11
12
|
}
|
|
12
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, ...props }: IPaginationProps) => JSX.Element;
|
|
13
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, ...props }: IPaginationProps) => JSX.Element;
|
|
13
14
|
export default _default;
|
|
@@ -23,7 +23,7 @@ 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"],
|
|
26
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table"],
|
|
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
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; }
|
|
@@ -33,15 +33,17 @@ var HTablePagination = (function (_ref) {
|
|
|
33
33
|
affixProps = _ref.affixProps,
|
|
34
34
|
goTop = _ref.goTop,
|
|
35
35
|
actionRender = _ref.actionRender,
|
|
36
|
+
table = _ref.table,
|
|
36
37
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
38
|
var _useHTableContext = context.useHTableContext(),
|
|
38
39
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
39
40
|
data = _useHTableContext.data,
|
|
40
|
-
|
|
41
|
+
contextTableInstance = _useHTableContext.tableInstance;
|
|
41
42
|
var _useHTableConfigConte = TableConfig.useHTableConfigContext({
|
|
42
43
|
paginationStyle: paginationStyle
|
|
43
44
|
}),
|
|
44
45
|
defaultPaginationStyle = _useHTableConfigConte.paginationStyle;
|
|
46
|
+
var tableInstance = table || contextTableInstance;
|
|
45
47
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
46
48
|
var _ref2 = data || {},
|
|
47
49
|
size = _ref2.size,
|
package/lib/TableCustomize.js
CHANGED
|
@@ -21,7 +21,7 @@ var useReq = require('./hooks/useReq.js');
|
|
|
21
21
|
var useDispatch = require('./hooks/useDispatch.js');
|
|
22
22
|
var React = require('react');
|
|
23
23
|
|
|
24
|
-
var _excluded = ["request", "configData", "table", "action", "children", "rowKey"];
|
|
24
|
+
var _excluded = ["request", "configData", "table", "action", "children", "rowKey", "hideLabel", "labelWidth"];
|
|
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
26
|
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; }
|
|
27
27
|
var Index = function Index(_ref) {
|
|
@@ -32,6 +32,8 @@ var Index = function Index(_ref) {
|
|
|
32
32
|
action = _ref$action === void 0 ? {} : _ref$action,
|
|
33
33
|
children = _ref.children,
|
|
34
34
|
rowKey = _ref.rowKey,
|
|
35
|
+
hideLabel = _ref.hideLabel,
|
|
36
|
+
labelWidth = _ref.labelWidth,
|
|
35
37
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
38
|
var _useReq = useReq.default(_objectSpread({
|
|
37
39
|
request: request
|
|
@@ -92,7 +94,9 @@ var Index = function Index(_ref) {
|
|
|
92
94
|
setSelectedRowData: setSelectedRowData,
|
|
93
95
|
rowKey: rowKey,
|
|
94
96
|
headerOpen: open,
|
|
95
|
-
setHeaderOpen: setOpen
|
|
97
|
+
setHeaderOpen: setOpen,
|
|
98
|
+
hideLabel: hideLabel,
|
|
99
|
+
labelWidth: labelWidth
|
|
96
100
|
},
|
|
97
101
|
children: children
|
|
98
102
|
});
|
package/package.json
CHANGED
|
@@ -50,6 +50,7 @@ export interface HTableBodyProps
|
|
|
50
50
|
paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
51
51
|
localSorter?: boolean;
|
|
52
52
|
options?: OptionModal | false;
|
|
53
|
+
table?:HTableInstance
|
|
53
54
|
}
|
|
54
55
|
const defaultRender = () => {
|
|
55
56
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
@@ -76,12 +77,14 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
76
77
|
localSorter,
|
|
77
78
|
columnsState,
|
|
78
79
|
tableExtraRender,
|
|
80
|
+
table,
|
|
81
|
+
onChange:tableOnchange,
|
|
79
82
|
...props
|
|
80
83
|
} = bodyProps;
|
|
81
84
|
const { selectedRowKeys, alwaysShowAlert: configAlwaysShowAlert } =
|
|
82
85
|
rowSelection || {};
|
|
83
86
|
const {
|
|
84
|
-
tableInstance,
|
|
87
|
+
tableInstance:contextTableInstance,
|
|
85
88
|
configData: contextConfigData,
|
|
86
89
|
data,
|
|
87
90
|
selectedRowData,
|
|
@@ -95,7 +98,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
95
98
|
const { cuSize, setCuSize } = useSize(size);
|
|
96
99
|
const bodyConfigData = configData || contextConfigData;
|
|
97
100
|
const { records } = data || {};
|
|
98
|
-
|
|
101
|
+
const tableInstance=table||contextTableInstance;
|
|
99
102
|
const { cols } = useCols({
|
|
100
103
|
configData: bodyConfigData,
|
|
101
104
|
table: tableInstance,
|
|
@@ -158,14 +161,15 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
158
161
|
columns={cols as any}
|
|
159
162
|
size={cuSize}
|
|
160
163
|
search={false}
|
|
161
|
-
onChange={(page, filters, sorter) => {
|
|
164
|
+
onChange={(page, filters, sorter,extra) => {
|
|
165
|
+
if (tableOnchange){
|
|
166
|
+
return tableOnchange(page,filters,sorter,extra);
|
|
167
|
+
}
|
|
162
168
|
const { field, order ,column} = sorter as any;
|
|
163
169
|
const {sorter:colSorter}=column;
|
|
164
170
|
if (localSorter||typeof colSorter==="function") {
|
|
165
171
|
return;
|
|
166
172
|
}
|
|
167
|
-
|
|
168
|
-
console.log(sorter)
|
|
169
173
|
const orderByField =
|
|
170
174
|
typeof order === "undefined" ? undefined : field;
|
|
171
175
|
const asc =
|
|
@@ -192,6 +196,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
192
196
|
paginationStyle={paginationStyle}
|
|
193
197
|
affixProps={affixProps}
|
|
194
198
|
goTop={goTop}
|
|
199
|
+
table={tableInstance}
|
|
195
200
|
actionRender={paginationActionRender}
|
|
196
201
|
{...pagination}
|
|
197
202
|
/>
|
|
@@ -24,15 +24,18 @@ export default ({
|
|
|
24
24
|
hideLabel,
|
|
25
25
|
labelWidth,
|
|
26
26
|
onReset,
|
|
27
|
+
table,
|
|
28
|
+
loading,
|
|
27
29
|
}: IHeaderProps) => {
|
|
28
30
|
const {
|
|
29
|
-
tableInstance,
|
|
30
|
-
loading,
|
|
31
|
+
tableInstance:contextTableInstance,
|
|
32
|
+
loading:contextLoading,
|
|
31
33
|
onFinish: contextOnFinish,
|
|
32
34
|
configData: contextConfigData,
|
|
33
35
|
hideLabel: contextHideLabel,
|
|
34
36
|
labelWidth: contextLabelWidth,
|
|
35
37
|
} = useHTableContext();
|
|
38
|
+
const tableInstance=table||contextTableInstance;
|
|
36
39
|
const headerConfigData = configData || contextConfigData;
|
|
37
40
|
const { form } = tableInstance;
|
|
38
41
|
const subOnFinish = onFinish || contextOnFinish;
|
|
@@ -59,7 +62,7 @@ export default ({
|
|
|
59
62
|
<HForm
|
|
60
63
|
itemSpan={searchSpan}
|
|
61
64
|
onFinish={subOnFinish}
|
|
62
|
-
submitLoading={loading}
|
|
65
|
+
submitLoading={contextLoading||loading}
|
|
63
66
|
dismissOnPressEnter={false}
|
|
64
67
|
gutter={[20, 0]}
|
|
65
68
|
initialValues={initValues}
|
|
@@ -13,6 +13,7 @@ export interface IPaginationProps extends PaginationProps {
|
|
|
13
13
|
affixProps?: AffixProps | false;
|
|
14
14
|
goTop?: boolean;
|
|
15
15
|
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
16
|
+
table?:HTableInstance
|
|
16
17
|
}
|
|
17
18
|
export default ({
|
|
18
19
|
onPageChange,
|
|
@@ -20,17 +21,18 @@ export default ({
|
|
|
20
21
|
affixProps,
|
|
21
22
|
goTop,
|
|
22
23
|
actionRender,
|
|
24
|
+
table,
|
|
23
25
|
...props
|
|
24
26
|
}: IPaginationProps) => {
|
|
25
27
|
const {
|
|
26
28
|
onPageChange: contextOnPageChange,
|
|
27
29
|
data,
|
|
28
|
-
tableInstance,
|
|
30
|
+
tableInstance:contextTableInstance,
|
|
29
31
|
} = useHTableContext();
|
|
30
32
|
const { paginationStyle: defaultPaginationStyle } = useHTableConfigContext({
|
|
31
33
|
paginationStyle,
|
|
32
34
|
});
|
|
33
|
-
|
|
35
|
+
const tableInstance=table||contextTableInstance;
|
|
34
36
|
const tableOnPageChange = onPageChange || contextOnPageChange;
|
|
35
37
|
const { size, current, total } = data || {};
|
|
36
38
|
const pageCurrent = Number.parseInt(current || "1", 10);
|
|
@@ -13,6 +13,8 @@ const Index: React.FC<HTableProps> = ({
|
|
|
13
13
|
action = {},
|
|
14
14
|
children,
|
|
15
15
|
rowKey,
|
|
16
|
+
hideLabel,
|
|
17
|
+
labelWidth,
|
|
16
18
|
...props
|
|
17
19
|
}) => {
|
|
18
20
|
const { run, loading, data, error, saveParams } = useReq({
|
|
@@ -64,6 +66,8 @@ const Index: React.FC<HTableProps> = ({
|
|
|
64
66
|
rowKey,
|
|
65
67
|
headerOpen: open,
|
|
66
68
|
setHeaderOpen: setOpen,
|
|
69
|
+
hideLabel,
|
|
70
|
+
labelWidth,
|
|
67
71
|
}}
|
|
68
72
|
>
|
|
69
73
|
{children}
|