es-grid-template 1.2.3 → 1.2.5
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/assets/index.css +0 -20
- package/assets/index.scss +22 -4
- package/es/grid-component/ColumnsChoose.d.ts +1 -0
- package/es/grid-component/ColumnsChoose.js +351 -61
- package/es/grid-component/EditableCell.js +3 -1
- package/es/grid-component/InternalTable.js +8 -1
- package/es/grid-component/hooks/useColumns.js +3 -3
- package/es/grid-component/hooks/useForceUpdate.d.ts +2 -0
- package/es/grid-component/hooks/useForceUpdate.js +5 -0
- package/es/grid-component/hooks/utils.d.ts +3 -0
- package/es/grid-component/hooks/utils.js +83 -16
- package/es/grid-component/styles.scss +22 -4
- package/es/grid-component/table/Grid.js +2 -1
- package/es/grid-component/table/GridEdit.js +75 -10
- package/es/grid-component/type.d.ts +3 -1
- package/lib/grid-component/ColumnsChoose.d.ts +1 -0
- package/lib/grid-component/ColumnsChoose.js +350 -60
- package/lib/grid-component/EditableCell.js +2 -1
- package/lib/grid-component/InternalTable.js +8 -1
- package/lib/grid-component/hooks/useColumns.js +3 -3
- package/lib/grid-component/hooks/useForceUpdate.d.ts +2 -0
- package/lib/grid-component/hooks/useForceUpdate.js +13 -0
- package/lib/grid-component/hooks/utils.d.ts +3 -0
- package/lib/grid-component/hooks/utils.js +89 -18
- package/lib/grid-component/styles.scss +22 -4
- package/lib/grid-component/table/Grid.js +2 -1
- package/lib/grid-component/table/GridEdit.js +74 -9
- package/lib/grid-component/type.d.ts +3 -1
- package/package.json +106 -106
|
@@ -245,11 +245,11 @@ const useColumns = config => {
|
|
|
245
245
|
}),
|
|
246
246
|
onCell: data => {
|
|
247
247
|
return {
|
|
248
|
-
colSpan: data.children && col.field === firstNonGroupColumn?.field ? 2 : data.children && nonGroupColumns[1].field === col.field ? 0 : 1,
|
|
248
|
+
colSpan: groupColumns && data.children && col.field === firstNonGroupColumn?.field ? 2 : groupColumns && data.children && nonGroupColumns[1].field === col.field ? 0 : 1,
|
|
249
249
|
zIndex: data.children && col.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
250
250
|
className: classNames('', {
|
|
251
|
-
'cell-group': data.children,
|
|
252
|
-
'cell-group-fixed': data.children && col.field === firstNonGroupColumn?.field
|
|
251
|
+
'cell-group': groupColumns && data.children,
|
|
252
|
+
'cell-group-fixed': groupColumns && data.children && col.field === firstNonGroupColumn?.field
|
|
253
253
|
})
|
|
254
254
|
};
|
|
255
255
|
},
|
|
@@ -66,3 +66,6 @@ export declare const transformColumns: <RecordType>(cols: ColumnsTable<RecordTyp
|
|
|
66
66
|
export declare const transformColumns1: <RecordType>(cols: ColumnsTable<RecordType>, sortMultiple?: boolean) => ColumnsTable<RecordType>;
|
|
67
67
|
export declare const removeColumns: <RecordType>(columns: ColumnsTable<RecordType>, groupColumns: string[]) => ColumnsTable<RecordType>;
|
|
68
68
|
export declare const convertFlatColumn: (array: ColumnsTable) => ColumnsTable[];
|
|
69
|
+
export declare const convertColumns: <RecordType>(cols: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
70
|
+
export declare const checkChild: (inputArray: any[]) => boolean;
|
|
71
|
+
export declare const isEditable: <RecordType>(column: ColumnEditType, rowData: RecordType) => boolean | ((rowData: any) => boolean);
|
|
@@ -4,6 +4,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
4
4
|
import { presetPalettes } from "@ant-design/colors";
|
|
5
5
|
import { Table } from "rc-master-ui";
|
|
6
6
|
import { flatColumns2 } from "./columns";
|
|
7
|
+
import { SELECTION_COLUMN } from "./useColumns";
|
|
7
8
|
export const newGuid = () => {
|
|
8
9
|
for (let i = 0; i < 20; i++) {
|
|
9
10
|
// @ts-ignore
|
|
@@ -138,9 +139,14 @@ export const updateColumns = (columns, includes) => {
|
|
|
138
139
|
newColumn.children = updateColumns(newColumn.children, includes);
|
|
139
140
|
hasVisibleChild = newColumn.children.some(child => !child.hidden);
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
+
|
|
143
|
+
// newColumn.hidden = newColumn.key && !includes.includes(newColumn.key)
|
|
144
|
+
newColumn.hidden = newColumn.field && !includes.includes(newColumn.field);
|
|
145
|
+
// newColumn.fixed = newColumn.field && !includes.includes(newColumn.field) ? undefined : newColumn.fixed
|
|
146
|
+
|
|
142
147
|
if (newColumn.children && newColumn.children.length > 0) {
|
|
143
148
|
newColumn.hidden = !hasVisibleChild;
|
|
149
|
+
// newColumn.fixed = !hasVisibleChild ? undefined : newColumn.fixed
|
|
144
150
|
}
|
|
145
151
|
return newColumn;
|
|
146
152
|
});
|
|
@@ -474,19 +480,6 @@ export const getFirstSelectCell = selectCells => {
|
|
|
474
480
|
col
|
|
475
481
|
};
|
|
476
482
|
};
|
|
477
|
-
|
|
478
|
-
// export const getLastSelectCell = (selectCells: any): {row: number, col: number} => {
|
|
479
|
-
//
|
|
480
|
-
// if (selectCells.size === 0) {
|
|
481
|
-
// return {row: 0, col: 0}
|
|
482
|
-
// }
|
|
483
|
-
// const lastValue = [...selectCells].pop();
|
|
484
|
-
//
|
|
485
|
-
// const [row, col] = lastValue.split("-").map(Number);
|
|
486
|
-
// return {row, col};
|
|
487
|
-
//
|
|
488
|
-
// }
|
|
489
|
-
|
|
490
483
|
export const getRowsPasteIndex = pasteRows => {
|
|
491
484
|
if (!pasteRows) {
|
|
492
485
|
return [];
|
|
@@ -504,8 +497,25 @@ export function addRows8(arr, n) {
|
|
|
504
497
|
const addedRows = [];
|
|
505
498
|
|
|
506
499
|
// Hàm kiểm tra kiểu date hợp lệ
|
|
507
|
-
const isValidDate =
|
|
508
|
-
|
|
500
|
+
const isValidDate = item => {
|
|
501
|
+
// console.log('!isNaN(Date.parse(d))', !isNaN(Date.parse(d)))
|
|
502
|
+
// return !isNaN(Date.parse(d))
|
|
503
|
+
|
|
504
|
+
if (typeof item === 'number') {
|
|
505
|
+
// return 'number'
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
if (typeof item === 'string') {
|
|
509
|
+
// Kiểm tra nếu là chuỗi ISO date hợp lệ
|
|
510
|
+
const date = new Date(item);
|
|
511
|
+
if (!isNaN(date.getTime()) && item.includes('T')) {
|
|
512
|
+
// return 'date'
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
// return 'string'
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
return !isNaN(Date.parse(item));
|
|
509
519
|
};
|
|
510
520
|
|
|
511
521
|
// Lấy giá trị mẫu của cột j từ hàng đầu tiên
|
|
@@ -711,4 +721,61 @@ export const convertFlatColumn = array => {
|
|
|
711
721
|
}
|
|
712
722
|
});
|
|
713
723
|
return result;
|
|
724
|
+
};
|
|
725
|
+
export const convertColumns = cols => {
|
|
726
|
+
return cols.map(col => {
|
|
727
|
+
if (col === SELECTION_COLUMN) {
|
|
728
|
+
return SELECTION_COLUMN;
|
|
729
|
+
}
|
|
730
|
+
const transformedColumn = {
|
|
731
|
+
...col,
|
|
732
|
+
dataIndex: col.field ?? col.dataIndex,
|
|
733
|
+
key: col.field ?? col.dataIndex ?? col.key,
|
|
734
|
+
// title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
|
|
735
|
+
// title: () => (<span>aaa</span>),
|
|
736
|
+
// title: () => (<HeaderContent column={{...col} as any} t={t}/>),
|
|
737
|
+
// title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
|
|
738
|
+
ellipsis: col.ellipsis !== false,
|
|
739
|
+
align: col.textAlign ?? col.align,
|
|
740
|
+
fixed: col.frozen ? col.frozen.toLowerCase() : col.fixed
|
|
741
|
+
};
|
|
742
|
+
if (transformedColumn.children && transformedColumn.children?.length) {
|
|
743
|
+
return {
|
|
744
|
+
...transformedColumn,
|
|
745
|
+
children: convertColumns(transformedColumn.children)
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
if (["index", "#"].includes(col.field)) {
|
|
749
|
+
return {
|
|
750
|
+
...transformedColumn,
|
|
751
|
+
onCell: () => ({
|
|
752
|
+
className: 'cell-number'
|
|
753
|
+
}),
|
|
754
|
+
render: (_, __, rowIndex) => rowIndex + 1
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
if (col.key === 'command') {
|
|
758
|
+
return {
|
|
759
|
+
...transformedColumn,
|
|
760
|
+
onCell: () => ({
|
|
761
|
+
className: 'cell-number',
|
|
762
|
+
style: {
|
|
763
|
+
padding: '2px 8px'
|
|
764
|
+
}
|
|
765
|
+
})
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
return {
|
|
769
|
+
...transformedColumn
|
|
770
|
+
};
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
export const checkChild = inputArray => {
|
|
774
|
+
return inputArray.some(item => item.children && item.children.length > 0);
|
|
775
|
+
};
|
|
776
|
+
export const isEditable = (column, rowData) => {
|
|
777
|
+
if (column && typeof column.editEnable === 'function') {
|
|
778
|
+
return column.editEnable(rowData);
|
|
779
|
+
}
|
|
780
|
+
return column?.editEnable;
|
|
714
781
|
};
|
|
@@ -42,6 +42,14 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
42
42
|
//font-weight: 500;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
.ui-rc-table {
|
|
46
|
+
.#{$prefix}-table-cell {
|
|
47
|
+
&.#{$prefix}-table-selection-column {
|
|
48
|
+
//padding: 6px 8px !important;
|
|
49
|
+
//padding: 6px 8px !important;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
45
53
|
|
|
46
54
|
|
|
47
55
|
&.table-none-column-select {
|
|
@@ -57,9 +65,12 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
.#{$prefix}-table {
|
|
60
|
-
|
|
68
|
+
|
|
69
|
+
//line-height: 20px;
|
|
70
|
+
|
|
61
71
|
.#{$prefix}-table-cell {
|
|
62
|
-
min-height: 35px;
|
|
72
|
+
//min-height: 35px;
|
|
73
|
+
//height: 35px;
|
|
63
74
|
|
|
64
75
|
.#{$prefix}-table-filter-column {
|
|
65
76
|
.#{$prefix}-dropdown-trigger.#{$prefix}-table-filter-trigger {
|
|
@@ -324,6 +335,13 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
324
335
|
|
|
325
336
|
.#{$prefix}-table-wrapper {
|
|
326
337
|
|
|
338
|
+
.#{$prefix}-table.#{$prefix}-table-small {
|
|
339
|
+
.#{$prefix}-table-selection-column{
|
|
340
|
+
//padding: 8px 8px;
|
|
341
|
+
//padding: 6px 8px;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
327
345
|
&.grid-editable {
|
|
328
346
|
|
|
329
347
|
.#{$prefix}-table-row {
|
|
@@ -528,7 +546,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
528
546
|
.#{$prefix}-table.#{$prefix}-table-small {
|
|
529
547
|
.#{$prefix}-table-selection-column{
|
|
530
548
|
//padding: 8px 8px;
|
|
531
|
-
padding: 6px 8px;
|
|
549
|
+
//padding: 6px 8px;
|
|
532
550
|
}
|
|
533
551
|
}
|
|
534
552
|
|
|
@@ -620,7 +638,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
620
638
|
.#{$prefix}-table-row-expand-icon {
|
|
621
639
|
position: absolute;
|
|
622
640
|
//.ui-rc_content {
|
|
623
|
-
padding-left: $i * 10px;
|
|
641
|
+
//padding-left: $i * 10px;
|
|
624
642
|
//}
|
|
625
643
|
}
|
|
626
644
|
|
|
@@ -13,7 +13,7 @@ import dayjs from "dayjs";
|
|
|
13
13
|
import 'dayjs/locale/es';
|
|
14
14
|
import 'dayjs/locale/vi';
|
|
15
15
|
import TableGrid from "../TableGrid";
|
|
16
|
-
import { addRows8, findAllChildrenKeys, findItemByKey, flattenArray, flattenData, getDefaultValue, getEditType, getFirstSelectCell, getLastSelectCell, getRowNumber, getRowsPasteIndex, isObjEmpty, newGuid, totalFixedWidth, updateArrayByKey } from "../hooks";
|
|
16
|
+
import { addRows8, checkChild, findAllChildrenKeys, findItemByKey, flattenArray, flattenData, getDefaultValue, getEditType, getFirstSelectCell, getLastSelectCell, getRowNumber, getRowsPasteIndex, isEditable, isObjEmpty, newGuid, totalFixedWidth, updateArrayByKey } from "../hooks";
|
|
17
17
|
import Message from "../../Message/Message";
|
|
18
18
|
|
|
19
19
|
// import Command from "../Command";
|
|
@@ -49,6 +49,7 @@ const GridEdit = props => {
|
|
|
49
49
|
defaultValue,
|
|
50
50
|
expandable,
|
|
51
51
|
onCellClick,
|
|
52
|
+
rowEditable,
|
|
52
53
|
...rest
|
|
53
54
|
} = props;
|
|
54
55
|
const {
|
|
@@ -85,8 +86,6 @@ const GridEdit = props => {
|
|
|
85
86
|
const [isSelectDragging, setSelectIsDragging] = useState(false);
|
|
86
87
|
const [isPasteDragging, setIsPasteDragging] = useState(false); // isPasteDragging == tiếp tục hiển thị con trỏ crosshair
|
|
87
88
|
|
|
88
|
-
// const [showDraggingPoint, setShowDraggingPoint] = useState(false);
|
|
89
|
-
|
|
90
89
|
const [rowsSelected, setRowsSelected] = useState(new Set());
|
|
91
90
|
const [startSelectedCells, setStartSelectedCell] = useState(null);
|
|
92
91
|
const [innerExpandedKeys, setInnerExpandedKeys] = React.useState(() => {
|
|
@@ -259,10 +258,54 @@ const GridEdit = props => {
|
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
260
|
};
|
|
262
|
-
const
|
|
261
|
+
const handleInsertChild = item => {
|
|
262
|
+
const defaultRowValue = getDefaultValue(defaultValue);
|
|
263
|
+
const rowId = defaultRowValue && defaultRowValue.id ? defaultRowValue.id : newGuid();
|
|
264
|
+
const record = flattenData(childrenColumnName, dataSource)[rowsFocus[rowsFocus.length - 1]];
|
|
265
|
+
if (item.onClick) {
|
|
266
|
+
item.onClick({
|
|
267
|
+
toolbar: item
|
|
268
|
+
});
|
|
269
|
+
} else {
|
|
270
|
+
const newData = [...dataSource];
|
|
271
|
+
let newElement = {};
|
|
272
|
+
if (!record.children || record.children.length === 0) {
|
|
273
|
+
newElement = {
|
|
274
|
+
...record,
|
|
275
|
+
children: [{
|
|
276
|
+
...defaultRowValue,
|
|
277
|
+
parentId: record.rowId,
|
|
278
|
+
rowId
|
|
279
|
+
}]
|
|
280
|
+
};
|
|
281
|
+
} else {
|
|
282
|
+
newElement = {
|
|
283
|
+
...record,
|
|
284
|
+
children: [...record.children, {
|
|
285
|
+
...defaultRowValue,
|
|
286
|
+
parentId: record.rowId,
|
|
287
|
+
rowId
|
|
288
|
+
}]
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const newDataSource = updateArrayByKey(newData, newElement, rowKey);
|
|
292
|
+
triggerChangeData?.(newDataSource, 'INSERT_CHILDREN');
|
|
293
|
+
}
|
|
294
|
+
const key = getRowKey(record, dataSource.indexOf(record));
|
|
295
|
+
|
|
296
|
+
// let newExpandedKeys: Key[];
|
|
297
|
+
const hasKey = mergedExpandedKeys.has(key);
|
|
298
|
+
if (!hasKey) {
|
|
299
|
+
const newExpandedKeys = [...mergedExpandedKeys, key];
|
|
300
|
+
setInnerExpandedKeys(newExpandedKeys);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const handleDeleteAll = () => {
|
|
304
|
+
triggerChangeData?.([], 'INSERT_BEFORE');
|
|
305
|
+
};
|
|
263
306
|
const toolbarItemsBottom = useMemo(() => {
|
|
264
307
|
if (!rowsFocus || rowsFocus.length === 0) {
|
|
265
|
-
return toolbarItems?.filter(it => it.position === 'Bottom' && it.visible !== false && it.key !== 'DUPLICATE' && it.key !== 'INSERT_BEFORE' && it.key !== 'INSERT_AFTER').map(item => {
|
|
308
|
+
return toolbarItems?.filter(it => it.position === 'Bottom' && it.visible !== false && it.key !== 'DUPLICATE' && it.key !== 'INSERT_BEFORE' && it.key !== 'INSERT_AFTER' && it.key !== 'INSERT_CHILDREN').map(item => {
|
|
266
309
|
if (item.key === 'ADD') {
|
|
267
310
|
return {
|
|
268
311
|
...item,
|
|
@@ -391,6 +434,24 @@ const GridEdit = props => {
|
|
|
391
434
|
}
|
|
392
435
|
};
|
|
393
436
|
}
|
|
437
|
+
if (item.key === 'INSERT_CHILDREN') {
|
|
438
|
+
return {
|
|
439
|
+
...item,
|
|
440
|
+
template: () => {
|
|
441
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
442
|
+
className: classnames(`be-toolbar-item`, item?.className)
|
|
443
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
444
|
+
style: {
|
|
445
|
+
color: '#28c76f',
|
|
446
|
+
borderColor: '#28c76f'
|
|
447
|
+
},
|
|
448
|
+
variant: 'outlined',
|
|
449
|
+
onClick: () => handleInsertChild(item),
|
|
450
|
+
className: "d-flex toolbar-button"
|
|
451
|
+
}, item.title ? t ? t(item.title) : item.title : t ? t('Insert item after') : 'Insert item after')));
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
}
|
|
394
455
|
if (item.key === 'DELETE') {
|
|
395
456
|
return {
|
|
396
457
|
...item,
|
|
@@ -951,8 +1012,8 @@ const GridEdit = props => {
|
|
|
951
1012
|
const newData = [...dataSource];
|
|
952
1013
|
|
|
953
1014
|
// @ts-ignore
|
|
954
|
-
const index = newData.findIndex(item => formData[rowKey] === item[rowKey]);
|
|
955
|
-
const rs = updateArrayByKey(
|
|
1015
|
+
const index = flattenData(childrenColumnName, newData).findIndex(item => formData[rowKey] === item[rowKey]);
|
|
1016
|
+
const rs = updateArrayByKey(newData, row, rowKey);
|
|
956
1017
|
if (index > -1) {
|
|
957
1018
|
triggerChangeData?.(rs, 'onChange');
|
|
958
1019
|
}
|
|
@@ -1305,7 +1366,8 @@ const GridEdit = props => {
|
|
|
1305
1366
|
title: getValueCell(column, record[column.field], format),
|
|
1306
1367
|
'data-col-index': colIndex,
|
|
1307
1368
|
'data-row-index': rowNumber,
|
|
1308
|
-
editing: isEditing(record),
|
|
1369
|
+
editing: isEditing(record) && rowEditable?.(record) !== false && isEditable(column, record) !== false,
|
|
1370
|
+
// editing: isEditing(record) && rowEditable?.(record) !== false,
|
|
1309
1371
|
tabIndex: (rowIndex ?? 0) * columns.length + colIndex,
|
|
1310
1372
|
style: isPasteDragging ? {
|
|
1311
1373
|
cursor: "crosshair"
|
|
@@ -1324,7 +1386,7 @@ const GridEdit = props => {
|
|
|
1324
1386
|
onMouseUp: handleMouseUp
|
|
1325
1387
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1326
1388
|
className: 'ui-rc_content'
|
|
1327
|
-
}, renderContent(column, value, record, rowIndex, format)), selectedCells && selectedCells.size > 0 && getLastSelectCell(selectedCells).row === rowNumber && getLastSelectCell(selectedCells).col === colIndex && !isSelectDragging &&
|
|
1389
|
+
}, renderContent(column, value, record, rowIndex, format)), selectedCells && selectedCells.size > 0 && getLastSelectCell(selectedCells).row === rowNumber && getLastSelectCell(selectedCells).col === colIndex && isEditable(column, record) !== false && !isSelectDragging &&
|
|
1328
1390
|
/*#__PURE__*/
|
|
1329
1391
|
// showDraggingPoint &&
|
|
1330
1392
|
React.createElement("div", {
|
|
@@ -1413,7 +1475,8 @@ const GridEdit = props => {
|
|
|
1413
1475
|
rowSelectedHoverBg: '#eb4619',
|
|
1414
1476
|
cellFontSize: 12,
|
|
1415
1477
|
cellFontSizeSM: 13,
|
|
1416
|
-
headerBg: '#ffffff'
|
|
1478
|
+
headerBg: '#ffffff',
|
|
1479
|
+
cellPaddingBlockSM: 7
|
|
1417
1480
|
// cellPaddingBlock: 0,
|
|
1418
1481
|
// cellPaddingBlockSM: 0,
|
|
1419
1482
|
// cellPaddingInlineSM: 0,
|
|
@@ -1447,6 +1510,7 @@ const GridEdit = props => {
|
|
|
1447
1510
|
rowHoverable: false,
|
|
1448
1511
|
bottomToolbar: bottomToolbar,
|
|
1449
1512
|
expandable: {
|
|
1513
|
+
expandIconColumnIndex: checkChild(dataSource) ? 3 : undefined,
|
|
1450
1514
|
...expandable,
|
|
1451
1515
|
expandedRowKeys: innerExpandedKeys,
|
|
1452
1516
|
expandIcon: args => {
|
|
@@ -1481,6 +1545,7 @@ const GridEdit = props => {
|
|
|
1481
1545
|
}
|
|
1482
1546
|
}
|
|
1483
1547
|
},
|
|
1548
|
+
triggerChangeColumns: triggerChangeColumns,
|
|
1484
1549
|
rowSelection: columns && columns.length === 0 ? undefined : {
|
|
1485
1550
|
type: mode === 'checkbox' || type === 'multiple' ? 'checkbox' : "radio",
|
|
1486
1551
|
columnWidth: !mode ? 0.0000001 : columnWidth ?? 50,
|
|
@@ -46,7 +46,7 @@ export type ColumnSelectTable = {
|
|
|
46
46
|
};
|
|
47
47
|
export type IEditSelectSettings = {
|
|
48
48
|
fieldKey?: string;
|
|
49
|
-
options: any[];
|
|
49
|
+
options: any[] | ((rowData: any, field: string) => any[]);
|
|
50
50
|
/** get value form other field **/
|
|
51
51
|
fieldValue?: string;
|
|
52
52
|
/** get label form other field **/
|
|
@@ -114,6 +114,7 @@ export type ColumnType<RecordType> = Omit<RcColumnType<RecordType>, 'headerTempl
|
|
|
114
114
|
export type ColumnEditType<RecordType = AnyObject> = Omit<ColumnType<RecordType>, 'children'> & {
|
|
115
115
|
editType?: EditType | ((rowData?: RecordType) => EditType);
|
|
116
116
|
disable?: boolean | ((rowData: any) => boolean);
|
|
117
|
+
editEnable?: boolean | ((rowData: any) => boolean);
|
|
117
118
|
isClearable?: boolean;
|
|
118
119
|
maxDate?: any;
|
|
119
120
|
minDate?: any;
|
|
@@ -185,6 +186,7 @@ export interface TableEditProps<RecordType = AnyObject> extends Omit<TableProps<
|
|
|
185
186
|
onCellPaste?: ICellPasteModel<RecordType>;
|
|
186
187
|
onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
|
|
187
188
|
onCellClick?: (args: ICellClick, callback?: any) => void;
|
|
189
|
+
rowEditable?: (rowData: RecordType) => boolean;
|
|
188
190
|
}
|
|
189
191
|
export type ICellClick = {
|
|
190
192
|
index: number;
|
|
@@ -5,5 +5,6 @@ export type IColumnsChoose<RecordType> = {
|
|
|
5
5
|
columnsGroup?: string[];
|
|
6
6
|
triggerChangeColumns?: (columns: ColumnsTable<RecordType>, type: string) => void;
|
|
7
7
|
t?: any;
|
|
8
|
+
triggerChangeKeys?: any;
|
|
8
9
|
};
|
|
9
10
|
export declare const ColumnsChoose: <RecordType extends object>(props: IColumnsChoose<RecordType>) => React.JSX.Element;
|