es-grid-template 1.7.38 → 1.7.39
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 +6 -0
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/useColumns.d.ts +1 -3
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/styles.scss +1437 -1437
- package/es/table-component/ContextMenu.d.ts +3 -2
- package/es/table-component/ContextMenu.js +2 -2
- package/es/table-component/InternalTable.d.ts +6 -6
- package/es/table-component/InternalTable.js +25 -134
- package/es/table-component/TableContainer.d.ts +5 -5
- package/es/table-component/TableContainer.js +32 -31
- package/es/table-component/TableContainerEdit.d.ts +1 -1
- package/es/table-component/TableContainerEdit.js +247 -228
- package/es/table-component/body/EditableCell.js +146 -147
- package/es/table-component/body/TableBody.d.ts +1 -1
- package/es/table-component/body/TableBody.js +5 -5
- package/es/table-component/body/TableBodyCell.js +18 -37
- package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/es/table-component/body/TableBodyCellEdit.js +64 -63
- package/es/table-component/body/TableBodyRow.js +1 -0
- package/es/table-component/footer/TableFooterCell.d.ts +3 -3
- package/es/table-component/footer/TableFooterCell.js +6 -8
- package/es/table-component/header/TableHead.d.ts +5 -5
- package/es/table-component/header/TableHead.js +2 -2
- package/es/table-component/hook/constant.js +6 -6
- package/es/table-component/hook/useFilterOperator.d.ts +1 -1
- package/es/table-component/hook/utils.d.ts +3 -2
- package/es/table-component/hook/utils.js +159 -202
- package/es/table-component/style.scss +1197 -1197
- package/es/table-component/table/TableWrapper.d.ts +4 -4
- package/es/table-component/table/TableWrapper.js +20 -23
- package/es/table-component/type.d.ts +40 -40
- package/es/table-component/useContext.d.ts +3 -4
- package/es/table-component/useContext.js +4 -4
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/useColumns.d.ts +1 -3
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/styles.scss +1437 -1437
- package/lib/table-component/ContextMenu.d.ts +3 -2
- package/lib/table-component/InternalTable.d.ts +6 -6
- package/lib/table-component/InternalTable.js +18 -125
- package/lib/table-component/TableContainer.d.ts +5 -5
- package/lib/table-component/TableContainer.js +26 -24
- package/lib/table-component/TableContainerEdit.d.ts +1 -1
- package/lib/table-component/TableContainerEdit.js +246 -227
- package/lib/table-component/body/EditableCell.js +145 -146
- package/lib/table-component/body/TableBody.d.ts +1 -1
- package/lib/table-component/body/TableBody.js +5 -5
- package/lib/table-component/body/TableBodyCell.js +17 -36
- package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/lib/table-component/body/TableBodyCellEdit.js +60 -59
- package/lib/table-component/body/TableBodyRow.js +1 -0
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
- package/lib/table-component/footer/TableFooterCell.js +5 -7
- package/lib/table-component/header/TableHead.d.ts +5 -5
- package/lib/table-component/header/TableHead.js +1 -1
- package/lib/table-component/hook/constant.js +6 -6
- package/lib/table-component/hook/useFilterOperator.d.ts +1 -1
- package/lib/table-component/hook/utils.d.ts +3 -2
- package/lib/table-component/hook/utils.js +159 -201
- package/lib/table-component/style.scss +1197 -1197
- package/lib/table-component/table/TableWrapper.d.ts +4 -4
- package/lib/table-component/table/TableWrapper.js +20 -23
- package/lib/table-component/type.d.ts +40 -40
- package/lib/table-component/useContext.d.ts +3 -4
- package/lib/table-component/useContext.js +3 -3
- package/package.json +116 -116
|
@@ -6,19 +6,19 @@ import type { Column } from "@tanstack/react-table";
|
|
|
6
6
|
type Props<T> = {
|
|
7
7
|
prefix: string;
|
|
8
8
|
id: string;
|
|
9
|
-
tableContainerRef: React.RefObject<HTMLDivElement
|
|
9
|
+
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
10
10
|
height: number;
|
|
11
11
|
minHeight?: number;
|
|
12
12
|
table: Table<T>;
|
|
13
13
|
summary?: boolean;
|
|
14
14
|
loading?: boolean;
|
|
15
|
-
commandClick?: (args: Omit<CommandClick<T>,
|
|
15
|
+
commandClick?: (args: Omit<CommandClick<T>, 'rows'>) => void;
|
|
16
16
|
editAble?: boolean;
|
|
17
17
|
contextMenuItems?: ContextMenuItem[];
|
|
18
18
|
showEmptyText?: boolean;
|
|
19
19
|
contextMenuClick?: any;
|
|
20
|
-
contextMenuOpen?: (args: Omit<ContextInfo<T>,
|
|
21
|
-
contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<T>,
|
|
20
|
+
contextMenuOpen?: (args: Omit<ContextInfo<T>, 'item'>) => void;
|
|
21
|
+
contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<T>, 'item' | 'event'>) => string[]);
|
|
22
22
|
next?: () => void;
|
|
23
23
|
dataSource: T[];
|
|
24
24
|
pagination?: false | PaginationConfig;
|
|
@@ -2,8 +2,7 @@ import classNames from "classnames";
|
|
|
2
2
|
import TableHead from "../header/TableHead";
|
|
3
3
|
import TableBody from "../body/TableBody";
|
|
4
4
|
import TableFooter from "../footer/TableFooter";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import ComponentSpinner from "../../grid-component/LoadingSpinner";
|
|
7
6
|
import { Tooltip } from "react-tooltip";
|
|
8
7
|
import ContextMenu from "../ContextMenu";
|
|
9
8
|
import React, { useContext } from "react";
|
|
@@ -55,7 +54,7 @@ const TableWrapper = props => {
|
|
|
55
54
|
viewportHeight: windowSize.innerHeight
|
|
56
55
|
});
|
|
57
56
|
const contextMenuItems = React.useMemo(() => {
|
|
58
|
-
if (typeof contextMenuHidden ===
|
|
57
|
+
if (typeof contextMenuHidden === 'function' && propContextMenuItems && selectedRowData) {
|
|
59
58
|
const hiddenItems = contextMenuHidden({
|
|
60
59
|
rowInfo: {
|
|
61
60
|
rowData: selectedRowData
|
|
@@ -63,15 +62,13 @@ const TableWrapper = props => {
|
|
|
63
62
|
});
|
|
64
63
|
return propContextMenuItems.filter(item => !hiddenItems.includes(item?.key));
|
|
65
64
|
}
|
|
66
|
-
if (contextMenuHidden && typeof contextMenuHidden !==
|
|
65
|
+
if (contextMenuHidden && typeof contextMenuHidden !== 'function' && propContextMenuItems) {
|
|
67
66
|
return propContextMenuItems.filter(item => !contextMenuHidden.includes(item?.key));
|
|
68
67
|
}
|
|
69
68
|
return propContextMenuItems;
|
|
70
69
|
}, [propContextMenuItems, contextMenuHidden, selectedRowData]);
|
|
71
70
|
const loadData = page => {
|
|
72
|
-
if (!hasMoreRef.current || loadingRef.current || loading)
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
71
|
+
if (!hasMoreRef.current || loadingRef.current || loading) return;
|
|
75
72
|
loadingRef.current = true;
|
|
76
73
|
setTimeout(() => {
|
|
77
74
|
next?.();
|
|
@@ -102,14 +99,14 @@ const TableWrapper = props => {
|
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
if (e.target.scrollLeft >= 0 && e.target.scrollLeft + e.target.clientWidth < e.target.scrollWidth) {
|
|
105
|
-
e.target.classList.add(
|
|
102
|
+
e.target.classList.add('ui-rc-table-ping-right');
|
|
106
103
|
} else {
|
|
107
|
-
e.target.classList.remove(
|
|
104
|
+
e.target.classList.remove('ui-rc-table-ping-right');
|
|
108
105
|
}
|
|
109
106
|
if ((e.target.scrollLeft ?? 0) > 0) {
|
|
110
|
-
e.target.classList.add(
|
|
107
|
+
e.target.classList.add('ui-rc-table-ping-left');
|
|
111
108
|
} else {
|
|
112
|
-
e.target.classList.remove(
|
|
109
|
+
e.target.classList.remove('ui-rc-table-ping-left');
|
|
113
110
|
}
|
|
114
111
|
};
|
|
115
112
|
const onContextMenu = data => event => {
|
|
@@ -152,8 +149,8 @@ const TableWrapper = props => {
|
|
|
152
149
|
if (!menuVisible) {
|
|
153
150
|
document.addEventListener(`click`, function onClickOutside(e) {
|
|
154
151
|
const element = e.target;
|
|
155
|
-
const menuContainer = document.querySelector(
|
|
156
|
-
const isInsideContainer = element.closest(
|
|
152
|
+
const menuContainer = document.querySelector('.popup-context-menu');
|
|
153
|
+
const isInsideContainer = element.closest('.popup-context-menu') && menuContainer;
|
|
157
154
|
if (isInsideContainer) {
|
|
158
155
|
return;
|
|
159
156
|
}
|
|
@@ -169,21 +166,19 @@ const TableWrapper = props => {
|
|
|
169
166
|
};
|
|
170
167
|
return /*#__PURE__*/React.createElement("div", {
|
|
171
168
|
style: {
|
|
172
|
-
position:
|
|
169
|
+
position: 'relative'
|
|
173
170
|
},
|
|
174
171
|
className: classNames(`${prefix}-grid-container`, {
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
'ui-rc-table-ping-right': tableContainerRef && (tableContainerRef.current?.scrollLeft ?? 0) >= 0 && (tableContainerRef.current?.scrollLeft ?? 0) + (tableContainerRef.current?.clientWidth ?? 0) < (tableContainerRef.current?.scrollWidth ?? 0),
|
|
173
|
+
'ui-rc-table-ping-left': tableContainerRef && (tableContainerRef.current?.scrollLeft ?? 0) > 0
|
|
177
174
|
})
|
|
178
175
|
}, /*#__PURE__*/React.createElement("div", {
|
|
179
|
-
|
|
180
|
-
// id={"rc-ui-table-container"}
|
|
181
|
-
,
|
|
176
|
+
// id={id}
|
|
182
177
|
ref: tableContainerRef,
|
|
183
178
|
style: {
|
|
184
|
-
overflow:
|
|
179
|
+
overflow: 'auto',
|
|
185
180
|
//our scrollable table container
|
|
186
|
-
position:
|
|
181
|
+
position: 'relative',
|
|
187
182
|
//needed for sticky header
|
|
188
183
|
// height: tableHeight ?? '500px' //should be a fixed height
|
|
189
184
|
maxHeight: height,
|
|
@@ -196,7 +191,7 @@ const TableWrapper = props => {
|
|
|
196
191
|
onScroll: handleScroll
|
|
197
192
|
}, /*#__PURE__*/React.createElement("table", {
|
|
198
193
|
style: {
|
|
199
|
-
display:
|
|
194
|
+
display: 'grid',
|
|
200
195
|
minWidth: table.getTotalSize()
|
|
201
196
|
}
|
|
202
197
|
}, /*#__PURE__*/React.createElement(TableHead, {
|
|
@@ -229,7 +224,9 @@ const TableWrapper = props => {
|
|
|
229
224
|
// virtualPaddingRight={virtualPaddingRight}
|
|
230
225
|
// fixedLeftColumns={fixedLeftColumns}
|
|
231
226
|
// fixedRightColumns={fixedRightColumns}
|
|
232
|
-
}))), /*#__PURE__*/React.createElement(
|
|
227
|
+
}))), loading && /*#__PURE__*/React.createElement("div", {
|
|
228
|
+
className: "spinner-loading"
|
|
229
|
+
}, /*#__PURE__*/React.createElement(ComponentSpinner, null)), /*#__PURE__*/React.createElement(Tooltip, {
|
|
233
230
|
id: `${id}-tooltip-content`,
|
|
234
231
|
style: {
|
|
235
232
|
zIndex: 1999,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { CheckboxProps, TablePaginationConfig } from
|
|
2
|
-
import type { ItemType } from
|
|
3
|
-
import type { OnChangeFn } from
|
|
4
|
-
import type { ReactElement, ReactNode } from
|
|
5
|
-
import type { IOperator } from
|
|
6
|
-
import type { ColorPickerProps } from
|
|
1
|
+
import type { CheckboxProps, TablePaginationConfig } from 'rc-master-ui';
|
|
2
|
+
import type { ItemType } from 'rc-master-ui/es/menu/interface';
|
|
3
|
+
import type { OnChangeFn } from '@tanstack/react-table';
|
|
4
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
5
|
+
import type { IOperator } from './hook/constant';
|
|
6
|
+
import type { ColorPickerProps } from 'antd';
|
|
7
7
|
import type { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
8
8
|
declare module "@tanstack/table-core" {
|
|
9
9
|
interface ColumnMeta<any, any> extends ColumnTable {
|
|
@@ -47,14 +47,14 @@ export type IFormat = {
|
|
|
47
47
|
monthFormat?: string;
|
|
48
48
|
yearFormat?: string;
|
|
49
49
|
};
|
|
50
|
-
export type RowSelectMethod =
|
|
51
|
-
export type EditType =
|
|
52
|
-
export type ITextAlign =
|
|
53
|
-
export type TypeFilter =
|
|
54
|
-
export type IColumnType =
|
|
55
|
-
export type FilterOperator =
|
|
56
|
-
export type FixedType =
|
|
57
|
-
export type SelectMode =
|
|
50
|
+
export type RowSelectMethod = 'all' | 'none' | 'invert' | 'single' | 'multiple';
|
|
51
|
+
export type EditType = 'text' | 'numeric' | 'asyncSelect' | 'date' | 'datetime' | 'time' | 'week' | 'month' | 'quarter' | 'year' | 'select' | 'checkbox' | 'currency' | 'image' | 'selectTable' | 'customSelect' | 'form' | 'color' | 'treeSelect' | 'file';
|
|
52
|
+
export type ITextAlign = 'center' | 'left' | 'right';
|
|
53
|
+
export type TypeFilter = 'Text' | 'Date' | 'Time' | 'Datetime' | 'DateRange' | 'Month' | 'Quarter' | 'Year' | 'Week' | 'Number' | 'NumberRange' | 'Dropdown' | 'DropTree' | 'Checkbox' | 'CheckboxTree' | 'CheckboxDropdown';
|
|
54
|
+
export type IColumnType = 'number' | 'time' | 'date' | 'week' | 'month' | 'file' | 'quarter' | 'year' | 'datetime' | 'string' | 'boolean' | 'checkbox' | 'color' | null | undefined;
|
|
55
|
+
export type FilterOperator = 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'startsWith' | 'endsWith' | 'contains';
|
|
56
|
+
export type FixedType = 'left' | 'right' | boolean;
|
|
57
|
+
export type SelectMode = 'checkbox' | 'radio' | undefined;
|
|
58
58
|
type IGrid = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
|
|
59
59
|
export interface FieldNames {
|
|
60
60
|
value?: string;
|
|
@@ -67,7 +67,7 @@ export interface CommandItem {
|
|
|
67
67
|
type?: string;
|
|
68
68
|
visible?: boolean | ((record: any) => boolean);
|
|
69
69
|
title: string;
|
|
70
|
-
color?:
|
|
70
|
+
color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
|
|
71
71
|
tooltip?: string;
|
|
72
72
|
icon?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
73
73
|
template?: ReactNode | ReactElement | ((record: any) => ReactNode | ReactElement);
|
|
@@ -92,9 +92,9 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
92
92
|
format?: IFormat | ((rowData: any) => IFormat);
|
|
93
93
|
allowFiltering?: boolean;
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
* @deprecated Please use `allowSorter` instead.
|
|
96
|
+
* @since 1.7.25
|
|
97
|
+
*/
|
|
98
98
|
sorter?: boolean;
|
|
99
99
|
allowSorter?: boolean;
|
|
100
100
|
operator?: FilterOperator;
|
|
@@ -106,9 +106,9 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
106
106
|
showFilterSearch?: boolean;
|
|
107
107
|
headerText?: string;
|
|
108
108
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
* @deprecated Please use `visible` instead.
|
|
110
|
+
* @since 1.7.33
|
|
111
|
+
*/
|
|
112
112
|
hidden?: boolean;
|
|
113
113
|
visible?: boolean;
|
|
114
114
|
headerTooltip?: boolean | string | (() => ReactNode | ReactElement);
|
|
@@ -145,9 +145,9 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
145
145
|
fixedType?: FixedType;
|
|
146
146
|
fixed?: FixedType;
|
|
147
147
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
* @deprecated Please use `wrapSettings` instead.
|
|
149
|
+
* @since 1.7.34
|
|
150
|
+
*/
|
|
151
151
|
headerTextWrap?: boolean;
|
|
152
152
|
ellipsis?: boolean;
|
|
153
153
|
allowResizing?: boolean;
|
|
@@ -205,8 +205,8 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
205
205
|
lang?: string;
|
|
206
206
|
contextMenuItems?: ContextMenuItem[];
|
|
207
207
|
showDefaultContext?: boolean;
|
|
208
|
-
contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<RecordType>,
|
|
209
|
-
contextMenuOpen?: (args: Omit<ContextInfo<RecordType>,
|
|
208
|
+
contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<RecordType>, 'item' | 'event'>) => string[]);
|
|
209
|
+
contextMenuOpen?: (args: Omit<ContextInfo<RecordType>, 'item'>) => void;
|
|
210
210
|
contextMenuClick?: (args: ContextInfo<RecordType>) => void;
|
|
211
211
|
recordDoubleClick?: (args: RecordDoubleClickEventArgs<RecordType>) => void;
|
|
212
212
|
toolbarItems?: ToolbarItem[];
|
|
@@ -216,7 +216,7 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
216
216
|
field: string;
|
|
217
217
|
key: string;
|
|
218
218
|
operator: IOperator;
|
|
219
|
-
predicate:
|
|
219
|
+
predicate: 'and' | 'or';
|
|
220
220
|
value: any;
|
|
221
221
|
}[]) => void;
|
|
222
222
|
onSorter?: (args: Sorter[]) => void;
|
|
@@ -295,7 +295,7 @@ export type IEditSelectSettings = {
|
|
|
295
295
|
fieldKey?: string;
|
|
296
296
|
options: any[] | ((rowData: any, field: string) => any[]);
|
|
297
297
|
/** get value form other field **/
|
|
298
|
-
fieldValue?:
|
|
298
|
+
fieldValue?: string;
|
|
299
299
|
/** get label form other field **/
|
|
300
300
|
fieldLabel?: string;
|
|
301
301
|
/** cho phép nhập giá trị - onBlur: giá trị search được set thành value **/
|
|
@@ -363,7 +363,7 @@ export type ColumnSelectTable = {
|
|
|
363
363
|
dataIndex?: string;
|
|
364
364
|
type?: IColumnType;
|
|
365
365
|
headerText?: string;
|
|
366
|
-
fixedType?:
|
|
366
|
+
fixedType?: 'left' | 'right' | undefined;
|
|
367
367
|
width?: number | undefined;
|
|
368
368
|
minWidth?: number;
|
|
369
369
|
maxWidth?: number;
|
|
@@ -387,7 +387,7 @@ export type ITemplateColumn = {
|
|
|
387
387
|
};
|
|
388
388
|
export type RawValueType = string | number;
|
|
389
389
|
export type ToolbarItem = {
|
|
390
|
-
position?:
|
|
390
|
+
position?: 'Top' | 'Bottom';
|
|
391
391
|
align?: ITextAlign;
|
|
392
392
|
onClick?: (args: any) => void;
|
|
393
393
|
key?: React.Key;
|
|
@@ -435,19 +435,19 @@ export type IOnPastedProps = {
|
|
|
435
435
|
copyRows: any[];
|
|
436
436
|
pastedColumns: string[];
|
|
437
437
|
pasteData: any[];
|
|
438
|
-
type:
|
|
438
|
+
type: 'onPaste' | 'onChange' | 'onCellPaste';
|
|
439
439
|
};
|
|
440
440
|
export type ICellClick = {
|
|
441
441
|
index: number;
|
|
442
442
|
indexCol?: number;
|
|
443
443
|
rowId: string | number;
|
|
444
|
-
type:
|
|
444
|
+
type: 'Editing' | 'Default';
|
|
445
445
|
field: string;
|
|
446
446
|
cellValue: any;
|
|
447
447
|
rowData: any;
|
|
448
448
|
};
|
|
449
449
|
export type CellChangeArgs<T> = {
|
|
450
|
-
type:
|
|
450
|
+
type: 'onPaste' | 'onChange' | 'onCellPaste';
|
|
451
451
|
value: any;
|
|
452
452
|
option: AnyObject;
|
|
453
453
|
rowData: T;
|
|
@@ -458,19 +458,19 @@ export type CellChangeArgs<T> = {
|
|
|
458
458
|
indexCol: any;
|
|
459
459
|
sumValue?: any[];
|
|
460
460
|
};
|
|
461
|
-
export type IWrapMode =
|
|
461
|
+
export type IWrapMode = 'Header' | 'Both' | 'Content';
|
|
462
462
|
export type IWrapSettings = {
|
|
463
463
|
wrapMode?: IWrapMode;
|
|
464
464
|
};
|
|
465
465
|
export type SelectionSettings<T = AnyObject> = {
|
|
466
|
-
mode?:
|
|
467
|
-
type?:
|
|
466
|
+
mode?: 'checkbox' | 'radio';
|
|
467
|
+
type?: 'single' | 'multiple';
|
|
468
468
|
checkboxOnly?: boolean;
|
|
469
469
|
columnWidth?: number;
|
|
470
470
|
hideSelectAll?: boolean;
|
|
471
471
|
selectedRowKeys?: Key[];
|
|
472
472
|
defaultSelectedRowKeys?: Key[];
|
|
473
|
-
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps,
|
|
473
|
+
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>>;
|
|
474
474
|
};
|
|
475
475
|
export type SelectionSelectFn<T = AnyObject> = (record: T, selected: boolean, selectedRows: T[], nativeEvent: Event) => void;
|
|
476
476
|
export type RowSelection<T> = {
|
|
@@ -480,7 +480,7 @@ export type RowSelection<T> = {
|
|
|
480
480
|
onChange?: (selectedRowKeys: Key[], selectedRows: T[], info: {
|
|
481
481
|
type: RowSelectMethod;
|
|
482
482
|
}, selectedRow: T) => void;
|
|
483
|
-
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps,
|
|
483
|
+
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>>;
|
|
484
484
|
onSelect?: SelectionSelectFn<T>;
|
|
485
485
|
/** @deprecated This function is deprecated and should use `onChange` instead */
|
|
486
486
|
onSelectMultiple?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
|
@@ -513,7 +513,7 @@ export type ContextInfo<RecordType> = {
|
|
|
513
513
|
event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
|
|
514
514
|
item: ItemType;
|
|
515
515
|
};
|
|
516
|
-
export type Presets = Required<ColorPickerProps>[
|
|
516
|
+
export type Presets = Required<ColorPickerProps>['presets'][number];
|
|
517
517
|
export type RangeState = {
|
|
518
518
|
rowRange: string[];
|
|
519
519
|
colRange: string[];
|
|
@@ -527,6 +527,6 @@ export type RangeState = {
|
|
|
527
527
|
export type Sorter = {
|
|
528
528
|
columnKey: string;
|
|
529
529
|
field: string;
|
|
530
|
-
order:
|
|
530
|
+
order: 'ascend' | 'descend';
|
|
531
531
|
};
|
|
532
532
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import type { ColumnTable, ExpandableConfig, IFormat, IWrapSettings, Locale, RangeState, RecordDoubleClickEventArgs, SelectionSettings } from "./type";
|
|
3
3
|
import type { SubmitHandler } from "react-hook-form";
|
|
4
|
-
import type { ExpandedState } from
|
|
4
|
+
import type { ExpandedState } from '@tanstack/react-table';
|
|
5
5
|
export type IPositionCell = {
|
|
6
6
|
rowId: string;
|
|
7
7
|
colId: string;
|
|
@@ -33,7 +33,6 @@ export interface IContext<T> {
|
|
|
33
33
|
innerHeight: number;
|
|
34
34
|
innerWidth: number;
|
|
35
35
|
};
|
|
36
|
-
isFullScreen?: boolean;
|
|
37
36
|
control?: any;
|
|
38
37
|
errors?: any;
|
|
39
38
|
handleSubmit?: any;
|
|
@@ -79,5 +78,5 @@ export type ContextCellChange = {
|
|
|
79
78
|
indexCol: number;
|
|
80
79
|
newState?: any;
|
|
81
80
|
prevState?: any;
|
|
82
|
-
type:
|
|
81
|
+
type: 'enter' | 'blur' | 'outClick';
|
|
83
82
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createContext } from
|
|
1
|
+
import { createContext } from 'react';
|
|
2
2
|
export const TableContext = /*#__PURE__*/createContext({
|
|
3
|
-
prefix:
|
|
4
|
-
id:
|
|
3
|
+
prefix: 'ui-rc',
|
|
4
|
+
id: '',
|
|
5
5
|
isDataTree: false,
|
|
6
|
-
rowKey:
|
|
6
|
+
rowKey: 'rowId',
|
|
7
7
|
dataSource: [],
|
|
8
8
|
originData: [],
|
|
9
9
|
expanded: {},
|
|
@@ -220,16 +220,16 @@ const optionFontSize = exports.optionFontSize = [{
|
|
|
220
220
|
label: '48'
|
|
221
221
|
}];
|
|
222
222
|
|
|
223
|
-
/**
|
|
224
|
-
* Sort order for BaseTable
|
|
223
|
+
/**
|
|
224
|
+
* Sort order for BaseTable
|
|
225
225
|
*/
|
|
226
226
|
const SortOrder = {
|
|
227
|
-
/**
|
|
228
|
-
* Sort data in ascending order
|
|
227
|
+
/**
|
|
228
|
+
* Sort data in ascending order
|
|
229
229
|
*/
|
|
230
230
|
ascend: 'Ascending',
|
|
231
|
-
/**
|
|
232
|
-
* Sort data in descending order
|
|
231
|
+
/**
|
|
232
|
+
* Sort data in descending order
|
|
233
233
|
*/
|
|
234
234
|
descend: 'Descending'
|
|
235
235
|
};
|
|
@@ -15,7 +15,5 @@ interface UseColumnsConfig<RecordType> {
|
|
|
15
15
|
rowKey?: any;
|
|
16
16
|
onMouseHover?: any;
|
|
17
17
|
}
|
|
18
|
-
declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
|
|
19
|
-
any
|
|
20
|
-
];
|
|
18
|
+
declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [any];
|
|
21
19
|
export default useColumns;
|
|
@@ -53,7 +53,7 @@ export declare const getTemplate: (template: any, column?: ColumnTable) => React
|
|
|
53
53
|
export declare const totalFixedWidth: <T>(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => number;
|
|
54
54
|
export declare const isObjEmpty: (obj: any) => boolean;
|
|
55
55
|
export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => ColumnTable<T>[];
|
|
56
|
-
export declare const updateData: <
|
|
56
|
+
export declare const updateData: <Record_1 = AnyObject>(initData: Record_1[], rows: Record_1[], key: keyof Record_1) => Record_1[];
|
|
57
57
|
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
|
|
58
58
|
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|
|
59
59
|
export declare function findAllChildrenKeys<RecordType>(data: readonly RecordType[], getRowKey: GetRowKey<RecordType>, childrenColumnName: string): Key[];
|