es-grid-template 1.9.62 → 1.9.64
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 +6 -3
- package/es/ali-table/InternalTable.js +500 -49
- package/es/ali-table/base-table/calculations.js +1 -1
- package/es/ali-table/base-table/cell/EditCell.js +14 -6
- package/es/ali-table/base-table/renderFilter.js +1 -1
- package/es/ali-table/base-table/styles.js +1 -1
- package/es/ali-table/interfaces.d.ts +2 -2
- package/es/ali-table/pipeline/features/columnCustom.d.ts +5 -2
- package/es/ali-table/pipeline/features/columnCustom.js +172 -102
- package/es/ali-table/utils/constants.d.ts +1 -0
- package/es/ali-table/utils/constants.js +1 -0
- package/es/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/es/ali-table/utils/convertColumnsChoose.js +1 -2
- package/es/ali-table/utils/utility.d.ts +16 -1
- package/es/ali-table/utils/utility.js +442 -2
- package/es/grid-component/type.d.ts +2 -2
- package/es/table-component/TableContainerEdit.js +148 -98
- package/es/table-component/body/EditableCell.js +9 -5
- package/es/table-component/body/TableBodyCellEdit.js +14 -8
- package/es/table-component/header/renderFilter.js +1 -1
- package/es/table-component/hook/utils.d.ts +1 -1
- package/es/table-component/hook/utils.js +2 -6
- package/es/table-component/useContext.d.ts +1 -1
- package/lib/ali-table/Grid.js +6 -3
- package/lib/ali-table/InternalTable.js +491 -45
- package/lib/ali-table/base-table/calculations.js +1 -1
- package/lib/ali-table/base-table/cell/EditCell.js +14 -6
- package/lib/ali-table/base-table/renderFilter.js +1 -1
- package/lib/ali-table/base-table/styles.js +1 -1
- package/lib/ali-table/interfaces.d.ts +2 -2
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +5 -2
- package/lib/ali-table/pipeline/features/columnCustom.js +166 -100
- package/lib/ali-table/utils/constants.d.ts +1 -0
- package/lib/ali-table/utils/constants.js +2 -1
- package/lib/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/lib/ali-table/utils/convertColumnsChoose.js +1 -2
- package/lib/ali-table/utils/utility.d.ts +16 -1
- package/lib/ali-table/utils/utility.js +454 -2
- package/lib/grid-component/type.d.ts +2 -2
- package/lib/table-component/TableContainerEdit.js +148 -98
- package/lib/table-component/body/EditableCell.js +9 -5
- package/lib/table-component/body/TableBodyCellEdit.js +11 -7
- package/lib/table-component/header/renderFilter.js +1 -1
- package/lib/table-component/hook/utils.d.ts +1 -1
- package/lib/table-component/hook/utils.js +2 -6
- package/lib/table-component/useContext.d.ts +1 -1
- package/package.json +1 -1
|
@@ -469,7 +469,9 @@ const EditCell = props => {
|
|
|
469
469
|
align: colSelect.textAlign
|
|
470
470
|
};
|
|
471
471
|
});
|
|
472
|
-
|
|
472
|
+
|
|
473
|
+
// let valueSelectTable = formValues[dataIndex]
|
|
474
|
+
let valueSelectTable = formValues[dataIndex] !== null ? formValues[dataIndex] : undefined;
|
|
473
475
|
if (fieldValue) {
|
|
474
476
|
// @ts-ignore
|
|
475
477
|
valueSelectTable = record[fieldValue] ?? formValues[dataIndex];
|
|
@@ -618,14 +620,16 @@ const EditCell = props => {
|
|
|
618
620
|
"data-tooltip-id": `${tableId}-tooltip-error`
|
|
619
621
|
});
|
|
620
622
|
case 'select':
|
|
621
|
-
let valueSelect = formValues[dataIndex];
|
|
623
|
+
let valueSelect = formValues[dataIndex] !== null ? formValues[dataIndex] : undefined;
|
|
624
|
+
// let valueSelect = !isNullOrUndefined(formValues[dataIndex]) ? formValues[dataIndex] : undefined
|
|
625
|
+
|
|
622
626
|
if (fieldValue) {
|
|
623
627
|
// @ts-ignore
|
|
624
628
|
valueSelect = record[fieldValue] ?? formValues[dataIndex];
|
|
625
629
|
}
|
|
626
630
|
return /*#__PURE__*/React.createElement(Select, {
|
|
627
631
|
options: options,
|
|
628
|
-
value: valueSelect ??
|
|
632
|
+
value: valueSelect ?? undefined,
|
|
629
633
|
onChange: (val, option) => {
|
|
630
634
|
onChange(val ?? '');
|
|
631
635
|
const formState = getValues();
|
|
@@ -761,7 +765,8 @@ const EditCell = props => {
|
|
|
761
765
|
"data-tooltip-id": `${tableId}-tooltip-error`
|
|
762
766
|
});
|
|
763
767
|
case 'asyncSelect':
|
|
764
|
-
let valueAsyncSelect = formValues[dataIndex]
|
|
768
|
+
// let valueAsyncSelect = formValues[dataIndex]
|
|
769
|
+
let valueAsyncSelect = formValues[dataIndex] !== null ? formValues[dataIndex] : undefined;
|
|
765
770
|
if (fieldValue) {
|
|
766
771
|
// @ts-ignore
|
|
767
772
|
valueAsyncSelect = record[fieldValue] ?? formValues[dataIndex];
|
|
@@ -769,7 +774,7 @@ const EditCell = props => {
|
|
|
769
774
|
return /*#__PURE__*/React.createElement(AsyncSelect, {
|
|
770
775
|
options: options,
|
|
771
776
|
defaultOptions: options,
|
|
772
|
-
value: valueAsyncSelect
|
|
777
|
+
value: valueAsyncSelect,
|
|
773
778
|
onChange: (val, option) => {
|
|
774
779
|
onChange(val ?? '');
|
|
775
780
|
const formState = getValues();
|
|
@@ -1237,7 +1242,10 @@ const EditCell = props => {
|
|
|
1237
1242
|
}
|
|
1238
1243
|
};
|
|
1239
1244
|
return /*#__PURE__*/React.createElement("form", {
|
|
1240
|
-
onSubmit: handleSubmit(onSubmit)
|
|
1245
|
+
onSubmit: handleSubmit(onSubmit),
|
|
1246
|
+
style: {
|
|
1247
|
+
height: '100%'
|
|
1248
|
+
}
|
|
1241
1249
|
}, /*#__PURE__*/React.createElement(Controller, {
|
|
1242
1250
|
name: dataIndex,
|
|
1243
1251
|
control: control,
|
|
@@ -292,7 +292,7 @@ export const renderFilter = args => {
|
|
|
292
292
|
,
|
|
293
293
|
onBlur: e => {
|
|
294
294
|
if (selectedKeys[0] === e.target.value) {} else {
|
|
295
|
-
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
295
|
+
setSelectedKeys(e.target.value ? [e.target.value.trim()] : []);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -60,7 +60,7 @@ const outerBorderStyleMixin = css(["border-top:var(--cell-border-horizontal);bor
|
|
|
60
60
|
export const StyleTableContainer = styled.div.withConfig({
|
|
61
61
|
displayName: "StyleTableContainer",
|
|
62
62
|
componentId: "es-grid-template__sc-ipj1ht-0"
|
|
63
|
-
})(["--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);
|
|
63
|
+
})(["--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);
|
|
64
64
|
export const StyledArtTableWrapper = styled.div.withConfig({
|
|
65
65
|
displayName: "StyledArtTableWrapper",
|
|
66
66
|
componentId: "es-grid-template__sc-ipj1ht-1"
|
|
@@ -25,8 +25,7 @@ export interface ArtColumnStaticPart<RecordType = any> {
|
|
|
25
25
|
/** Column width; required if the column is locked */
|
|
26
26
|
width?: number;
|
|
27
27
|
fixed?: 'left' | 'right';
|
|
28
|
-
|
|
29
|
-
hidden?: boolean;
|
|
28
|
+
visible?: boolean;
|
|
30
29
|
/** Whether the column is locked (fixed) */
|
|
31
30
|
lock?: boolean;
|
|
32
31
|
/** Props for the header cell */
|
|
@@ -68,6 +67,7 @@ export interface ArtColumnStaticPart<RecordType = any> {
|
|
|
68
67
|
headerEditEnable?: boolean;
|
|
69
68
|
/** Kiểu editor khi edit cell */
|
|
70
69
|
headerEditType?: EditType;
|
|
70
|
+
editSelectSettings?: any;
|
|
71
71
|
}
|
|
72
72
|
export interface ArtColumnDynamicPart<RecordType = any> {
|
|
73
73
|
/** Custom data retrieval method */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TablePipeline } from '../pipeline';
|
|
2
2
|
import type { ColumnResizeMode } from '../../base-table/table';
|
|
3
3
|
import type { ArtColumn, SortOrder } from '../../interfaces';
|
|
4
|
-
import type { FilterItem, IFormat, IWrapSettings, Sorter, SourceFilter } from '../../../grid-component/type';
|
|
4
|
+
import type { FilterItem, ICellClick, IFormat, IWrapSettings, Sorter, SourceFilter } from '../../../grid-component/type';
|
|
5
5
|
type FilterState = {
|
|
6
6
|
field: any;
|
|
7
7
|
key: any;
|
|
@@ -14,6 +14,7 @@ export interface ColumnFeatureOptions {
|
|
|
14
14
|
columns: any[];
|
|
15
15
|
isDataTree?: boolean;
|
|
16
16
|
dataSource: any[];
|
|
17
|
+
rowIndexMap: any;
|
|
17
18
|
/** Uncontrolled usage: default column widths array */
|
|
18
19
|
defaultSizes?: number[];
|
|
19
20
|
columnResizeMode?: ColumnResizeMode;
|
|
@@ -63,7 +64,7 @@ export interface ColumnFeatureOptions {
|
|
|
63
64
|
getValues?: any;
|
|
64
65
|
control?: any;
|
|
65
66
|
errors?: any;
|
|
66
|
-
|
|
67
|
+
triggerChangeData?: any;
|
|
67
68
|
tableRef: any;
|
|
68
69
|
triggerPaste?: (pastedRows: any[], pastedColumnsArray: string[], newData: any[], copyRows: any[]) => void;
|
|
69
70
|
handleSubmit: any;
|
|
@@ -72,6 +73,8 @@ export interface ColumnFeatureOptions {
|
|
|
72
73
|
handleHeaderCellChange?: any;
|
|
73
74
|
dataErrors?: any[];
|
|
74
75
|
headerData?: any;
|
|
76
|
+
headerEditAble?: boolean;
|
|
77
|
+
onCellClick?: (args: ICellClick, callback?: any) => void;
|
|
75
78
|
}
|
|
76
79
|
export declare function columnCustom(opts: ColumnFeatureOptions): (pipeline: TablePipeline) => TablePipeline;
|
|
77
80
|
export {};
|
|
@@ -3,20 +3,25 @@ import { internals } from "../../internals";
|
|
|
3
3
|
import { collectNodes, makeRecursiveMapper, mergeCellProps } from "../../utils";
|
|
4
4
|
import Resizer from "../../base-table/ColumnResizer";
|
|
5
5
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
6
|
-
import { booleanOperator, findItemPath, isEditable, isObjEmpty, nonActionColumn, numberOperator, pageSizeOptions, stringOperator, translateOption, updateArrayByKey
|
|
6
|
+
import { booleanOperator, findItemPath, isEditable, isObjEmpty, nonActionColumn, numberOperator, pageSizeOptions, stringOperator, translateOption, updateArrayByKey
|
|
7
|
+
// updateOrInsert
|
|
8
|
+
} from "../../../grid-component/hooks";
|
|
7
9
|
import classNames from 'classnames';
|
|
8
10
|
import { Dropdown, Select, Space, Button } from 'rc-master-ui';
|
|
9
|
-
import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, convertFilters, extendsObject, flattenArray, flattenData, getColIdsBetween1, getDefaultOperator, getDragRightData, getKeys, getNextColumn, getNextColumn1, getPrevColumn, getRowIdsBetween3,
|
|
11
|
+
import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, convertFilters, extendsObject, flattenArray, flattenData, getColIdsBetween1, getDefaultOperator, getDragRightData, getEditType, getKeys, getNextColumn, getNextColumn1, getPrevColumn, getRowIdsBetween3,
|
|
12
|
+
// getRowIndexMap,
|
|
13
|
+
getSelectedCellMatrix1, getTypeFilter,
|
|
10
14
|
// isObjEqual,
|
|
11
|
-
newGuid
|
|
15
|
+
newGuid } from "../../../table-component/hook/utils";
|
|
12
16
|
import { renderFilter } from "../../base-table/renderFilter";
|
|
13
17
|
import { renderValueCell } from "../../../table-component/hook/useColumns";
|
|
14
18
|
import EditCell from "../../base-table/cell/EditCell";
|
|
15
19
|
import HeaderEditCell from "../../base-table/cell/HeaderEditCell";
|
|
16
20
|
import { stateKeyResize, stateKeyColumnFilter, stateKeyFilter, stateKeyPagination, stateKeySorter, stateKeyTooltip, stateKeyTypePaste, stateKeyVisible,
|
|
17
21
|
// state For edit
|
|
18
|
-
stateKeyEndCell, stateKeyEndPasteCell, stateKeyStartCell, stateKeyStartPasteCell, stateKeyFocusedCell, stateKeyIsEditing, stateKeyIsPasting, stateKeyIsSelecting } from "../../utils/constants";
|
|
22
|
+
stateKeyEndCell, stateKeyEndPasteCell, stateKeyStartCell, stateKeyStartPasteCell, stateKeyFocusedCell, stateKeyEditCellSettings, stateKeyIsEditing, stateKeyIsPasting, stateKeyIsSelecting } from "../../utils/constants";
|
|
19
23
|
import { getColumnsAtLevel } from "../../base-table/utils";
|
|
24
|
+
import { unFlattenData, updateOrInsert } from "../../utils/utility";
|
|
20
25
|
// import { getMaxDepth } from '../../utils/utility';
|
|
21
26
|
|
|
22
27
|
function clamp(min, x, max) {
|
|
@@ -53,7 +58,7 @@ export function columnCustom(opts) {
|
|
|
53
58
|
control,
|
|
54
59
|
getValues,
|
|
55
60
|
errors,
|
|
56
|
-
|
|
61
|
+
triggerChangeData,
|
|
57
62
|
tableRef,
|
|
58
63
|
triggerPaste,
|
|
59
64
|
handleSubmit,
|
|
@@ -61,7 +66,10 @@ export function columnCustom(opts) {
|
|
|
61
66
|
handleCellChange,
|
|
62
67
|
handleHeaderCellChange,
|
|
63
68
|
dataErrors,
|
|
64
|
-
headerData
|
|
69
|
+
headerData,
|
|
70
|
+
headerEditAble,
|
|
71
|
+
rowIndexMap,
|
|
72
|
+
onCellClick
|
|
65
73
|
// originData
|
|
66
74
|
|
|
67
75
|
// currentPage = 1,
|
|
@@ -72,6 +80,7 @@ export function columnCustom(opts) {
|
|
|
72
80
|
mode = 'multiple',
|
|
73
81
|
onSorter
|
|
74
82
|
} = opts;
|
|
83
|
+
const rowKey = 'rowId';
|
|
75
84
|
return function columnResizeFeature(pipeline) {
|
|
76
85
|
// State table
|
|
77
86
|
|
|
@@ -92,7 +101,6 @@ export function columnCustom(opts) {
|
|
|
92
101
|
const originCols = pipeline.getColumns();
|
|
93
102
|
const rowIds = getKeys(allRows, 'rowId');
|
|
94
103
|
const colIds = getKeys(leafColumns, 'field');
|
|
95
|
-
const rowIndexMap = getRowIndexMap(allRows);
|
|
96
104
|
|
|
97
105
|
// const deppthCols = getMaxDepth(originCols)
|
|
98
106
|
|
|
@@ -104,6 +112,7 @@ export function columnCustom(opts) {
|
|
|
104
112
|
|
|
105
113
|
const focusedCell = pipeline.getStateAtKey(stateKeyFocusedCell) ?? {};
|
|
106
114
|
const isEditing = pipeline.getStateAtKey(stateKeyIsEditing) ?? false;
|
|
115
|
+
const editCellSettings = pipeline.getStateAtKey(stateKeyEditCellSettings);
|
|
107
116
|
const isSelecting = pipeline.getStateAtKey(stateKeyIsSelecting) ?? false;
|
|
108
117
|
const isPasting = pipeline.getStateAtKey(stateKeyIsPasting) ?? false;
|
|
109
118
|
const startCell = pipeline.getStateAtKey(stateKeyStartCell) ?? undefined;
|
|
@@ -122,7 +131,10 @@ export function columnCustom(opts) {
|
|
|
122
131
|
endColIndex,
|
|
123
132
|
endRowIndex
|
|
124
133
|
} = rangeState ?? {};
|
|
125
|
-
const
|
|
134
|
+
const rowPasteIds = getRowIdsBetween3(allRows, rowIndexMap, startPasteCell?.rowId ?? '', endPasteCell?.rowId ?? '');
|
|
135
|
+
const colPasteds = getColIdsBetween1(leafColumns, startPasteCell?.colId ?? '', endPasteCell?.colId ?? '');
|
|
136
|
+
const rowSelectIds = getRowIdsBetween3(allRows, rowIndexMap, startCell?.rowId ?? '', endCell?.rowId ?? '');
|
|
137
|
+
const colSelectIds = getColIdsBetween1(leafColumns, startCell?.colId ?? '', endCell?.colId ?? '');
|
|
126
138
|
leafColumns.forEach((col, colIndex) => {
|
|
127
139
|
if (sizes[colIndex] == null) {
|
|
128
140
|
if (typeof col.width === 'number') {
|
|
@@ -326,11 +338,7 @@ export function columnCustom(opts) {
|
|
|
326
338
|
}
|
|
327
339
|
};
|
|
328
340
|
const triggerDragPaste = (pasteState, ctrlKey) => {
|
|
329
|
-
const tmpCols =
|
|
330
|
-
const rowPasteIds = getRowIdsBetween3(allRows, rowIndexMap, startPasteCell?.rowId ?? '', endPasteCell?.rowId ?? '');
|
|
331
|
-
const colPasteds = getColIdsBetween1(leafColumns, startPasteCell?.colId ?? '', endPasteCell?.colId ?? '');
|
|
332
|
-
const rowSelectIds = getRowIdsBetween3(allRows, rowIndexMap, startCell?.rowId ?? '', endCell?.rowId ?? '');
|
|
333
|
-
const colSelectIds = getColIdsBetween1(leafColumns, startCell?.colId ?? '', endCell?.colId ?? '');
|
|
341
|
+
const tmpCols = leafColumns;
|
|
334
342
|
const dataSelected = []; // data được copy
|
|
335
343
|
|
|
336
344
|
rowSelectIds.forEach(rowId => {
|
|
@@ -338,8 +346,6 @@ export function columnCustom(opts) {
|
|
|
338
346
|
if (!row) return;
|
|
339
347
|
const rowData = [];
|
|
340
348
|
colSelectIds.forEach(colId => {
|
|
341
|
-
// const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
342
|
-
|
|
343
349
|
const value = row[colId];
|
|
344
350
|
rowData.push(value !== undefined ? value : '');
|
|
345
351
|
});
|
|
@@ -382,7 +388,7 @@ export function columnCustom(opts) {
|
|
|
382
388
|
}
|
|
383
389
|
|
|
384
390
|
// Cập nhật data mới
|
|
385
|
-
const newData = flattenArray(
|
|
391
|
+
const newData = flattenArray(allRows);
|
|
386
392
|
const pastedRows = [];
|
|
387
393
|
if (pasteState.type === 'down' || pasteState.type === 'up') {
|
|
388
394
|
newRange.addedRows.forEach((rowValues, rowIndex1) => {
|
|
@@ -448,7 +454,9 @@ export function columnCustom(opts) {
|
|
|
448
454
|
pastedRows.push(newData[targetRow]);
|
|
449
455
|
});
|
|
450
456
|
}
|
|
451
|
-
|
|
457
|
+
|
|
458
|
+
// const rsFilterData = updateOrInsert(flattenArray(dataSource), newData)
|
|
459
|
+
const rsFilterData = updateOrInsert(dataSource, newData);
|
|
452
460
|
const rs = unFlattenData(rsFilterData);
|
|
453
461
|
triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
|
|
454
462
|
pipeline.setStateAtKey(stateKeyEndCell, endPasteCell);
|
|
@@ -456,12 +464,8 @@ export function columnCustom(opts) {
|
|
|
456
464
|
pipeline.setStateAtKey(stateKeyStartPasteCell, undefined);
|
|
457
465
|
};
|
|
458
466
|
const triggerPointPaste = (pasteState, cellStart, cellEnd, ctrlKey) => {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const rowPasteIds = getRowIdsBetween3(allRows, rowIndexMap, cellStart?.rowId ?? '', cellEnd?.rowId ?? '');
|
|
462
|
-
const colPasteds = getColIdsBetween1(leafColumns, cellStart?.colId ?? '', cellEnd?.colId ?? '');
|
|
463
|
-
const rowSelectIds = getRowIdsBetween3(allRows, rowIndexMap, startCell?.rowId ?? '', endCell?.rowId ?? '');
|
|
464
|
-
const colSelectIds = getColIdsBetween1(leafColumns, startCell?.colId ?? '', endCell?.colId ?? '');
|
|
467
|
+
const rowsPasteId = getRowIdsBetween3(allRows, rowIndexMap, cellStart?.rowId ?? '', cellEnd?.rowId ?? '');
|
|
468
|
+
const colsPastedId = getColIdsBetween1(leafColumns, cellStart?.colId ?? '', cellEnd?.colId ?? '');
|
|
465
469
|
const dataSelected = [];
|
|
466
470
|
rowSelectIds.forEach(rowId => {
|
|
467
471
|
const row = allRows.find(r => r.rowId === rowId);
|
|
@@ -476,21 +480,13 @@ export function columnCustom(opts) {
|
|
|
476
480
|
const copyRows = flattenData('children', dataSource).filter(it => rowSelectIds.includes(it[rowKey]));
|
|
477
481
|
|
|
478
482
|
// kéo xuóng
|
|
479
|
-
|
|
480
|
-
const newRange = ctrlKey ? addRowsDownWithCtrl(dataSelected, rowPasteIds.length) : addRowsDown(dataSelected, rowPasteIds.length);
|
|
483
|
+
const newRange = ctrlKey ? addRowsDownWithCtrl(dataSelected, rowsPasteId.length) : addRowsDown(dataSelected, rowsPasteId.length);
|
|
481
484
|
|
|
482
485
|
// Cập nhật data mới
|
|
483
|
-
const newData = flattenArray(
|
|
486
|
+
const newData = flattenArray(dataSource);
|
|
484
487
|
const pastedRows = [];
|
|
485
488
|
newRange.addedRows.forEach((rowValues, rowIndex1) => {
|
|
486
|
-
const targetRow = pasteState
|
|
487
|
-
|
|
488
|
-
// Nếu vượt quá số dòng hiện có, thêm dòng mới
|
|
489
|
-
// if (targetRow >= newData.length) {
|
|
490
|
-
|
|
491
|
-
// newData.push({ id: undefined, rowId: newGuid() })
|
|
492
|
-
// }
|
|
493
|
-
|
|
489
|
+
const targetRow = pasteState?.startRowIndex + rowIndex1;
|
|
494
490
|
rowValues.forEach((cellValue, colIndex1) => {
|
|
495
491
|
const targetCol = startColIndex + colIndex1;
|
|
496
492
|
if (targetCol >= leafColumns.length) {
|
|
@@ -507,9 +503,9 @@ export function columnCustom(opts) {
|
|
|
507
503
|
// Lưu dòng được paste
|
|
508
504
|
pastedRows.push(newData[targetRow]);
|
|
509
505
|
});
|
|
510
|
-
const rsFilterData = updateOrInsert(
|
|
506
|
+
const rsFilterData = updateOrInsert(dataSource, newData);
|
|
511
507
|
const rs = unFlattenData(rsFilterData);
|
|
512
|
-
triggerPaste?.(pastedRows,
|
|
508
|
+
triggerPaste?.(pastedRows, colsPastedId, rs, copyRows);
|
|
513
509
|
};
|
|
514
510
|
const handleMouseDown = (rowId, colId) => {
|
|
515
511
|
pipeline.setStateAtKey(stateKeyIsSelecting, true);
|
|
@@ -639,6 +635,11 @@ export function columnCustom(opts) {
|
|
|
639
635
|
// }
|
|
640
636
|
}
|
|
641
637
|
};
|
|
638
|
+
|
|
639
|
+
// const handleDeleteContent = () => {
|
|
640
|
+
|
|
641
|
+
// }
|
|
642
|
+
|
|
642
643
|
const handleKeyDown = (e, rowId, colId, rowIndex, column, record, editType) => {
|
|
643
644
|
if (e.key === 'Tab') {
|
|
644
645
|
const nextCol = getNextColumn(allCols, focusedCell.colId);
|
|
@@ -772,8 +773,54 @@ export function columnCustom(opts) {
|
|
|
772
773
|
}
|
|
773
774
|
return;
|
|
774
775
|
}
|
|
775
|
-
if (e.key === 'Delete') {
|
|
776
|
-
handleDeleteContent?.()
|
|
776
|
+
if (e.key === 'Delete' || e.key === 'Backspace') {
|
|
777
|
+
// handleDeleteContent?.()
|
|
778
|
+
|
|
779
|
+
if (startCell && endCell) {
|
|
780
|
+
const tmpData = flattenArray([...dataSource]);
|
|
781
|
+
const rs = tmpData.map((row, index) => {
|
|
782
|
+
if (!rangeState?.rowRange.includes(row.rowId)) {
|
|
783
|
+
return row;
|
|
784
|
+
}
|
|
785
|
+
const updatedRow = {
|
|
786
|
+
...row
|
|
787
|
+
};
|
|
788
|
+
for (const field of rangeState.colRange) {
|
|
789
|
+
const col = leafColumns.find(it => it.field === field);
|
|
790
|
+
const columnIndex = leafColumns.findIndex(it => it.field === field);
|
|
791
|
+
if (isEditable(col, row)) {
|
|
792
|
+
let newValue = '';
|
|
793
|
+
if (col.type === 'number') {
|
|
794
|
+
newValue = 0;
|
|
795
|
+
}
|
|
796
|
+
if (col.type === 'boolean' || col.type === 'checkbox') {
|
|
797
|
+
newValue = false;
|
|
798
|
+
}
|
|
799
|
+
const cellEditType = getEditType(col, row);
|
|
800
|
+
if (col.type === 'date' || col.type === 'datetime' || col.type === 'time' || col.type === 'month' || col.type === 'week' || col.type === 'year' || col.type === 'quarter' || cellEditType === 'asyncSelect' || cellEditType === 'select' || cellEditType === 'treeSelect' || cellEditType === 'selectTable') {
|
|
801
|
+
newValue = undefined;
|
|
802
|
+
}
|
|
803
|
+
updatedRow[col.field] = newValue;
|
|
804
|
+
handleCellChange({
|
|
805
|
+
key: row[rowKey],
|
|
806
|
+
field: col.field,
|
|
807
|
+
record: updatedRow,
|
|
808
|
+
prevState: row[col.field],
|
|
809
|
+
newState: newValue,
|
|
810
|
+
option: '',
|
|
811
|
+
indexCol: columnIndex,
|
|
812
|
+
indexRow: index,
|
|
813
|
+
type: e.key
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return updatedRow;
|
|
818
|
+
});
|
|
819
|
+
const newData = unFlattenData(rs);
|
|
820
|
+
triggerChangeData?.([...newData], {
|
|
821
|
+
type: 'DELETE_CONTENT'
|
|
822
|
+
});
|
|
823
|
+
}
|
|
777
824
|
return;
|
|
778
825
|
}
|
|
779
826
|
if (e.key === 'Enter') {
|
|
@@ -998,20 +1045,13 @@ export function columnCustom(opts) {
|
|
|
998
1045
|
rowId: rowEnd.id,
|
|
999
1046
|
colId: column.field
|
|
1000
1047
|
};
|
|
1001
|
-
const
|
|
1002
|
-
const pasteStartRow = allRows[
|
|
1048
|
+
const currentRowIndex = rowIndexMap.get(record.rowId);
|
|
1049
|
+
const pasteStartRow = allRows[currentRowIndex + 1];
|
|
1003
1050
|
const cellStart = {
|
|
1004
1051
|
rowId: pasteStartRow.id,
|
|
1005
1052
|
colId: endCell?.colId ?? ''
|
|
1006
1053
|
};
|
|
1007
|
-
|
|
1008
|
-
// const selectState = getSelectedCellMatrix(table, startCell, cellEnd)
|
|
1009
|
-
|
|
1010
1054
|
const selectPasteState = getSelectedCellMatrix1(allRows, leafColumns, cellStart, cellEnd);
|
|
1011
|
-
|
|
1012
|
-
// setRangeState?.(selectState)
|
|
1013
|
-
// setEndCell?.(cellEnd)
|
|
1014
|
-
|
|
1015
1055
|
pipeline.setStateAtKey(stateKeyEndCell, cellEnd);
|
|
1016
1056
|
triggerPointPaste(selectPasteState, cellStart, cellEnd, e.ctrlKey);
|
|
1017
1057
|
};
|
|
@@ -1269,7 +1309,7 @@ export function columnCustom(opts) {
|
|
|
1269
1309
|
[`${prefix}-grid-cell-text-center`]: (col?.headerTextAlign ?? col?.textAlign) === 'center',
|
|
1270
1310
|
[`${prefix}-grid-cell-text-right`]: (col?.headerTextAlign ?? col.textAlign) === 'right'
|
|
1271
1311
|
})
|
|
1272
|
-
}, col.headerEditEnable && cellHeaderEditing ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderEditCell, {
|
|
1312
|
+
}, headerEditAble && col.headerEditEnable && cellHeaderEditing ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderEditCell, {
|
|
1273
1313
|
column: col,
|
|
1274
1314
|
editType: headerEditType ?? 'text',
|
|
1275
1315
|
record: headerRecord,
|
|
@@ -1293,7 +1333,7 @@ export function columnCustom(opts) {
|
|
|
1293
1333
|
startCell: startCell,
|
|
1294
1334
|
handleSubmit: handleSubmit,
|
|
1295
1335
|
onSubmit: onSubmit
|
|
1296
|
-
})) : col.headerEditEnable ? /*#__PURE__*/React.createElement(React.Fragment, null, headerValue) : col.headerTemplate ? /*#__PURE__*/React.createElement(React.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle))), !col.headerEditEnable && (!nonActionColumn.includes(col.field) && !col?.children || col?.children && col?.children.length < 1) && /*#__PURE__*/React.createElement("span", {
|
|
1336
|
+
})) : headerEditAble && col.headerEditEnable ? /*#__PURE__*/React.createElement(React.Fragment, null, headerValue) : col.headerTemplate ? /*#__PURE__*/React.createElement(React.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle))), !col.headerEditEnable && (!nonActionColumn.includes(col.field) && !col?.children || col?.children && col?.children.length < 1) && /*#__PURE__*/React.createElement("span", {
|
|
1297
1337
|
className: "ui-rc-header-trigger d-flex gap-50"
|
|
1298
1338
|
}, canSort && /*#__PURE__*/React.createElement("div", {
|
|
1299
1339
|
style: {
|
|
@@ -1376,84 +1416,89 @@ export function columnCustom(opts) {
|
|
|
1376
1416
|
onDoubleClick: e => {
|
|
1377
1417
|
// prevCellProps?.onDoubleClick?.(e)
|
|
1378
1418
|
|
|
1379
|
-
if (
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1419
|
+
if (headerEditAble) {
|
|
1420
|
+
if (!col.headerEditEnable) {
|
|
1421
|
+
e.stopPropagation();
|
|
1422
|
+
e.preventDefault();
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
if (headerRowId === focusedCell.rowId && col.field === focusedCell.colId && col.headerEditEnable) {
|
|
1426
|
+
handleEdit(e, headerRecord, col, headerEditType ?? 'text', false, true);
|
|
1427
|
+
}
|
|
1386
1428
|
}
|
|
1387
1429
|
},
|
|
1388
1430
|
onKeyDown: e => {
|
|
1389
1431
|
// prevCellProps?.onKeyDown?.(e)
|
|
1390
1432
|
// chưa editing
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
e.preventDefault();
|
|
1396
|
-
e.stopPropagation();
|
|
1433
|
+
|
|
1434
|
+
if (headerEditAble) {
|
|
1435
|
+
if (!isEditing) {
|
|
1436
|
+
handleHeaderKeyDown(e, headerRowId, col.field, headerRowIndex, col, headerRecord, headerEditType ?? 'text');
|
|
1397
1437
|
} else {
|
|
1398
|
-
if (e.key === 'Enter') {
|
|
1438
|
+
if (e.shiftKey && e.key === 'Enter') {
|
|
1399
1439
|
e.preventDefault();
|
|
1400
1440
|
e.stopPropagation();
|
|
1441
|
+
} else {
|
|
1442
|
+
if (e.key === 'Enter') {
|
|
1443
|
+
e.preventDefault();
|
|
1444
|
+
e.stopPropagation();
|
|
1401
1445
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1446
|
+
// const currentRowIndex = allRows.findIndex(r => r.rowId === headerRowId);
|
|
1447
|
+
// const nextRow = allRows[currentRowIndex + 1];
|
|
1404
1448
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1449
|
+
// if (nextRow) {
|
|
1450
|
+
// const nextCellPosition = { rowId: nextRow.rowId, colId: col.field }
|
|
1407
1451
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1452
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
1453
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
1454
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
1411
1455
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1456
|
+
handleHeaderChange(headerRecord, col, startIndex);
|
|
1457
|
+
pipeline.setStateAtKey(stateKeyIsEditing, false);
|
|
1414
1458
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1459
|
+
// }
|
|
1460
|
+
}
|
|
1461
|
+
if (e.key === 'Tab') {
|
|
1462
|
+
e.preventDefault();
|
|
1419
1463
|
|
|
1420
|
-
|
|
1464
|
+
// const nextCol = getNextColumn(allCols, col.field)
|
|
1421
1465
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1466
|
+
if (nextHeaderCol?.column?.field && !nextHeaderCol?.isWrapped) {
|
|
1467
|
+
const nextCellPosition = {
|
|
1468
|
+
rowId: headerRowId,
|
|
1469
|
+
colId: nextHeaderCol.column.field
|
|
1470
|
+
};
|
|
1471
|
+
pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition);
|
|
1472
|
+
pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition);
|
|
1473
|
+
pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition);
|
|
1430
1474
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1475
|
+
// columnVirtualizer.scrollToIndex(nextCol.getIndex(), { align: 'center' })
|
|
1476
|
+
} else {
|
|
1477
|
+
// Nếu là cột cuối cùng, có thể nhảy xuống dòng tiếp theo
|
|
1434
1478
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1479
|
+
// const currentRowIndex = allRows.findIndex(r => r.rowId === headerRowId);
|
|
1480
|
+
// const nextRow = allRows[currentRowIndex + 1];
|
|
1437
1481
|
|
|
1438
|
-
|
|
1482
|
+
// const firstCol = nextCol.column
|
|
1439
1483
|
|
|
1440
|
-
|
|
1484
|
+
// if (nextRow) {
|
|
1441
1485
|
|
|
1442
|
-
|
|
1486
|
+
// const nextCellPosition = { rowId: nextRow.rowId, colId: firstCol.field }
|
|
1443
1487
|
|
|
1444
|
-
|
|
1488
|
+
// pipeline.setStateAtKey(stateKeyFocusedCell, nextCellPosition)
|
|
1445
1489
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1490
|
+
// pipeline.setStateAtKey(stateKeyStartCell, nextCellPosition)
|
|
1491
|
+
// pipeline.setStateAtKey(stateKeyEndCell, nextCellPosition)
|
|
1448
1492
|
|
|
1449
|
-
|
|
1493
|
+
// // columnVirtualizer.scrollToIndex(nextRowCol.getIndex())
|
|
1450
1494
|
|
|
1451
|
-
|
|
1495
|
+
// // rowVirtualizer.scrollToIndex(nextRow.index, { align: 'auto' })
|
|
1452
1496
|
|
|
1453
|
-
|
|
1497
|
+
// }
|
|
1498
|
+
}
|
|
1499
|
+
handleHeaderChange(headerRecord, col, startIndex);
|
|
1500
|
+
pipeline.setStateAtKey(stateKeyIsEditing, false);
|
|
1454
1501
|
}
|
|
1455
|
-
handleHeaderChange(headerRecord, col, startIndex);
|
|
1456
|
-
pipeline.setStateAtKey(stateKeyIsEditing, false);
|
|
1457
1502
|
}
|
|
1458
1503
|
}
|
|
1459
1504
|
}
|
|
@@ -1610,6 +1655,28 @@ export function columnCustom(opts) {
|
|
|
1610
1655
|
return;
|
|
1611
1656
|
}
|
|
1612
1657
|
if (record.rowId === focusedCell.rowId && col.field === focusedCell.colId && canEdit) {
|
|
1658
|
+
if (onCellClick) {
|
|
1659
|
+
const cellClickCallback = newOptions => {
|
|
1660
|
+
if (newOptions) {
|
|
1661
|
+
pipeline.setStateAtKey(stateKeyEditCellSettings, {
|
|
1662
|
+
rowId: record.rowId,
|
|
1663
|
+
colId: col.field,
|
|
1664
|
+
editSelectSettings: {
|
|
1665
|
+
...col.editSelectSettings,
|
|
1666
|
+
options: newOptions
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
onCellClick({
|
|
1672
|
+
index: rowIndex,
|
|
1673
|
+
rowId: record.rowId,
|
|
1674
|
+
cellValue: value,
|
|
1675
|
+
type: "Editing",
|
|
1676
|
+
field: col.field,
|
|
1677
|
+
rowData: record
|
|
1678
|
+
}, cellClickCallback);
|
|
1679
|
+
}
|
|
1613
1680
|
handleEdit(e, record, col, editType ?? 'text', false);
|
|
1614
1681
|
}
|
|
1615
1682
|
},
|
|
@@ -1688,7 +1755,10 @@ export function columnCustom(opts) {
|
|
|
1688
1755
|
},
|
|
1689
1756
|
// children: ''
|
|
1690
1757
|
children: canEdit && cellEditing ? /*#__PURE__*/React.createElement(EditCell, {
|
|
1691
|
-
column: col
|
|
1758
|
+
column: editCellSettings?.rowId === record.rowId && editCellSettings?.colId === col.field ? {
|
|
1759
|
+
...col,
|
|
1760
|
+
editSelectSettings: editCellSettings.editSelectSettings
|
|
1761
|
+
} : col,
|
|
1692
1762
|
editType: editType ?? 'text',
|
|
1693
1763
|
record: record,
|
|
1694
1764
|
tableId: id,
|
|
@@ -10,6 +10,7 @@ export declare const stateKeyIsEditing = "isEditing";
|
|
|
10
10
|
export declare const stateKeyStartPasteCell = "startPasteCell";
|
|
11
11
|
export declare const stateKeyEndPasteCell = "endPasteCell";
|
|
12
12
|
export declare const stateKeyIsSelecting = "isSelecting";
|
|
13
|
+
export declare const stateKeyEditCellSettings = "editCellSettings";
|
|
13
14
|
export declare const stateKeyIsPasting = "isPasting";
|
|
14
15
|
export declare const stateKeyEndCell = "endCell";
|
|
15
16
|
export declare const stateKeyStartCell = "startCell";
|
|
@@ -15,6 +15,7 @@ export const stateKeyIsEditing = 'isEditing';
|
|
|
15
15
|
export const stateKeyStartPasteCell = 'startPasteCell';
|
|
16
16
|
export const stateKeyEndPasteCell = 'endPasteCell';
|
|
17
17
|
export const stateKeyIsSelecting = 'isSelecting';
|
|
18
|
+
export const stateKeyEditCellSettings = 'editCellSettings';
|
|
18
19
|
export const stateKeyIsPasting = 'isPasting';
|
|
19
20
|
export const stateKeyEndCell = 'endCell';
|
|
20
21
|
export const stateKeyStartCell = 'startCell';
|