es-grid-template 1.7.26 → 1.7.28
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/grid-component/InternalTable.js +31 -36
- package/es/grid-component/TempTable.d.ts +4 -0
- package/es/grid-component/TempTable.js +21 -0
- package/es/grid-component/hooks/columns/index.js +3 -1
- package/es/grid-component/index.d.ts +2 -2
- package/es/grid-component/index.js +6 -4
- package/es/grid-component/styles.scss +0 -1
- package/es/grid-component/table/GridEdit.js +112 -96
- package/es/grid-component/type.d.ts +7 -1
- package/es/table-component/InternalTable.js +160 -122
- package/es/table-component/TableContainer.d.ts +6 -0
- package/es/table-component/TableContainer.js +74 -70
- package/es/table-component/TableContainerEdit.d.ts +6 -0
- package/es/table-component/TableContainerEdit.js +372 -92
- package/es/table-component/body/TableBody.d.ts +2 -8
- package/es/table-component/body/TableBody.js +28 -0
- package/es/table-component/body/TableBodyCell.d.ts +1 -1
- package/es/table-component/body/TableBodyCell.js +28 -14
- package/es/table-component/body/TableBodyCellEdit.d.ts +1 -1
- package/es/table-component/body/TableBodyCellEdit.js +44 -28
- package/es/table-component/body/TableBodyRow.d.ts +3 -3
- package/es/table-component/body/TableBodyRow.js +4 -6
- package/es/table-component/footer/TableFooter.d.ts +2 -8
- package/es/table-component/footer/TableFooter.js +14 -13
- package/es/table-component/footer/TableFooterCell.d.ts +3 -6
- package/es/table-component/footer/TableFooterCell.js +14 -11
- package/es/table-component/footer/TableFooterRow.d.ts +2 -8
- package/es/table-component/footer/TableFooterRow.js +23 -48
- package/es/table-component/header/TableHead.d.ts +4 -3
- package/es/table-component/header/TableHead.js +6 -28
- package/es/table-component/header/TableHeadCell.d.ts +2 -3
- package/es/table-component/header/TableHeadCell.js +25 -55
- package/es/table-component/header/TableHeadRow.d.ts +6 -7
- package/es/table-component/header/TableHeadRow.js +37 -62
- package/es/table-component/hook/convert.d.ts +1 -0
- package/es/table-component/hook/convert.js +28 -0
- package/es/table-component/hook/useColumns.js +1 -0
- package/es/table-component/hook/utils.js +3 -0
- package/es/table-component/style.scss +61 -50
- package/es/table-component/table/Grid.d.ts +3 -0
- package/es/table-component/table/Grid.js +9 -5
- package/es/table-component/table/TableWrapper.d.ts +32 -0
- package/es/table-component/table/TableWrapper.js +242 -0
- package/es/table-component/type.d.ts +9 -4
- package/es/table-component/useContext.d.ts +4 -0
- package/es/table-component/useContext.js +4 -0
- package/lib/grid-component/InternalTable.js +30 -35
- package/lib/grid-component/TempTable.d.ts +4 -0
- package/lib/grid-component/TempTable.js +30 -0
- package/lib/grid-component/hooks/columns/index.js +3 -1
- package/lib/grid-component/index.d.ts +2 -2
- package/lib/grid-component/index.js +5 -3
- package/lib/grid-component/styles.scss +0 -1
- package/lib/grid-component/table/GridEdit.js +112 -96
- package/lib/grid-component/type.d.ts +7 -1
- package/lib/table-component/InternalTable.js +161 -122
- package/lib/table-component/TableContainer.d.ts +6 -0
- package/lib/table-component/TableContainer.js +76 -70
- package/lib/table-component/TableContainerEdit.d.ts +6 -0
- package/lib/table-component/TableContainerEdit.js +368 -90
- package/lib/table-component/body/TableBody.d.ts +2 -8
- package/lib/table-component/body/TableBody.js +29 -0
- package/lib/table-component/body/TableBodyCell.d.ts +1 -1
- package/lib/table-component/body/TableBodyCell.js +28 -14
- package/lib/table-component/body/TableBodyCellEdit.d.ts +1 -1
- package/lib/table-component/body/TableBodyCellEdit.js +44 -28
- package/lib/table-component/body/TableBodyRow.d.ts +3 -3
- package/lib/table-component/body/TableBodyRow.js +4 -6
- package/lib/table-component/footer/TableFooter.d.ts +2 -8
- package/lib/table-component/footer/TableFooter.js +15 -13
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -6
- package/lib/table-component/footer/TableFooterCell.js +15 -11
- package/lib/table-component/footer/TableFooterRow.d.ts +2 -8
- package/lib/table-component/footer/TableFooterRow.js +23 -48
- package/lib/table-component/header/TableHead.d.ts +4 -3
- package/lib/table-component/header/TableHead.js +6 -28
- package/lib/table-component/header/TableHeadCell.d.ts +2 -3
- package/lib/table-component/header/TableHeadCell.js +25 -54
- package/lib/table-component/header/TableHeadRow.d.ts +6 -7
- package/lib/table-component/header/TableHeadRow.js +37 -62
- package/lib/table-component/hook/convert.d.ts +1 -0
- package/lib/table-component/hook/convert.js +34 -0
- package/lib/table-component/hook/useColumns.js +1 -0
- package/lib/table-component/hook/utils.js +3 -0
- package/lib/table-component/style.scss +61 -50
- package/lib/table-component/table/Grid.d.ts +3 -0
- package/lib/table-component/table/Grid.js +9 -5
- package/lib/table-component/table/TableWrapper.d.ts +32 -0
- package/lib/table-component/table/TableWrapper.js +251 -0
- package/lib/table-component/type.d.ts +9 -4
- package/lib/table-component/useContext.d.ts +4 -0
- package/lib/table-component/useContext.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Table } from "@tanstack/react-table";
|
|
2
|
+
import type { CommandClick, ContextInfo, ContextMenuItem, PaginationConfig } from "../type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { Virtualizer } from "@tanstack/react-virtual";
|
|
5
|
+
import type { Column } from "@tanstack/react-table";
|
|
6
|
+
type Props<T> = {
|
|
7
|
+
prefix: string;
|
|
8
|
+
id: string;
|
|
9
|
+
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
10
|
+
height: number;
|
|
11
|
+
table: Table<T>;
|
|
12
|
+
summary?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
commandClick?: (args: Omit<CommandClick<T>, 'rows'>) => void;
|
|
15
|
+
editAble?: boolean;
|
|
16
|
+
contextMenuItems?: ContextMenuItem[];
|
|
17
|
+
showEmptyText?: boolean;
|
|
18
|
+
contextMenuClick?: any;
|
|
19
|
+
contextMenuOpen?: (args: Omit<ContextInfo<T>, 'item'>) => void;
|
|
20
|
+
contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<T>, 'item' | 'event'>) => string[]);
|
|
21
|
+
next?: () => void;
|
|
22
|
+
dataSource: T[];
|
|
23
|
+
pagination?: false | PaginationConfig;
|
|
24
|
+
infiniteScroll?: boolean;
|
|
25
|
+
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
26
|
+
virtualPaddingLeft: number | undefined;
|
|
27
|
+
virtualPaddingRight: number | undefined;
|
|
28
|
+
fixedLeftColumns: Column<T, unknown>[];
|
|
29
|
+
fixedRightColumns: Column<T, unknown>[];
|
|
30
|
+
};
|
|
31
|
+
declare const TableWrapper: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
32
|
+
export default TableWrapper;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _TableHead = _interopRequireDefault(require("../header/TableHead"));
|
|
10
|
+
var _TableBody = _interopRequireDefault(require("../body/TableBody"));
|
|
11
|
+
var _TableFooter = _interopRequireDefault(require("../footer/TableFooter"));
|
|
12
|
+
var _LoadingSpinner = _interopRequireDefault(require("../../grid-component/LoadingSpinner"));
|
|
13
|
+
var _reactTooltip = require("react-tooltip");
|
|
14
|
+
var _ContextMenu = _interopRequireDefault(require("../ContextMenu"));
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
+
var _useContext = require("../useContext");
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
const TableWrapper = props => {
|
|
20
|
+
const {
|
|
21
|
+
id,
|
|
22
|
+
prefix,
|
|
23
|
+
tableContainerRef,
|
|
24
|
+
height,
|
|
25
|
+
summary,
|
|
26
|
+
table,
|
|
27
|
+
loading,
|
|
28
|
+
commandClick,
|
|
29
|
+
editAble,
|
|
30
|
+
contextMenuItems: propContextMenuItems,
|
|
31
|
+
contextMenuHidden,
|
|
32
|
+
showEmptyText,
|
|
33
|
+
contextMenuClick,
|
|
34
|
+
contextMenuOpen,
|
|
35
|
+
next,
|
|
36
|
+
dataSource,
|
|
37
|
+
pagination,
|
|
38
|
+
infiniteScroll,
|
|
39
|
+
columnVirtualizer,
|
|
40
|
+
fixedLeftColumns,
|
|
41
|
+
fixedRightColumns,
|
|
42
|
+
virtualPaddingLeft,
|
|
43
|
+
virtualPaddingRight
|
|
44
|
+
} = props;
|
|
45
|
+
const menuRef = _react.default.useRef(null);
|
|
46
|
+
const loadingRef = _react.default.useRef(false);
|
|
47
|
+
const hasMoreRef = _react.default.useRef(true);
|
|
48
|
+
const {
|
|
49
|
+
windowSize
|
|
50
|
+
} = (0, _react.useContext)(_useContext.TableContext);
|
|
51
|
+
const {
|
|
52
|
+
currentPage,
|
|
53
|
+
pageSize,
|
|
54
|
+
total
|
|
55
|
+
} = pagination ?? {};
|
|
56
|
+
const [menuVisible, setMenuVisible] = _react.default.useState(false);
|
|
57
|
+
const [selectedRowData, setSelectedRowData] = _react.default.useState(null);
|
|
58
|
+
const [position, setPosition] = _react.default.useState({
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0,
|
|
61
|
+
viewportWidth: windowSize.innerWidth,
|
|
62
|
+
viewportHeight: windowSize.innerHeight
|
|
63
|
+
});
|
|
64
|
+
const contextMenuItems = _react.default.useMemo(() => {
|
|
65
|
+
if (typeof contextMenuHidden === 'function' && propContextMenuItems && selectedRowData) {
|
|
66
|
+
const hiddenItems = contextMenuHidden({
|
|
67
|
+
rowInfo: {
|
|
68
|
+
rowData: selectedRowData
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return propContextMenuItems.filter(item => !hiddenItems.includes(item?.key));
|
|
72
|
+
}
|
|
73
|
+
if (contextMenuHidden && typeof contextMenuHidden !== 'function' && propContextMenuItems) {
|
|
74
|
+
return propContextMenuItems.filter(item => !contextMenuHidden.includes(item?.key));
|
|
75
|
+
}
|
|
76
|
+
return propContextMenuItems;
|
|
77
|
+
}, [propContextMenuItems, contextMenuHidden, selectedRowData]);
|
|
78
|
+
const loadData = page => {
|
|
79
|
+
if (!hasMoreRef.current || loadingRef.current || loading) return;
|
|
80
|
+
loadingRef.current = true;
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
next?.();
|
|
83
|
+
if (page * pageSize >= total) {
|
|
84
|
+
hasMoreRef.current = false;
|
|
85
|
+
}
|
|
86
|
+
loadingRef.current = false;
|
|
87
|
+
}, 10);
|
|
88
|
+
};
|
|
89
|
+
const handleNext = () => {
|
|
90
|
+
loadData(currentPage + 1);
|
|
91
|
+
};
|
|
92
|
+
const handleScroll = e => {
|
|
93
|
+
if (infiniteScroll) {
|
|
94
|
+
if (loadingRef.current || loading || dataSource?.length === 0) {
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const {
|
|
100
|
+
scrollHeight: tbScrollHeight,
|
|
101
|
+
scrollTop,
|
|
102
|
+
clientHeight
|
|
103
|
+
} = e.currentTarget;
|
|
104
|
+
const isEnd = scrollTop + clientHeight >= tbScrollHeight - 50;
|
|
105
|
+
if (isEnd && !loadingRef.current && hasMoreRef.current && dataSource?.length > 0) {
|
|
106
|
+
handleNext();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (e.target.scrollLeft >= 0 && e.target.scrollLeft + e.target.clientWidth < e.target.scrollWidth) {
|
|
110
|
+
e.target.classList.add('ui-rc-table-ping-right');
|
|
111
|
+
} else {
|
|
112
|
+
e.target.classList.remove('ui-rc-table-ping-right');
|
|
113
|
+
}
|
|
114
|
+
if ((e.target.scrollLeft ?? 0) > 0) {
|
|
115
|
+
e.target.classList.add('ui-rc-table-ping-left');
|
|
116
|
+
} else {
|
|
117
|
+
e.target.classList.remove('ui-rc-table-ping-left');
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const onContextMenu = data => event => {
|
|
121
|
+
event.preventDefault(); // Ngăn chặn menu mặc định của trình duyệt
|
|
122
|
+
|
|
123
|
+
setSelectedRowData(data);
|
|
124
|
+
contextMenuOpen?.({
|
|
125
|
+
rowInfo: {
|
|
126
|
+
rowData: data
|
|
127
|
+
},
|
|
128
|
+
event
|
|
129
|
+
});
|
|
130
|
+
setMenuVisible(true);
|
|
131
|
+
|
|
132
|
+
// Đợi DOM cập nhật và lấy kích thước menu
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
const menuElement = menuRef.current; // Lấy menu từ DOM
|
|
135
|
+
const menuWidth = menuElement?.offsetWidth || 200; // Mặc định 200px nếu chưa render
|
|
136
|
+
const menuHeight = menuElement?.offsetHeight; // Mặc định 450px nếu chưa render
|
|
137
|
+
|
|
138
|
+
// Điều chỉnh vị trí menu
|
|
139
|
+
let x = event.clientX;
|
|
140
|
+
let y = event.clientY;
|
|
141
|
+
if (x + menuWidth > windowSize.innerWidth) {
|
|
142
|
+
x = x - menuWidth - 10; // Cách cạnh phải 10px
|
|
143
|
+
}
|
|
144
|
+
if (y + menuHeight > windowSize.innerHeight) {
|
|
145
|
+
if (y < menuHeight) {
|
|
146
|
+
y = 10;
|
|
147
|
+
} else {
|
|
148
|
+
y = y - 10 - menuHeight; // Cách cạnh dưới 10px
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
setPosition(prevState => ({
|
|
152
|
+
...prevState,
|
|
153
|
+
x,
|
|
154
|
+
y
|
|
155
|
+
}));
|
|
156
|
+
}, 100);
|
|
157
|
+
if (!menuVisible) {
|
|
158
|
+
document.addEventListener(`click`, function onClickOutside(e) {
|
|
159
|
+
const element = e.target;
|
|
160
|
+
const menuContainer = document.querySelector('.popup-context-menu');
|
|
161
|
+
const isInsideContainer = element.closest('.popup-context-menu') && menuContainer;
|
|
162
|
+
if (isInsideContainer) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
setMenuVisible(false);
|
|
166
|
+
setPosition(prevState => ({
|
|
167
|
+
...prevState,
|
|
168
|
+
x: undefined,
|
|
169
|
+
y: undefined
|
|
170
|
+
}));
|
|
171
|
+
document.removeEventListener(`click`, onClickOutside);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
+
style: {
|
|
177
|
+
position: 'relative'
|
|
178
|
+
}
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
180
|
+
className: (0, _classnames.default)(`${prefix}-grid-container`, {
|
|
181
|
+
'ui-rc-table-ping-right': tableContainerRef && (tableContainerRef.current?.scrollLeft ?? 0) >= 0 && (tableContainerRef.current?.scrollLeft ?? 0) + (tableContainerRef.current?.clientWidth ?? 0) < (tableContainerRef.current?.scrollWidth ?? 0),
|
|
182
|
+
'ui-rc-table-ping-left': tableContainerRef && (tableContainerRef.current?.scrollLeft ?? 0) > 0
|
|
183
|
+
}),
|
|
184
|
+
id: id,
|
|
185
|
+
ref: tableContainerRef,
|
|
186
|
+
style: {
|
|
187
|
+
overflow: 'auto',
|
|
188
|
+
//our scrollable table container
|
|
189
|
+
position: 'relative',
|
|
190
|
+
//needed for sticky header
|
|
191
|
+
// height: tableHeight ?? '500px' //should be a fixed height
|
|
192
|
+
maxHeight: height //should be a fixed height
|
|
193
|
+
// minWidth: table.getTotalSize()
|
|
194
|
+
}
|
|
195
|
+
// onScroll={infiniteScroll ? handleScroll : undefined}
|
|
196
|
+
,
|
|
197
|
+
onScroll: handleScroll
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
199
|
+
style: {
|
|
200
|
+
display: 'grid'
|
|
201
|
+
// minWidth: table.getTotalSize()
|
|
202
|
+
}
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
204
|
+
tableContainerRef: tableContainerRef,
|
|
205
|
+
table: table,
|
|
206
|
+
columnVirtualizer: columnVirtualizer,
|
|
207
|
+
virtualPaddingLeft: virtualPaddingLeft,
|
|
208
|
+
virtualPaddingRight: virtualPaddingRight,
|
|
209
|
+
fixedLeftColumns: fixedLeftColumns,
|
|
210
|
+
fixedRightColumns: fixedRightColumns
|
|
211
|
+
}), /*#__PURE__*/_react.default.createElement(_TableBody.default, {
|
|
212
|
+
tableId: id,
|
|
213
|
+
table: table,
|
|
214
|
+
tableContainerRef: tableContainerRef,
|
|
215
|
+
commandClick: commandClick,
|
|
216
|
+
editAble: editAble,
|
|
217
|
+
contextMenuItems: contextMenuItems,
|
|
218
|
+
showEmptyText: showEmptyText,
|
|
219
|
+
onContextMenu: onContextMenu,
|
|
220
|
+
columnVirtualizer: columnVirtualizer,
|
|
221
|
+
virtualPaddingLeft: virtualPaddingLeft,
|
|
222
|
+
virtualPaddingRight: virtualPaddingRight,
|
|
223
|
+
fixedLeftColumns: fixedLeftColumns,
|
|
224
|
+
fixedRightColumns: fixedRightColumns
|
|
225
|
+
}), summary && /*#__PURE__*/_react.default.createElement(_TableFooter.default
|
|
226
|
+
// columnVirtualizer={columnVirtualizer}
|
|
227
|
+
, {
|
|
228
|
+
table: table
|
|
229
|
+
// virtualPaddingLeft={virtualPaddingLeft}
|
|
230
|
+
// virtualPaddingRight={virtualPaddingRight}
|
|
231
|
+
// fixedLeftColumns={fixedLeftColumns}
|
|
232
|
+
// fixedRightColumns={fixedRightColumns}
|
|
233
|
+
}))), loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
234
|
+
className: "spinner-loading"
|
|
235
|
+
}, /*#__PURE__*/_react.default.createElement(_LoadingSpinner.default, null)), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
236
|
+
id: `${id}-tooltip-content`,
|
|
237
|
+
style: {
|
|
238
|
+
zIndex: 1999,
|
|
239
|
+
maxWidth: 450
|
|
240
|
+
}
|
|
241
|
+
}), menuVisible && /*#__PURE__*/_react.default.createElement(_ContextMenu.default, {
|
|
242
|
+
open: menuVisible,
|
|
243
|
+
pos: position,
|
|
244
|
+
setOpen: setMenuVisible,
|
|
245
|
+
menuRef: menuRef,
|
|
246
|
+
contextMenuItems: contextMenuItems,
|
|
247
|
+
contextMenuClick: contextMenuClick,
|
|
248
|
+
rowData: selectedRowData
|
|
249
|
+
}));
|
|
250
|
+
};
|
|
251
|
+
var _default = exports.default = TableWrapper;
|
|
@@ -5,6 +5,11 @@ import type { ReactElement, ReactNode } from 'react';
|
|
|
5
5
|
import type { IOperator } from './hook/constant';
|
|
6
6
|
import type { ColorPickerProps } from 'antd';
|
|
7
7
|
import type { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
8
|
+
declare module "@tanstack/table-core" {
|
|
9
|
+
interface ColumnMeta<any, any> extends ColumnTable {
|
|
10
|
+
rowSpan?: number;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
8
13
|
export type ExtendedColumnFilter = {
|
|
9
14
|
id: string;
|
|
10
15
|
value: string;
|
|
@@ -215,7 +220,7 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
215
220
|
showToolbar?: boolean;
|
|
216
221
|
onDataChange?: (data: RecordType[]) => void;
|
|
217
222
|
defaultValue?: AnyObject | (() => AnyObject);
|
|
218
|
-
summary?: boolean
|
|
223
|
+
summary?: boolean;
|
|
219
224
|
showEmptyText?: boolean;
|
|
220
225
|
commandSettings?: CommandSettings;
|
|
221
226
|
onCellPaste?: ICellPasteModel<RecordType>;
|
|
@@ -231,7 +236,7 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
231
236
|
}) => void;
|
|
232
237
|
wrapSettings?: IWrapSettings;
|
|
233
238
|
actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
234
|
-
commandClick?: (args: CommandClick) => void;
|
|
239
|
+
commandClick?: (args: CommandClick<RecordType>) => void;
|
|
235
240
|
expandable?: ExpandableConfig<RecordType>;
|
|
236
241
|
fullScreen?: boolean;
|
|
237
242
|
};
|
|
@@ -265,12 +270,12 @@ export interface RenderExpandIconProps<RecordType> {
|
|
|
265
270
|
export type TriggerEventHandler<RecordType> = (record: RecordType, event: React.MouseEvent<HTMLElement>) => void;
|
|
266
271
|
export type RowClassName<RecordType> = (record: RecordType, index: number, indent: number) => string;
|
|
267
272
|
export type ExpandedRowRender<ValueType> = (record: ValueType, index: number, indent: number, expanded: boolean) => React.ReactNode;
|
|
268
|
-
export type CommandClick = {
|
|
273
|
+
export type CommandClick<T> = {
|
|
269
274
|
id: string;
|
|
270
275
|
rowId: string;
|
|
271
276
|
rowData: any;
|
|
272
277
|
index: number;
|
|
273
|
-
rows
|
|
278
|
+
rows: T[];
|
|
274
279
|
};
|
|
275
280
|
export type IEditSelectSettings = {
|
|
276
281
|
fieldKey?: string;
|
|
@@ -27,6 +27,10 @@ export interface IContext<T> {
|
|
|
27
27
|
setFilterChange: Dispatch<SetStateAction<boolean>>;
|
|
28
28
|
onContextMenu?: (data: T) => (event: any) => void;
|
|
29
29
|
locale?: Locale;
|
|
30
|
+
windowSize: {
|
|
31
|
+
innerHeight: number;
|
|
32
|
+
innerWidth: number;
|
|
33
|
+
};
|
|
30
34
|
control?: any;
|
|
31
35
|
errors?: any;
|
|
32
36
|
handleSubmit?: any;
|
|
@@ -12,6 +12,10 @@ const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContex
|
|
|
12
12
|
dataSource: [],
|
|
13
13
|
originData: [],
|
|
14
14
|
expanded: {},
|
|
15
|
+
windowSize: {
|
|
16
|
+
innerHeight: 0,
|
|
17
|
+
innerWidth: 0
|
|
18
|
+
},
|
|
15
19
|
// triggerFilter: () => { },
|
|
16
20
|
|
|
17
21
|
setIsSelectionChange: () => {},
|