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;
|
|
@@ -9,14 +9,13 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
9
9
|
var _TableHead = _interopRequireDefault(require("../header/TableHead"));
|
|
10
10
|
var _TableBody = _interopRequireDefault(require("../body/TableBody"));
|
|
11
11
|
var _TableFooter = _interopRequireDefault(require("../footer/TableFooter"));
|
|
12
|
+
var _LoadingSpinner = _interopRequireDefault(require("../../grid-component/LoadingSpinner"));
|
|
12
13
|
var _reactTooltip = require("react-tooltip");
|
|
13
14
|
var _ContextMenu = _interopRequireDefault(require("../ContextMenu"));
|
|
14
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
16
|
var _useContext = require("../useContext");
|
|
16
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); }
|
|
17
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; }
|
|
18
|
-
// import ComponentSpinner from "../../grid-component/LoadingSpinner"
|
|
19
|
-
|
|
20
19
|
const TableWrapper = props => {
|
|
21
20
|
const {
|
|
22
21
|
id,
|
|
@@ -64,7 +63,7 @@ const TableWrapper = props => {
|
|
|
64
63
|
viewportHeight: windowSize.innerHeight
|
|
65
64
|
});
|
|
66
65
|
const contextMenuItems = _react.default.useMemo(() => {
|
|
67
|
-
if (typeof contextMenuHidden ===
|
|
66
|
+
if (typeof contextMenuHidden === 'function' && propContextMenuItems && selectedRowData) {
|
|
68
67
|
const hiddenItems = contextMenuHidden({
|
|
69
68
|
rowInfo: {
|
|
70
69
|
rowData: selectedRowData
|
|
@@ -72,15 +71,13 @@ const TableWrapper = props => {
|
|
|
72
71
|
});
|
|
73
72
|
return propContextMenuItems.filter(item => !hiddenItems.includes(item?.key));
|
|
74
73
|
}
|
|
75
|
-
if (contextMenuHidden && typeof contextMenuHidden !==
|
|
74
|
+
if (contextMenuHidden && typeof contextMenuHidden !== 'function' && propContextMenuItems) {
|
|
76
75
|
return propContextMenuItems.filter(item => !contextMenuHidden.includes(item?.key));
|
|
77
76
|
}
|
|
78
77
|
return propContextMenuItems;
|
|
79
78
|
}, [propContextMenuItems, contextMenuHidden, selectedRowData]);
|
|
80
79
|
const loadData = page => {
|
|
81
|
-
if (!hasMoreRef.current || loadingRef.current || loading)
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
80
|
+
if (!hasMoreRef.current || loadingRef.current || loading) return;
|
|
84
81
|
loadingRef.current = true;
|
|
85
82
|
setTimeout(() => {
|
|
86
83
|
next?.();
|
|
@@ -111,14 +108,14 @@ const TableWrapper = props => {
|
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
if (e.target.scrollLeft >= 0 && e.target.scrollLeft + e.target.clientWidth < e.target.scrollWidth) {
|
|
114
|
-
e.target.classList.add(
|
|
111
|
+
e.target.classList.add('ui-rc-table-ping-right');
|
|
115
112
|
} else {
|
|
116
|
-
e.target.classList.remove(
|
|
113
|
+
e.target.classList.remove('ui-rc-table-ping-right');
|
|
117
114
|
}
|
|
118
115
|
if ((e.target.scrollLeft ?? 0) > 0) {
|
|
119
|
-
e.target.classList.add(
|
|
116
|
+
e.target.classList.add('ui-rc-table-ping-left');
|
|
120
117
|
} else {
|
|
121
|
-
e.target.classList.remove(
|
|
118
|
+
e.target.classList.remove('ui-rc-table-ping-left');
|
|
122
119
|
}
|
|
123
120
|
};
|
|
124
121
|
const onContextMenu = data => event => {
|
|
@@ -161,8 +158,8 @@ const TableWrapper = props => {
|
|
|
161
158
|
if (!menuVisible) {
|
|
162
159
|
document.addEventListener(`click`, function onClickOutside(e) {
|
|
163
160
|
const element = e.target;
|
|
164
|
-
const menuContainer = document.querySelector(
|
|
165
|
-
const isInsideContainer = element.closest(
|
|
161
|
+
const menuContainer = document.querySelector('.popup-context-menu');
|
|
162
|
+
const isInsideContainer = element.closest('.popup-context-menu') && menuContainer;
|
|
166
163
|
if (isInsideContainer) {
|
|
167
164
|
return;
|
|
168
165
|
}
|
|
@@ -178,21 +175,19 @@ const TableWrapper = props => {
|
|
|
178
175
|
};
|
|
179
176
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
180
177
|
style: {
|
|
181
|
-
position:
|
|
178
|
+
position: 'relative'
|
|
182
179
|
},
|
|
183
180
|
className: (0, _classnames.default)(`${prefix}-grid-container`, {
|
|
184
|
-
|
|
185
|
-
|
|
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
|
|
186
183
|
})
|
|
187
184
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
188
|
-
|
|
189
|
-
// id={"rc-ui-table-container"}
|
|
190
|
-
,
|
|
185
|
+
// id={id}
|
|
191
186
|
ref: tableContainerRef,
|
|
192
187
|
style: {
|
|
193
|
-
overflow:
|
|
188
|
+
overflow: 'auto',
|
|
194
189
|
//our scrollable table container
|
|
195
|
-
position:
|
|
190
|
+
position: 'relative',
|
|
196
191
|
//needed for sticky header
|
|
197
192
|
// height: tableHeight ?? '500px' //should be a fixed height
|
|
198
193
|
maxHeight: height,
|
|
@@ -205,7 +200,7 @@ const TableWrapper = props => {
|
|
|
205
200
|
onScroll: handleScroll
|
|
206
201
|
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
207
202
|
style: {
|
|
208
|
-
display:
|
|
203
|
+
display: 'grid',
|
|
209
204
|
minWidth: table.getTotalSize()
|
|
210
205
|
}
|
|
211
206
|
}, /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
@@ -238,7 +233,9 @@ const TableWrapper = props => {
|
|
|
238
233
|
// virtualPaddingRight={virtualPaddingRight}
|
|
239
234
|
// fixedLeftColumns={fixedLeftColumns}
|
|
240
235
|
// fixedRightColumns={fixedRightColumns}
|
|
241
|
-
}))), /*#__PURE__*/_react.default.createElement(
|
|
236
|
+
}))), loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
237
|
+
className: "spinner-loading"
|
|
238
|
+
}, /*#__PURE__*/_react.default.createElement(_LoadingSpinner.default, null)), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
242
239
|
id: `${id}-tooltip-content`,
|
|
243
240
|
style: {
|
|
244
241
|
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
|
};
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TableContext = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContext)({
|
|
9
|
-
prefix:
|
|
10
|
-
id:
|
|
9
|
+
prefix: 'ui-rc',
|
|
10
|
+
id: '',
|
|
11
11
|
isDataTree: false,
|
|
12
|
-
rowKey:
|
|
12
|
+
rowKey: 'rowId',
|
|
13
13
|
dataSource: [],
|
|
14
14
|
originData: [],
|
|
15
15
|
expanded: {},
|
package/package.json
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "es-grid-template",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"description": "es-grid-template",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"react",
|
|
7
|
-
"react-component",
|
|
8
|
-
"grid",
|
|
9
|
-
"table"
|
|
10
|
-
],
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"main": "lib/index",
|
|
13
|
-
"module": "es/index",
|
|
14
|
-
"files": [
|
|
15
|
-
"lib",
|
|
16
|
-
"es",
|
|
17
|
-
"assets/*.css",
|
|
18
|
-
"assets/*.scss"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"__compile": "father build && ",
|
|
22
|
-
"compile": "father build && sass assets/index.scss assets/index.css",
|
|
23
|
-
"clean": "rimraf lib es",
|
|
24
|
-
"__docs:build": "dumi build",
|
|
25
|
-
"__docs:deploy": "gh-pages -d dist",
|
|
26
|
-
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
|
|
27
|
-
"__now-build": "npm run docs:build",
|
|
28
|
-
"prepare": "dumi setup",
|
|
29
|
-
"prepublishOnly": "npm run compile",
|
|
30
|
-
"___postpublish": "npm run docs:build",
|
|
31
|
-
"__postpublish": "npm run docs:build && npm run docs:deploy",
|
|
32
|
-
"start": "dumi dev",
|
|
33
|
-
"test": "vitest --watch false",
|
|
34
|
-
"coverage": "vitest run --coverage"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@ant-design/colors": "^8.0.0",
|
|
38
|
-
"@ant-design/icons": "^5.5.2",
|
|
39
|
-
"@babel/runtime": "^7.11.2",
|
|
40
|
-
"@core-rc/rc-select": "^0.1.3",
|
|
41
|
-
"@dnd-kit/core": "^6.3.1",
|
|
42
|
-
"@dnd-kit/modifiers": "^9.0.0",
|
|
43
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
44
|
-
"@faker-js/faker": "^9.5.0",
|
|
45
|
-
"@floating-ui/react": "^0.27.5",
|
|
46
|
-
"@hookform/resolvers": "^5.0.1",
|
|
47
|
-
"@rc-component/color-picker": "^2.0.1",
|
|
48
|
-
"@rc-component/father-plugin": "^2.0.1",
|
|
49
|
-
"@rc-component/trigger": "^2.0.0",
|
|
50
|
-
"@rc-component/util": "^1.0.1",
|
|
51
|
-
"@tanstack/react-table": "^8.21.3",
|
|
52
|
-
"@tanstack/react-virtual": "^3.13.12",
|
|
53
|
-
"@types/react-resizable": "^3.0.8",
|
|
54
|
-
"@types/styled-components": "^5.1.34",
|
|
55
|
-
"@vitest/coverage-v8": "^2.0.5",
|
|
56
|
-
"antd": "^5.24.1",
|
|
57
|
-
"antd-style": "^3.7.1",
|
|
58
|
-
"becoxy-icons": "^2.0.1",
|
|
59
|
-
"classnames": "^2.3.1",
|
|
60
|
-
"dayjs": "^1.11.13",
|
|
61
|
-
"lodash": "^4.17.21",
|
|
62
|
-
"moment": "^2.30.1",
|
|
63
|
-
"postcss": "^8.4.35",
|
|
64
|
-
"rc-checkbox": "^3.5.0",
|
|
65
|
-
"rc-dropdown": "^4.2.1",
|
|
66
|
-
"rc-field-form": "^2.6.0",
|
|
67
|
-
"rc-master-ui": "1.1.44",
|
|
68
|
-
"rc-select": "^14.16.3",
|
|
69
|
-
"rc-tooltip": "^6.3.0",
|
|
70
|
-
"rc-tree": "^5.10.1",
|
|
71
|
-
"rc-tree-select": "^5.24.5",
|
|
72
|
-
"react-full-screen": "^1.1.1",
|
|
73
|
-
"react-hook-form": "^7.54.2",
|
|
74
|
-
"react-hot-toast": "^2.5.2",
|
|
75
|
-
"react-numeric-component": "^1.0.7",
|
|
76
|
-
"react-resizable": "^3.0.5",
|
|
77
|
-
"react-tooltip": "^5.28.1",
|
|
78
|
-
"rimraf": "5.0.10",
|
|
79
|
-
"sass": "^1.81.0",
|
|
80
|
-
"styled-components": "^6.1.15",
|
|
81
|
-
"sweetalert2": "^11.4.14",
|
|
82
|
-
"sweetalert2-react-content": "^5.0.0",
|
|
83
|
-
"throttle-debounce": "^5.0.2",
|
|
84
|
-
"vitest": "^2.0.5",
|
|
85
|
-
"yup": "^1.6.1"
|
|
86
|
-
},
|
|
87
|
-
"devDependencies": {
|
|
88
|
-
"@babel/cli": "^7.26.4",
|
|
89
|
-
"@babel/preset-env": "^7.26.9",
|
|
90
|
-
"@rc-component/np": "^1.0.3",
|
|
91
|
-
"@testing-library/react": "^14.0.0",
|
|
92
|
-
"@types/jest": "^29.4.0",
|
|
93
|
-
"@types/react": "^18.0.26",
|
|
94
|
-
"@types/react-dom": "^18.0.10",
|
|
95
|
-
"@types/warning": "^3.0.0",
|
|
96
|
-
"cross-env": "^7.0.0",
|
|
97
|
-
"dumi": "^2.2.13",
|
|
98
|
-
"eslint": "^8.56.0",
|
|
99
|
-
"eslint-plugin-unicorn": "^55.0.0",
|
|
100
|
-
"father": "^4.0.0",
|
|
101
|
-
"gh-pages": "^3.1.0",
|
|
102
|
-
"less": "^4.1.1",
|
|
103
|
-
"np": "^7.1.0",
|
|
104
|
-
"rc-test": "^7.0.9",
|
|
105
|
-
"react": "^18.2.0",
|
|
106
|
-
"react-dom": "^18.2.0",
|
|
107
|
-
"typescript": "^4.0.5"
|
|
108
|
-
},
|
|
109
|
-
"peerDependencies": {
|
|
110
|
-
"react": ">=16.9.0",
|
|
111
|
-
"react-dom": ">=16.9.0"
|
|
112
|
-
},
|
|
113
|
-
"umi": {
|
|
114
|
-
"configFile": "config.ts"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "es-grid-template",
|
|
3
|
+
"version": "1.7.39",
|
|
4
|
+
"description": "es-grid-template",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-component",
|
|
8
|
+
"grid",
|
|
9
|
+
"table"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"main": "lib/index",
|
|
13
|
+
"module": "es/index",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"es",
|
|
17
|
+
"assets/*.css",
|
|
18
|
+
"assets/*.scss"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"__compile": "father build && ",
|
|
22
|
+
"compile": "father build && sass assets/index.scss assets/index.css",
|
|
23
|
+
"clean": "rimraf lib es",
|
|
24
|
+
"__docs:build": "dumi build",
|
|
25
|
+
"__docs:deploy": "gh-pages -d dist",
|
|
26
|
+
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
|
|
27
|
+
"__now-build": "npm run docs:build",
|
|
28
|
+
"prepare": "dumi setup",
|
|
29
|
+
"prepublishOnly": "npm run compile",
|
|
30
|
+
"___postpublish": "npm run docs:build",
|
|
31
|
+
"__postpublish": "npm run docs:build && npm run docs:deploy",
|
|
32
|
+
"start": "dumi dev",
|
|
33
|
+
"test": "vitest --watch false",
|
|
34
|
+
"coverage": "vitest run --coverage"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@ant-design/colors": "^8.0.0",
|
|
38
|
+
"@ant-design/icons": "^5.5.2",
|
|
39
|
+
"@babel/runtime": "^7.11.2",
|
|
40
|
+
"@core-rc/rc-select": "^0.1.3",
|
|
41
|
+
"@dnd-kit/core": "^6.3.1",
|
|
42
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
43
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
44
|
+
"@faker-js/faker": "^9.5.0",
|
|
45
|
+
"@floating-ui/react": "^0.27.5",
|
|
46
|
+
"@hookform/resolvers": "^5.0.1",
|
|
47
|
+
"@rc-component/color-picker": "^2.0.1",
|
|
48
|
+
"@rc-component/father-plugin": "^2.0.1",
|
|
49
|
+
"@rc-component/trigger": "^2.0.0",
|
|
50
|
+
"@rc-component/util": "^1.0.1",
|
|
51
|
+
"@tanstack/react-table": "^8.21.3",
|
|
52
|
+
"@tanstack/react-virtual": "^3.13.12",
|
|
53
|
+
"@types/react-resizable": "^3.0.8",
|
|
54
|
+
"@types/styled-components": "^5.1.34",
|
|
55
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
56
|
+
"antd": "^5.24.1",
|
|
57
|
+
"antd-style": "^3.7.1",
|
|
58
|
+
"becoxy-icons": "^2.0.1",
|
|
59
|
+
"classnames": "^2.3.1",
|
|
60
|
+
"dayjs": "^1.11.13",
|
|
61
|
+
"lodash": "^4.17.21",
|
|
62
|
+
"moment": "^2.30.1",
|
|
63
|
+
"postcss": "^8.4.35",
|
|
64
|
+
"rc-checkbox": "^3.5.0",
|
|
65
|
+
"rc-dropdown": "^4.2.1",
|
|
66
|
+
"rc-field-form": "^2.6.0",
|
|
67
|
+
"rc-master-ui": "1.1.44",
|
|
68
|
+
"rc-select": "^14.16.3",
|
|
69
|
+
"rc-tooltip": "^6.3.0",
|
|
70
|
+
"rc-tree": "^5.10.1",
|
|
71
|
+
"rc-tree-select": "^5.24.5",
|
|
72
|
+
"react-full-screen": "^1.1.1",
|
|
73
|
+
"react-hook-form": "^7.54.2",
|
|
74
|
+
"react-hot-toast": "^2.5.2",
|
|
75
|
+
"react-numeric-component": "^1.0.7",
|
|
76
|
+
"react-resizable": "^3.0.5",
|
|
77
|
+
"react-tooltip": "^5.28.1",
|
|
78
|
+
"rimraf": "5.0.10",
|
|
79
|
+
"sass": "^1.81.0",
|
|
80
|
+
"styled-components": "^6.1.15",
|
|
81
|
+
"sweetalert2": "^11.4.14",
|
|
82
|
+
"sweetalert2-react-content": "^5.0.0",
|
|
83
|
+
"throttle-debounce": "^5.0.2",
|
|
84
|
+
"vitest": "^2.0.5",
|
|
85
|
+
"yup": "^1.6.1"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@babel/cli": "^7.26.4",
|
|
89
|
+
"@babel/preset-env": "^7.26.9",
|
|
90
|
+
"@rc-component/np": "^1.0.3",
|
|
91
|
+
"@testing-library/react": "^14.0.0",
|
|
92
|
+
"@types/jest": "^29.4.0",
|
|
93
|
+
"@types/react": "^18.0.26",
|
|
94
|
+
"@types/react-dom": "^18.0.10",
|
|
95
|
+
"@types/warning": "^3.0.0",
|
|
96
|
+
"cross-env": "^7.0.0",
|
|
97
|
+
"dumi": "^2.2.13",
|
|
98
|
+
"eslint": "^8.56.0",
|
|
99
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
100
|
+
"father": "^4.0.0",
|
|
101
|
+
"gh-pages": "^3.1.0",
|
|
102
|
+
"less": "^4.1.1",
|
|
103
|
+
"np": "^7.1.0",
|
|
104
|
+
"rc-test": "^7.0.9",
|
|
105
|
+
"react": "^18.2.0",
|
|
106
|
+
"react-dom": "^18.2.0",
|
|
107
|
+
"typescript": "^4.0.5"
|
|
108
|
+
},
|
|
109
|
+
"peerDependencies": {
|
|
110
|
+
"react": ">=16.9.0",
|
|
111
|
+
"react-dom": ">=16.9.0"
|
|
112
|
+
},
|
|
113
|
+
"umi": {
|
|
114
|
+
"configFile": "config.ts"
|
|
115
|
+
}
|
|
116
|
+
}
|