@hw-component/table 1.9.15 → 1.9.18
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 -5
- 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 -5
- 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 +8 -4
- 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 +10 -6
- 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"],
|
|
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,13 @@ var Body = (function (bodyProps) {
|
|
|
56
56
|
localSorter = bodyProps.localSorter,
|
|
57
57
|
columnsState = bodyProps.columnsState,
|
|
58
58
|
tableExtraRender = bodyProps.tableExtraRender,
|
|
59
|
+
table = bodyProps.table,
|
|
59
60
|
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
60
61
|
var _ref = rowSelection || {},
|
|
61
62
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
62
63
|
configAlwaysShowAlert = _ref.alwaysShowAlert;
|
|
63
64
|
var _useHTableContext = useHTableContext(),
|
|
64
|
-
|
|
65
|
+
contextTableInstance = _useHTableContext.tableInstance,
|
|
65
66
|
contextConfigData = _useHTableContext.configData,
|
|
66
67
|
data = _useHTableContext.data,
|
|
67
68
|
selectedRowData = _useHTableContext.selectedRowData,
|
|
@@ -81,6 +82,7 @@ var Body = (function (bodyProps) {
|
|
|
81
82
|
var bodyConfigData = configData || contextConfigData;
|
|
82
83
|
var _ref2 = data || {},
|
|
83
84
|
records = _ref2.records;
|
|
85
|
+
var tableInstance = table || contextTableInstance;
|
|
84
86
|
var _useCols = useCols({
|
|
85
87
|
configData: bodyConfigData,
|
|
86
88
|
table: tableInstance,
|
|
@@ -154,11 +156,13 @@ var Body = (function (bodyProps) {
|
|
|
154
156
|
size: cuSize,
|
|
155
157
|
search: false,
|
|
156
158
|
onChange: function onChange(page, filters, sorter) {
|
|
157
|
-
|
|
159
|
+
var field = sorter.field,
|
|
160
|
+
order = sorter.order,
|
|
161
|
+
column = sorter.column;
|
|
162
|
+
var colSorter = column.sorter;
|
|
163
|
+
if (localSorter || typeof colSorter === "function") {
|
|
158
164
|
return;
|
|
159
165
|
}
|
|
160
|
-
var field = sorter.field,
|
|
161
|
-
order = sorter.order;
|
|
162
166
|
var orderByField = typeof order === "undefined" ? undefined : field;
|
|
163
167
|
var asc = typeof order === "undefined" ? undefined : order === "ascend";
|
|
164
168
|
tableInstance.table.reloadWithParams({
|
|
@@ -181,6 +185,7 @@ var Body = (function (bodyProps) {
|
|
|
181
185
|
paginationStyle: paginationStyle,
|
|
182
186
|
affixProps: affixProps,
|
|
183
187
|
goTop: goTop,
|
|
188
|
+
table: tableInstance,
|
|
184
189
|
actionRender: paginationActionRender
|
|
185
190
|
}, pagination))]
|
|
186
191
|
})]
|
|
@@ -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"],
|
|
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,13 @@ var Body = (function (bodyProps) {
|
|
|
59
59
|
localSorter = bodyProps.localSorter,
|
|
60
60
|
columnsState = bodyProps.columnsState,
|
|
61
61
|
tableExtraRender = bodyProps.tableExtraRender,
|
|
62
|
+
table = bodyProps.table,
|
|
62
63
|
props = _objectWithoutProperties(bodyProps, _excluded);
|
|
63
64
|
var _ref = rowSelection || {},
|
|
64
65
|
selectedRowKeys = _ref.selectedRowKeys,
|
|
65
66
|
configAlwaysShowAlert = _ref.alwaysShowAlert;
|
|
66
67
|
var _useHTableContext = context.useHTableContext(),
|
|
67
|
-
|
|
68
|
+
contextTableInstance = _useHTableContext.tableInstance,
|
|
68
69
|
contextConfigData = _useHTableContext.configData,
|
|
69
70
|
data = _useHTableContext.data,
|
|
70
71
|
selectedRowData = _useHTableContext.selectedRowData,
|
|
@@ -84,6 +85,7 @@ var Body = (function (bodyProps) {
|
|
|
84
85
|
var bodyConfigData = configData || contextConfigData;
|
|
85
86
|
var _ref2 = data || {},
|
|
86
87
|
records = _ref2.records;
|
|
88
|
+
var tableInstance = table || contextTableInstance;
|
|
87
89
|
var _useCols = hooks.useCols({
|
|
88
90
|
configData: bodyConfigData,
|
|
89
91
|
table: tableInstance,
|
|
@@ -157,11 +159,13 @@ var Body = (function (bodyProps) {
|
|
|
157
159
|
size: cuSize,
|
|
158
160
|
search: false,
|
|
159
161
|
onChange: function onChange(page, filters, sorter) {
|
|
160
|
-
|
|
162
|
+
var field = sorter.field,
|
|
163
|
+
order = sorter.order,
|
|
164
|
+
column = sorter.column;
|
|
165
|
+
var colSorter = column.sorter;
|
|
166
|
+
if (localSorter || typeof colSorter === "function") {
|
|
161
167
|
return;
|
|
162
168
|
}
|
|
163
|
-
var field = sorter.field,
|
|
164
|
-
order = sorter.order;
|
|
165
169
|
var orderByField = typeof order === "undefined" ? undefined : field;
|
|
166
170
|
var asc = typeof order === "undefined" ? undefined : order === "ascend";
|
|
167
171
|
tableInstance.table.reloadWithParams({
|
|
@@ -184,6 +188,7 @@ var Body = (function (bodyProps) {
|
|
|
184
188
|
paginationStyle: paginationStyle,
|
|
185
189
|
affixProps: affixProps,
|
|
186
190
|
goTop: goTop,
|
|
191
|
+
table: tableInstance,
|
|
187
192
|
actionRender: paginationActionRender
|
|
188
193
|
}, pagination))]
|
|
189
194
|
})]
|
|
@@ -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,13 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
76
77
|
localSorter,
|
|
77
78
|
columnsState,
|
|
78
79
|
tableExtraRender,
|
|
80
|
+
table,
|
|
79
81
|
...props
|
|
80
82
|
} = bodyProps;
|
|
81
83
|
const { selectedRowKeys, alwaysShowAlert: configAlwaysShowAlert } =
|
|
82
84
|
rowSelection || {};
|
|
83
85
|
const {
|
|
84
|
-
tableInstance,
|
|
86
|
+
tableInstance:contextTableInstance,
|
|
85
87
|
configData: contextConfigData,
|
|
86
88
|
data,
|
|
87
89
|
selectedRowData,
|
|
@@ -95,7 +97,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
95
97
|
const { cuSize, setCuSize } = useSize(size);
|
|
96
98
|
const bodyConfigData = configData || contextConfigData;
|
|
97
99
|
const { records } = data || {};
|
|
98
|
-
|
|
100
|
+
const tableInstance=table||contextTableInstance;
|
|
99
101
|
const { cols } = useCols({
|
|
100
102
|
configData: bodyConfigData,
|
|
101
103
|
table: tableInstance,
|
|
@@ -159,10 +161,11 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
159
161
|
size={cuSize}
|
|
160
162
|
search={false}
|
|
161
163
|
onChange={(page, filters, sorter) => {
|
|
162
|
-
|
|
164
|
+
const { field, order ,column} = sorter as any;
|
|
165
|
+
const {sorter:colSorter}=column;
|
|
166
|
+
if (localSorter||typeof colSorter==="function") {
|
|
163
167
|
return;
|
|
164
168
|
}
|
|
165
|
-
const { field, order } = sorter as any;
|
|
166
169
|
const orderByField =
|
|
167
170
|
typeof order === "undefined" ? undefined : field;
|
|
168
171
|
const asc =
|
|
@@ -189,6 +192,7 @@ export default (bodyProps: HTableBodyProps) => {
|
|
|
189
192
|
paginationStyle={paginationStyle}
|
|
190
193
|
affixProps={affixProps}
|
|
191
194
|
goTop={goTop}
|
|
195
|
+
table={tableInstance}
|
|
192
196
|
actionRender={paginationActionRender}
|
|
193
197
|
{...pagination}
|
|
194
198
|
/>
|
|
@@ -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}
|
|
@@ -56,10 +56,14 @@ export const configData = [
|
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
title: "
|
|
60
|
-
dataIndex: "
|
|
61
|
-
valueType: "tags",
|
|
59
|
+
title: "id",
|
|
60
|
+
dataIndex: "id",
|
|
62
61
|
width: 120,
|
|
62
|
+
sorter:(a, b) => {
|
|
63
|
+
const { id: aNum } = a;
|
|
64
|
+
const { id: bNum } = b;
|
|
65
|
+
return aNum - bNum;
|
|
66
|
+
}
|
|
63
67
|
},
|
|
64
68
|
{
|
|
65
69
|
title: "悠哉公众号openid",
|
|
@@ -115,12 +119,12 @@ export default () => {
|
|
|
115
119
|
const hTable = useHTable();
|
|
116
120
|
const { loading, data } = useRequest(() => {
|
|
117
121
|
const arrayData: any[] = [];
|
|
118
|
-
for (let i = 0; i <
|
|
122
|
+
for (let i = 0; i < 10; i = i + 1) {
|
|
119
123
|
arrayData.push({
|
|
120
124
|
id: i,
|
|
121
|
-
name: "
|
|
125
|
+
name: "仙人仙人",
|
|
122
126
|
mobileList: null,
|
|
123
|
-
mailList:
|
|
127
|
+
mailList: i,
|
|
124
128
|
openidList: ["okSMy58P_PE9sQkAG03gkpiTk-hs"],
|
|
125
129
|
dingdingList: [
|
|
126
130
|
{
|