@hi-ui/table 5.0.0-experimental.4 → 5.0.0
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/CHANGELOG.md +101 -173
- package/lib/cjs/SettingDrawer.js +12 -9
- package/lib/cjs/hooks/use-async-switch.js +18 -21
- package/lib/cjs/hooks/use-col-width.js +2 -1
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -1
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -1
- package/lib/cjs/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.development.js +1 -1
- package/lib/cjs/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.production.min.js +1 -1
- package/lib/cjs/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/index.js +3 -3
- package/lib/esm/SettingDrawer.js +12 -9
- package/lib/esm/hooks/use-async-switch.js +18 -21
- package/lib/esm/hooks/use-col-width.js +2 -1
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -1
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -1
- package/lib/esm/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.development.js +1 -1
- package/lib/esm/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.production.min.js +1 -1
- package/lib/esm/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/index.js +3 -3
- package/lib/types/Table.d.ts +4 -4
- package/lib/types/TableColumnMenu.d.ts +1 -1
- package/lib/types/TbodyContent.d.ts +3 -3
- package/lib/types/context.d.ts +54 -54
- package/lib/types/hooks/use-async-switch.d.ts +3 -3
- package/lib/types/hooks/use-check.d.ts +2 -2
- package/lib/types/hooks/use-col-frozen.d.ts +1 -1
- package/lib/types/hooks/use-col-hidden.d.ts +3 -2
- package/lib/types/hooks/use-col-set.d.ts +1 -1
- package/lib/types/hooks/use-col-sorter.d.ts +2 -1
- package/lib/types/hooks/use-col-width.d.ts +1 -1
- package/lib/types/hooks/use-embed-expand.d.ts +1 -1
- package/lib/types/hooks/use-expand.d.ts +2 -2
- package/lib/types/hooks/use-pagination.d.ts +2 -2
- package/lib/types/types.d.ts +12 -12
- package/lib/types/use-table.d.ts +8 -8
- package/package.json +37 -37
|
@@ -52,56 +52,53 @@ var useAsyncSwitch = function useAsyncSwitch(_ref) {
|
|
|
52
52
|
addLoadingIds = _useCheckState.add,
|
|
53
53
|
removeLoadingIds = _useCheckState.remove;
|
|
54
54
|
var onExpandLatest = useLatestCallback(onExpand);
|
|
55
|
-
var onNodeSwitch = useCallback(function (
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
var onNodeSwitch = useCallback(function (node, onlyExpand) {
|
|
56
|
+
if (onlyExpand === void 0) {
|
|
57
|
+
onlyExpand = false;
|
|
58
58
|
}
|
|
59
|
-
return __awaiter(void 0,
|
|
59
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
60
60
|
var id, children, isLeaf;
|
|
61
61
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
62
62
|
while (1) {
|
|
63
63
|
switch (_context2.prev = _context2.next) {
|
|
64
64
|
case 0:
|
|
65
|
-
if (onlyExpand === void 0) {
|
|
66
|
-
onlyExpand = false;
|
|
67
|
-
}
|
|
68
65
|
// 直接触发选中该节点
|
|
69
66
|
onExpandLatest(node, onlyExpand);
|
|
70
67
|
id = node.id, children = node.children, isLeaf = node.isLeaf;
|
|
71
68
|
if (!children) {
|
|
72
|
-
_context2.next =
|
|
69
|
+
_context2.next = 4;
|
|
73
70
|
break;
|
|
74
71
|
}
|
|
75
72
|
return _context2.abrupt("return");
|
|
76
|
-
case
|
|
73
|
+
case 4:
|
|
77
74
|
if (!isLeaf) {
|
|
78
|
-
_context2.next =
|
|
75
|
+
_context2.next = 6;
|
|
79
76
|
break;
|
|
80
77
|
}
|
|
81
78
|
return _context2.abrupt("return");
|
|
82
|
-
case
|
|
79
|
+
case 6:
|
|
83
80
|
if (!onLoadChildren) {
|
|
84
|
-
_context2.next =
|
|
81
|
+
_context2.next = 17;
|
|
85
82
|
break;
|
|
86
83
|
}
|
|
87
84
|
addLoadingIds(id);
|
|
88
|
-
_context2.prev =
|
|
89
|
-
_context2.next =
|
|
85
|
+
_context2.prev = 8;
|
|
86
|
+
_context2.next = 11;
|
|
90
87
|
return loadChildren(node);
|
|
91
|
-
case
|
|
88
|
+
case 11:
|
|
92
89
|
removeLoadingIds(id);
|
|
93
|
-
_context2.next =
|
|
90
|
+
_context2.next = 17;
|
|
94
91
|
break;
|
|
95
|
-
case
|
|
96
|
-
_context2.prev =
|
|
97
|
-
_context2.t0 = _context2["catch"](
|
|
92
|
+
case 14:
|
|
93
|
+
_context2.prev = 14;
|
|
94
|
+
_context2.t0 = _context2["catch"](8);
|
|
98
95
|
removeLoadingIds(id);
|
|
99
|
-
case
|
|
96
|
+
case 17:
|
|
100
97
|
case "end":
|
|
101
98
|
return _context2.stop();
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
|
-
}, _callee2, null, [[
|
|
101
|
+
}, _callee2, null, [[8, 14]]);
|
|
105
102
|
}));
|
|
106
103
|
}, [loadChildren, onLoadChildren, onExpandLatest, addLoadingIds, removeLoadingIds]);
|
|
107
104
|
var isLoadingId = function isLoadingId(id) {
|
|
@@ -175,6 +175,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
175
175
|
if (headerTableElement) {
|
|
176
176
|
resizeObserver = new ResizeObserver(function () {
|
|
177
177
|
var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index) {
|
|
178
|
+
var _a;
|
|
178
179
|
var _getGroupItemWidth2 = getGroupItemWidth(columns),
|
|
179
180
|
colWidths = _getGroupItemWidth2.colWidths,
|
|
180
181
|
minColWidths = _getGroupItemWidth2.minColWidths;
|
|
@@ -187,7 +188,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
187
188
|
var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
|
|
188
189
|
var childNode = Array.from(th.childNodes)[0];
|
|
189
190
|
// 计算真实标题内容宽度
|
|
190
|
-
var childNodeWidth = (childNode === null ||
|
|
191
|
+
var childNodeWidth = ((_a = childNode) === null || _a === void 0 ? void 0 : _a.offsetWidth) + thPaddingLeft * 2;
|
|
191
192
|
// 如果设置的标题宽度小于真实内容宽度,则使用设置的宽度,否则使用真实内容宽度
|
|
192
193
|
if (colWidth && colWidth < childNodeWidth) {
|
|
193
194
|
return colWidth;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import React__default from 'react';
|
|
11
|
-
import '
|
|
11
|
+
import '../../../../../react-is/index.js';
|
|
12
12
|
import { r as reactIs } from '../../../../../../_virtual/index2.js';
|
|
13
13
|
function toArray(children) {
|
|
14
14
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import _typeof from '@babel/runtime/helpers/esm/typeof';
|
|
11
|
-
import '
|
|
11
|
+
import '../../../../react-is/index.js';
|
|
12
12
|
import { r as reactIs } from '../../../../../_virtual/index2.js';
|
|
13
13
|
function fillRef(ref, node) {
|
|
14
14
|
if (typeof ref === 'function') {
|
|
@@ -8,7 +8,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/
|
|
11
|
-
import { __exports as reactIs_development } from '
|
|
11
|
+
import { __exports as reactIs_development } from '../../../_virtual/react-is.development.js';
|
|
12
12
|
|
|
13
13
|
/** @license React v16.13.1
|
|
14
14
|
* react-is.development.js
|
|
@@ -8,7 +8,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/
|
|
11
|
-
import { __exports as reactIs_production_min } from '
|
|
11
|
+
import { __exports as reactIs_production_min } from '../../../_virtual/react-is.production.min.js';
|
|
12
12
|
|
|
13
13
|
/** @license React v16.13.1
|
|
14
14
|
* react-is.production.min.js
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
import { r as reactIs } from '
|
|
10
|
+
import { r as reactIs } from '../../_virtual/index2.js';
|
|
11
11
|
import './cjs/react-is.production.min.js';
|
|
12
12
|
import './cjs/react-is.development.js';
|
|
13
|
-
import { __exports as reactIs_production_min } from '
|
|
14
|
-
import { __exports as reactIs_development } from '
|
|
13
|
+
import { __exports as reactIs_production_min } from '../../_virtual/react-is.production.min.js';
|
|
14
|
+
import { __exports as reactIs_development } from '../../_virtual/react-is.development.js';
|
|
15
15
|
if (process.env.NODE_ENV === 'production') {
|
|
16
16
|
reactIs.exports = reactIs_production_min;
|
|
17
17
|
} else {
|
package/lib/types/Table.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ export declare const SELECTION_DATA_KEY: string;
|
|
|
7
7
|
* 表格
|
|
8
8
|
*/
|
|
9
9
|
export declare const Table: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
10
|
-
export type TableSemanticName = 'root' | 'wrapper' | 'content' | 'table' | 'header' | 'headerRow' | 'headerCell' | 'body' | 'bodyRow' | 'bodyCell' | 'cell' | 'footer' | 'freezeShadowLeft' | 'freezeShadowRight';
|
|
11
|
-
export type TableSemanticClassNames = SemanticClassNamesType<TableProps, TableSemanticName>;
|
|
12
|
-
export type TableSemanticStyles = SemanticStylesType<TableProps, TableSemanticName>;
|
|
13
|
-
export type TableSemantic = ComponentSemantic<TableSemanticClassNames, TableSemanticStyles>;
|
|
10
|
+
export declare type TableSemanticName = 'root' | 'wrapper' | 'content' | 'table' | 'header' | 'headerRow' | 'headerCell' | 'body' | 'bodyRow' | 'bodyCell' | 'cell' | 'footer' | 'freezeShadowLeft' | 'freezeShadowRight';
|
|
11
|
+
export declare type TableSemanticClassNames = SemanticClassNamesType<TableProps, TableSemanticName>;
|
|
12
|
+
export declare type TableSemanticStyles = SemanticStylesType<TableProps, TableSemanticName>;
|
|
13
|
+
export declare type TableSemantic = ComponentSemantic<TableSemanticClassNames, TableSemanticStyles>;
|
|
14
14
|
export interface TableProps extends Omit<BaseTableProps, 'classNames' | 'styles'>, TableSemantic {
|
|
15
15
|
/**
|
|
16
16
|
* 加载中状态
|
|
@@ -17,7 +17,7 @@ export interface TableColumnMenuProps {
|
|
|
17
17
|
onClose?: () => void;
|
|
18
18
|
}
|
|
19
19
|
export declare const TableColumnMenuItem: ({ prefixCls, active, onSwitch, content, icon, }: {
|
|
20
|
-
prefixCls?: string;
|
|
20
|
+
prefixCls?: string | undefined;
|
|
21
21
|
active: boolean;
|
|
22
22
|
onSwitch: (shouldActive: boolean) => void;
|
|
23
23
|
icon?: React.ReactNode;
|
|
@@ -11,8 +11,8 @@ export interface TbodyContentProps extends HiBaseHTMLProps<'div'> {
|
|
|
11
11
|
* 负责空状态渲染
|
|
12
12
|
*/
|
|
13
13
|
export declare const renderEmptyContent: ({ className, colSpan, emptyContent, scrollBodyWidth, }: {
|
|
14
|
-
colSpan?: number;
|
|
15
|
-
className?: string;
|
|
14
|
+
colSpan?: number | undefined;
|
|
15
|
+
className?: string | undefined;
|
|
16
16
|
emptyContent: React.ReactNode;
|
|
17
|
-
scrollBodyWidth?: number |
|
|
17
|
+
scrollBodyWidth?: string | number | undefined;
|
|
18
18
|
}) => JSX.Element;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const TableProvider: React.Provider<(Omit<{
|
|
|
7
7
|
width: number | undefined;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
getStickyColProps: (column: any, type?: "
|
|
10
|
+
getStickyColProps: (column: any, type?: "td" | "th") => {
|
|
11
11
|
style: React.CSSProperties;
|
|
12
12
|
'data-sticky': "" | undefined;
|
|
13
13
|
};
|
|
@@ -22,11 +22,11 @@ export declare const TableProvider: React.Provider<(Omit<{
|
|
|
22
22
|
trySetHighlightedColKeys: (stateOrFunction: React.SetStateAction<string[]>, ...args: any[]) => void;
|
|
23
23
|
showColHighlight: boolean;
|
|
24
24
|
isHoveredHighlightCol: (id: React.ReactText) => boolean;
|
|
25
|
-
onHoveredColChange: <T extends import("packages/hooks/use-check/lib/types").UseCheckItem>(targetItem: T, shouldSelected?: boolean) => void;
|
|
25
|
+
onHoveredColChange: <T extends import("packages/hooks/use-check/lib/types").UseCheckItem>(targetItem: T, shouldSelected?: boolean | undefined) => void;
|
|
26
26
|
draggable: boolean;
|
|
27
27
|
highlightColumns: any;
|
|
28
28
|
dragRowRef: React.MutableRefObject<any>;
|
|
29
|
-
onDragStart: ((evt: React.DragEvent
|
|
29
|
+
onDragStart: ((evt: React.DragEvent<Element>, option: {
|
|
30
30
|
dragNode: object;
|
|
31
31
|
}) => void) | undefined;
|
|
32
32
|
onDrop: (evt: any, sourceId: any, targetId: any, dragDirection: any) => void;
|
|
@@ -40,16 +40,16 @@ export declare const TableProvider: React.Provider<(Omit<{
|
|
|
40
40
|
onColumnResizable: (evt: any, { size }: any, index: number) => void;
|
|
41
41
|
isTree: boolean;
|
|
42
42
|
cellRender: ((text: any) => React.ReactNode) | undefined;
|
|
43
|
-
footerRender: ((...nodes: React.ReactElement[]) => React.ReactNode) | undefined;
|
|
43
|
+
footerRender: ((...nodes: React.ReactElement<any, string | React.JSXElementConstructor<any>>[]) => React.ReactNode) | undefined;
|
|
44
44
|
showColMenu: boolean | undefined;
|
|
45
|
-
onLoadChildren: ((item: TableRowEventData) =>
|
|
45
|
+
onLoadChildren: ((item: TableRowEventData) => void | Promise<void | any[]>) | undefined;
|
|
46
46
|
setHeaderTableElement: React.Dispatch<React.SetStateAction<HTMLTableRowElement | null>>;
|
|
47
47
|
scrollbar: boolean | import("packages/ui/scrollbar/lib/types").ScrollbarProps | undefined;
|
|
48
48
|
rowClassName: ((record: Record<string, any>, index: number) => string) | undefined;
|
|
49
49
|
cellClassName: ((record: Record<string, any>, column: Record<string, any>, index: number) => string) | undefined;
|
|
50
50
|
onHighlightedCol: ((changedColInfo: {
|
|
51
51
|
active: boolean;
|
|
52
|
-
column: import("./types").TableColumnItem
|
|
52
|
+
column: import("./types").TableColumnItem<any>;
|
|
53
53
|
}, highlightedColKeys: string[]) => void) | undefined;
|
|
54
54
|
innerRef: React.Ref<import("./types").TableHelper> | undefined;
|
|
55
55
|
virtualListRef: React.RefObject<import("rc-virtual-list").ListRef>;
|
|
@@ -59,13 +59,13 @@ export declare const TableProvider: React.Provider<(Omit<{
|
|
|
59
59
|
scrollRight: number;
|
|
60
60
|
measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
|
|
61
61
|
rootProps: {
|
|
62
|
-
bordered?: boolean;
|
|
63
|
-
pagination?: import("packages/ui/pagination/lib/types").PaginationProps;
|
|
62
|
+
bordered?: boolean | undefined;
|
|
63
|
+
pagination?: import("packages/ui/pagination/lib/types").PaginationProps | undefined;
|
|
64
64
|
setting?: boolean | {
|
|
65
65
|
trigger?: React.ReactNode;
|
|
66
|
-
};
|
|
67
|
-
loading?: boolean;
|
|
68
|
-
uniqueId?: string;
|
|
66
|
+
} | undefined;
|
|
67
|
+
loading?: boolean | undefined;
|
|
68
|
+
uniqueId?: string | undefined;
|
|
69
69
|
};
|
|
70
70
|
scrollWidth: number | undefined;
|
|
71
71
|
activeSorterColumn: string | null;
|
|
@@ -107,8 +107,8 @@ export declare const TableProvider: React.Provider<(Omit<{
|
|
|
107
107
|
rightFixedColumnsWidth: number | undefined;
|
|
108
108
|
}, "rootProps"> & {
|
|
109
109
|
embedExpandable: boolean | {
|
|
110
|
-
rowExpandable: true | ((row: import("./types").TableColumnItem) => React.ReactNode
|
|
111
|
-
expandedRender: (row: Record<string, any>, index: number) => React.ReactNode | Promise<React.ReactNode
|
|
110
|
+
rowExpandable: true | ((row: import("./types").TableColumnItem<any>) => React.ReactNode);
|
|
111
|
+
expandedRender: (row: Record<string, any>, index: number) => React.ReactNode | Promise<void | React.ReactNode>;
|
|
112
112
|
};
|
|
113
113
|
onEmbedSwitch: (node: import("./types").FlattedTableRowData, rowIndex: number) => Promise<void>;
|
|
114
114
|
getEmbedPanelById: (id: React.ReactText) => any;
|
|
@@ -120,29 +120,29 @@ export declare const TableProvider: React.Provider<(Omit<{
|
|
|
120
120
|
hasAvgColumn: boolean;
|
|
121
121
|
sumRow: Record<string, any>;
|
|
122
122
|
hasSumColumn: boolean;
|
|
123
|
-
onRow?: (rowData: Record<string, any> | null, index: number) => TableOnRowReturn;
|
|
123
|
+
onRow?: ((rowData: Record<string, any> | null, index: number) => TableOnRowReturn) | undefined;
|
|
124
124
|
striped: boolean;
|
|
125
125
|
virtual?: boolean | {
|
|
126
|
-
onVisibleChange?: (visibleList: any[], fullList: any[], virtualInfo?: {
|
|
126
|
+
onVisibleChange?: ((visibleList: any[], fullList: any[], virtualInfo?: {
|
|
127
127
|
start: number;
|
|
128
128
|
end: number;
|
|
129
129
|
scrollTop: number;
|
|
130
130
|
heights: number[];
|
|
131
|
-
}) => void;
|
|
132
|
-
};
|
|
133
|
-
onResizeStop?: (evt: SyntheticEvent, size: ResizeCallbackData[
|
|
131
|
+
} | undefined) => void) | undefined;
|
|
132
|
+
} | undefined;
|
|
133
|
+
onResizeStop?: ((evt: SyntheticEvent, size: ResizeCallbackData['size'], index: number, columnsWidth: number[]) => void) | undefined;
|
|
134
134
|
fixedToRow?: {
|
|
135
|
-
top?: number | ((rowData: TableRowEventData, index: number) => boolean);
|
|
136
|
-
bottom?: number | ((rowData: TableRowEventData, index: number) => boolean);
|
|
137
|
-
};
|
|
138
|
-
onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
139
|
-
sticky?: boolean;
|
|
140
|
-
stickyTop?: number;
|
|
141
|
-
stickyFooter?: boolean;
|
|
135
|
+
top?: number | ((rowData: TableRowEventData, index: number) => boolean) | undefined;
|
|
136
|
+
bottom?: number | ((rowData: TableRowEventData, index: number) => boolean) | undefined;
|
|
137
|
+
} | undefined;
|
|
138
|
+
onScroll?: ((event: React.UIEvent<HTMLDivElement>) => void) | undefined;
|
|
139
|
+
sticky?: boolean | undefined;
|
|
140
|
+
stickyTop?: number | undefined;
|
|
141
|
+
stickyFooter?: boolean | undefined;
|
|
142
142
|
/** 语义化 classNames(由 BaseTable 透传) */
|
|
143
|
-
semanticClassNames?: Record<string, any
|
|
143
|
+
semanticClassNames?: Record<string, any> | undefined;
|
|
144
144
|
/** 语义化 styles(由 BaseTable 透传) */
|
|
145
|
-
semanticStyles?: Record<string, any
|
|
145
|
+
semanticStyles?: Record<string, any> | undefined;
|
|
146
146
|
}) | null>;
|
|
147
147
|
export declare const useTableContext: () => Omit<{
|
|
148
148
|
getColgroupProps: (column: import("./types").FlattedTableColumnItemData, index: number) => {
|
|
@@ -150,7 +150,7 @@ export declare const useTableContext: () => Omit<{
|
|
|
150
150
|
width: number | undefined;
|
|
151
151
|
};
|
|
152
152
|
};
|
|
153
|
-
getStickyColProps: (column: any, type?: "
|
|
153
|
+
getStickyColProps: (column: any, type?: "td" | "th") => {
|
|
154
154
|
style: React.CSSProperties;
|
|
155
155
|
'data-sticky': "" | undefined;
|
|
156
156
|
};
|
|
@@ -165,11 +165,11 @@ export declare const useTableContext: () => Omit<{
|
|
|
165
165
|
trySetHighlightedColKeys: (stateOrFunction: React.SetStateAction<string[]>, ...args: any[]) => void;
|
|
166
166
|
showColHighlight: boolean;
|
|
167
167
|
isHoveredHighlightCol: (id: React.ReactText) => boolean;
|
|
168
|
-
onHoveredColChange: <T extends import("packages/hooks/use-check/lib/types").UseCheckItem>(targetItem: T, shouldSelected?: boolean) => void;
|
|
168
|
+
onHoveredColChange: <T extends import("packages/hooks/use-check/lib/types").UseCheckItem>(targetItem: T, shouldSelected?: boolean | undefined) => void;
|
|
169
169
|
draggable: boolean;
|
|
170
170
|
highlightColumns: any;
|
|
171
171
|
dragRowRef: React.MutableRefObject<any>;
|
|
172
|
-
onDragStart: ((evt: React.DragEvent
|
|
172
|
+
onDragStart: ((evt: React.DragEvent<Element>, option: {
|
|
173
173
|
dragNode: object;
|
|
174
174
|
}) => void) | undefined;
|
|
175
175
|
onDrop: (evt: any, sourceId: any, targetId: any, dragDirection: any) => void;
|
|
@@ -183,16 +183,16 @@ export declare const useTableContext: () => Omit<{
|
|
|
183
183
|
onColumnResizable: (evt: any, { size }: any, index: number) => void;
|
|
184
184
|
isTree: boolean;
|
|
185
185
|
cellRender: ((text: any) => React.ReactNode) | undefined;
|
|
186
|
-
footerRender: ((...nodes: React.ReactElement[]) => React.ReactNode) | undefined;
|
|
186
|
+
footerRender: ((...nodes: React.ReactElement<any, string | React.JSXElementConstructor<any>>[]) => React.ReactNode) | undefined;
|
|
187
187
|
showColMenu: boolean | undefined;
|
|
188
|
-
onLoadChildren: ((item: TableRowEventData) =>
|
|
188
|
+
onLoadChildren: ((item: TableRowEventData) => void | Promise<void | any[]>) | undefined;
|
|
189
189
|
setHeaderTableElement: React.Dispatch<React.SetStateAction<HTMLTableRowElement | null>>;
|
|
190
190
|
scrollbar: boolean | import("packages/ui/scrollbar/lib/types").ScrollbarProps | undefined;
|
|
191
191
|
rowClassName: ((record: Record<string, any>, index: number) => string) | undefined;
|
|
192
192
|
cellClassName: ((record: Record<string, any>, column: Record<string, any>, index: number) => string) | undefined;
|
|
193
193
|
onHighlightedCol: ((changedColInfo: {
|
|
194
194
|
active: boolean;
|
|
195
|
-
column: import("./types").TableColumnItem
|
|
195
|
+
column: import("./types").TableColumnItem<any>;
|
|
196
196
|
}, highlightedColKeys: string[]) => void) | undefined;
|
|
197
197
|
innerRef: React.Ref<import("./types").TableHelper> | undefined;
|
|
198
198
|
virtualListRef: React.RefObject<import("rc-virtual-list").ListRef>;
|
|
@@ -202,13 +202,13 @@ export declare const useTableContext: () => Omit<{
|
|
|
202
202
|
scrollRight: number;
|
|
203
203
|
measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
|
|
204
204
|
rootProps: {
|
|
205
|
-
bordered?: boolean;
|
|
206
|
-
pagination?: import("packages/ui/pagination/lib/types").PaginationProps;
|
|
205
|
+
bordered?: boolean | undefined;
|
|
206
|
+
pagination?: import("packages/ui/pagination/lib/types").PaginationProps | undefined;
|
|
207
207
|
setting?: boolean | {
|
|
208
208
|
trigger?: React.ReactNode;
|
|
209
|
-
};
|
|
210
|
-
loading?: boolean;
|
|
211
|
-
uniqueId?: string;
|
|
209
|
+
} | undefined;
|
|
210
|
+
loading?: boolean | undefined;
|
|
211
|
+
uniqueId?: string | undefined;
|
|
212
212
|
};
|
|
213
213
|
scrollWidth: number | undefined;
|
|
214
214
|
activeSorterColumn: string | null;
|
|
@@ -250,8 +250,8 @@ export declare const useTableContext: () => Omit<{
|
|
|
250
250
|
rightFixedColumnsWidth: number | undefined;
|
|
251
251
|
}, "rootProps"> & {
|
|
252
252
|
embedExpandable: boolean | {
|
|
253
|
-
rowExpandable: true | ((row: import("./types").TableColumnItem) => React.ReactNode
|
|
254
|
-
expandedRender: (row: Record<string, any>, index: number) => React.ReactNode | Promise<React.ReactNode
|
|
253
|
+
rowExpandable: true | ((row: import("./types").TableColumnItem<any>) => React.ReactNode);
|
|
254
|
+
expandedRender: (row: Record<string, any>, index: number) => React.ReactNode | Promise<void | React.ReactNode>;
|
|
255
255
|
};
|
|
256
256
|
onEmbedSwitch: (node: import("./types").FlattedTableRowData, rowIndex: number) => Promise<void>;
|
|
257
257
|
getEmbedPanelById: (id: React.ReactText) => any;
|
|
@@ -263,27 +263,27 @@ export declare const useTableContext: () => Omit<{
|
|
|
263
263
|
hasAvgColumn: boolean;
|
|
264
264
|
sumRow: Record<string, any>;
|
|
265
265
|
hasSumColumn: boolean;
|
|
266
|
-
onRow?: (rowData: Record<string, any> | null, index: number) => TableOnRowReturn;
|
|
266
|
+
onRow?: ((rowData: Record<string, any> | null, index: number) => TableOnRowReturn) | undefined;
|
|
267
267
|
striped: boolean;
|
|
268
268
|
virtual?: boolean | {
|
|
269
|
-
onVisibleChange?: (visibleList: any[], fullList: any[], virtualInfo?: {
|
|
269
|
+
onVisibleChange?: ((visibleList: any[], fullList: any[], virtualInfo?: {
|
|
270
270
|
start: number;
|
|
271
271
|
end: number;
|
|
272
272
|
scrollTop: number;
|
|
273
273
|
heights: number[];
|
|
274
|
-
}) => void;
|
|
275
|
-
};
|
|
276
|
-
onResizeStop?: (evt: SyntheticEvent, size: ResizeCallbackData[
|
|
274
|
+
} | undefined) => void) | undefined;
|
|
275
|
+
} | undefined;
|
|
276
|
+
onResizeStop?: ((evt: SyntheticEvent, size: ResizeCallbackData['size'], index: number, columnsWidth: number[]) => void) | undefined;
|
|
277
277
|
fixedToRow?: {
|
|
278
|
-
top?: number | ((rowData: TableRowEventData, index: number) => boolean);
|
|
279
|
-
bottom?: number | ((rowData: TableRowEventData, index: number) => boolean);
|
|
280
|
-
};
|
|
281
|
-
onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
282
|
-
sticky?: boolean;
|
|
283
|
-
stickyTop?: number;
|
|
284
|
-
stickyFooter?: boolean;
|
|
278
|
+
top?: number | ((rowData: TableRowEventData, index: number) => boolean) | undefined;
|
|
279
|
+
bottom?: number | ((rowData: TableRowEventData, index: number) => boolean) | undefined;
|
|
280
|
+
} | undefined;
|
|
281
|
+
onScroll?: ((event: React.UIEvent<HTMLDivElement>) => void) | undefined;
|
|
282
|
+
sticky?: boolean | undefined;
|
|
283
|
+
stickyTop?: number | undefined;
|
|
284
|
+
stickyFooter?: boolean | undefined;
|
|
285
285
|
/** 语义化 classNames(由 BaseTable 透传) */
|
|
286
|
-
semanticClassNames?: Record<string, any
|
|
286
|
+
semanticClassNames?: Record<string, any> | undefined;
|
|
287
287
|
/** 语义化 styles(由 BaseTable 透传) */
|
|
288
|
-
semanticStyles?: Record<string, any
|
|
288
|
+
semanticStyles?: Record<string, any> | undefined;
|
|
289
289
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TableRowEventData } from '../types';
|
|
3
3
|
export declare const useAsyncSwitch: ({ setCascaderData, onExpand, onLoadChildren, fieldKey, }: {
|
|
4
4
|
setCascaderData: React.Dispatch<React.SetStateAction<any[]>>;
|
|
5
|
-
onExpand?: (selectedOption: TableRowEventData, onlyExpand: boolean) => void;
|
|
6
|
-
onLoadChildren?: (item: TableRowEventData) => Promise<any[] | void> | void;
|
|
7
|
-
fieldKey?: string;
|
|
5
|
+
onExpand?: ((selectedOption: TableRowEventData, onlyExpand: boolean) => void) | undefined;
|
|
6
|
+
onLoadChildren?: ((item: TableRowEventData) => Promise<any[] | void> | void) | undefined;
|
|
7
|
+
fieldKey?: string | undefined;
|
|
8
8
|
}) => readonly [(id: React.ReactText) => boolean, (node: TableRowEventData, onlyExpand?: any) => Promise<void>];
|
|
@@ -11,7 +11,7 @@ export declare const useTableCheck: ({ rowSelection, flattedData, fieldKey, }: {
|
|
|
11
11
|
onCheckedRowKeysChange: (rowItem: Record<string, any>, checked: boolean) => void;
|
|
12
12
|
onRadioCheckedRowKeysChange: (rowItem: Record<string, any>, checked: boolean) => void;
|
|
13
13
|
isCheckedRowKey: (id: React.ReactText) => boolean;
|
|
14
|
-
checkedRowKeys:
|
|
15
|
-
trySetCheckedRowKeys: (stateOrFunction: React.SetStateAction<
|
|
14
|
+
checkedRowKeys: React.ReactText[];
|
|
15
|
+
trySetCheckedRowKeys: (stateOrFunction: React.SetStateAction<React.ReactText[]>, ...args: any[]) => void;
|
|
16
16
|
checkRowIsDisabledCheckbox: (rowItem: any) => boolean;
|
|
17
17
|
};
|
|
@@ -5,6 +5,6 @@ export declare const useColFrozen: ({ columns, resizable, }: {
|
|
|
5
5
|
}) => {
|
|
6
6
|
flattedColumns: import("packages/utils/tree-utils/lib/types/types").BaseFlattedTreeNodeData<any, any>[];
|
|
7
7
|
mergedColumns: FlattedTableColumnItemData[];
|
|
8
|
-
groupedColumns: TableColumnItem[][];
|
|
8
|
+
groupedColumns: TableColumnItem<any>[][];
|
|
9
9
|
flattedColumnsWithoutChildren: import("packages/utils/tree-utils/lib/types/types").BaseFlattedTreeNodeData<any, any>[];
|
|
10
10
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableProps } from '../Table';
|
|
2
3
|
/**
|
|
3
4
|
* 列操作逻辑
|
|
4
5
|
*/
|
|
5
6
|
export declare const useColHidden: ({ uniqueId, columns, hiddenColKeys: hiddenColKeysProp, onHiddenColKeysChange, }: TableProps) => {
|
|
6
|
-
visibleCols: import("..").TableColumnItem[];
|
|
7
|
+
visibleCols: import("..").TableColumnItem<any>[];
|
|
7
8
|
hiddenColKeys: string[];
|
|
8
9
|
setHiddenColKeys: (stateOrFunction: import("react").SetStateAction<string[]>, ...args: any[]) => void;
|
|
9
10
|
cacheHiddenColKeys: string[];
|
|
10
11
|
setCacheHiddenColKeys: import("react").Dispatch<import("react").SetStateAction<string[]>>;
|
|
11
12
|
};
|
|
12
|
-
export type UseColHiddenReturn = ReturnType<typeof useColHidden>;
|
|
13
|
+
export declare type UseColHiddenReturn = ReturnType<typeof useColHidden>;
|
|
@@ -6,4 +6,4 @@ export declare const useColSet: ({ columns, sortedColKeys: sortedColKeysProp, hi
|
|
|
6
6
|
sortedColKeys: string[] | undefined;
|
|
7
7
|
hiddenColKeys: string[] | undefined;
|
|
8
8
|
};
|
|
9
|
-
export type UseColSetReturn = ReturnType<typeof useColSet>;
|
|
9
|
+
export declare type UseColSetReturn = ReturnType<typeof useColSet>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableProps } from './../Table';
|
|
2
3
|
/**
|
|
3
4
|
* 列排序
|
|
@@ -8,4 +9,4 @@ export declare const useColSorter: ({ uniqueId, columns, sortedColKeys: sortedCo
|
|
|
8
9
|
cacheSortedCols: any[];
|
|
9
10
|
setCacheSortedCols: import("react").Dispatch<import("react").SetStateAction<any[]>>;
|
|
10
11
|
};
|
|
11
|
-
export type UseColSorterReturn = ReturnType<typeof useColSorter>;
|
|
12
|
+
export declare type UseColSorterReturn = ReturnType<typeof useColSorter>;
|
|
@@ -5,7 +5,7 @@ export declare const useColWidth: ({ resizable, tableWidthAdjustOnResize, data,
|
|
|
5
5
|
tableWidthAdjustOnResize: boolean;
|
|
6
6
|
data: TableRowRecord[];
|
|
7
7
|
columns: TableColumnItem[];
|
|
8
|
-
virtual?: boolean;
|
|
8
|
+
virtual?: boolean | undefined;
|
|
9
9
|
scrollBodyElementRef: React.RefObject<HTMLTableElement>;
|
|
10
10
|
}) => {
|
|
11
11
|
measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
|
|
@@ -36,4 +36,4 @@ export interface UseEmbedExpandProps {
|
|
|
36
36
|
*/
|
|
37
37
|
rowExpandable?: boolean | ((row: TableColumnItem) => React.ReactNode | boolean);
|
|
38
38
|
}
|
|
39
|
-
export type UseEmbedExpandReturn = ReturnType<typeof useEmbedExpand>;
|
|
39
|
+
export declare type UseEmbedExpandReturn = ReturnType<typeof useEmbedExpand>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlattedTableRowData, TableRowEventData } from '../types';
|
|
3
|
-
export declare const useExpandProps: (flattedData: FlattedTableRowData[], defaultExpandedIds: React.ReactText[], expandedIdsProp?: React.ReactText[], onExpand?: (expandIds: React.ReactText[], node: TableRowEventData, expanded: boolean) => void, defaultExpandAll?: boolean) => readonly [React.ReactText[], (stateOrFunction: React.SetStateAction<React.ReactText[]>, ...args: any[]) => void, boolean];
|
|
3
|
+
export declare const useExpandProps: (flattedData: FlattedTableRowData[], defaultExpandedIds: React.ReactText[], expandedIdsProp?: React.ReactText[] | undefined, onExpand?: ((expandIds: React.ReactText[], node: TableRowEventData, expanded: boolean) => void) | undefined, defaultExpandAll?: boolean | undefined) => readonly [React.ReactText[], (stateOrFunction: React.SetStateAction<React.ReactText[]>, ...args: any[]) => void, boolean];
|
|
4
4
|
/**
|
|
5
5
|
* 树形节点展开
|
|
6
6
|
*/
|
|
7
|
-
export declare const useExpand: (flattedData: FlattedTableRowData[], defaultExpandedIds: React.ReactText[], expandedIdsProp?: React.ReactText[], onExpand?: (expandIds: React.ReactText[], node: TableRowEventData, expanded: boolean) => void, defaultExpandAll?: boolean) => readonly [FlattedTableRowData[], (expandedNode: TableRowEventData, shouldExpanded: boolean) => void, (id: React.ReactText) => boolean];
|
|
7
|
+
export declare const useExpand: (flattedData: FlattedTableRowData[], defaultExpandedIds: React.ReactText[], expandedIdsProp?: React.ReactText[] | undefined, onExpand?: ((expandIds: React.ReactText[], node: TableRowEventData, expanded: boolean) => void) | undefined, defaultExpandAll?: boolean | undefined) => readonly [FlattedTableRowData[], (expandedNode: TableRowEventData, shouldExpanded: boolean) => void, (id: React.ReactText) => boolean];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PaginationProps } from '@hi-ui/pagination';
|
|
3
3
|
export declare const useTablePagination: ({ pagination, loadingProp, data: dataProp, dataSource, }: {
|
|
4
|
-
loadingProp?: boolean;
|
|
4
|
+
loadingProp?: boolean | undefined;
|
|
5
5
|
data: object[];
|
|
6
6
|
pagination: PaginationProps;
|
|
7
|
-
dataSource?: (current: number, pageSize?: number) => any;
|
|
7
|
+
dataSource?: ((current: number, pageSize?: number | undefined) => any) | undefined;
|
|
8
8
|
}) => {
|
|
9
9
|
mergedData: object[];
|
|
10
10
|
pagination: PaginationProps;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PaginationProps } from '@hi-ui/pagination';
|
|
3
3
|
import { PopperOverlayProps } from '@hi-ui/popper';
|
|
4
|
-
export type TableColumnItemAlignEnum = 'left' | 'right' | 'center';
|
|
5
|
-
export type TableFrozenColumnOptions = {
|
|
4
|
+
export declare type TableColumnItemAlignEnum = 'left' | 'right' | 'center';
|
|
5
|
+
export declare type TableFrozenColumnOptions = {
|
|
6
6
|
/**
|
|
7
7
|
* 表格从左侧冻结至某列
|
|
8
8
|
*/
|
|
@@ -12,11 +12,11 @@ export type TableFrozenColumnOptions = {
|
|
|
12
12
|
*/
|
|
13
13
|
right?: React.ReactText;
|
|
14
14
|
};
|
|
15
|
-
export type TableExtra = {
|
|
15
|
+
export declare type TableExtra = {
|
|
16
16
|
footer?: React.ReactNode;
|
|
17
17
|
header?: React.ReactNode;
|
|
18
18
|
};
|
|
19
|
-
export type TableCheckAllOptions = {
|
|
19
|
+
export declare type TableCheckAllOptions = {
|
|
20
20
|
/**
|
|
21
21
|
* 添加全选按钮右侧过滤 icon
|
|
22
22
|
*/
|
|
@@ -26,7 +26,7 @@ export type TableCheckAllOptions = {
|
|
|
26
26
|
*/
|
|
27
27
|
render?: (checkboxNode: React.ReactNode) => React.ReactNode;
|
|
28
28
|
};
|
|
29
|
-
export type TableRowSelection = {
|
|
29
|
+
export declare type TableRowSelection = {
|
|
30
30
|
type?: 'checkbox' | 'radio';
|
|
31
31
|
/**
|
|
32
32
|
* 设置选中列列宽
|
|
@@ -51,7 +51,7 @@ export type TableRowSelection = {
|
|
|
51
51
|
*/
|
|
52
52
|
checkAllOptions?: TableCheckAllOptions;
|
|
53
53
|
};
|
|
54
|
-
export type TableOnRowReturn = {
|
|
54
|
+
export declare type TableOnRowReturn = {
|
|
55
55
|
/**
|
|
56
56
|
* 行点击事件
|
|
57
57
|
*/
|
|
@@ -80,8 +80,8 @@ export interface TableColumnItemRenderReturn {
|
|
|
80
80
|
rowSpan?: number;
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
export type TableColumnSortOrder = 'ascend' | 'descend' | null;
|
|
84
|
-
export type TableColumnItem<T extends Record<string, any> = any> = {
|
|
83
|
+
export declare type TableColumnSortOrder = 'ascend' | 'descend' | null;
|
|
84
|
+
export declare type TableColumnItem<T extends Record<string, any> = any> = {
|
|
85
85
|
/**
|
|
86
86
|
* 列标题
|
|
87
87
|
*/
|
|
@@ -174,7 +174,7 @@ export type TableColumnItem<T extends Record<string, any> = any> = {
|
|
|
174
174
|
setFilterDropdownVisible: Function;
|
|
175
175
|
}) => React.ReactNode;
|
|
176
176
|
};
|
|
177
|
-
export type TableDataSource = {
|
|
177
|
+
export declare type TableDataSource = {
|
|
178
178
|
url: string;
|
|
179
179
|
currentPageName?: string;
|
|
180
180
|
auto?: boolean;
|
|
@@ -269,9 +269,9 @@ export interface TableRowRequiredProps {
|
|
|
269
269
|
loading: boolean;
|
|
270
270
|
focused: boolean;
|
|
271
271
|
}
|
|
272
|
-
export type TableRowRecord = Record<string, any>;
|
|
273
|
-
export type TableVirtualScrollAlign = 'top' | 'bottom' | 'auto';
|
|
274
|
-
export type TableVirtualScrollConfig = {
|
|
272
|
+
export declare type TableRowRecord = Record<string, any>;
|
|
273
|
+
export declare type TableVirtualScrollAlign = 'top' | 'bottom' | 'auto';
|
|
274
|
+
export declare type TableVirtualScrollConfig = {
|
|
275
275
|
index: number;
|
|
276
276
|
align?: TableVirtualScrollAlign;
|
|
277
277
|
offset?: number;
|