es-grid-template 1.9.61 → 1.9.63
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/ali-table/Grid.js +1 -1
- package/es/ali-table/InternalTable.d.ts +2 -1
- package/es/ali-table/InternalTable.js +24 -43
- package/es/ali-table/base-table/styles.js +1 -1
- package/es/ali-table/base-table/table.d.ts +2 -2
- package/es/ali-table/base-table/utils.d.ts +2 -0
- package/es/ali-table/base-table/utils.js +12 -1
- package/es/ali-table/interfaces.d.ts +4 -0
- package/es/ali-table/internals.d.ts +2 -1
- package/es/ali-table/pipeline/features/columnCustom.d.ts +2 -0
- package/es/ali-table/pipeline/features/columnCustom.js +310 -24
- package/es/ali-table/utils/utility.d.ts +1 -0
- package/es/ali-table/utils/utility.js +43 -1
- package/es/grid-component/type.d.ts +2 -1
- package/es/group-component/hook/utils.d.ts +3 -3
- package/es/table-component/components/async-select/index.js +1 -1
- package/es/table-component/hook/utils.d.ts +1 -3
- package/lib/ali-table/Grid.js +1 -1
- package/lib/ali-table/InternalTable.d.ts +2 -1
- package/lib/ali-table/InternalTable.js +24 -43
- package/lib/ali-table/base-table/styles.js +1 -1
- package/lib/ali-table/base-table/table.d.ts +2 -2
- package/lib/ali-table/base-table/utils.d.ts +2 -0
- package/lib/ali-table/base-table/utils.js +13 -0
- package/lib/ali-table/interfaces.d.ts +4 -0
- package/lib/ali-table/internals.d.ts +2 -1
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +2 -0
- package/lib/ali-table/pipeline/features/columnCustom.js +310 -24
- package/lib/ali-table/utils/utility.d.ts +1 -0
- package/lib/ali-table/utils/utility.js +45 -1
- package/lib/grid-component/type.d.ts +2 -1
- package/lib/table-component/components/async-select/index.js +1 -1
- package/lib/table-component/hook/utils.d.ts +1 -3
- package/package.json +1 -1
|
@@ -73,6 +73,7 @@ const InternalTable = props => {
|
|
|
73
73
|
toolbarItems,
|
|
74
74
|
defaultValue,
|
|
75
75
|
commandSettings,
|
|
76
|
+
headerData,
|
|
76
77
|
...rest
|
|
77
78
|
} = props;
|
|
78
79
|
const tableRef = (0, _react.useRef)(null);
|
|
@@ -319,51 +320,29 @@ const InternalTable = props => {
|
|
|
319
320
|
type: changeType,
|
|
320
321
|
newState,
|
|
321
322
|
prevState,
|
|
322
|
-
|
|
323
|
-
field,
|
|
324
|
-
indexCol,
|
|
325
|
-
indexRow,
|
|
326
|
-
key
|
|
323
|
+
field
|
|
327
324
|
} = args;
|
|
328
325
|
if (changeType === 'blur') {
|
|
329
|
-
const handleChangeCallback = callbackData => {
|
|
330
|
-
|
|
331
|
-
Object.entries(callbackRecord).forEach(([name, value]) => {
|
|
332
|
-
setValue(name, value);
|
|
333
|
-
});
|
|
334
|
-
onSubmit(callbackRecord);
|
|
335
|
-
};
|
|
336
|
-
if (onHeaderCellChange) {
|
|
337
|
-
if (onHeaderCellChange.length > 1) {
|
|
338
|
-
onHeaderCellChange({
|
|
339
|
-
field,
|
|
340
|
-
indexCol,
|
|
341
|
-
type: 'onChange',
|
|
342
|
-
value: newState,
|
|
343
|
-
option,
|
|
344
|
-
indexRow,
|
|
345
|
-
rowData: record,
|
|
346
|
-
rowId: key,
|
|
347
|
-
// rowsData: [...dataSource],
|
|
348
|
-
rowsData: [...convertData],
|
|
349
|
-
sumValue: []
|
|
350
|
-
}, handleChangeCallback);
|
|
351
|
-
} else {
|
|
352
|
-
onHeaderCellChange({
|
|
353
|
-
field,
|
|
354
|
-
indexCol,
|
|
355
|
-
type: 'onChange',
|
|
356
|
-
option,
|
|
357
|
-
value: newState,
|
|
358
|
-
indexRow,
|
|
359
|
-
rowData: record,
|
|
360
|
-
rowId: key,
|
|
361
|
-
rowsData: [...convertData],
|
|
362
|
-
sumValue: []
|
|
363
|
-
}, handleChangeCallback);
|
|
326
|
+
// const handleChangeCallback = (callbackData: RecordType[]) => {
|
|
327
|
+
// const callbackRecord = callbackData
|
|
364
328
|
|
|
365
|
-
|
|
366
|
-
|
|
329
|
+
// Object.entries(callbackRecord).forEach(
|
|
330
|
+
// ([name, value]: any) => {
|
|
331
|
+
// setValue(name, value)
|
|
332
|
+
|
|
333
|
+
// }
|
|
334
|
+
// )
|
|
335
|
+
|
|
336
|
+
// onSubmit(callbackRecord)
|
|
337
|
+
|
|
338
|
+
// }
|
|
339
|
+
|
|
340
|
+
if (onHeaderCellChange) {
|
|
341
|
+
const newObj = {
|
|
342
|
+
...headerData,
|
|
343
|
+
[field]: newState
|
|
344
|
+
};
|
|
345
|
+
onHeaderCellChange(newObj);
|
|
367
346
|
}
|
|
368
347
|
}
|
|
369
348
|
if (prevState && newState && prevState !== newState && changeType === 'enter') {
|
|
@@ -469,8 +448,10 @@ const InternalTable = props => {
|
|
|
469
448
|
handleSubmit,
|
|
470
449
|
onSubmit,
|
|
471
450
|
triggerPaste,
|
|
451
|
+
headerEditAble,
|
|
472
452
|
handleCellChange,
|
|
473
|
-
handleHeaderCellChange
|
|
453
|
+
handleHeaderCellChange,
|
|
454
|
+
headerData
|
|
474
455
|
})).use(_pipeline.features.paginationFeature({
|
|
475
456
|
pagination
|
|
476
457
|
}));
|
|
@@ -68,7 +68,7 @@ const outerBorderStyleMixin = (0, _styledComponents.css)(["border-top:var(--cell
|
|
|
68
68
|
const StyleTableContainer = exports.StyleTableContainer = _styledComponents.default.div.withConfig({
|
|
69
69
|
displayName: "StyleTableContainer",
|
|
70
70
|
componentId: "es-grid-template__sc-ipj1ht-0"
|
|
71
|
-
})(["--row-height:34px;--color:#333;--bgcolor:white;--body-hover-bgcolor:#f5f5f5;--body-hover-color:#333;--hover-bgcolor:var(--body-hover-bgcolor,#f5f5f5);--hover-color:var(--body-hover-color);--highlight-bgcolor:#eee;--header-row-height:34px;--header-color:#000000de;--header-bgcolor:#ffffff;--header-hover-bgcolor:#ddd;--header-highlight-bgcolor:#e4e8ed;--cell-padding:7px 8px;--font-size:13px;--line-height:1.28571;--lock-shadow:rgba(152,152,152,0.5) 0 0 6px 2px;--border-color:#dfe3e8;--border-color-select:#eb4619;--cell-border:1px solid var(--border-color);--cell-border-select:1px solid var(--border-color-select);--cell-border-horizontal:var(--cell-border);--cell-border-vertical:var(--cell-border);--header-cell-border:1px solid var(--border-color);--header-cell-border-horizontal:var(--header-cell-border);--header-cell-border-vertical:var(--header-cell-border);--footer-bgcolor:#fafafa;&.", "{--bgcolor:#343e59;--footer-bgcolor:#2e3342;--header-bgcolor:#343e59;--hover-bgcolor:#232b43;--header-hover-bgcolor:#606164;--highlight-bgcolor:#eff2f5;--header-highlight-bgcolor:#191a1b;--hover-color:#dadde1;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#4f5266;background-color:var(--bgcolor);}&.use-outer-border{", ";}&.", "{.", "{border-left:0;border-right:0;td,th{border-right:0;}td.first,th.first{border-left:0;}td.last,th.last{}thead tr.first th,tbody tr.first td{}tr{td{&.lock-left,&.lock-right{border-bottom-width:0;box-shadow:0 -1px 0 0 var(--border-color),0 0px 0 0 var(--border-color),0px 0 0 0 var(--border-color);}}}&.has-footer tfoot tr.last td{}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{&.use-outer-border{border-bottom:var(--header-cell-border);}.", "{border-top:0;td,th{border-bottom:0;border-top:0;}td.lock-left{box-shadow:none;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{.", "{border:0;td,th{border-right:0;border-bottom:0;}td.lock-left{box-shadow:none;}td,th{border:0;}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{border-top:0;border:0;}}}.", "{padding:8px;}&.ui-rc-grid .ui-rc-pagination{background-color:var(--bgcolor);color:var(--color);padding:10px;background-color:var(--bgcolor);.ui-rc-pagination-prev{.anticon.anticon-left{color:var(--color);}}.ui-rc-pagination-disabled{.anticon.anticon-left{color:#7d7a7a;}}.ui-rc-pagination-next{.anticon.anticon-right{color:var(--color);}&.ui-rc-pagination-disabled{.anticon.anticon-right{color:#7d7a7a;}}}}&.auto-height{.ui-rc-grid-bottom{border-top:0;}}.ui-rc-grid-bottom{border-top:var(--cell-border-horizontal);}&.", "{&.ui-rc-grid{.ui-rc-toolbar-bottom{background-color:var(--footer-bgcolor);color:#ffffff;}}.ui-rc-grid-top-toolbar{border-color:var(--border-color);color:#ffffff;}.ui-rc-toolbar{.ui-rc-toolbar-selection-item{background-color:var(--footer-bgcolor);color:#ffffff;}}}"], Classes.tableThemeDark, outerBorderStyleMixin, Classes.gridHorizontal, Classes.tableWrapper, Classes.tableTop, Classes.gridVertical, Classes.tableWrapper, Classes.tableTop, Classes.gridNone, Classes.tableWrapper, Classes.tableTop, Classes.tableTop, Classes.tableThemeDark);
|
|
71
|
+
})(["--row-height:34px;--color:#333;--bgcolor:white;--body-hover-bgcolor:#f5f5f5;--body-hover-color:#333;--hover-bgcolor:var(--body-hover-bgcolor,#f5f5f5);--hover-color:var(--body-hover-color);--highlight-bgcolor:#eee;--header-row-height:34px;--header-color:#000000de;--header-bgcolor:#ffffff;--header-hover-bgcolor:#ddd;--header-highlight-bgcolor:#e4e8ed;--cell-padding:7px 8px;--font-size:13px;--line-height:1.28571;--lock-shadow:rgba(152,152,152,0.5) 0 0 6px 2px;--border-color:#dfe3e8;--border-color-select:#eb4619;--cell-border:1px solid var(--border-color);--cell-border-select:1px solid var(--border-color-select);--cell-border-horizontal:var(--cell-border);--cell-border-vertical:var(--cell-border);--header-cell-border:1px solid var(--border-color);--header-cell-border-horizontal:var(--header-cell-border);--header-cell-border-vertical:var(--header-cell-border);--footer-bgcolor:#fafafa;&.", "{--bgcolor:#343e59;--footer-bgcolor:#2e3342;--header-bgcolor:#343e59;--hover-bgcolor:#232b43;--header-hover-bgcolor:#606164;--highlight-bgcolor:#eff2f5;--header-highlight-bgcolor:#191a1b;--hover-color:#dadde1;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#4f5266;background-color:var(--bgcolor);}&.use-outer-border{", ";}&.", "{.", "{border-left:0;border-right:0;td,th{border-right:0;}td.first,th.first{border-left:0;}td.last,th.last{}thead tr.first th,tbody tr.first td{}tr{td{&.lock-left,&.lock-right{border-bottom-width:0;box-shadow:0 -1px 0 0 var(--border-color),0 0px 0 0 var(--border-color),0px 0 0 0 var(--border-color);}}}&.has-footer tfoot tr.last td{}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{&.use-outer-border{border-bottom:var(--header-cell-border);}.", "{border-top:0;td,th{border-bottom:0;border-top:0;}td.lock-left{box-shadow:none;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{.", "{border:0;td,th{border-right:0;border-bottom:0;}td.lock-left{box-shadow:none;}td,th{border:0;}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{border-top:0;border:0;}}}.", "{padding:8px;}&.ui-rc-grid .ui-rc-pagination{background-color:var(--bgcolor);color:var(--color);padding:10px;background-color:var(--bgcolor);.ui-rc-pagination-prev{.anticon.anticon-left{color:var(--color);}}.ui-rc-pagination-disabled{.anticon.anticon-left{color:#7d7a7a;}}.ui-rc-pagination-next{.anticon.anticon-right{color:var(--color);}&.ui-rc-pagination-disabled{.anticon.anticon-right{color:#7d7a7a;}}}}&.auto-height{.ui-rc-grid-bottom{border-top:0;}}.ui-rc-grid-bottom{border-top:var(--cell-border-horizontal);}.ui-rc-toolbar-bottom{.be-toolbar-item{.ui-rc-btn{font-size:12px;line-height:1.5}.toolbar-dropdown-button{font-size:12px;.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item{border-color:#28c76f;}.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item{border-color:#28c76f;.ui-rc-btn-icon{color:#28c76f;}}}}}.ui-rc-toolbar-bottom{position:relative;padding:.15rem 0.5rem;background-color:#ffffff;.toolbar-button{border-radius:3px;}.ui-rc-btn{border-radius:3px;height:28px;&.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item{border-start-start-radius:0;border-end-start-radius:0;}&.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item{border-start-end-radius:0;border-end-end-radius:0;}}}&.", "{&.ui-rc-grid{.ui-rc-toolbar-bottom{background-color:var(--footer-bgcolor);color:#ffffff;}}.ui-rc-grid-top-toolbar{border-color:var(--border-color);color:#ffffff;}.ui-rc-toolbar{.ui-rc-toolbar-selection-item{background-color:var(--footer-bgcolor);color:#ffffff;}}}"], Classes.tableThemeDark, outerBorderStyleMixin, Classes.gridHorizontal, Classes.tableWrapper, Classes.tableTop, Classes.gridVertical, Classes.tableWrapper, Classes.tableTop, Classes.gridNone, Classes.tableWrapper, Classes.tableTop, Classes.tableTop, Classes.tableThemeDark);
|
|
72
72
|
const StyledArtTableWrapper = exports.StyledArtTableWrapper = _styledComponents.default.div.withConfig({
|
|
73
73
|
displayName: "StyledArtTableWrapper",
|
|
74
74
|
componentId: "es-grid-template__sc-ipj1ht-1"
|
|
@@ -6,8 +6,8 @@ import { TableDOMHelper } from './helpers/TableDOMUtils';
|
|
|
6
6
|
import type { ResolvedUseVirtual, VerticalRenderRange, VirtualEnum } from './interfaces';
|
|
7
7
|
import type { LoadingContentWrapperProps } from './loading';
|
|
8
8
|
import type { BaseTableCSSVariables } from './styles';
|
|
9
|
-
import type { CommandClick, ExpandedRowRender, IFormat, IFTheme, RenderExpandIcon, RowClassName } from '../../grid-component/type';
|
|
10
|
-
export type PrimaryKey =
|
|
9
|
+
import type { AnyObject, CommandClick, ExpandedRowRender, IFormat, IFTheme, RenderExpandIcon, RowClassName } from '../../grid-component/type';
|
|
10
|
+
export type PrimaryKey<RecordType = AnyObject> = keyof RecordType | ((row: RecordType) => keyof RecordType);
|
|
11
11
|
export type ColumnResizeMode = 'onChange' | 'onEnd';
|
|
12
12
|
export type ExpandableConfig<RecordType> = {
|
|
13
13
|
expandedRowKeys?: readonly Key[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Subscription } from 'rxjs';
|
|
2
|
+
import { ColumnTable } from '../../grid-component';
|
|
2
3
|
/** styled-components 类库的版本,ali-react-table 同时支持 v3 和 v5 */
|
|
3
4
|
export declare const STYLED_VERSION: string;
|
|
4
5
|
export declare const STYLED_REF_PROP: string;
|
|
@@ -19,3 +20,4 @@ export declare function syncScrollLeft(elements: HTMLElement[], callback: (scrol
|
|
|
19
20
|
*/
|
|
20
21
|
export declare function shallowEqual<T>(objA: T, objB: T): boolean;
|
|
21
22
|
export declare function getParentElement(element: any, selector: any): any;
|
|
23
|
+
export declare function getColumnsAtLevel(columns: ColumnTable[], level: number): ColumnTable[];
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.STYLED_VERSION = exports.STYLED_REF_PROP = exports.OVERSCAN_SIZE = exports.AUTO_VIRTUAL_THRESHOLD = void 0;
|
|
7
|
+
exports.getColumnsAtLevel = getColumnsAtLevel;
|
|
7
8
|
exports.getParentElement = getParentElement;
|
|
8
9
|
exports.getScrollbarSize = getScrollbarSize;
|
|
9
10
|
exports.shallowEqual = shallowEqual;
|
|
@@ -164,4 +165,16 @@ function getParentElement(element, selector) {
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
return getParent(element, selector);
|
|
168
|
+
}
|
|
169
|
+
function getColumnsAtLevel(columns, level) {
|
|
170
|
+
if (level === 0) {
|
|
171
|
+
return columns;
|
|
172
|
+
}
|
|
173
|
+
const result = [];
|
|
174
|
+
for (const column of columns) {
|
|
175
|
+
if (column.children?.length) {
|
|
176
|
+
result.push(...getColumnsAtLevel(column.children, level - 1));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
167
180
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { ColumnTemplate, CommandItem, EditType, FilterOperator, IColumnType, IFormat, ITextAlign, TypeFilter } from '../grid-component/type';
|
|
4
|
+
import type { PrimaryKey } from './base-table/table';
|
|
4
5
|
export type CellProps = React.TdHTMLAttributes<HTMLTableCellElement>;
|
|
6
|
+
export type BaseRecord = {
|
|
7
|
+
rowId: PrimaryKey;
|
|
8
|
+
};
|
|
5
9
|
export type FilterState = {
|
|
6
10
|
field: any;
|
|
7
11
|
key: any;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { PrimaryKey } from './base-table/table';
|
|
2
3
|
import type { ArtColumn } from './interfaces';
|
|
3
4
|
declare function safeRenderHeader(column: ArtColumn): import("react").ReactNode;
|
|
4
5
|
declare function safeRenderHeaderContent(column: ArtColumn, t?: any): any;
|
|
5
6
|
declare function safeGetValue(column: ArtColumn, record: any, rowIndex: number): any;
|
|
6
|
-
declare function safeGetRowKey(primaryKey:
|
|
7
|
+
declare function safeGetRowKey(primaryKey: PrimaryKey, record: any, rowIndex: number): string;
|
|
7
8
|
declare function safeGetCellProps(column: ArtColumn, record: any, rowIndex: number): import("./interfaces").CellProps;
|
|
8
9
|
declare function safeRender(column: ArtColumn, record: any, rowIndex: number): any;
|
|
9
10
|
export declare const internals: {
|
|
@@ -71,6 +71,8 @@ export interface ColumnFeatureOptions {
|
|
|
71
71
|
handleCellChange: any;
|
|
72
72
|
handleHeaderCellChange?: any;
|
|
73
73
|
dataErrors?: any[];
|
|
74
|
+
headerData?: any;
|
|
75
|
+
headerEditAble?: boolean;
|
|
74
76
|
}
|
|
75
77
|
export declare function columnCustom(opts: ColumnFeatureOptions): (pipeline: TablePipeline) => TablePipeline;
|
|
76
78
|
export {};
|
|
@@ -19,6 +19,7 @@ var _useColumns = require("../../../table-component/hook/useColumns");
|
|
|
19
19
|
var _EditCell = _interopRequireDefault(require("../../base-table/cell/EditCell"));
|
|
20
20
|
var _HeaderEditCell = _interopRequireDefault(require("../../base-table/cell/HeaderEditCell"));
|
|
21
21
|
var _constants = require("../../utils/constants");
|
|
22
|
+
var _utils3 = require("../../base-table/utils");
|
|
22
23
|
// import { getMaxDepth } from '../../utils/utility';
|
|
23
24
|
|
|
24
25
|
function clamp(min, x, max) {
|
|
@@ -62,7 +63,9 @@ function columnCustom(opts) {
|
|
|
62
63
|
onSubmit,
|
|
63
64
|
handleCellChange,
|
|
64
65
|
handleHeaderCellChange,
|
|
65
|
-
dataErrors
|
|
66
|
+
dataErrors,
|
|
67
|
+
headerData,
|
|
68
|
+
headerEditAble
|
|
66
69
|
// originData
|
|
67
70
|
|
|
68
71
|
// currentPage = 1,
|
|
@@ -90,8 +93,7 @@ function columnCustom(opts) {
|
|
|
90
93
|
const allRows = pipeline.getDataSource(); // flat data
|
|
91
94
|
|
|
92
95
|
const leafColumns = (0, _utils.collectNodes)(pipeline.getColumns(), 'leaf-only');
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
const originCols = pipeline.getColumns();
|
|
95
97
|
const rowIds = (0, _utils2.getKeys)(allRows, 'rowId');
|
|
96
98
|
const colIds = (0, _utils2.getKeys)(leafColumns, 'field');
|
|
97
99
|
const rowIndexMap = (0, _utils2.getRowIndexMap)(allRows);
|
|
@@ -295,7 +297,7 @@ function columnCustom(opts) {
|
|
|
295
297
|
|
|
296
298
|
// Chức năng edit
|
|
297
299
|
|
|
298
|
-
const handleEdit = (e, record, col, editType, isKeyDown) => {
|
|
300
|
+
const handleEdit = (e, record, col, editType, isKeyDown, isHeader) => {
|
|
299
301
|
pipeline.setStateAtKey(_constants.stateKeyIsEditing, true);
|
|
300
302
|
reset?.();
|
|
301
303
|
if (!(0, _hooks.isObjEmpty)(record)) {
|
|
@@ -317,6 +319,15 @@ function columnCustom(opts) {
|
|
|
317
319
|
}
|
|
318
320
|
}, 10);
|
|
319
321
|
}
|
|
322
|
+
if (focusedCell?.rowId && isHeader) {
|
|
323
|
+
setTimeout(() => {
|
|
324
|
+
const textarea = document.querySelector(`.ui-rc-grid-table-header-row .header-cell-editable[data-col-key="${focusedCell.colId}"] textarea`);
|
|
325
|
+
if (textarea) {
|
|
326
|
+
textarea.focus();
|
|
327
|
+
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
|
328
|
+
}
|
|
329
|
+
}, 10);
|
|
330
|
+
}
|
|
320
331
|
};
|
|
321
332
|
const triggerDragPaste = (pasteState, ctrlKey) => {
|
|
322
333
|
const tmpCols = [...leafColumns];
|
|
@@ -441,7 +452,7 @@ function columnCustom(opts) {
|
|
|
441
452
|
pastedRows.push(newData[targetRow]);
|
|
442
453
|
});
|
|
443
454
|
}
|
|
444
|
-
const rsFilterData = (0, _utils2.updateOrInsert)((0, _utils2.flattenArray)(
|
|
455
|
+
const rsFilterData = (0, _utils2.updateOrInsert)((0, _utils2.flattenArray)(dataSource), newData);
|
|
445
456
|
const rs = (0, _utils2.unFlattenData)(rsFilterData);
|
|
446
457
|
triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
|
|
447
458
|
pipeline.setStateAtKey(_constants.stateKeyEndCell, endPasteCell);
|
|
@@ -500,7 +511,7 @@ function columnCustom(opts) {
|
|
|
500
511
|
// Lưu dòng được paste
|
|
501
512
|
pastedRows.push(newData[targetRow]);
|
|
502
513
|
});
|
|
503
|
-
const rsFilterData = (0, _utils2.updateOrInsert)((0, _utils2.flattenArray)(
|
|
514
|
+
const rsFilterData = (0, _utils2.updateOrInsert)((0, _utils2.flattenArray)(dataSource), newData);
|
|
504
515
|
const rs = (0, _utils2.unFlattenData)(rsFilterData);
|
|
505
516
|
triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
|
|
506
517
|
};
|
|
@@ -772,7 +783,7 @@ function columnCustom(opts) {
|
|
|
772
783
|
if (e.key === 'Enter') {
|
|
773
784
|
e.preventDefault();
|
|
774
785
|
e.stopPropagation();
|
|
775
|
-
handleEdit(e, record, column, editType);
|
|
786
|
+
handleEdit(e, record, column, editType, false);
|
|
776
787
|
return;
|
|
777
788
|
}
|
|
778
789
|
if (e.key.length === 1 && !e.ctrlKey) {
|
|
@@ -781,6 +792,168 @@ function columnCustom(opts) {
|
|
|
781
792
|
handleEdit(e, record, column, editType, true);
|
|
782
793
|
}
|
|
783
794
|
};
|
|
795
|
+
const handleHeaderKeyDown = (e, rowId, colId, rowIndex, column, record, editType) => {
|
|
796
|
+
if (e.key === 'Tab') {
|
|
797
|
+
const currentHeaderRowCols = (0, _utils3.getColumnsAtLevel)(originCols, rowIndex);
|
|
798
|
+
const currentHeaderRowColsEditAble = currentHeaderRowCols ? currentHeaderRowCols.filter(it => it.headerEditEnable) : undefined;
|
|
799
|
+
const nextCol = currentHeaderRowColsEditAble ? (0, _utils2.getNextColumn)(currentHeaderRowColsEditAble, focusedCell.colId) : undefined;
|
|
800
|
+
const nextHeaderRowCols = (0, _utils3.getColumnsAtLevel)(originCols, rowIndex + 1);
|
|
801
|
+
const nextHeaderRowColsEditAble = nextHeaderRowCols ? nextHeaderRowCols.filter(it => it.headerEditEnable) : undefined;
|
|
802
|
+
const nextRow = nextHeaderRowColsEditAble ? nextHeaderRowColsEditAble : undefined;
|
|
803
|
+
const checkEnd = nextCol && currentHeaderRowColsEditAble ? (0, _utils2.getNextColumn1)(currentHeaderRowColsEditAble, nextCol.column.field) : undefined;
|
|
804
|
+
if (!checkEnd) {
|
|
805
|
+
e.preventDefault();
|
|
806
|
+
e.stopPropagation();
|
|
807
|
+
}
|
|
808
|
+
if (nextCol?.column && !nextCol.isWrapped) {
|
|
809
|
+
const nextCellPosition = {
|
|
810
|
+
rowId,
|
|
811
|
+
colId: nextCol.column.field
|
|
812
|
+
};
|
|
813
|
+
pipeline.setStateAtKey(_constants.stateKeyFocusedCell, nextCellPosition);
|
|
814
|
+
pipeline.setStateAtKey(_constants.stateKeyStartCell, nextCellPosition);
|
|
815
|
+
pipeline.setStateAtKey(_constants.stateKeyEndCell, nextCellPosition);
|
|
816
|
+
} else {
|
|
817
|
+
// Nếu là cột cuối cùng, có thể nhảy xuống dòng tiếp theo
|
|
818
|
+
|
|
819
|
+
// const currentRowIndex = allRows.findIndex(r => r.rowId === rowId);
|
|
820
|
+
// const nextRow = allRows[currentRowIndex + 1];
|
|
821
|
+
|
|
822
|
+
const firstCol = nextRow?.[0];
|
|
823
|
+
if (nextRow && firstCol) {
|
|
824
|
+
const nextRowId = `header-field-${rowIndex + 1}`;
|
|
825
|
+
const nextCellPosition = {
|
|
826
|
+
rowId: nextRowId,
|
|
827
|
+
colId: firstCol.field
|
|
828
|
+
};
|
|
829
|
+
pipeline.setStateAtKey(_constants.stateKeyFocusedCell, nextCellPosition);
|
|
830
|
+
pipeline.setStateAtKey(_constants.stateKeyStartCell, nextCellPosition);
|
|
831
|
+
pipeline.setStateAtKey(_constants.stateKeyEndCell, nextCellPosition);
|
|
832
|
+
if (tableRef) {
|
|
833
|
+
// tableRef?.current?.artTableWrapperRef?.current?.scrollLeft = 0
|
|
834
|
+
|
|
835
|
+
// const wrapper = tableRef.current?.artTableWrapperRef?.current;
|
|
836
|
+
const wrapper = tableRef.current?.domHelper?.stickyScroll;
|
|
837
|
+
if (!wrapper) return;
|
|
838
|
+
wrapper.scrollLeft = 0;
|
|
839
|
+
}
|
|
840
|
+
} else {
|
|
841
|
+
e.preventDefault();
|
|
842
|
+
e.stopPropagation();
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// if (e.key === 'ArrowRight') {
|
|
849
|
+
|
|
850
|
+
// // e.preventDefault();
|
|
851
|
+
// // e.stopPropagation()
|
|
852
|
+
|
|
853
|
+
// const nextCol = getNextColumn(leafColumns, column.field)
|
|
854
|
+
|
|
855
|
+
// if (nextCol.column && !nextCol.isWrapped) {
|
|
856
|
+
|
|
857
|
+
// const nextCellPosition = { rowId, colId: nextCol.column.field }
|
|
858
|
+
|
|
859
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
860
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
861
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
862
|
+
|
|
863
|
+
// }
|
|
864
|
+
|
|
865
|
+
// return
|
|
866
|
+
// }
|
|
867
|
+
|
|
868
|
+
// if (e.key === 'ArrowLeft') {
|
|
869
|
+
|
|
870
|
+
// // e.preventDefault()
|
|
871
|
+
// // e.stopPropagation()
|
|
872
|
+
|
|
873
|
+
// const prevCol = getPrevColumn(leafColumns, column.field)
|
|
874
|
+
|
|
875
|
+
// if (prevCol) {
|
|
876
|
+
|
|
877
|
+
// const nextCellPosition = { rowId, colId: prevCol.field }
|
|
878
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
879
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
880
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
881
|
+
|
|
882
|
+
// }
|
|
883
|
+
// return
|
|
884
|
+
// }
|
|
885
|
+
|
|
886
|
+
// if (e.key === 'ArrowDown') {
|
|
887
|
+
|
|
888
|
+
// // e.preventDefault()
|
|
889
|
+
// // e.stopPropagation()
|
|
890
|
+
|
|
891
|
+
// const nextRow = allRows[rowIndex + 1]
|
|
892
|
+
|
|
893
|
+
// if (nextRow) {
|
|
894
|
+
// const nextRowId = nextRow.rowId
|
|
895
|
+
|
|
896
|
+
// const nextCellPosition = { rowId: nextRowId, colId }
|
|
897
|
+
// // setFocusedCell?.({ rowId: nextRowId, colId });
|
|
898
|
+
// // setStartCell?.({ rowId: nextRowId, colId });
|
|
899
|
+
// // setEndCell?.({ rowId: nextRowId, colId });
|
|
900
|
+
|
|
901
|
+
// // setRangeState?.(getSelectedCellMatrix(table, { rowId: nextRowId, colId }, { rowId: nextRowId, colId }))
|
|
902
|
+
|
|
903
|
+
// // columnVirtualizer.scrollToIndex(nextCol.getIndex(), { align: 'center' })
|
|
904
|
+
// // rowVirtualizer.scrollToIndex(nextRow.index, { align: 'center' })
|
|
905
|
+
|
|
906
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
907
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
908
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
909
|
+
|
|
910
|
+
// // const rowElement: any = document.querySelector(`.ui-rc-grid-table-row[data-row-key="${nextRowId}"]`)
|
|
911
|
+
|
|
912
|
+
// // const cellFocus = rowElement?.querySelector('.ui-rc-grid-cell')
|
|
913
|
+
|
|
914
|
+
// }
|
|
915
|
+
|
|
916
|
+
// return
|
|
917
|
+
// }
|
|
918
|
+
|
|
919
|
+
// if (e.key === 'ArrowUp') {
|
|
920
|
+
|
|
921
|
+
// // e.preventDefault()
|
|
922
|
+
// // e.stopPropagation()
|
|
923
|
+
|
|
924
|
+
// const nextRow = allRows[rowIndex - 1]
|
|
925
|
+
|
|
926
|
+
// if (nextRow) {
|
|
927
|
+
// const nextRowId = nextRow.rowId
|
|
928
|
+
|
|
929
|
+
// const nextCellPosition = { rowId: nextRowId, colId }
|
|
930
|
+
|
|
931
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
932
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
933
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
934
|
+
|
|
935
|
+
// }
|
|
936
|
+
|
|
937
|
+
// return
|
|
938
|
+
// }
|
|
939
|
+
|
|
940
|
+
// if (e.key === 'Delete') {
|
|
941
|
+
// handleDeleteContent?.()
|
|
942
|
+
// return
|
|
943
|
+
// }
|
|
944
|
+
|
|
945
|
+
if (e.key === 'Enter') {
|
|
946
|
+
e.preventDefault();
|
|
947
|
+
e.stopPropagation();
|
|
948
|
+
handleEdit(e, record, column, editType, false, true);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
if (e.key.length === 1 && !e.ctrlKey) {
|
|
952
|
+
e.preventDefault();
|
|
953
|
+
e.stopPropagation();
|
|
954
|
+
handleEdit(e, record, column, editType, true, true);
|
|
955
|
+
}
|
|
956
|
+
};
|
|
784
957
|
const handleChange = (record, column, indexCol) => {
|
|
785
958
|
const currentRowIndex = allRows.findIndex(r => r.rowId === record.rowId);
|
|
786
959
|
const formState = getValues();
|
|
@@ -801,6 +974,26 @@ function columnCustom(opts) {
|
|
|
801
974
|
});
|
|
802
975
|
} else {}
|
|
803
976
|
};
|
|
977
|
+
const handleHeaderChange = (record, column, indexCol) => {
|
|
978
|
+
const currentRowIndex = allRows.findIndex(r => r.rowId === record.rowId);
|
|
979
|
+
const formState = getValues();
|
|
980
|
+
const itemState = getValues(column.field);
|
|
981
|
+
const prevState = record[column.field];
|
|
982
|
+
const newState = itemState;
|
|
983
|
+
if (newState !== prevState) {
|
|
984
|
+
handleHeaderCellChange?.({
|
|
985
|
+
key: record.rowId,
|
|
986
|
+
field: column.field,
|
|
987
|
+
record: formState,
|
|
988
|
+
prevState,
|
|
989
|
+
newState,
|
|
990
|
+
option: newState,
|
|
991
|
+
indexCol: indexCol,
|
|
992
|
+
indexRow: currentRowIndex,
|
|
993
|
+
type: 'blur'
|
|
994
|
+
});
|
|
995
|
+
} else {}
|
|
996
|
+
};
|
|
804
997
|
const handlePointDoubleClick = (e, column, record) => {
|
|
805
998
|
e.preventDefault();
|
|
806
999
|
e.stopPropagation();
|
|
@@ -1045,15 +1238,19 @@ function columnCustom(opts) {
|
|
|
1045
1238
|
const htmlTooltip = headerCustomTooltip;
|
|
1046
1239
|
const headerEditType = col.headerEditType;
|
|
1047
1240
|
const headerRowIndex = params.path.findIndex(it => it.field === col.field);
|
|
1048
|
-
const
|
|
1241
|
+
const headerRowId = `header-field-${headerRowIndex}`;
|
|
1242
|
+
|
|
1243
|
+
// const headerRecord: any = { ...col, rowId: `field-${headerRowIndex}`, [col.field]: tmpValue, children: undefined }
|
|
1244
|
+
|
|
1049
1245
|
const headerRecord = {
|
|
1050
|
-
|
|
1051
|
-
rowId: `field-${headerRowIndex}`,
|
|
1052
|
-
[col.field]: tmpValue,
|
|
1053
|
-
children: undefined
|
|
1246
|
+
[col.field]: headerData?.[col.field] ?? ''
|
|
1054
1247
|
};
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1248
|
+
const headerValue = headerData?.[col.field] ?? '';
|
|
1249
|
+
const cellHeaderEditing = isEditing && headerRowId === focusedCell.rowId && col.field === focusedCell.colId;
|
|
1250
|
+
const isCellSelect = headerRowId === focusedCell.rowId && startCell?.colId === col.field;
|
|
1251
|
+
const aa = (0, _utils3.getColumnsAtLevel)(originCols, headerRowIndex);
|
|
1252
|
+
const aaEditAble = aa ? aa.filter(it => it.headerEditEnable) : undefined;
|
|
1253
|
+
const nextHeaderCol = aaEditAble ? (0, _utils2.getNextColumn)(aaEditAble, focusedCell.colId) : undefined;
|
|
1057
1254
|
|
|
1058
1255
|
// Cell thường có thể filter và sort được
|
|
1059
1256
|
return {
|
|
@@ -1076,7 +1273,7 @@ function columnCustom(opts) {
|
|
|
1076
1273
|
[`${prefix}-grid-cell-text-center`]: (col?.headerTextAlign ?? col?.textAlign) === 'center',
|
|
1077
1274
|
[`${prefix}-grid-cell-text-right`]: (col?.headerTextAlign ?? col.textAlign) === 'right'
|
|
1078
1275
|
})
|
|
1079
|
-
}, col.headerEditEnable && cellHeaderEditing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_HeaderEditCell.default, {
|
|
1276
|
+
}, headerEditAble && col.headerEditEnable && cellHeaderEditing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_HeaderEditCell.default, {
|
|
1080
1277
|
column: col,
|
|
1081
1278
|
editType: headerEditType ?? 'text',
|
|
1082
1279
|
record: headerRecord,
|
|
@@ -1100,7 +1297,7 @@ function columnCustom(opts) {
|
|
|
1100
1297
|
startCell: startCell,
|
|
1101
1298
|
handleSubmit: handleSubmit,
|
|
1102
1299
|
onSubmit: onSubmit
|
|
1103
|
-
})) : col.headerEditEnable ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
1300
|
+
})) : headerEditAble && col.headerEditEnable ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, headerValue) : col.headerTemplate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, prevTitle))), !col.headerEditEnable && (!_hooks.nonActionColumn.includes(col.field) && !col?.children || col?.children && col?.children.length < 1) && /*#__PURE__*/_react.default.createElement("span", {
|
|
1104
1301
|
className: "ui-rc-header-trigger d-flex gap-50"
|
|
1105
1302
|
}, canSort && /*#__PURE__*/_react.default.createElement("div", {
|
|
1106
1303
|
style: {
|
|
@@ -1151,9 +1348,20 @@ function columnCustom(opts) {
|
|
|
1151
1348
|
headerCellProps: (0, _utils.mergeCellProps)(col.headerCellProps ?? {}, {
|
|
1152
1349
|
'data-tooltip-id': `${id}-tooltip-content`,
|
|
1153
1350
|
'data-tooltip-content': htmlTooltip,
|
|
1351
|
+
// @ts-ignore
|
|
1352
|
+
'data-col-key': col.field,
|
|
1353
|
+
ref: el => {
|
|
1354
|
+
if (focusedCell?.rowId === headerRowId && focusedCell?.colId === col.field && !isEditing) {
|
|
1355
|
+
el?.focus({
|
|
1356
|
+
preventScroll: true
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
tabIndex: focusedCell?.rowId === headerRowId && focusedCell?.colId === col.field ? 1 : col.field === nextHeaderCol?.column?.field ? 1 : -1,
|
|
1154
1361
|
style: {
|
|
1155
1362
|
overflow: 'visible',
|
|
1156
1363
|
position: 'relative',
|
|
1364
|
+
outline: 'none',
|
|
1157
1365
|
padding: cellHeaderEditing ? 0 : undefined
|
|
1158
1366
|
},
|
|
1159
1367
|
className: (0, _classnames.default)('', {
|
|
@@ -1166,19 +1374,97 @@ function columnCustom(opts) {
|
|
|
1166
1374
|
}),
|
|
1167
1375
|
onMouseDown: () => {
|
|
1168
1376
|
if (col.headerEditEnable) {
|
|
1169
|
-
handleMouseDown(
|
|
1377
|
+
handleMouseDown(headerRowId, col.field);
|
|
1170
1378
|
}
|
|
1171
1379
|
},
|
|
1172
1380
|
onDoubleClick: e => {
|
|
1173
1381
|
// prevCellProps?.onDoubleClick?.(e)
|
|
1174
1382
|
|
|
1175
|
-
if (
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1383
|
+
if (headerEditAble) {
|
|
1384
|
+
if (!col.headerEditEnable) {
|
|
1385
|
+
e.stopPropagation();
|
|
1386
|
+
e.preventDefault();
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
if (headerRowId === focusedCell.rowId && col.field === focusedCell.colId && col.headerEditEnable) {
|
|
1390
|
+
handleEdit(e, headerRecord, col, headerEditType ?? 'text', false, true);
|
|
1391
|
+
}
|
|
1179
1392
|
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1393
|
+
},
|
|
1394
|
+
onKeyDown: e => {
|
|
1395
|
+
// prevCellProps?.onKeyDown?.(e)
|
|
1396
|
+
// chưa editing
|
|
1397
|
+
|
|
1398
|
+
if (headerEditAble) {
|
|
1399
|
+
if (!isEditing) {
|
|
1400
|
+
handleHeaderKeyDown(e, headerRowId, col.field, headerRowIndex, col, headerRecord, headerEditType ?? 'text');
|
|
1401
|
+
} else {
|
|
1402
|
+
if (e.shiftKey && e.key === 'Enter') {
|
|
1403
|
+
e.preventDefault();
|
|
1404
|
+
e.stopPropagation();
|
|
1405
|
+
} else {
|
|
1406
|
+
if (e.key === 'Enter') {
|
|
1407
|
+
e.preventDefault();
|
|
1408
|
+
e.stopPropagation();
|
|
1409
|
+
|
|
1410
|
+
// const currentRowIndex = allRows.findIndex(r => r.rowId === headerRowId);
|
|
1411
|
+
// const nextRow = allRows[currentRowIndex + 1];
|
|
1412
|
+
|
|
1413
|
+
// if (nextRow) {
|
|
1414
|
+
// const nextCellPosition = { rowId: nextRow.rowId, colId: col.field }
|
|
1415
|
+
|
|
1416
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
1417
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
1418
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
1419
|
+
|
|
1420
|
+
handleHeaderChange(headerRecord, col, startIndex);
|
|
1421
|
+
pipeline.setStateAtKey(_constants.stateKeyIsEditing, false);
|
|
1422
|
+
|
|
1423
|
+
// }
|
|
1424
|
+
}
|
|
1425
|
+
if (e.key === 'Tab') {
|
|
1426
|
+
e.preventDefault();
|
|
1427
|
+
|
|
1428
|
+
// const nextCol = getNextColumn(allCols, col.field)
|
|
1429
|
+
|
|
1430
|
+
if (nextHeaderCol?.column?.field && !nextHeaderCol?.isWrapped) {
|
|
1431
|
+
const nextCellPosition = {
|
|
1432
|
+
rowId: headerRowId,
|
|
1433
|
+
colId: nextHeaderCol.column.field
|
|
1434
|
+
};
|
|
1435
|
+
pipeline.setStateAtKey(_constants.stateKeyFocusedCell, nextCellPosition);
|
|
1436
|
+
pipeline.setStateAtKey(_constants.stateKeyStartCell, nextCellPosition);
|
|
1437
|
+
pipeline.setStateAtKey(_constants.stateKeyEndCell, nextCellPosition);
|
|
1438
|
+
|
|
1439
|
+
// columnVirtualizer.scrollToIndex(nextCol.getIndex(), { align: 'center' })
|
|
1440
|
+
} else {
|
|
1441
|
+
// Nếu là cột cuối cùng, có thể nhảy xuống dòng tiếp theo
|
|
1442
|
+
|
|
1443
|
+
// const currentRowIndex = allRows.findIndex(r => r.rowId === headerRowId);
|
|
1444
|
+
// const nextRow = allRows[currentRowIndex + 1];
|
|
1445
|
+
|
|
1446
|
+
// const firstCol = nextCol.column
|
|
1447
|
+
|
|
1448
|
+
// if (nextRow) {
|
|
1449
|
+
|
|
1450
|
+
// const nextCellPosition = { rowId: nextRow.rowId, colId: firstCol.field }
|
|
1451
|
+
|
|
1452
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
1453
|
+
|
|
1454
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
1455
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
1456
|
+
|
|
1457
|
+
// // columnVirtualizer.scrollToIndex(nextRowCol.getIndex())
|
|
1458
|
+
|
|
1459
|
+
// // rowVirtualizer.scrollToIndex(nextRow.index, { align: 'auto' })
|
|
1460
|
+
|
|
1461
|
+
// }
|
|
1462
|
+
}
|
|
1463
|
+
handleHeaderChange(headerRecord, col, startIndex);
|
|
1464
|
+
pipeline.setStateAtKey(_constants.stateKeyIsEditing, false);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1182
1468
|
}
|
|
1183
1469
|
}
|
|
1184
1470
|
}),
|
|
@@ -1333,7 +1619,7 @@ function columnCustom(opts) {
|
|
|
1333
1619
|
return;
|
|
1334
1620
|
}
|
|
1335
1621
|
if (record.rowId === focusedCell.rowId && col.field === focusedCell.colId && canEdit) {
|
|
1336
|
-
handleEdit(e, record, col, editType ?? 'text');
|
|
1622
|
+
handleEdit(e, record, col, editType ?? 'text', false);
|
|
1337
1623
|
}
|
|
1338
1624
|
},
|
|
1339
1625
|
onKeyDown: e => {
|
|
@@ -9,4 +9,5 @@ export declare function sortData1(data: any[], sorter: Sorter[]): any[];
|
|
|
9
9
|
export declare function sortData(data: any[], sorter: Sorter[]): any[];
|
|
10
10
|
export declare function filterDataByColumns1(data: any[], queries: FilterItem[] | undefined, sorter: Sorter[] | undefined, keysFilter: string[] | undefined, ignoreAccents?: boolean): any[];
|
|
11
11
|
export declare const getMaxDepth: (data: any[]) => number;
|
|
12
|
+
export declare const addRowIdArray: (inputArray: any[]) => any[];
|
|
12
13
|
export {};
|