es-grid-template 1.3.6 → 1.3.7
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 +32 -15
- package/assets/index.scss +48 -16
- package/es/grid-component/GridStyle.d.ts +5 -3
- package/es/grid-component/GridStyle.js +1 -1
- package/es/grid-component/TableGrid.js +16 -12
- package/es/grid-component/hooks/columns/index.js +1 -1
- package/es/grid-component/hooks/useColumns.js +7 -5
- package/es/grid-component/hooks/utils.d.ts +14 -2
- package/es/grid-component/hooks/utils.js +332 -12
- package/es/grid-component/styles.scss +48 -16
- package/es/grid-component/table/Grid.js +1 -1
- package/es/grid-component/table/GridEdit.js +456 -214
- package/es/grid-component/table/Group.js +1 -1
- package/lib/grid-component/GridStyle.d.ts +5 -3
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/TableGrid.js +14 -11
- package/lib/grid-component/hooks/columns/index.js +1 -1
- package/lib/grid-component/hooks/useColumns.js +7 -5
- package/lib/grid-component/hooks/utils.d.ts +14 -2
- package/lib/grid-component/hooks/utils.js +353 -19
- package/lib/grid-component/styles.scss +48 -16
- package/lib/grid-component/table/Grid.js +1 -1
- package/lib/grid-component/table/GridEdit.js +456 -205
- package/lib/grid-component/table/Group.js +1 -1
- package/package.json +109 -109
|
@@ -317,7 +317,7 @@ export const totalFixedWidth = (columns, type, selectionSettings) => {
|
|
|
317
317
|
const width = typeof column.width === 'number' ? column.width : parseInt(column.width, 10) || 0; // Chuyển từ chuỗi sang số, nếu không hợp lệ thì lấy 0
|
|
318
318
|
return sum + width;
|
|
319
319
|
}, 0);
|
|
320
|
-
const selectColumnWidth = !selectionSettings?.mode ? 0
|
|
320
|
+
const selectColumnWidth = !selectionSettings?.mode ? 0 : typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth, 10) || 50;
|
|
321
321
|
return totalFixedLeftWidth + selectColumnWidth;
|
|
322
322
|
};
|
|
323
323
|
export const isObjEmpty = obj => {
|
|
@@ -741,8 +741,8 @@ export function addRowsUp(array, n) {
|
|
|
741
741
|
{
|
|
742
742
|
// Lấy giá trị cuối, chuyển về date, cộng thêm (i+1)*step, chuyển lại về định dạng ISO
|
|
743
743
|
|
|
744
|
-
const lastDate = new Date(
|
|
745
|
-
const newTime = lastDate.getTime() - (i + 1) * steps[j] * -1;
|
|
744
|
+
const lastDate = new Date(arr[m - 1][j]);
|
|
745
|
+
const newTime = m === 1 ? lastDate.getTime() - (i + 1) * steps[j] : lastDate.getTime() - (i + 1) * steps[j] * -1;
|
|
746
746
|
newValue = moment(new Date(newTime)).format();
|
|
747
747
|
}
|
|
748
748
|
break;
|
|
@@ -794,7 +794,7 @@ export const transformColumns1 = (cols, sortMultiple) => {
|
|
|
794
794
|
if (!column?.field && !column?.key) {
|
|
795
795
|
return Table.SELECTION_COLUMN;
|
|
796
796
|
}
|
|
797
|
-
if (column.dataIndex === '
|
|
797
|
+
if (column.dataIndex === '#' || column.dataIndex === '#') {
|
|
798
798
|
return {
|
|
799
799
|
...column
|
|
800
800
|
};
|
|
@@ -1165,6 +1165,91 @@ export const filterDataByColumns3 = (data, queries) => {
|
|
|
1165
1165
|
return result;
|
|
1166
1166
|
});
|
|
1167
1167
|
};
|
|
1168
|
+
export const shouldInclude = (item, queries) => {
|
|
1169
|
+
if (item.isFilterState === true) {
|
|
1170
|
+
return true;
|
|
1171
|
+
}
|
|
1172
|
+
let result = null;
|
|
1173
|
+
for (const query of queries) {
|
|
1174
|
+
const {
|
|
1175
|
+
field,
|
|
1176
|
+
value,
|
|
1177
|
+
operator,
|
|
1178
|
+
predicate
|
|
1179
|
+
} = query;
|
|
1180
|
+
const itemValue = item[field];
|
|
1181
|
+
let condition = false;
|
|
1182
|
+
const isDateComparison = isDate(itemValue) || isDateString(value);
|
|
1183
|
+
const itemDate = isDateComparison ? new Date(itemValue) : null;
|
|
1184
|
+
const queryDate = isDateComparison ? parseToDate(value) : null;
|
|
1185
|
+
const itemStr = itemValue?.toString().toLowerCase?.();
|
|
1186
|
+
const queryStr = value?.toString().toLowerCase?.();
|
|
1187
|
+
switch (operator.toLowerCase()) {
|
|
1188
|
+
case "equal":
|
|
1189
|
+
condition = isDateComparison ? compareDates(itemDate, queryDate) : itemValue === value;
|
|
1190
|
+
break;
|
|
1191
|
+
case "notequal":
|
|
1192
|
+
condition = isDateComparison ? !compareDates(itemDate, queryDate) : itemValue !== value;
|
|
1193
|
+
break;
|
|
1194
|
+
case "greaterthan":
|
|
1195
|
+
// @ts-ignore
|
|
1196
|
+
condition = isDateComparison ? itemDate > queryDate : itemValue > value;
|
|
1197
|
+
|
|
1198
|
+
// condition = isDateComparison ? invalidDate(itemDate) && invalidDate(queryDate) && itemDate > queryDate : itemValue > value;
|
|
1199
|
+
break;
|
|
1200
|
+
case "greaterthanorequal":
|
|
1201
|
+
// @ts-ignore
|
|
1202
|
+
condition = isDateComparison ? itemDate >= queryDate : itemValue >= value;
|
|
1203
|
+
break;
|
|
1204
|
+
case "lessthan":
|
|
1205
|
+
// @ts-ignore
|
|
1206
|
+
condition = isDateComparison ? itemDate < queryDate : itemValue < value;
|
|
1207
|
+
break;
|
|
1208
|
+
case "lessthanorequal":
|
|
1209
|
+
// @ts-ignore
|
|
1210
|
+
condition = isDateComparison ? itemDate <= queryDate : itemValue <= value;
|
|
1211
|
+
break;
|
|
1212
|
+
case "contains":
|
|
1213
|
+
condition = itemStr?.includes(queryStr);
|
|
1214
|
+
break;
|
|
1215
|
+
case "startswith":
|
|
1216
|
+
condition = itemStr?.startsWith(queryStr);
|
|
1217
|
+
break;
|
|
1218
|
+
case "endswith":
|
|
1219
|
+
condition = itemStr?.endsWith(queryStr);
|
|
1220
|
+
break;
|
|
1221
|
+
default:
|
|
1222
|
+
console.warn(`Unknown operator: ${operator}`);
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
if (predicate === "and") {
|
|
1226
|
+
result = result === null ? condition : result && condition;
|
|
1227
|
+
} else if (predicate === "or") {
|
|
1228
|
+
result = result === null ? condition : result || condition;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
return result;
|
|
1232
|
+
};
|
|
1233
|
+
export function filterDataByColumns4(data, queries) {
|
|
1234
|
+
if (!queries || queries.length === 0) {
|
|
1235
|
+
return data;
|
|
1236
|
+
}
|
|
1237
|
+
return data.map(item => {
|
|
1238
|
+
const newItem = {
|
|
1239
|
+
...item
|
|
1240
|
+
};
|
|
1241
|
+
if (Array.isArray(item.children)) {
|
|
1242
|
+
newItem.children = filterDataByColumns4(item.children, queries);
|
|
1243
|
+
}
|
|
1244
|
+
const isSelfMatched = shouldInclude(item, queries);
|
|
1245
|
+
|
|
1246
|
+
// Nếu chính item thỏa hoặc có con thỏa → giữ lại
|
|
1247
|
+
if (isSelfMatched || newItem.children && newItem.children.length > 0) {
|
|
1248
|
+
return newItem;
|
|
1249
|
+
}
|
|
1250
|
+
return null; // loại bỏ node không phù hợp
|
|
1251
|
+
}).filter(Boolean); // xóa các null
|
|
1252
|
+
}
|
|
1168
1253
|
|
|
1169
1254
|
// ======= Helper functions ========
|
|
1170
1255
|
|
|
@@ -1353,30 +1438,149 @@ export const sortedSetDSC = setValue => {
|
|
|
1353
1438
|
});
|
|
1354
1439
|
return new Set(sorted);
|
|
1355
1440
|
};
|
|
1356
|
-
export
|
|
1441
|
+
export function getBottomRowCells(cellSet) {
|
|
1442
|
+
const cells = Array.from(cellSet).map(key => {
|
|
1443
|
+
const [row, col] = key.split('-').map(Number);
|
|
1444
|
+
return {
|
|
1445
|
+
row,
|
|
1446
|
+
col,
|
|
1447
|
+
key
|
|
1448
|
+
};
|
|
1449
|
+
});
|
|
1450
|
+
const maxRow = Math.max(...cells.map(c => c.row));
|
|
1451
|
+
return cells.filter(c => c.row === maxRow).map(c => c.key);
|
|
1452
|
+
}
|
|
1453
|
+
export function getCellsByPosition(cellSet, position = "bottom") {
|
|
1454
|
+
const cells = Array.from(cellSet).map(key => {
|
|
1455
|
+
const [row, col] = key.split("-").map(Number);
|
|
1456
|
+
return {
|
|
1457
|
+
row,
|
|
1458
|
+
col,
|
|
1459
|
+
key
|
|
1460
|
+
};
|
|
1461
|
+
});
|
|
1462
|
+
switch (position) {
|
|
1463
|
+
case "top":
|
|
1464
|
+
{
|
|
1465
|
+
// const minRow = Math.min(...cells.map(c => c.row));
|
|
1466
|
+
// return cells.filter(c => c.row === minRow).map(c => c.key);
|
|
1467
|
+
|
|
1468
|
+
// const rows = cells.map(c => c.row).filter(r => r > 0);
|
|
1469
|
+
// if (rows.length === 0) return [];
|
|
1470
|
+
// const minRow = Math.min(...rows);
|
|
1471
|
+
// return cells.filter(c => c.row === minRow).map(c => c.key);
|
|
1472
|
+
|
|
1473
|
+
const minRow = Math.min(...cells.map(c => c.row));
|
|
1474
|
+
if (minRow === 0) return []; // Bỏ qua nếu rowIndex = 0
|
|
1475
|
+
|
|
1476
|
+
return cells.filter(c => c.row === minRow).map(c => `${c.row - 1}-${c.col}`);
|
|
1477
|
+
}
|
|
1478
|
+
case "bottom":
|
|
1479
|
+
{
|
|
1480
|
+
const maxRow = Math.max(...cells.map(c => c.row));
|
|
1481
|
+
return cells.filter(c => c.row === maxRow).map(c => c.key);
|
|
1482
|
+
}
|
|
1483
|
+
case "left":
|
|
1484
|
+
{
|
|
1485
|
+
// const minCol = Math.min(...cells.map(c => c.col));
|
|
1486
|
+
// return cells.filter(c => c.col === minCol).map(c => c.key);
|
|
1487
|
+
|
|
1488
|
+
// const cols = cells.map(c => c.col).filter(c => c > 0);
|
|
1489
|
+
// if (cols.length === 0) return [];
|
|
1490
|
+
// const minCol = Math.min(...cols);
|
|
1491
|
+
// return cells.filter(c => c.col === minCol).map(c => c.key);
|
|
1492
|
+
|
|
1493
|
+
const minCol = Math.min(...cells.map(c => c.col));
|
|
1494
|
+
if (minCol === 0) return []; // Bỏ qua nếu colIndex = 0
|
|
1495
|
+
|
|
1496
|
+
// Trả về các ô cùng row, nhưng ở cột bên trái
|
|
1497
|
+
return cells.filter(c => c.col === minCol).map(c => `${c.row}-${c.col - 1}`);
|
|
1498
|
+
}
|
|
1499
|
+
case "right":
|
|
1500
|
+
{
|
|
1501
|
+
const maxCol = Math.max(...cells.map(c => c.col));
|
|
1502
|
+
return cells.filter(c => c.col === maxCol).map(c => c.key);
|
|
1503
|
+
}
|
|
1504
|
+
default:
|
|
1505
|
+
return [];
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
export const addBorderClass = (selectedCells, type, className, id) => {
|
|
1509
|
+
const table = document.querySelector(`#${id}`);
|
|
1510
|
+
const typeCells = getCellsByPosition(selectedCells, type);
|
|
1511
|
+
const selectorsCells = typeCells.map(pos => {
|
|
1512
|
+
const [row, col] = pos.split('-');
|
|
1513
|
+
return `[data-row-index="${row}"][data-col-index="${col}"]`;
|
|
1514
|
+
});
|
|
1515
|
+
const cellsFilter = typeCells.length > 0 ? table?.querySelectorAll(selectorsCells.join(',')) : null;
|
|
1516
|
+
if (cellsFilter && cellsFilter.length > 0) {
|
|
1517
|
+
cellsFilter.forEach(cell => {
|
|
1518
|
+
cell.classList.add(className);
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
export const removeBorderClass = (selectedCells, type, className, id) => {
|
|
1523
|
+
const table = document.querySelector(`#${id}`);
|
|
1524
|
+
const typeCells = getCellsByPosition(selectedCells, type);
|
|
1525
|
+
const selectorsCells = typeCells.map(pos => {
|
|
1526
|
+
const [row, col] = pos.split('-');
|
|
1527
|
+
return `[data-row-index="${row}"][data-col-index="${col}"]`;
|
|
1528
|
+
});
|
|
1529
|
+
const cellsFilter = typeCells.length > 0 ? table?.querySelectorAll(selectorsCells.join(',')) : null;
|
|
1530
|
+
if (cellsFilter && cellsFilter.length > 0) {
|
|
1531
|
+
cellsFilter.forEach(cell => {
|
|
1532
|
+
cell.classList.remove(className);
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
export const onAddClassBgSelectedCell = (selectedCells, id) => {
|
|
1357
1537
|
const selectors = Array.from(selectedCells).map(pos => {
|
|
1358
1538
|
const [row1, col1] = pos.split('-');
|
|
1359
1539
|
return `[data-row-index="${row1}"][data-col-index="${col1}"]`;
|
|
1360
1540
|
});
|
|
1361
|
-
|
|
1362
|
-
// const cells = document.querySelectorAll(selectors.join(','));
|
|
1363
|
-
|
|
1364
1541
|
const table = document.querySelector(`#${id}`);
|
|
1365
|
-
|
|
1366
|
-
const cells = table?.querySelectorAll(selectors.join(','));
|
|
1542
|
+
const cells = table && selectors.length > 0 ? table?.querySelectorAll(selectors.join(',')) : null;
|
|
1367
1543
|
if (cells) {
|
|
1368
1544
|
cells.forEach(cell => {
|
|
1369
1545
|
cell.classList.add('selected');
|
|
1370
1546
|
});
|
|
1371
1547
|
}
|
|
1548
|
+
const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
|
|
1549
|
+
const rowsSelectors = rowsArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
|
|
1550
|
+
const cellsIndex = table && rowsSelectors.length > 0 ? table?.querySelectorAll(rowsSelectors) : null;
|
|
1551
|
+
if (cellsIndex) {
|
|
1552
|
+
cellsIndex.forEach(cell => {
|
|
1553
|
+
cell.classList.add('focus');
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
// tăng z-index để hiển thị round point paste
|
|
1558
|
+
const row = getLastSelectCell(selectedCells).row;
|
|
1559
|
+
const col = getLastSelectCell(selectedCells).col;
|
|
1560
|
+
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1561
|
+
if (cell) {
|
|
1562
|
+
cell.style.zIndex = 1;
|
|
1563
|
+
}
|
|
1564
|
+
if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
|
|
1565
|
+
cell.style.zIndex = 3;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
// thêm class border selected
|
|
1569
|
+
|
|
1570
|
+
addBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id);
|
|
1571
|
+
addBorderClass(selectedCells, 'right', 'cell-border-right', id);
|
|
1572
|
+
addBorderClass(selectedCells, 'top', 'cell-border-top', id);
|
|
1573
|
+
addBorderClass(selectedCells, 'left', 'cell-border-left', id);
|
|
1372
1574
|
};
|
|
1373
|
-
export const onRemoveClassSelectedCell = (selectedCells, id) => {
|
|
1575
|
+
export const onRemoveClassSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
1374
1576
|
const selectors = Array.from(selectedCells).map(pos => {
|
|
1375
1577
|
const [row, col] = pos.split('-');
|
|
1376
1578
|
return `[data-row-index="${row}"][data-col-index="${col}"]`;
|
|
1377
1579
|
});
|
|
1580
|
+
const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
|
|
1581
|
+
const rowsSelectors = rowsArray.map(row => `.rc-ui-cell-index[data-row-index="${row}"]`).join(", ");
|
|
1378
1582
|
const table = document.querySelector(`#${id}`);
|
|
1379
|
-
const cells = table?.querySelectorAll(selectors.join(','));
|
|
1583
|
+
const cells = table && selectors.length > 0 ? table?.querySelectorAll(selectors.join(',')) : null;
|
|
1380
1584
|
// const cells = table?.querySelectorAll(selectors.join(','))
|
|
1381
1585
|
|
|
1382
1586
|
// const cells = table?.querySelectorAll('.ui-rc-table-cell.selected');
|
|
@@ -1386,4 +1590,120 @@ export const onRemoveClassSelectedCell = (selectedCells, id) => {
|
|
|
1386
1590
|
cell.classList.remove('selected');
|
|
1387
1591
|
});
|
|
1388
1592
|
}
|
|
1593
|
+
const cellsIndex = table && rowsSelectors.length > 0 ? table?.querySelectorAll(rowsSelectors) : null;
|
|
1594
|
+
if (cellsIndex) {
|
|
1595
|
+
cellsIndex.forEach(cell => {
|
|
1596
|
+
cell.classList.remove('focus');
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
// xóa class selected ô STT
|
|
1601
|
+
|
|
1602
|
+
if (rowsSelected && rowsSelected.size > 0) {
|
|
1603
|
+
const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
|
|
1604
|
+
const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
|
|
1605
|
+
const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
|
|
1606
|
+
if (cellsSelectedIndex) {
|
|
1607
|
+
cellsSelectedIndex.forEach(cell => {
|
|
1608
|
+
cell.classList.remove('selected');
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
// xóa z-index về mặc định
|
|
1614
|
+
|
|
1615
|
+
const row = getLastSelectCell(selectedCells).row;
|
|
1616
|
+
const col = getLastSelectCell(selectedCells).col;
|
|
1617
|
+
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1618
|
+
if (cell) {
|
|
1619
|
+
cell.style.zIndex = 0;
|
|
1620
|
+
}
|
|
1621
|
+
if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
|
|
1622
|
+
cell.style.zIndex = 2;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
// remove class border
|
|
1626
|
+
|
|
1627
|
+
removeBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id);
|
|
1628
|
+
removeBorderClass(selectedCells, 'right', 'cell-border-right', id);
|
|
1629
|
+
removeBorderClass(selectedCells, 'top', 'cell-border-top', id);
|
|
1630
|
+
removeBorderClass(selectedCells, 'left', 'cell-border-left', id);
|
|
1631
|
+
};
|
|
1632
|
+
export const addClassBorderPasteCell = (pasteCells, type, id) => {
|
|
1633
|
+
// thêm class border
|
|
1634
|
+
|
|
1635
|
+
addBorderClass(pasteCells, 'right', 'cell-paste-border-right', id);
|
|
1636
|
+
addBorderClass(pasteCells, 'left', 'cell-paste-border-left', id);
|
|
1637
|
+
if (type === 'up') {
|
|
1638
|
+
addBorderClass(pasteCells, 'top', 'cell-paste-border-top', id);
|
|
1639
|
+
}
|
|
1640
|
+
if (type === 'down') {
|
|
1641
|
+
addBorderClass(pasteCells, 'bottom', 'cell-paste-border-bottom', id);
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
export const removeClassBorderPasteCell = (pasteCells, type, id) => {
|
|
1645
|
+
// remove class border
|
|
1646
|
+
|
|
1647
|
+
removeBorderClass(pasteCells, 'bottom', 'cell-paste-border-bottom', id);
|
|
1648
|
+
removeBorderClass(pasteCells, 'right', 'cell-paste-border-right', id);
|
|
1649
|
+
removeBorderClass(pasteCells, 'top', 'cell-paste-border-top', id);
|
|
1650
|
+
removeBorderClass(pasteCells, 'left', 'cell-paste-border-left', id);
|
|
1651
|
+
};
|
|
1652
|
+
export const addClassCellIndexSelected = (rowsSelected, id) => {
|
|
1653
|
+
// thêm class selected vào ô STT
|
|
1654
|
+
const table = document.querySelector(`#${id}`);
|
|
1655
|
+
if (rowsSelected && rowsSelected.size > 0) {
|
|
1656
|
+
const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
|
|
1657
|
+
const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
|
|
1658
|
+
const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
|
|
1659
|
+
if (cellsSelectedIndex) {
|
|
1660
|
+
cellsSelectedIndex.forEach(cell => {
|
|
1661
|
+
cell.classList.add('selected');
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
export const removeClassCellIndexSelected = (rowsSelected, id) => {
|
|
1667
|
+
// thêm class selected vào ô STT
|
|
1668
|
+
const table = document.querySelector(`#${id}`);
|
|
1669
|
+
if (rowsSelected && rowsSelected.size > 0) {
|
|
1670
|
+
const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
|
|
1671
|
+
const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
|
|
1672
|
+
const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
|
|
1673
|
+
if (cellsSelectedIndex) {
|
|
1674
|
+
cellsSelectedIndex.forEach(cell => {
|
|
1675
|
+
cell.classList.remove('selected');
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
export const showDraggingPoint = (selectedCells, id) => {
|
|
1681
|
+
const row = getLastSelectCell(selectedCells).row;
|
|
1682
|
+
const col = getLastSelectCell(selectedCells).col;
|
|
1683
|
+
const table = document.querySelector(`#${id}`);
|
|
1684
|
+
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1685
|
+
const point = cell?.querySelector('.dragging-point');
|
|
1686
|
+
if (point) {
|
|
1687
|
+
point.classList.add('show');
|
|
1688
|
+
point.classList.remove('hidden');
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
export const hideDraggingPoint = (selectedCells, id) => {
|
|
1692
|
+
const table = document.querySelector(`#${id}`);
|
|
1693
|
+
|
|
1694
|
+
// const point = table?.querySelector('.dragging-point.show')
|
|
1695
|
+
// const points = document.querySelectorAll('.dragging-point.show')
|
|
1696
|
+
const points = table?.querySelectorAll('.dragging-point.show');
|
|
1697
|
+
|
|
1698
|
+
// if (point) {
|
|
1699
|
+
// point.classList.add('hidden')
|
|
1700
|
+
// point.classList.remove('show')
|
|
1701
|
+
// }
|
|
1702
|
+
|
|
1703
|
+
if (points && points.length > 0) {
|
|
1704
|
+
points.forEach(cell => {
|
|
1705
|
+
cell.classList.add('hidden');
|
|
1706
|
+
cell.classList.remove('show');
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1389
1709
|
};
|
|
@@ -144,6 +144,19 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
144
144
|
|
|
145
145
|
.#{$prefix}-table-cell {
|
|
146
146
|
line-height: 22px;
|
|
147
|
+
&:focus-visible {
|
|
148
|
+
outline: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
&.disable {
|
|
153
|
+
background-color: #f0f0f0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&.selected {
|
|
157
|
+
//background: red;
|
|
158
|
+
background-color: $cell-selected-bg;
|
|
159
|
+
}
|
|
147
160
|
|
|
148
161
|
.ui-rc-table-cell-content {
|
|
149
162
|
line-height: 22px;
|
|
@@ -406,7 +419,20 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
406
419
|
left: 8px;
|
|
407
420
|
}
|
|
408
421
|
|
|
422
|
+
&.rc-ui-cell-index {
|
|
423
|
+
&.focus {
|
|
424
|
+
background-color: $cell-index-focus-bg;
|
|
425
|
+
font-weight: 500;
|
|
426
|
+
}
|
|
427
|
+
&.selected {
|
|
428
|
+
background-color: $cell-index-selected-bg;
|
|
429
|
+
color: #fff;
|
|
430
|
+
//font-weight: 500;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
409
434
|
&.cell-editable {
|
|
435
|
+
|
|
410
436
|
&.cell-border-top {
|
|
411
437
|
border-bottom: 1px solid $border-selected-color;
|
|
412
438
|
}
|
|
@@ -415,29 +441,31 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
415
441
|
border-bottom: 1px solid $border-selected-color;
|
|
416
442
|
}
|
|
417
443
|
|
|
418
|
-
&.cell-paste-border-bottom {
|
|
419
|
-
border-bottom: 1px dashed #949494;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
444
|
&.cell-border-left {
|
|
423
445
|
border-inline-end: 1px solid $border-selected-color;
|
|
424
446
|
}
|
|
425
447
|
|
|
426
|
-
&.cell-
|
|
427
|
-
border-inline-end: 1px
|
|
448
|
+
&.cell-border-right {
|
|
449
|
+
border-inline-end: 1px solid $border-selected-color;
|
|
428
450
|
}
|
|
451
|
+
|
|
429
452
|
&.cell-paste-border-top {
|
|
430
|
-
border-bottom: 1px dashed #949494
|
|
453
|
+
border-bottom: 1px dashed #949494;
|
|
431
454
|
}
|
|
432
455
|
|
|
433
|
-
&.cell-border-
|
|
434
|
-
border-
|
|
456
|
+
&.cell-paste-border-bottom {
|
|
457
|
+
border-bottom: 1px dashed #949494;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
&.cell-paste-border-left {
|
|
461
|
+
border-inline-end: 1px dashed #949494;
|
|
435
462
|
}
|
|
436
463
|
|
|
437
464
|
&.cell-paste-border-right {
|
|
438
465
|
border-inline-end: 1px dashed #949494;
|
|
439
466
|
}
|
|
440
467
|
|
|
468
|
+
|
|
441
469
|
&.#{$prefix}-table-cell-fix-left {
|
|
442
470
|
&:has(.ui-rc_cell-content.selected) {
|
|
443
471
|
}
|
|
@@ -620,18 +648,22 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
620
648
|
height: 10px;
|
|
621
649
|
position: absolute;
|
|
622
650
|
cursor: crosshair;
|
|
623
|
-
right:
|
|
624
|
-
bottom:
|
|
651
|
+
right: -1px;
|
|
652
|
+
bottom: -1px;
|
|
625
653
|
//background: red;
|
|
626
654
|
|
|
655
|
+
&.hidden {
|
|
656
|
+
display: none;
|
|
657
|
+
}
|
|
658
|
+
|
|
627
659
|
.dot-point {
|
|
628
660
|
position: absolute;
|
|
629
661
|
width: 8px;
|
|
630
662
|
height: 8px;
|
|
631
663
|
border-radius: 6px;
|
|
632
664
|
background-color: $border-selected-color;
|
|
633
|
-
bottom: -
|
|
634
|
-
right: -
|
|
665
|
+
bottom: -3px;
|
|
666
|
+
right: -3px;
|
|
635
667
|
}
|
|
636
668
|
|
|
637
669
|
}
|
|
@@ -641,9 +673,9 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
641
673
|
background-color: $cell-selected-bg;
|
|
642
674
|
}
|
|
643
675
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}
|
|
676
|
+
//.ui-rc_cell-content.disable {
|
|
677
|
+
// background-color: #f0f0f0;
|
|
678
|
+
//}
|
|
647
679
|
|
|
648
680
|
.ui-rc_cell-content--index {
|
|
649
681
|
&.focus {
|