es-grid-template 1.4.3 → 1.4.4
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/grid-component/InternalTable.js +14 -2
- package/es/grid-component/hooks/content/HeaderContent.js +3 -5
- package/es/grid-component/hooks/useColumns.js +1 -2
- package/es/grid-component/hooks/utils.d.ts +6 -2
- package/es/grid-component/hooks/utils.js +136 -45
- package/es/grid-component/styles.scss +62 -5
- package/es/grid-component/table/GridEdit.js +407 -400
- package/lib/grid-component/InternalTable.js +14 -2
- package/lib/grid-component/hooks/content/HeaderContent.js +3 -5
- package/lib/grid-component/hooks/useColumns.js +1 -2
- package/lib/grid-component/hooks/utils.d.ts +6 -2
- package/lib/grid-component/hooks/utils.js +145 -50
- package/lib/grid-component/styles.scss +62 -5
- package/lib/grid-component/table/GridEdit.js +401 -399
- package/package.json +1 -1
|
@@ -171,8 +171,8 @@ const InternalTable = props => {
|
|
|
171
171
|
...rest
|
|
172
172
|
} = props;
|
|
173
173
|
const rowKey = React.useMemo(() => {
|
|
174
|
-
return propRowKey ?? 'rowId';
|
|
175
|
-
}, [propRowKey]);
|
|
174
|
+
return editAble ? 'rowId' : propRowKey ?? 'rowId';
|
|
175
|
+
}, [propRowKey, editAble]);
|
|
176
176
|
const local = lang && lang === 'en' ? en : vi;
|
|
177
177
|
const buddhistLocale = {
|
|
178
178
|
...local,
|
|
@@ -352,6 +352,12 @@ const InternalTable = props => {
|
|
|
352
352
|
if (transformedColumn.field === '#') {
|
|
353
353
|
return {
|
|
354
354
|
...transformedColumn,
|
|
355
|
+
title: () => /*#__PURE__*/React.createElement(HeaderContent, {
|
|
356
|
+
column: {
|
|
357
|
+
...column
|
|
358
|
+
},
|
|
359
|
+
t: t
|
|
360
|
+
}),
|
|
355
361
|
onCell: () => ({
|
|
356
362
|
className: 'cell-number'
|
|
357
363
|
}),
|
|
@@ -366,6 +372,12 @@ const InternalTable = props => {
|
|
|
366
372
|
if (transformedColumn.field === 'command') {
|
|
367
373
|
return {
|
|
368
374
|
...transformedColumn,
|
|
375
|
+
title: () => /*#__PURE__*/React.createElement(HeaderContent, {
|
|
376
|
+
column: {
|
|
377
|
+
...column
|
|
378
|
+
},
|
|
379
|
+
t: t
|
|
380
|
+
}),
|
|
369
381
|
onCell: () => ({
|
|
370
382
|
className: 'cell-number',
|
|
371
383
|
style: {
|
|
@@ -29,8 +29,8 @@ const HeaderContent = props => {
|
|
|
29
29
|
return columnGroupText ?? headerText;
|
|
30
30
|
}, [columnGroupText, headerText]);
|
|
31
31
|
const tooltip = React.useMemo(() => {
|
|
32
|
-
return headerTooltip ?? columnGroupText ?? headerText;
|
|
33
|
-
}, [columnGroupText, headerText, headerTooltip]);
|
|
32
|
+
return headerTooltip ?? t ? t(columnGroupText ?? headerText) : columnGroupText ?? headerText;
|
|
33
|
+
}, [columnGroupText, headerText, headerTooltip, t]);
|
|
34
34
|
//
|
|
35
35
|
//
|
|
36
36
|
// const [isOpen, setIsOpen] = useState(false)
|
|
@@ -67,9 +67,7 @@ const HeaderContent = props => {
|
|
|
67
67
|
// style={{flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'keep-all'}}
|
|
68
68
|
// style={{flex: 1}}
|
|
69
69
|
className: classnames('', {}),
|
|
70
|
-
"data-tooltip-id": "tooltip-header"
|
|
71
|
-
// data-tooltip-id="tooltip-cell-content"
|
|
72
|
-
,
|
|
70
|
+
"data-tooltip-id": "tooltip-header",
|
|
73
71
|
"data-tooltip-content": tooltip,
|
|
74
72
|
"data-tooltip-offset": 16
|
|
75
73
|
}, headerTemplate ? getTemplate(headerTemplate) : t ? t(text) : text));
|
|
@@ -276,8 +276,7 @@ const useColumns = config => {
|
|
|
276
276
|
className: classNames(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
277
277
|
'cell-group': groupColumns && data.children,
|
|
278
278
|
'cell-group-fixed': groupColumns && data.children && col.field === firstNonGroupColumn?.field
|
|
279
|
-
})
|
|
280
|
-
'data-tooltip-id': "tooltip-cell-content"
|
|
279
|
+
})
|
|
281
280
|
// onMouseEnter: () => {
|
|
282
281
|
// onMouseHover(data, col as any)
|
|
283
282
|
// },
|
|
@@ -121,12 +121,14 @@ export declare const sortedSetASC: (setValue: any) => Set<unknown>;
|
|
|
121
121
|
export declare const sortedSetDSC: (setValue: any) => Set<unknown>;
|
|
122
122
|
export declare function getBottomRowCells(cellSet: any): any[];
|
|
123
123
|
export declare function getCellsByPosition(cellSet: any, position?: string): any[];
|
|
124
|
-
export declare const addBorderClass: (selectedCells: any, type: string, className: string, id?: string) => void;
|
|
124
|
+
export declare const addBorderClass: (selectedCells: any, type: string, className: string, id?: string, nextCellRight?: boolean) => void;
|
|
125
125
|
export declare const removeBorderClass: (selectedCells: any, type: string, className: string, id?: string) => void;
|
|
126
126
|
export declare const removeBorderClass2: (className: string, id?: string) => void;
|
|
127
127
|
export declare const onAddBgSelectedCell: (selectedCells: any, id?: string, isFocusCellIndex?: boolean) => void;
|
|
128
|
-
export declare const onAddBorderSelectedCell: (selectedCells: any, id?: string) => void;
|
|
129
128
|
export declare const onRemoveBgSelectedCell: (selectedCells: any, id?: string, rowsSelected?: any) => void;
|
|
129
|
+
export declare const onAddBgCellIndex: (selectedCells: any, id?: string, isFocusCellIndex?: boolean) => void;
|
|
130
|
+
export declare const onRemoveBgCellIndex: (selectedCells: any, id?: string, rowsSelected?: any) => void;
|
|
131
|
+
export declare const onAddBorderSelectedCell: (selectedCells: any, id?: string) => void;
|
|
130
132
|
export declare const onRemoveBorderSelectedCell: (selectedCells: any, id?: string) => void;
|
|
131
133
|
export declare const addClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
|
|
132
134
|
export declare const removeClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
|
|
@@ -134,3 +136,5 @@ export declare const addClassCellIndexSelected: (rowsSelected: any, id?: string)
|
|
|
134
136
|
export declare const removeClassCellIndexSelected: (rowsSelected: any, id?: string) => void;
|
|
135
137
|
export declare const showDraggingPoint: (selectedCells: any, id?: any) => void;
|
|
136
138
|
export declare const hideDraggingPoint: (selectedCells: any, id?: any) => void;
|
|
139
|
+
export declare const isRangeCell: (selectedCells: any, type: string, rowIndex: number, colIndex: number) => boolean;
|
|
140
|
+
export declare const isSelectedCell: (selectedCells: any, rowIndex: number, colIndex: number) => any;
|
|
@@ -443,12 +443,9 @@ export const getDefaultValue = defaultValue => {
|
|
|
443
443
|
export const addRowIdArray = inputArray => {
|
|
444
444
|
if (inputArray) {
|
|
445
445
|
return inputArray.map(item => {
|
|
446
|
-
if (item.children && item.children.length > 0) {
|
|
447
|
-
// item.children = convertArrayWithIndent(item.children)
|
|
446
|
+
if (typeof item.children !== "string" && item.children && item.children.length > 0) {
|
|
448
447
|
item.children = addRowIdArray(item.children);
|
|
449
448
|
}
|
|
450
|
-
|
|
451
|
-
// return { ...item, rowId: item.rowId ? item.rowId : (item.id ? item.id : newGuid())}
|
|
452
449
|
return {
|
|
453
450
|
...item,
|
|
454
451
|
rowId: item.rowId ?? item.id ?? newGuid()
|
|
@@ -1526,7 +1523,7 @@ export function getCellsByPosition(cellSet, position = "bottom") {
|
|
|
1526
1523
|
return [];
|
|
1527
1524
|
}
|
|
1528
1525
|
}
|
|
1529
|
-
export const addBorderClass = (selectedCells, type, className, id) => {
|
|
1526
|
+
export const addBorderClass = (selectedCells, type, className, id, nextCellRight) => {
|
|
1530
1527
|
const table = document.querySelector(`#${id}`);
|
|
1531
1528
|
const typeCells = getCellsByPosition(selectedCells, type);
|
|
1532
1529
|
const selectorsCells = typeCells.map(pos => {
|
|
@@ -1537,7 +1534,24 @@ export const addBorderClass = (selectedCells, type, className, id) => {
|
|
|
1537
1534
|
if (cellsFilter && cellsFilter.length > 0) {
|
|
1538
1535
|
cellsFilter.forEach(cell => {
|
|
1539
1536
|
cell.classList.add(className);
|
|
1537
|
+
if (nextCellRight) {
|
|
1538
|
+
cell.style.zIndex = 1;
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
if (type === 'left') {
|
|
1543
|
+
const selectorsCells2 = typeCells.map(pos => {
|
|
1544
|
+
const [row, col] = pos.split('-');
|
|
1545
|
+
return `[data-row-index="${row}"][data-col-index="${Number(col) + 1}"]`;
|
|
1540
1546
|
});
|
|
1547
|
+
const fullSelector = selectorsCells2.map(s => `.ui-rc-table-cell-fix-right-first${s}`).join(', ');
|
|
1548
|
+
const cellsFilter2 = typeCells.length > 0 ? table?.querySelectorAll(fullSelector) : null;
|
|
1549
|
+
if (cellsFilter2 && cellsFilter2.length > 0) {
|
|
1550
|
+
cellsFilter2.forEach(cell => {
|
|
1551
|
+
// cell.classList.add('has-before');
|
|
1552
|
+
cell.classList.add('cell-border-left');
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1541
1555
|
}
|
|
1542
1556
|
};
|
|
1543
1557
|
export const removeBorderClass = (selectedCells, type, className, id) => {
|
|
@@ -1569,10 +1583,20 @@ export const onAddBgSelectedCell = (selectedCells, id, isFocusCellIndex) => {
|
|
|
1569
1583
|
return `[data-row-index="${row1}"][data-col-index="${col1}"]`;
|
|
1570
1584
|
});
|
|
1571
1585
|
const table = document.querySelector(`#${id}`);
|
|
1586
|
+
|
|
1587
|
+
//// xóa class các ô đã chọn trước đó
|
|
1588
|
+
const cellsSelected = table ? table?.querySelectorAll('.ui-rc-table-cell.selected-bg') : null;
|
|
1589
|
+
if (cellsSelected) {
|
|
1590
|
+
cellsSelected.forEach(cell => {
|
|
1591
|
+
cell.classList.remove('selected-bg');
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
/// thêm class
|
|
1572
1596
|
const cells = table && selectors.length > 0 ? table?.querySelectorAll(selectors.join(',')) : null;
|
|
1573
1597
|
if (cells) {
|
|
1574
1598
|
cells.forEach(cell => {
|
|
1575
|
-
cell.classList.add('selected');
|
|
1599
|
+
cell.classList.add('selected-bg');
|
|
1576
1600
|
});
|
|
1577
1601
|
}
|
|
1578
1602
|
const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
|
|
@@ -1604,35 +1628,47 @@ export const onAddBgSelectedCell = (selectedCells, id, isFocusCellIndex) => {
|
|
|
1604
1628
|
// addBorderClass(selectedCells, 'top', 'cell-border-top', id)
|
|
1605
1629
|
// addBorderClass(selectedCells, 'left', 'cell-border-left', id)
|
|
1606
1630
|
};
|
|
1607
|
-
export const
|
|
1631
|
+
export const onRemoveBgSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
1608
1632
|
const table = document.querySelector(`#${id}`);
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
if (cell) {
|
|
1615
|
-
cell.style.zIndex = 1;
|
|
1633
|
+
const cells = table ? table?.querySelectorAll('.ui-rc-table-cell.selected-bg') : null;
|
|
1634
|
+
if (cells) {
|
|
1635
|
+
cells.forEach(cell => {
|
|
1636
|
+
cell.classList.remove('selected-bg');
|
|
1637
|
+
});
|
|
1616
1638
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1639
|
+
const cellsIndex = table ? table?.querySelectorAll('.ui-rc-table-cell.focus') : null;
|
|
1640
|
+
if (cellsIndex) {
|
|
1641
|
+
cellsIndex.forEach(cell => {
|
|
1642
|
+
cell.classList.remove('focus');
|
|
1643
|
+
});
|
|
1619
1644
|
}
|
|
1620
1645
|
|
|
1621
|
-
//
|
|
1646
|
+
// xóa class selected ô STT
|
|
1622
1647
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1648
|
+
if (rowsSelected && rowsSelected.size > 0) {
|
|
1649
|
+
const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
|
|
1650
|
+
const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
|
|
1651
|
+
const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
|
|
1652
|
+
if (cellsSelectedIndex) {
|
|
1653
|
+
cellsSelectedIndex.forEach(cell => {
|
|
1654
|
+
cell.classList.remove('selected');
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1627
1658
|
};
|
|
1628
|
-
export const
|
|
1659
|
+
export const onAddBgCellIndex = (selectedCells, id, isFocusCellIndex) => {
|
|
1629
1660
|
const table = document.querySelector(`#${id}`);
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1661
|
+
const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
|
|
1662
|
+
const rowsSelectors = rowsArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
|
|
1663
|
+
const cellsIndex = table && rowsSelectors.length > 0 ? table?.querySelectorAll(rowsSelectors) : null;
|
|
1664
|
+
if (cellsIndex && isFocusCellIndex !== false) {
|
|
1665
|
+
cellsIndex.forEach(cell => {
|
|
1666
|
+
cell.classList.add('focus');
|
|
1634
1667
|
});
|
|
1635
1668
|
}
|
|
1669
|
+
};
|
|
1670
|
+
export const onRemoveBgCellIndex = (selectedCells, id, rowsSelected) => {
|
|
1671
|
+
const table = document.querySelector(`#${id}`);
|
|
1636
1672
|
const cellsIndex = table ? table?.querySelectorAll('.ui-rc-table-cell.focus') : null;
|
|
1637
1673
|
if (cellsIndex) {
|
|
1638
1674
|
cellsIndex.forEach(cell => {
|
|
@@ -1653,6 +1689,35 @@ export const onRemoveBgSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
|
1653
1689
|
}
|
|
1654
1690
|
}
|
|
1655
1691
|
};
|
|
1692
|
+
export const onAddBorderSelectedCell = (selectedCells, id) => {
|
|
1693
|
+
const table = document.querySelector(`#${id}`);
|
|
1694
|
+
|
|
1695
|
+
// tăng z-index để hiển thị round point paste
|
|
1696
|
+
const row = getLastSelectCell(selectedCells).row;
|
|
1697
|
+
const col = getLastSelectCell(selectedCells).col;
|
|
1698
|
+
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1699
|
+
const nextCellLeft = table?.querySelector(`.ui-rc-table-cell.ui-rc-table-cell-fix-left[data-row-index="${row}"][data-col-index="${col + 1}"]`);
|
|
1700
|
+
// const nextCellRight: any = table?.querySelector(`.ui-rc-table-cell.ui-rc-table-cell-fix-right[data-row-index="${row}"][data-col-index="${col + 1}"]`)
|
|
1701
|
+
|
|
1702
|
+
console.log('nextCell', nextCellLeft);
|
|
1703
|
+
if (cell) {
|
|
1704
|
+
cell.style.zIndex = nextCellLeft ? 3 : 1;
|
|
1705
|
+
}
|
|
1706
|
+
if (cell && (cell.classList.contains('ui-rc-table-cell-fix-left') || cell.classList.contains('ui-rc-table-cell-fix-right'))) {
|
|
1707
|
+
cell.style.zIndex = 3;
|
|
1708
|
+
}
|
|
1709
|
+
removeBorderClass2('cell-border-bottom', id);
|
|
1710
|
+
removeBorderClass2('cell-border-top', id);
|
|
1711
|
+
removeBorderClass2('cell-border-right', id);
|
|
1712
|
+
removeBorderClass2('cell-border-left', id);
|
|
1713
|
+
|
|
1714
|
+
// thêm class border selected
|
|
1715
|
+
|
|
1716
|
+
addBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id);
|
|
1717
|
+
addBorderClass(selectedCells, 'right', 'cell-border-right', id);
|
|
1718
|
+
addBorderClass(selectedCells, 'top', 'cell-border-top', id);
|
|
1719
|
+
addBorderClass(selectedCells, 'left', 'cell-border-left', id);
|
|
1720
|
+
};
|
|
1656
1721
|
export const onRemoveBorderSelectedCell = (selectedCells, id) => {
|
|
1657
1722
|
const table = document.querySelector(`#${id}`);
|
|
1658
1723
|
|
|
@@ -1660,13 +1725,11 @@ export const onRemoveBorderSelectedCell = (selectedCells, id) => {
|
|
|
1660
1725
|
|
|
1661
1726
|
const row = getLastSelectCell(selectedCells).row;
|
|
1662
1727
|
const col = getLastSelectCell(selectedCells).col;
|
|
1663
|
-
|
|
1664
|
-
// const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
|
|
1665
1728
|
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1666
1729
|
if (cell) {
|
|
1667
1730
|
cell.style.zIndex = 0;
|
|
1668
1731
|
}
|
|
1669
|
-
if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
|
|
1732
|
+
if (cell && (cell.classList.contains('ui-rc-table-cell-fix-left') || cell.classList.contains('ui-rc-table-cell-fix-right'))) {
|
|
1670
1733
|
cell.style.zIndex = 2;
|
|
1671
1734
|
}
|
|
1672
1735
|
|
|
@@ -1676,10 +1739,6 @@ export const onRemoveBorderSelectedCell = (selectedCells, id) => {
|
|
|
1676
1739
|
removeBorderClass2('cell-border-top', id);
|
|
1677
1740
|
removeBorderClass2('cell-border-right', id);
|
|
1678
1741
|
removeBorderClass2('cell-border-left', id);
|
|
1679
|
-
|
|
1680
|
-
// removeBorderClass(selectedCells, 'right', 'cell-border-right', id)
|
|
1681
|
-
// removeBorderClass(selectedCells, 'top', 'cell-border-top', id)
|
|
1682
|
-
// removeBorderClass(selectedCells, 'left', 'cell-border-left', id)
|
|
1683
1742
|
};
|
|
1684
1743
|
export const addClassBorderPasteCell = (pasteCells, type, id) => {
|
|
1685
1744
|
// thêm class border
|
|
@@ -1701,6 +1760,8 @@ export const removeClassBorderPasteCell = (pasteCells, type, id) => {
|
|
|
1701
1760
|
removeBorderClass(pasteCells, 'top', 'cell-paste-border-top', id);
|
|
1702
1761
|
removeBorderClass(pasteCells, 'left', 'cell-paste-border-left', id);
|
|
1703
1762
|
};
|
|
1763
|
+
|
|
1764
|
+
///////////////////////////////
|
|
1704
1765
|
export const addClassCellIndexSelected = (rowsSelected, id) => {
|
|
1705
1766
|
// thêm class selected vào ô STT
|
|
1706
1767
|
const table = document.querySelector(`#${id}`);
|
|
@@ -1710,7 +1771,7 @@ export const addClassCellIndexSelected = (rowsSelected, id) => {
|
|
|
1710
1771
|
const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
|
|
1711
1772
|
if (cellsSelectedIndex) {
|
|
1712
1773
|
cellsSelectedIndex.forEach(cell => {
|
|
1713
|
-
cell.classList.add('selected');
|
|
1774
|
+
cell.classList.add('selected-index');
|
|
1714
1775
|
});
|
|
1715
1776
|
}
|
|
1716
1777
|
}
|
|
@@ -1724,7 +1785,7 @@ export const removeClassCellIndexSelected = (rowsSelected, id) => {
|
|
|
1724
1785
|
const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
|
|
1725
1786
|
if (cellsSelectedIndex) {
|
|
1726
1787
|
cellsSelectedIndex.forEach(cell => {
|
|
1727
|
-
cell.classList.remove('selected');
|
|
1788
|
+
cell.classList.remove('selected-index');
|
|
1728
1789
|
});
|
|
1729
1790
|
}
|
|
1730
1791
|
}
|
|
@@ -1733,7 +1794,19 @@ export const showDraggingPoint = (selectedCells, id) => {
|
|
|
1733
1794
|
const row = getLastSelectCell(selectedCells).row;
|
|
1734
1795
|
const col = getLastSelectCell(selectedCells).col;
|
|
1735
1796
|
const table = document.querySelector(`#${id}`);
|
|
1797
|
+
|
|
1798
|
+
// tăng z-index để hiển thị round point paste
|
|
1799
|
+
|
|
1736
1800
|
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1801
|
+
|
|
1802
|
+
// if (cell) {
|
|
1803
|
+
// cell.style.zIndex = 1
|
|
1804
|
+
// }
|
|
1805
|
+
//
|
|
1806
|
+
// if (cell && (cell.classList.contains('ui-rc-table-cell-fix-left') || cell.classList.contains('ui-rc-table-cell-fix-right'))) {
|
|
1807
|
+
// cell.style.zIndex = 3;
|
|
1808
|
+
// }
|
|
1809
|
+
|
|
1737
1810
|
const point = cell?.querySelector('.dragging-point');
|
|
1738
1811
|
if (point) {
|
|
1739
1812
|
point.classList.add('show');
|
|
@@ -1743,19 +1816,37 @@ export const showDraggingPoint = (selectedCells, id) => {
|
|
|
1743
1816
|
export const hideDraggingPoint = (selectedCells, id) => {
|
|
1744
1817
|
const table = document.querySelector(`#${id}`);
|
|
1745
1818
|
|
|
1746
|
-
//
|
|
1747
|
-
// const points = document.querySelectorAll('.dragging-point.show')
|
|
1748
|
-
const points = table?.querySelectorAll('.dragging-point.show');
|
|
1819
|
+
// xóa z-index về mặc định
|
|
1749
1820
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
// }
|
|
1821
|
+
const row = getLastSelectCell(selectedCells).row;
|
|
1822
|
+
const col = getLastSelectCell(selectedCells).col;
|
|
1823
|
+
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1824
|
+
// const cellRight: any = table?.querySelector(`.ui-rc-table.ui-rc-table-ping-left:not(.ui-rc-table.ui-rc-table-ping-right) .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.ui-rc-table-cell-fix-right.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col + 1}"]`)
|
|
1754
1825
|
|
|
1826
|
+
if (cell) {
|
|
1827
|
+
cell.style.zIndex = 0;
|
|
1828
|
+
}
|
|
1829
|
+
if (cell && (cell.classList.contains('ui-rc-table-cell-fix-left') || cell.classList.contains('ui-rc-table-cell-fix-right'))) {
|
|
1830
|
+
// cell.style.zIndex = cellRight ? 1 : 2
|
|
1831
|
+
cell.style.zIndex = 2;
|
|
1832
|
+
}
|
|
1833
|
+
const points = table?.querySelectorAll('.dragging-point.show');
|
|
1755
1834
|
if (points && points.length > 0) {
|
|
1756
|
-
points.forEach(
|
|
1757
|
-
|
|
1758
|
-
|
|
1835
|
+
points.forEach(c => {
|
|
1836
|
+
c.classList.add('hidden');
|
|
1837
|
+
c.classList.remove('show');
|
|
1759
1838
|
});
|
|
1760
1839
|
}
|
|
1840
|
+
};
|
|
1841
|
+
export const isRangeCell = (selectedCells, type, rowIndex, colIndex) => {
|
|
1842
|
+
const typeCells = getCellsByPosition(selectedCells, type);
|
|
1843
|
+
const key = `${rowIndex}-${colIndex}`;
|
|
1844
|
+
return typeCells.includes(key);
|
|
1845
|
+
};
|
|
1846
|
+
export const isSelectedCell = (selectedCells, rowIndex, colIndex) => {
|
|
1847
|
+
if (selectedCells.size === 1) {
|
|
1848
|
+
return false;
|
|
1849
|
+
}
|
|
1850
|
+
const key = `${rowIndex}-${colIndex}`;
|
|
1851
|
+
return selectedCells.has(key);
|
|
1761
1852
|
};
|
|
@@ -157,7 +157,11 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
157
157
|
background-color: #f0f0f0;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
//&.selected {
|
|
161
|
+
// //background: red;
|
|
162
|
+
// background-color: $cell-selected-bg !important;
|
|
163
|
+
//}
|
|
164
|
+
&.selected-bg {
|
|
161
165
|
//background: red;
|
|
162
166
|
background-color: $cell-selected-bg !important;
|
|
163
167
|
}
|
|
@@ -286,10 +290,24 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
286
290
|
}
|
|
287
291
|
}
|
|
288
292
|
|
|
289
|
-
|
|
290
|
-
|
|
293
|
+
//.#{$prefix}-table-bordered .#{$prefix}-table-tbody-virtual .#{$prefix}-table-cell.#{$prefix}-table-cell-fix-right-first:before {
|
|
294
|
+
// border-inline-start: 1px solid $tableBorderColor;
|
|
295
|
+
//}
|
|
296
|
+
|
|
297
|
+
.#{$prefix}-table-bordered .#{$prefix}-table-tbody-virtual .#{$prefix}-table-cell.#{$prefix}-table-cell-fix-right-first {
|
|
298
|
+
&::before {
|
|
299
|
+
border-inline-start: 1px solid $tableBorderColor;
|
|
300
|
+
}
|
|
301
|
+
&.has-before::before {
|
|
302
|
+
border-inline-start: 1px solid $border-selected-color;
|
|
303
|
+
}
|
|
304
|
+
&.cell-border-left.selected-bg::before {
|
|
305
|
+
border-inline-start: 1px solid $border-selected-color;
|
|
306
|
+
}
|
|
291
307
|
}
|
|
292
308
|
|
|
309
|
+
|
|
310
|
+
|
|
293
311
|
.#{$prefix}-table {
|
|
294
312
|
|
|
295
313
|
&.#{$prefix}-table-bordered {
|
|
@@ -428,7 +446,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
428
446
|
background-color: $cell-index-focus-bg;
|
|
429
447
|
//font-weight: 500;
|
|
430
448
|
}
|
|
431
|
-
&.selected {
|
|
449
|
+
&.selected-index {
|
|
432
450
|
background-color: $cell-index-selected-bg !important;
|
|
433
451
|
color: #fff;
|
|
434
452
|
//font-weight: 500;
|
|
@@ -439,6 +457,30 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
439
457
|
|
|
440
458
|
&.cell-border-top {
|
|
441
459
|
border-bottom: 1px solid $border-selected-color;
|
|
460
|
+
|
|
461
|
+
//&::after {
|
|
462
|
+
// content: "";
|
|
463
|
+
// position: absolute;
|
|
464
|
+
// top: -1px;
|
|
465
|
+
// left: 0;
|
|
466
|
+
//
|
|
467
|
+
// height: 1px;
|
|
468
|
+
// width: 100%;
|
|
469
|
+
// border-top: 1px solid red;
|
|
470
|
+
// pointer-events: none;
|
|
471
|
+
// z-index: 1;
|
|
472
|
+
//}
|
|
473
|
+
//&.ui-rc-table-cell-fix-left {
|
|
474
|
+
// &::after {
|
|
475
|
+
// left: -100%;
|
|
476
|
+
// }
|
|
477
|
+
//}
|
|
478
|
+
//&.ui-rc-table-cell-fix-right {
|
|
479
|
+
// &::after {
|
|
480
|
+
// left: 100%;
|
|
481
|
+
// }
|
|
482
|
+
//}
|
|
483
|
+
|
|
442
484
|
}
|
|
443
485
|
|
|
444
486
|
&.cell-border-bottom {
|
|
@@ -447,6 +489,17 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
447
489
|
|
|
448
490
|
&.cell-border-left {
|
|
449
491
|
border-inline-end: 1px solid $border-selected-color;
|
|
492
|
+
//&::before {
|
|
493
|
+
// content: "";
|
|
494
|
+
// position: absolute;
|
|
495
|
+
// top: 0;
|
|
496
|
+
// left: 0;
|
|
497
|
+
// height: 102%;
|
|
498
|
+
// width: 1px;
|
|
499
|
+
// border-left: 1px solid red;
|
|
500
|
+
// pointer-events: none;
|
|
501
|
+
// z-index: 1;
|
|
502
|
+
//}
|
|
450
503
|
}
|
|
451
504
|
|
|
452
505
|
&.cell-border-right {
|
|
@@ -564,7 +617,11 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
564
617
|
// //}
|
|
565
618
|
|
|
566
619
|
&.#{$prefix}-table-cell-fix-right {
|
|
567
|
-
z-index: 0;
|
|
620
|
+
z-index: 0 !important;
|
|
621
|
+
|
|
622
|
+
&:has(.dragging-point.show) {
|
|
623
|
+
z-index: 3 !important;
|
|
624
|
+
}
|
|
568
625
|
|
|
569
626
|
&.cell-border-end {
|
|
570
627
|
z-index: 3;
|