es-grid-template 1.9.51 → 1.9.53
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/utils/convertColumnsChoose.d.ts +2 -2
- package/es/group-component/hook/utils.d.ts +3 -3
- package/es/table-component/TableContainerEdit.js +65 -55
- package/es/table-component/hook/utils.js +8 -2
- package/es/table-component/style.js +1 -1
- package/es/table-virtuoso/InternalTable.js +2 -0
- package/es/table-virtuoso/body/TableBodyCell.js +11 -6
- package/lib/ali-table/utils/convertColumnsChoose.d.ts +2 -2
- package/lib/table-component/TableContainerEdit.js +63 -54
- package/lib/table-component/hook/utils.js +8 -2
- package/lib/table-component/style.js +1 -1
- package/lib/table-virtuoso/InternalTable.js +2 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +10 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TreeDataNode } from "antd";
|
|
2
|
-
import { ColumnTable } from "../../grid-component";
|
|
1
|
+
import type { TreeDataNode } from "antd";
|
|
2
|
+
import type { ColumnTable } from "../../grid-component";
|
|
3
3
|
export declare function convertColumnsToTreeData(columns: ColumnTable[], groupColumns?: string[], t?: any): TreeDataNode[];
|
|
4
4
|
export declare function filterColumnsByField(columns: ColumnTable[], fieldList: string[]): ColumnTable[];
|
|
5
5
|
export declare function filterVisibleColumns(columns: ColumnTable[]): ColumnTable[];
|
|
@@ -194,10 +194,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
194
194
|
value: any;
|
|
195
195
|
rowData: RecordType;
|
|
196
196
|
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
197
|
-
onCellStyles?: Omit<CSSProperties, "
|
|
198
|
-
onCellHeaderStyles?: Omit<CSSProperties, "
|
|
197
|
+
onCellStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
198
|
+
onCellHeaderStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
199
199
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
200
|
-
onCellFooterStyles?: Omit<CSSProperties, "
|
|
200
|
+
onCellFooterStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
201
201
|
getValue?: (row: any, rowIndex: number) => any;
|
|
202
202
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
203
203
|
headerCellProps?: import("./../../grid-component/type").CellProps;
|
|
@@ -3,7 +3,8 @@ import React, { Fragment } from "react";
|
|
|
3
3
|
import { useCopyToClipboard } from 'usehooks-ts';
|
|
4
4
|
import { checkDecimalSeparator, checkThousandSeparator,
|
|
5
5
|
// convertDateToDayjs,
|
|
6
|
-
detectSeparators, findItemByKey, flattenArray, flattenData, getAllRowKey, getColIdsBetween,
|
|
6
|
+
detectSeparators, findItemByKey, flattenArray, flattenData, getAllRowKey, getColIdsBetween,
|
|
7
|
+
// getDatepickerFormat,
|
|
7
8
|
// getDatepickerFormat,
|
|
8
9
|
getDefaultValue, getEditType, getFormat, getRowIdsBetween, getSelectedCellMatrix, getTableHeight, isDateValue, isEditable, isEmpty, isFormattedNumber, newGuid, parseExcelClipboard,
|
|
9
10
|
// parseExcelClipboardText,
|
|
@@ -256,39 +257,6 @@ const TableContainerEdit = props => {
|
|
|
256
257
|
const rowsFocus = React.useMemo(() => {
|
|
257
258
|
return startCell && endCell ? getRowIdsBetween(table, startCell.rowId, endCell.rowId) : [];
|
|
258
259
|
}, [endCell, startCell, table]);
|
|
259
|
-
const copySelectionToClipboard = React.useCallback(() => {
|
|
260
|
-
if (!startCell || !endCell) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// const allRows = table.getRowModel().rows;
|
|
265
|
-
const allRows = table.getRowModel().flatRows;
|
|
266
|
-
// const allColumns = table.getAllLeafColumns();
|
|
267
|
-
|
|
268
|
-
const rowIds = getRowIdsBetween(table, startCell.rowId, endCell.rowId);
|
|
269
|
-
const colIds = getColIdsBetween(table, startCell.colId, endCell.colId);
|
|
270
|
-
const dataToCopy = [];
|
|
271
|
-
rowIds.forEach(rowId => {
|
|
272
|
-
const row = allRows.find(r => r.id === rowId);
|
|
273
|
-
if (!row) return;
|
|
274
|
-
const rowData = [];
|
|
275
|
-
colIds.forEach(colId => {
|
|
276
|
-
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
277
|
-
const value = cellll?.getValue();
|
|
278
|
-
rowData.push(value !== undefined ? String(value) : '');
|
|
279
|
-
});
|
|
280
|
-
dataToCopy.push(rowData);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
// Convert to TSV string
|
|
284
|
-
const tsv = dataToCopy.map(row => row.join('\t')).join('\n');
|
|
285
|
-
|
|
286
|
-
// Copy to clipboard
|
|
287
|
-
// navigator.clipboard.writeText(tsv).then(() => {
|
|
288
|
-
// });
|
|
289
|
-
|
|
290
|
-
copy(tsv).then(() => {}).catch(() => {});
|
|
291
|
-
}, [startCell, endCell, table]);
|
|
292
260
|
const triggerChangeData = React.useCallback((newData, args) => {
|
|
293
261
|
onDataChange?.(newData, args);
|
|
294
262
|
}, [onDataChange, dataSource]);
|
|
@@ -329,6 +297,55 @@ const TableContainerEdit = props => {
|
|
|
329
297
|
});
|
|
330
298
|
}
|
|
331
299
|
}, [onCellPaste, originData, triggerChangeData]);
|
|
300
|
+
|
|
301
|
+
// Copy
|
|
302
|
+
|
|
303
|
+
const copySelectionToClipboard = React.useCallback(() => {
|
|
304
|
+
if (!startCell || !endCell) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// const allRows = table.getRowModel().rows;
|
|
309
|
+
const allRows = table.getRowModel().flatRows;
|
|
310
|
+
// const allColumns = table.getAllLeafColumns();
|
|
311
|
+
|
|
312
|
+
const rowIds = getRowIdsBetween(table, startCell.rowId, endCell.rowId);
|
|
313
|
+
const colIds = getColIdsBetween(table, startCell.colId, endCell.colId);
|
|
314
|
+
const dataToCopy = [];
|
|
315
|
+
rowIds.forEach(rowId => {
|
|
316
|
+
const row = allRows.find(r => r.id === rowId);
|
|
317
|
+
if (!row) return;
|
|
318
|
+
const rowData = [];
|
|
319
|
+
colIds.forEach(colId => {
|
|
320
|
+
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
321
|
+
const value = cellll?.getValue();
|
|
322
|
+
rowData.push(value !== undefined ? String(value) : '');
|
|
323
|
+
});
|
|
324
|
+
dataToCopy.push(rowData);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// Convert to TSV string
|
|
328
|
+
const tsv = dataToCopy.map(row => row.join('\t')).join('\n');
|
|
329
|
+
|
|
330
|
+
// Copy to clipboard
|
|
331
|
+
// navigator.clipboard.writeText(tsv).then(() => {
|
|
332
|
+
// });
|
|
333
|
+
|
|
334
|
+
copy(tsv).then(() => {}).catch(() => {});
|
|
335
|
+
}, [startCell, endCell, table]);
|
|
336
|
+
React.useEffect(() => {
|
|
337
|
+
const handleKeyDown = e => {
|
|
338
|
+
if (e.ctrlKey && e.key === 'c' && startCell && endCell && !editingKey) {
|
|
339
|
+
e.preventDefault();
|
|
340
|
+
copySelectionToClipboard();
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
344
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
345
|
+
}, [startCell, endCell, table, copySelectionToClipboard, editingKey]);
|
|
346
|
+
|
|
347
|
+
// Paste
|
|
348
|
+
|
|
332
349
|
const handlePasted = React.useCallback(pasteData => {
|
|
333
350
|
if (!startCell) {
|
|
334
351
|
return;
|
|
@@ -336,7 +353,8 @@ const TableContainerEdit = props => {
|
|
|
336
353
|
const rows = pasteData.slice(0, onCellPaste?.maxRowsPaste ?? 200);
|
|
337
354
|
|
|
338
355
|
// const allRows = table.getRowModel().rows;
|
|
339
|
-
const
|
|
356
|
+
const flatRows = table.getRowModel().flatRows;
|
|
357
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
340
358
|
const allCols = table.getVisibleLeafColumns();
|
|
341
359
|
const startRowIdx = allRows.findIndex(r => r.id === startCell.rowId);
|
|
342
360
|
const startColIdx = allCols.findIndex(c => c.id === startCell.colId);
|
|
@@ -360,7 +378,7 @@ const TableContainerEdit = props => {
|
|
|
360
378
|
const targetRow = startRow + rowIndex;
|
|
361
379
|
|
|
362
380
|
// Nếu vượt quá số dòng hiện có, thêm dòng mới
|
|
363
|
-
if (targetRow
|
|
381
|
+
if (targetRow > newData.length) {
|
|
364
382
|
const newID = newGuid();
|
|
365
383
|
const defaultRowValue = getDefaultValue(defaultValue);
|
|
366
384
|
newData.push(defaultValue ? {
|
|
@@ -524,11 +542,17 @@ const TableContainerEdit = props => {
|
|
|
524
542
|
}
|
|
525
543
|
} else if (columnOri.type === 'data' || columnOri.type === 'datatime' || columnOri.editType === 'date' || columnOri.editType === 'datetime') {
|
|
526
544
|
const isDate = isDateValue(cellValue.trim());
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
const
|
|
545
|
+
|
|
546
|
+
// const colFormat = typeof columnOri?.format === 'function' ? columnOri?.format(record) : columnOri?.format
|
|
547
|
+
// const cellFormat = getFormat(colFormat, format)
|
|
548
|
+
|
|
549
|
+
// const editType = getEditType(columnOri as any)
|
|
550
|
+
|
|
551
|
+
// const dateFormat = getDatepickerFormat(editType, cellFormat)
|
|
552
|
+
|
|
553
|
+
// const date = isDate && !isEmpty(cellValue.trim()) ? moment(cellValue.trim(), dateFormat).format("YYYY-MM-DDTHH:mm:ssZ") : null
|
|
554
|
+
|
|
555
|
+
const date = isDate && !isEmpty(cellValue.trim()) ? moment(cellValue.trim()).format() : null;
|
|
532
556
|
childData[targetRow] = {
|
|
533
557
|
...childData[targetRow],
|
|
534
558
|
[columnKey]: date
|
|
@@ -603,20 +627,6 @@ const TableContainerEdit = props => {
|
|
|
603
627
|
handlePasted(rowsPasted);
|
|
604
628
|
}
|
|
605
629
|
}, [handlePasted, onCellPaste?.maxRowsPaste, startCell]);
|
|
606
|
-
|
|
607
|
-
// Copy
|
|
608
|
-
React.useEffect(() => {
|
|
609
|
-
const handleKeyDown = e => {
|
|
610
|
-
if (e.ctrlKey && e.key === 'c' && startCell && endCell && !editingKey) {
|
|
611
|
-
e.preventDefault();
|
|
612
|
-
copySelectionToClipboard();
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
616
|
-
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
617
|
-
}, [startCell, endCell, table, copySelectionToClipboard, editingKey]);
|
|
618
|
-
|
|
619
|
-
// Paste
|
|
620
630
|
React.useEffect(() => {
|
|
621
631
|
const handlePaste = e => {
|
|
622
632
|
if (startCell && !editingKey) {
|
|
@@ -194,6 +194,7 @@ export const convertToDate = (value, format) => {
|
|
|
194
194
|
}
|
|
195
195
|
const valueType = getDateValueType(value);
|
|
196
196
|
if (valueType === 'time') {
|
|
197
|
+
// const date = dayjs(value, format ? [format, 'HH:mm:ss', 'HH:mm' ] : ['HH:mm:ss', 'HH:mm'], true);
|
|
197
198
|
const date = dayjs(value, format ?? ['HH:mm:ss', 'HH:mm'], true);
|
|
198
199
|
return date.isValid() ? moment(date.toDate()).format() : '';
|
|
199
200
|
}
|
|
@@ -619,7 +620,9 @@ export function getColIdsBetween(table, a, b) {
|
|
|
619
620
|
}
|
|
620
621
|
export function getRowIdsBetween(table, a, b) {
|
|
621
622
|
// const ids = table.getRowModel().rows.map(r => r.id);
|
|
622
|
-
const
|
|
623
|
+
const flatRows = table.getRowModel().flatRows;
|
|
624
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
625
|
+
const ids = allRows.map(r => r.id);
|
|
623
626
|
const [start, end] = [ids.indexOf(a), ids.indexOf(b)].sort((x, y) => x - y);
|
|
624
627
|
return ids.slice(start, end + 1);
|
|
625
628
|
}
|
|
@@ -1365,7 +1368,10 @@ export const getSelectedCellMatrix = (table, startCell, endCell) => {
|
|
|
1365
1368
|
};
|
|
1366
1369
|
|
|
1367
1370
|
// const rowIds = table.getRowModel().rows.map(r => r.id);
|
|
1368
|
-
|
|
1371
|
+
|
|
1372
|
+
const flatRows = table.getRowModel().flatRows;
|
|
1373
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
1374
|
+
const rowIds = allRows.map(r => r.id);
|
|
1369
1375
|
const colIds = table.getVisibleLeafColumns().map(c => c.id);
|
|
1370
1376
|
|
|
1371
1377
|
// const colIds = table.getAllLeafColumns().map(c => c.id);
|
|
@@ -48,4 +48,4 @@ const colorDark = '#e6e4f3e6 ';
|
|
|
48
48
|
export const GridStyle = styled.div.withConfig({
|
|
49
49
|
displayName: "GridStyle",
|
|
50
50
|
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
51
|
-
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}.ui-rc-toolbar-bottom{border-right:1px solid #e0e0e0;border-left:1px solid #e0e0e0;.be-toolbar-item{.ui-rc-btn{font-size:12px;}.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_border-bottom{border-bottom:1px solid #e0e0e0;}.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;}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
51
|
+
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}.ui-rc-toolbar-bottom{border-right:1px solid #e0e0e0;border-left:1px solid #e0e0e0;.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_border-bottom{border-bottom:1px solid #e0e0e0;}.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;}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Space from "rc-master-ui/es/space";
|
|
2
|
-
import { getCommonPinningStyles } from "../hook/utils";
|
|
2
|
+
import { getCommonPinningStyles, getFormat } from "../hook/utils";
|
|
3
3
|
import Checkbox from "rc-master-ui/es/checkbox/Checkbox";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import React from "react";
|
|
@@ -9,9 +9,10 @@ import { renderValueCell, toggleRowSelection } from "../../table-component/hook/
|
|
|
9
9
|
const renderCellIndex = props => {
|
|
10
10
|
const {
|
|
11
11
|
cell,
|
|
12
|
-
pagination
|
|
12
|
+
pagination,
|
|
13
|
+
isDataTree
|
|
13
14
|
} = props;
|
|
14
|
-
const parrents = cell.row.getParentRows();
|
|
15
|
+
const parrents = cell.row.parentId && isDataTree ? cell.row.getParentRows?.() : undefined;
|
|
15
16
|
if (parrents && parrents.length > 0) {
|
|
16
17
|
return /*#__PURE__*/React.createElement("span", {
|
|
17
18
|
className: "ui-rc_cell-content"
|
|
@@ -250,10 +251,12 @@ const TableBodyCell = props => {
|
|
|
250
251
|
className: "ui-rc_cell-content"
|
|
251
252
|
}, renderCellIndex({
|
|
252
253
|
cell,
|
|
253
|
-
pagination
|
|
254
|
+
pagination,
|
|
255
|
+
isDataTree
|
|
254
256
|
})) : renderCellIndex({
|
|
255
257
|
cell,
|
|
256
|
-
pagination
|
|
258
|
+
pagination,
|
|
259
|
+
isDataTree
|
|
257
260
|
}));
|
|
258
261
|
}
|
|
259
262
|
if (cell.column.id === "command") {
|
|
@@ -313,8 +316,10 @@ const TableBodyCell = props => {
|
|
|
313
316
|
})));
|
|
314
317
|
}
|
|
315
318
|
const cellValue = cell.getValue();
|
|
319
|
+
const colFormat = typeof columnMeta.format === 'function' ? columnMeta.format(record) : columnMeta.format;
|
|
320
|
+
const cellFormat = getFormat(colFormat, format);
|
|
316
321
|
const rowIndex = cell.row.index;
|
|
317
|
-
const fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex,
|
|
322
|
+
const fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, false);
|
|
318
323
|
const cellContent = columnMeta.template ? typeof columnMeta.template === 'function' ? columnMeta.template({
|
|
319
324
|
field: columnMeta.field,
|
|
320
325
|
index: cell.row.index,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TreeDataNode } from "antd";
|
|
2
|
-
import { ColumnTable } from "../../grid-component";
|
|
1
|
+
import type { TreeDataNode } from "antd";
|
|
2
|
+
import type { ColumnTable } from "../../grid-component";
|
|
3
3
|
export declare function convertColumnsToTreeData(columns: ColumnTable[], groupColumns?: string[], t?: any): TreeDataNode[];
|
|
4
4
|
export declare function filterColumnsByField(columns: ColumnTable[], fieldList: string[]): ColumnTable[];
|
|
5
5
|
export declare function filterVisibleColumns(columns: ColumnTable[]): ColumnTable[];
|
|
@@ -257,39 +257,6 @@ const TableContainerEdit = props => {
|
|
|
257
257
|
const rowsFocus = _react.default.useMemo(() => {
|
|
258
258
|
return startCell && endCell ? (0, _utils.getRowIdsBetween)(table, startCell.rowId, endCell.rowId) : [];
|
|
259
259
|
}, [endCell, startCell, table]);
|
|
260
|
-
const copySelectionToClipboard = _react.default.useCallback(() => {
|
|
261
|
-
if (!startCell || !endCell) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// const allRows = table.getRowModel().rows;
|
|
266
|
-
const allRows = table.getRowModel().flatRows;
|
|
267
|
-
// const allColumns = table.getAllLeafColumns();
|
|
268
|
-
|
|
269
|
-
const rowIds = (0, _utils.getRowIdsBetween)(table, startCell.rowId, endCell.rowId);
|
|
270
|
-
const colIds = (0, _utils.getColIdsBetween)(table, startCell.colId, endCell.colId);
|
|
271
|
-
const dataToCopy = [];
|
|
272
|
-
rowIds.forEach(rowId => {
|
|
273
|
-
const row = allRows.find(r => r.id === rowId);
|
|
274
|
-
if (!row) return;
|
|
275
|
-
const rowData = [];
|
|
276
|
-
colIds.forEach(colId => {
|
|
277
|
-
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
278
|
-
const value = cellll?.getValue();
|
|
279
|
-
rowData.push(value !== undefined ? String(value) : '');
|
|
280
|
-
});
|
|
281
|
-
dataToCopy.push(rowData);
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
// Convert to TSV string
|
|
285
|
-
const tsv = dataToCopy.map(row => row.join('\t')).join('\n');
|
|
286
|
-
|
|
287
|
-
// Copy to clipboard
|
|
288
|
-
// navigator.clipboard.writeText(tsv).then(() => {
|
|
289
|
-
// });
|
|
290
|
-
|
|
291
|
-
copy(tsv).then(() => {}).catch(() => {});
|
|
292
|
-
}, [startCell, endCell, table]);
|
|
293
260
|
const triggerChangeData = _react.default.useCallback((newData, args) => {
|
|
294
261
|
onDataChange?.(newData, args);
|
|
295
262
|
}, [onDataChange, dataSource]);
|
|
@@ -330,6 +297,55 @@ const TableContainerEdit = props => {
|
|
|
330
297
|
});
|
|
331
298
|
}
|
|
332
299
|
}, [onCellPaste, originData, triggerChangeData]);
|
|
300
|
+
|
|
301
|
+
// Copy
|
|
302
|
+
|
|
303
|
+
const copySelectionToClipboard = _react.default.useCallback(() => {
|
|
304
|
+
if (!startCell || !endCell) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// const allRows = table.getRowModel().rows;
|
|
309
|
+
const allRows = table.getRowModel().flatRows;
|
|
310
|
+
// const allColumns = table.getAllLeafColumns();
|
|
311
|
+
|
|
312
|
+
const rowIds = (0, _utils.getRowIdsBetween)(table, startCell.rowId, endCell.rowId);
|
|
313
|
+
const colIds = (0, _utils.getColIdsBetween)(table, startCell.colId, endCell.colId);
|
|
314
|
+
const dataToCopy = [];
|
|
315
|
+
rowIds.forEach(rowId => {
|
|
316
|
+
const row = allRows.find(r => r.id === rowId);
|
|
317
|
+
if (!row) return;
|
|
318
|
+
const rowData = [];
|
|
319
|
+
colIds.forEach(colId => {
|
|
320
|
+
const cellll = row.getVisibleCells().find(c => c.column.id === colId);
|
|
321
|
+
const value = cellll?.getValue();
|
|
322
|
+
rowData.push(value !== undefined ? String(value) : '');
|
|
323
|
+
});
|
|
324
|
+
dataToCopy.push(rowData);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// Convert to TSV string
|
|
328
|
+
const tsv = dataToCopy.map(row => row.join('\t')).join('\n');
|
|
329
|
+
|
|
330
|
+
// Copy to clipboard
|
|
331
|
+
// navigator.clipboard.writeText(tsv).then(() => {
|
|
332
|
+
// });
|
|
333
|
+
|
|
334
|
+
copy(tsv).then(() => {}).catch(() => {});
|
|
335
|
+
}, [startCell, endCell, table]);
|
|
336
|
+
_react.default.useEffect(() => {
|
|
337
|
+
const handleKeyDown = e => {
|
|
338
|
+
if (e.ctrlKey && e.key === 'c' && startCell && endCell && !editingKey) {
|
|
339
|
+
e.preventDefault();
|
|
340
|
+
copySelectionToClipboard();
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
344
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
345
|
+
}, [startCell, endCell, table, copySelectionToClipboard, editingKey]);
|
|
346
|
+
|
|
347
|
+
// Paste
|
|
348
|
+
|
|
333
349
|
const handlePasted = _react.default.useCallback(pasteData => {
|
|
334
350
|
if (!startCell) {
|
|
335
351
|
return;
|
|
@@ -337,7 +353,8 @@ const TableContainerEdit = props => {
|
|
|
337
353
|
const rows = pasteData.slice(0, onCellPaste?.maxRowsPaste ?? 200);
|
|
338
354
|
|
|
339
355
|
// const allRows = table.getRowModel().rows;
|
|
340
|
-
const
|
|
356
|
+
const flatRows = table.getRowModel().flatRows;
|
|
357
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
341
358
|
const allCols = table.getVisibleLeafColumns();
|
|
342
359
|
const startRowIdx = allRows.findIndex(r => r.id === startCell.rowId);
|
|
343
360
|
const startColIdx = allCols.findIndex(c => c.id === startCell.colId);
|
|
@@ -361,7 +378,7 @@ const TableContainerEdit = props => {
|
|
|
361
378
|
const targetRow = startRow + rowIndex;
|
|
362
379
|
|
|
363
380
|
// Nếu vượt quá số dòng hiện có, thêm dòng mới
|
|
364
|
-
if (targetRow
|
|
381
|
+
if (targetRow > newData.length) {
|
|
365
382
|
const newID = (0, _utils.newGuid)();
|
|
366
383
|
const defaultRowValue = (0, _utils.getDefaultValue)(defaultValue);
|
|
367
384
|
newData.push(defaultValue ? {
|
|
@@ -525,11 +542,17 @@ const TableContainerEdit = props => {
|
|
|
525
542
|
}
|
|
526
543
|
} else if (columnOri.type === 'data' || columnOri.type === 'datatime' || columnOri.editType === 'date' || columnOri.editType === 'datetime') {
|
|
527
544
|
const isDate = (0, _utils.isDateValue)(cellValue.trim());
|
|
528
|
-
|
|
529
|
-
const
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
const
|
|
545
|
+
|
|
546
|
+
// const colFormat = typeof columnOri?.format === 'function' ? columnOri?.format(record) : columnOri?.format
|
|
547
|
+
// const cellFormat = getFormat(colFormat, format)
|
|
548
|
+
|
|
549
|
+
// const editType = getEditType(columnOri as any)
|
|
550
|
+
|
|
551
|
+
// const dateFormat = getDatepickerFormat(editType, cellFormat)
|
|
552
|
+
|
|
553
|
+
// const date = isDate && !isEmpty(cellValue.trim()) ? moment(cellValue.trim(), dateFormat).format("YYYY-MM-DDTHH:mm:ssZ") : null
|
|
554
|
+
|
|
555
|
+
const date = isDate && !(0, _utils.isEmpty)(cellValue.trim()) ? (0, _moment.default)(cellValue.trim()).format() : null;
|
|
533
556
|
childData[targetRow] = {
|
|
534
557
|
...childData[targetRow],
|
|
535
558
|
[columnKey]: date
|
|
@@ -604,20 +627,6 @@ const TableContainerEdit = props => {
|
|
|
604
627
|
handlePasted(rowsPasted);
|
|
605
628
|
}
|
|
606
629
|
}, [handlePasted, onCellPaste?.maxRowsPaste, startCell]);
|
|
607
|
-
|
|
608
|
-
// Copy
|
|
609
|
-
_react.default.useEffect(() => {
|
|
610
|
-
const handleKeyDown = e => {
|
|
611
|
-
if (e.ctrlKey && e.key === 'c' && startCell && endCell && !editingKey) {
|
|
612
|
-
e.preventDefault();
|
|
613
|
-
copySelectionToClipboard();
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
617
|
-
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
618
|
-
}, [startCell, endCell, table, copySelectionToClipboard, editingKey]);
|
|
619
|
-
|
|
620
|
-
// Paste
|
|
621
630
|
_react.default.useEffect(() => {
|
|
622
631
|
const handlePaste = e => {
|
|
623
632
|
if (startCell && !editingKey) {
|
|
@@ -277,6 +277,7 @@ const convertToDate = (value, format) => {
|
|
|
277
277
|
}
|
|
278
278
|
const valueType = getDateValueType(value);
|
|
279
279
|
if (valueType === 'time') {
|
|
280
|
+
// const date = dayjs(value, format ? [format, 'HH:mm:ss', 'HH:mm' ] : ['HH:mm:ss', 'HH:mm'], true);
|
|
280
281
|
const date = (0, _dayjs.default)(value, format ?? ['HH:mm:ss', 'HH:mm'], true);
|
|
281
282
|
return date.isValid() ? (0, _moment.default)(date.toDate()).format() : '';
|
|
282
283
|
}
|
|
@@ -714,7 +715,9 @@ function getColIdsBetween(table, a, b) {
|
|
|
714
715
|
}
|
|
715
716
|
function getRowIdsBetween(table, a, b) {
|
|
716
717
|
// const ids = table.getRowModel().rows.map(r => r.id);
|
|
717
|
-
const
|
|
718
|
+
const flatRows = table.getRowModel().flatRows;
|
|
719
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
720
|
+
const ids = allRows.map(r => r.id);
|
|
718
721
|
const [start, end] = [ids.indexOf(a), ids.indexOf(b)].sort((x, y) => x - y);
|
|
719
722
|
return ids.slice(start, end + 1);
|
|
720
723
|
}
|
|
@@ -1486,7 +1489,10 @@ const getSelectedCellMatrix = (table, startCell, endCell) => {
|
|
|
1486
1489
|
};
|
|
1487
1490
|
|
|
1488
1491
|
// const rowIds = table.getRowModel().rows.map(r => r.id);
|
|
1489
|
-
|
|
1492
|
+
|
|
1493
|
+
const flatRows = table.getRowModel().flatRows;
|
|
1494
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
1495
|
+
const rowIds = allRows.map(r => r.id);
|
|
1490
1496
|
const colIds = table.getVisibleLeafColumns().map(c => c.id);
|
|
1491
1497
|
|
|
1492
1498
|
// const colIds = table.getAllLeafColumns().map(c => c.id);
|
|
@@ -55,4 +55,4 @@ const colorDark = '#e6e4f3e6 ';
|
|
|
55
55
|
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
56
56
|
displayName: "GridStyle",
|
|
57
57
|
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
58
|
-
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}.ui-rc-toolbar-bottom{border-right:1px solid #e0e0e0;border-left:1px solid #e0e0e0;.be-toolbar-item{.ui-rc-btn{font-size:12px;}.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_border-bottom{border-bottom:1px solid #e0e0e0;}.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;}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
58
|
+
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}.ui-rc-toolbar-bottom{border-right:1px solid #e0e0e0;border-left:1px solid #e0e0e0;.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_border-bottom{border-bottom:1px solid #e0e0e0;}.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;}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -207,6 +207,8 @@ const InternalTable = props => {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
|
+
console.log('tableData', tableData);
|
|
211
|
+
console.log('isDataTree', isDataTree);
|
|
210
212
|
const table = (0, _reactTable.useReactTable)({
|
|
211
213
|
_features: [_operator.OperatorFeature],
|
|
212
214
|
data: tableData,
|
|
@@ -16,9 +16,10 @@ var _useColumns = require("../../table-component/hook/useColumns");
|
|
|
16
16
|
const renderCellIndex = props => {
|
|
17
17
|
const {
|
|
18
18
|
cell,
|
|
19
|
-
pagination
|
|
19
|
+
pagination,
|
|
20
|
+
isDataTree
|
|
20
21
|
} = props;
|
|
21
|
-
const parrents = cell.row.getParentRows();
|
|
22
|
+
const parrents = cell.row.parentId && isDataTree ? cell.row.getParentRows?.() : undefined;
|
|
22
23
|
if (parrents && parrents.length > 0) {
|
|
23
24
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
24
25
|
className: "ui-rc_cell-content"
|
|
@@ -257,10 +258,12 @@ const TableBodyCell = props => {
|
|
|
257
258
|
className: "ui-rc_cell-content"
|
|
258
259
|
}, renderCellIndex({
|
|
259
260
|
cell,
|
|
260
|
-
pagination
|
|
261
|
+
pagination,
|
|
262
|
+
isDataTree
|
|
261
263
|
})) : renderCellIndex({
|
|
262
264
|
cell,
|
|
263
|
-
pagination
|
|
265
|
+
pagination,
|
|
266
|
+
isDataTree
|
|
264
267
|
}));
|
|
265
268
|
}
|
|
266
269
|
if (cell.column.id === "command") {
|
|
@@ -320,8 +323,10 @@ const TableBodyCell = props => {
|
|
|
320
323
|
})));
|
|
321
324
|
}
|
|
322
325
|
const cellValue = cell.getValue();
|
|
326
|
+
const colFormat = typeof columnMeta.format === 'function' ? columnMeta.format(record) : columnMeta.format;
|
|
327
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
323
328
|
const rowIndex = cell.row.index;
|
|
324
|
-
const fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex,
|
|
329
|
+
const fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, false);
|
|
325
330
|
const cellContent = columnMeta.template ? typeof columnMeta.template === 'function' ? columnMeta.template({
|
|
326
331
|
field: columnMeta.field,
|
|
327
332
|
index: cell.row.index,
|