es-grid-template 1.8.93 → 1.8.95
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/group-component/hook/utils.d.ts +8 -8
- package/es/table-component/body/EditableCell.js +52 -0
- package/es/table-component/header/TableHeadCell2.js +2 -2
- package/es/table-component/table/Grid.js +1 -1
- package/lib/table-component/body/EditableCell.js +52 -0
- package/lib/table-component/header/TableHeadCell2.js +2 -2
- package/lib/table-component/table/Grid.js +1 -1
- package/package.json +1 -1
|
@@ -162,7 +162,7 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
162
162
|
type?: IColumnType;
|
|
163
163
|
haveSum?: boolean;
|
|
164
164
|
isSummary?: boolean;
|
|
165
|
-
summaryTemplate?: (data: number, key: string) => import("react").
|
|
165
|
+
summaryTemplate?: (data: number, key: string) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode;
|
|
166
166
|
format?: IFormat | ((rowData: any) => IFormat);
|
|
167
167
|
allowFiltering?: boolean;
|
|
168
168
|
sorter?: boolean;
|
|
@@ -177,18 +177,18 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
177
177
|
headerText?: string;
|
|
178
178
|
hidden?: boolean;
|
|
179
179
|
visible?: boolean;
|
|
180
|
-
headerTooltip?: string | boolean | (() => import("react").
|
|
180
|
+
headerTooltip?: string | boolean | (() => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
181
181
|
columnGroupText?: string;
|
|
182
182
|
align?: import("./../../grid-component/type").ITextAlign;
|
|
183
183
|
textAlign?: import("./../../grid-component/type").ITextAlign;
|
|
184
184
|
headerTextAlign?: import("./../../grid-component/type").ITextAlign;
|
|
185
|
-
template?: import("react").
|
|
185
|
+
template?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
186
186
|
showTooltip?: boolean;
|
|
187
187
|
tooltipDescription?: string | ((args: {
|
|
188
188
|
value: any;
|
|
189
189
|
rowData: RecordType;
|
|
190
|
-
}) => import("react").
|
|
191
|
-
headerTemplate?: import("react").
|
|
190
|
+
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
191
|
+
headerTemplate?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((column: ColumnTable<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
192
192
|
commandItems?: import("./../../grid-component/type").CommandItem[];
|
|
193
193
|
children?: ColumnTable<RecordType>[];
|
|
194
194
|
editType?: EditType | ((rowData?: RecordType) => EditType);
|
|
@@ -208,9 +208,9 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
208
208
|
ellipsis?: boolean;
|
|
209
209
|
allowResizing?: boolean;
|
|
210
210
|
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
211
|
-
onCellStyles?: Omit<CSSProperties, "
|
|
212
|
-
onCellHeaderStyles?: Omit<CSSProperties, "
|
|
213
|
-
onCellFooterStyles?: Omit<CSSProperties, "
|
|
211
|
+
onCellStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
212
|
+
onCellHeaderStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
213
|
+
onCellFooterStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
214
214
|
sumGroup?: boolean;
|
|
215
215
|
getValue?: (row: any, rowIndex: number) => any;
|
|
216
216
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
@@ -447,6 +447,32 @@ const EditableCell = props => {
|
|
|
447
447
|
});
|
|
448
448
|
}
|
|
449
449
|
},
|
|
450
|
+
onKeyDown: event => {
|
|
451
|
+
if (event.key === 'Enter' && event.target?.value && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
452
|
+
const val = event.target.value;
|
|
453
|
+
onChange(val ?? '');
|
|
454
|
+
const formState = getValues();
|
|
455
|
+
// const itemState = getValues(dataIndex)
|
|
456
|
+
// @ts-ignore
|
|
457
|
+
const prevState = record[dataIndex];
|
|
458
|
+
const newState = val;
|
|
459
|
+
handleCellChange?.({
|
|
460
|
+
key,
|
|
461
|
+
field: column.field ?? column.field,
|
|
462
|
+
record: formState,
|
|
463
|
+
prevState,
|
|
464
|
+
newState,
|
|
465
|
+
option: {
|
|
466
|
+
value: val,
|
|
467
|
+
label: val,
|
|
468
|
+
searchTextAsValue: true
|
|
469
|
+
},
|
|
470
|
+
indexCol,
|
|
471
|
+
indexRow,
|
|
472
|
+
type: 'blur'
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
},
|
|
450
476
|
"data-tooltip-content": message,
|
|
451
477
|
"data-tooltip-id": `${id}-tooltip-error`
|
|
452
478
|
});
|
|
@@ -526,6 +552,32 @@ const EditableCell = props => {
|
|
|
526
552
|
});
|
|
527
553
|
}
|
|
528
554
|
},
|
|
555
|
+
onKeyDown: event => {
|
|
556
|
+
if (event.key === 'Enter' && event.target?.value && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
557
|
+
const val = event.target.value;
|
|
558
|
+
onChange(val ?? '');
|
|
559
|
+
const formState = getValues();
|
|
560
|
+
// const itemState = getValues(dataIndex)
|
|
561
|
+
// @ts-ignore
|
|
562
|
+
const prevState = record[dataIndex];
|
|
563
|
+
const newState = val;
|
|
564
|
+
handleCellChange?.({
|
|
565
|
+
key,
|
|
566
|
+
field: column.field ?? column.field,
|
|
567
|
+
record: formState,
|
|
568
|
+
prevState,
|
|
569
|
+
newState,
|
|
570
|
+
option: {
|
|
571
|
+
value: val,
|
|
572
|
+
label: val,
|
|
573
|
+
searchTextAsValue: true
|
|
574
|
+
},
|
|
575
|
+
indexCol,
|
|
576
|
+
indexRow,
|
|
577
|
+
type: 'blur'
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
},
|
|
529
581
|
dropdownRender: menu => {
|
|
530
582
|
if (toolbarItems && toolbarItems.length > 0) {
|
|
531
583
|
return /*#__PURE__*/React.createElement(React.Fragment, null, menu, toolbarItems && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
@@ -98,8 +98,8 @@ const TableHeadCell2 = props => {
|
|
|
98
98
|
if (newVisible) {
|
|
99
99
|
const filterValue = column.getFilterValue() ?? [];
|
|
100
100
|
const filterValueOrigin = fieldOriginal ? fieldOriginal.getFilterValue() ?? [] : undefined;
|
|
101
|
-
const
|
|
102
|
-
const operatorValue = column.getFilterOperator() ??
|
|
101
|
+
const defaultFilterOption = defaultFilter?.find(it => it.field === originalColumn.field);
|
|
102
|
+
const operatorValue = column.getFilterOperator() ?? defaultFilterOption?.operator ?? getDefaultOperator(column.columnDef?.meta ?? {});
|
|
103
103
|
setSelectedKeys(filterValueOrigin ?? filterValue);
|
|
104
104
|
if (fieldOriginal) {
|
|
105
105
|
fieldOriginal.setFilterOperator?.(operatorValue);
|
|
@@ -218,7 +218,7 @@ const Grid = props => {
|
|
|
218
218
|
selected: rs
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
|
-
}, [isSelectionChange,
|
|
221
|
+
}, [isSelectionChange, rowSelection, table.getState().rowSelection]);
|
|
222
222
|
React.useEffect(() => {
|
|
223
223
|
if (sorterChange) {
|
|
224
224
|
const aa = table.getState().sorting;
|
|
@@ -455,6 +455,32 @@ const EditableCell = props => {
|
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
457
|
},
|
|
458
|
+
onKeyDown: event => {
|
|
459
|
+
if (event.key === 'Enter' && event.target?.value && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
460
|
+
const val = event.target.value;
|
|
461
|
+
onChange(val ?? '');
|
|
462
|
+
const formState = getValues();
|
|
463
|
+
// const itemState = getValues(dataIndex)
|
|
464
|
+
// @ts-ignore
|
|
465
|
+
const prevState = record[dataIndex];
|
|
466
|
+
const newState = val;
|
|
467
|
+
handleCellChange?.({
|
|
468
|
+
key,
|
|
469
|
+
field: column.field ?? column.field,
|
|
470
|
+
record: formState,
|
|
471
|
+
prevState,
|
|
472
|
+
newState,
|
|
473
|
+
option: {
|
|
474
|
+
value: val,
|
|
475
|
+
label: val,
|
|
476
|
+
searchTextAsValue: true
|
|
477
|
+
},
|
|
478
|
+
indexCol,
|
|
479
|
+
indexRow,
|
|
480
|
+
type: 'blur'
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
},
|
|
458
484
|
"data-tooltip-content": message,
|
|
459
485
|
"data-tooltip-id": `${id}-tooltip-error`
|
|
460
486
|
});
|
|
@@ -534,6 +560,32 @@ const EditableCell = props => {
|
|
|
534
560
|
});
|
|
535
561
|
}
|
|
536
562
|
},
|
|
563
|
+
onKeyDown: event => {
|
|
564
|
+
if (event.key === 'Enter' && event.target?.value && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
565
|
+
const val = event.target.value;
|
|
566
|
+
onChange(val ?? '');
|
|
567
|
+
const formState = getValues();
|
|
568
|
+
// const itemState = getValues(dataIndex)
|
|
569
|
+
// @ts-ignore
|
|
570
|
+
const prevState = record[dataIndex];
|
|
571
|
+
const newState = val;
|
|
572
|
+
handleCellChange?.({
|
|
573
|
+
key,
|
|
574
|
+
field: column.field ?? column.field,
|
|
575
|
+
record: formState,
|
|
576
|
+
prevState,
|
|
577
|
+
newState,
|
|
578
|
+
option: {
|
|
579
|
+
value: val,
|
|
580
|
+
label: val,
|
|
581
|
+
searchTextAsValue: true
|
|
582
|
+
},
|
|
583
|
+
indexCol,
|
|
584
|
+
indexRow,
|
|
585
|
+
type: 'blur'
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
},
|
|
537
589
|
dropdownRender: menu => {
|
|
538
590
|
if (toolbarItems && toolbarItems.length > 0) {
|
|
539
591
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, menu, toolbarItems && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Divider, {
|
|
@@ -107,8 +107,8 @@ const TableHeadCell2 = props => {
|
|
|
107
107
|
if (newVisible) {
|
|
108
108
|
const filterValue = column.getFilterValue() ?? [];
|
|
109
109
|
const filterValueOrigin = fieldOriginal ? fieldOriginal.getFilterValue() ?? [] : undefined;
|
|
110
|
-
const
|
|
111
|
-
const operatorValue = column.getFilterOperator() ??
|
|
110
|
+
const defaultFilterOption = defaultFilter?.find(it => it.field === originalColumn.field);
|
|
111
|
+
const operatorValue = column.getFilterOperator() ?? defaultFilterOption?.operator ?? (0, _utils.getDefaultOperator)(column.columnDef?.meta ?? {});
|
|
112
112
|
setSelectedKeys(filterValueOrigin ?? filterValue);
|
|
113
113
|
if (fieldOriginal) {
|
|
114
114
|
fieldOriginal.setFilterOperator?.(operatorValue);
|
|
@@ -223,7 +223,7 @@ const Grid = props => {
|
|
|
223
223
|
selected: rs
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
|
-
}, [isSelectionChange,
|
|
226
|
+
}, [isSelectionChange, rowSelection, table.getState().rowSelection]);
|
|
227
227
|
_react.default.useEffect(() => {
|
|
228
228
|
if (sorterChange) {
|
|
229
229
|
const aa = table.getState().sorting;
|