es-grid-template 1.3.6 → 1.3.8

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.
Files changed (31) hide show
  1. package/assets/index.css +35 -24
  2. package/assets/index.scss +57 -21
  3. package/es/grid-component/EditableCell.js +12 -11
  4. package/es/grid-component/GridStyle.d.ts +5 -3
  5. package/es/grid-component/GridStyle.js +1 -1
  6. package/es/grid-component/TableGrid.js +28 -21
  7. package/es/grid-component/hooks/columns/index.d.ts +1 -1
  8. package/es/grid-component/hooks/columns/index.js +15 -14
  9. package/es/grid-component/hooks/useColumns.js +12 -9
  10. package/es/grid-component/hooks/utils.d.ts +19 -4
  11. package/es/grid-component/hooks/utils.js +377 -26
  12. package/es/grid-component/styles.scss +57 -21
  13. package/es/grid-component/table/Grid.js +1 -1
  14. package/es/grid-component/table/GridEdit.js +383 -268
  15. package/es/grid-component/table/Group.js +1 -1
  16. package/es/grid-component/type.d.ts +4 -4
  17. package/lib/grid-component/EditableCell.js +12 -11
  18. package/lib/grid-component/GridStyle.d.ts +5 -3
  19. package/lib/grid-component/GridStyle.js +1 -1
  20. package/lib/grid-component/TableGrid.js +26 -20
  21. package/lib/grid-component/hooks/columns/index.d.ts +1 -1
  22. package/lib/grid-component/hooks/columns/index.js +15 -14
  23. package/lib/grid-component/hooks/useColumns.js +12 -9
  24. package/lib/grid-component/hooks/utils.d.ts +19 -4
  25. package/lib/grid-component/hooks/utils.js +401 -33
  26. package/lib/grid-component/styles.scss +57 -21
  27. package/lib/grid-component/table/Grid.js +1 -1
  28. package/lib/grid-component/table/GridEdit.js +382 -259
  29. package/lib/grid-component/table/Group.js +1 -1
  30. package/lib/grid-component/type.d.ts +4 -4
  31. package/package.json +2 -2
@@ -171,24 +171,24 @@ export const updateColumnsByGroup = (columns, columnsGroup) => {
171
171
  return newColumn;
172
172
  });
173
173
  };
174
- export const getDatepickerFormat = (type, col) => {
174
+ export const getDatepickerFormat = (type, format) => {
175
175
  const typeFormat = type ? type.toLowerCase() : '';
176
176
  switch (typeFormat) {
177
177
  case "date":
178
178
  case "daterange":
179
- return col.format?.dateFormat ? col.format?.dateFormat : 'DD/MM/YYYY';
179
+ return format?.dateFormat ?? 'DD/MM/YYYY';
180
180
  case "datetime":
181
- return col.format?.datetimeFormat ? col.format?.datetimeFormat : 'DD/MM/YYYY HH:mm';
181
+ return format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm';
182
182
  case "week":
183
- return col.format?.weekFormat ? col.format?.weekFormat : 'DD/MM';
183
+ return format?.weekFormat ?? 'DD/MM';
184
184
  case "month":
185
- return col.format?.monthFormat ? col.format?.monthFormat : 'MM/YYYY';
185
+ return format?.monthFormat ?? 'MM/YYYY';
186
186
  case "quarter":
187
- return col.format?.dateFormat ? col.format?.dateFormat : 'DD/MM/YYYY';
187
+ return format?.dateFormat ?? 'DD/MM/YYYY';
188
188
  case "year":
189
- return col.format?.yearFormat ? col.format?.yearFormat : 'YYYY';
189
+ return format?.yearFormat ?? 'YYYY';
190
190
  case "time":
191
- return col.format?.timeFormat ? col.format?.timeFormat : 'HH:mm';
191
+ return format?.timeFormat ?? 'HH:mm';
192
192
  default:
193
193
  return 'DD/MM/YYYY';
194
194
  }
@@ -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.0000001 : typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth, 10) || 50;
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(array[m - 1][j]);
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 === 'index' || column.field === 'index' || column.dataIndex === '#' || 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,37 +1438,303 @@ export const sortedSetDSC = setValue => {
1353
1438
  });
1354
1439
  return new Set(sorted);
1355
1440
  };
1356
- export const onAddClassSelectedCell = (selectedCells, id) => {
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 removeBorderClass2 = (className, id) => {
1537
+ const table = document.querySelector(`#${id}`);
1538
+ const cellsFilter = table ? table?.querySelectorAll(`.ui-rc-table-cell.${className}`) : null;
1539
+ if (cellsFilter && cellsFilter.length > 0) {
1540
+ cellsFilter.forEach(cell => {
1541
+ cell.classList.remove(className);
1542
+ });
1543
+ }
1544
+ };
1545
+ export const onAddBgSelectedCell = (selectedCells, id) => {
1357
1546
  const selectors = Array.from(selectedCells).map(pos => {
1358
1547
  const [row1, col1] = pos.split('-');
1359
1548
  return `[data-row-index="${row1}"][data-col-index="${col1}"]`;
1360
1549
  });
1361
-
1362
- // const cells = document.querySelectorAll(selectors.join(','));
1363
-
1364
1550
  const table = document.querySelector(`#${id}`);
1365
- console.log('table', table);
1366
- const cells = table?.querySelectorAll(selectors.join(','));
1551
+ const cells = table && selectors.length > 0 ? table?.querySelectorAll(selectors.join(',')) : null;
1367
1552
  if (cells) {
1368
1553
  cells.forEach(cell => {
1369
1554
  cell.classList.add('selected');
1370
1555
  });
1371
1556
  }
1557
+ const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
1558
+ const rowsSelectors = rowsArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
1559
+ const cellsIndex = table && rowsSelectors.length > 0 ? table?.querySelectorAll(rowsSelectors) : null;
1560
+ if (cellsIndex) {
1561
+ cellsIndex.forEach(cell => {
1562
+ cell.classList.add('focus');
1563
+ });
1564
+ }
1565
+
1566
+ // // tăng z-index để hiển thị round point paste
1567
+ // const row = getLastSelectCell(selectedCells).row
1568
+ // const col = getLastSelectCell(selectedCells).col
1569
+ // const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
1570
+ //
1571
+ // if (cell) {
1572
+ // cell.style.zIndex = 1
1573
+ // }
1574
+ //
1575
+ // if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
1576
+ // cell.style.zIndex = 3;
1577
+ // }
1578
+
1579
+ // thêm class border selected
1580
+
1581
+ // addBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id)
1582
+ // addBorderClass(selectedCells, 'right', 'cell-border-right', id)
1583
+ // addBorderClass(selectedCells, 'top', 'cell-border-top', id)
1584
+ // addBorderClass(selectedCells, 'left', 'cell-border-left', id)
1372
1585
  };
1373
- export const onRemoveClassSelectedCell = (selectedCells, id) => {
1374
- const selectors = Array.from(selectedCells).map(pos => {
1375
- const [row, col] = pos.split('-');
1376
- return `[data-row-index="${row}"][data-col-index="${col}"]`;
1377
- });
1586
+ export const onAddBorderSelectedCell = (selectedCells, id) => {
1378
1587
  const table = document.querySelector(`#${id}`);
1379
- const cells = table?.querySelectorAll(selectors.join(','));
1380
- // const cells = table?.querySelectorAll(selectors.join(','))
1381
1588
 
1382
- // const cells = table?.querySelectorAll('.ui-rc-table-cell.selected');
1589
+ // tăng z-index để hiển thị round point paste
1590
+ const row = getLastSelectCell(selectedCells).row;
1591
+ const col = getLastSelectCell(selectedCells).col;
1592
+ const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
1593
+ if (cell) {
1594
+ cell.style.zIndex = 1;
1595
+ }
1596
+ if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
1597
+ cell.style.zIndex = 3;
1598
+ }
1383
1599
 
1600
+ // thêm class border selected
1601
+
1602
+ addBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id);
1603
+ addBorderClass(selectedCells, 'right', 'cell-border-right', id);
1604
+ addBorderClass(selectedCells, 'top', 'cell-border-top', id);
1605
+ addBorderClass(selectedCells, 'left', 'cell-border-left', id);
1606
+ };
1607
+ export const onRemoveBgSelectedCell = (selectedCells, id, rowsSelected) => {
1608
+ const table = document.querySelector(`#${id}`);
1609
+ const cells = table ? table?.querySelectorAll('.ui-rc-table-cell.selected') : null;
1384
1610
  if (cells) {
1385
1611
  cells.forEach(cell => {
1386
1612
  cell.classList.remove('selected');
1387
1613
  });
1388
1614
  }
1615
+ const cellsIndex = table ? table?.querySelectorAll('.ui-rc-table-cell.focus') : null;
1616
+ if (cellsIndex) {
1617
+ cellsIndex.forEach(cell => {
1618
+ cell.classList.remove('focus');
1619
+ });
1620
+ }
1621
+
1622
+ // xóa class selected ô STT
1623
+
1624
+ if (rowsSelected && rowsSelected.size > 0) {
1625
+ const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
1626
+ const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
1627
+ const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
1628
+ if (cellsSelectedIndex) {
1629
+ cellsSelectedIndex.forEach(cell => {
1630
+ cell.classList.remove('selected');
1631
+ });
1632
+ }
1633
+ }
1634
+ };
1635
+ export const onRemoveBorderSelectedCell = (selectedCells, id) => {
1636
+ const table = document.querySelector(`#${id}`);
1637
+
1638
+ // xóa z-index về mặc định
1639
+
1640
+ const row = getLastSelectCell(selectedCells).row;
1641
+ const col = getLastSelectCell(selectedCells).col;
1642
+
1643
+ // const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
1644
+ const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
1645
+ if (cell) {
1646
+ cell.style.zIndex = 0;
1647
+ }
1648
+ if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
1649
+ cell.style.zIndex = 2;
1650
+ }
1651
+
1652
+ // remove class border
1653
+
1654
+ removeBorderClass2('cell-border-bottom', id);
1655
+ removeBorderClass2('cell-border-top', id);
1656
+ removeBorderClass2('cell-border-right', id);
1657
+ removeBorderClass2('cell-border-left', id);
1658
+
1659
+ // removeBorderClass(selectedCells, 'right', 'cell-border-right', id)
1660
+ // removeBorderClass(selectedCells, 'top', 'cell-border-top', id)
1661
+ // removeBorderClass(selectedCells, 'left', 'cell-border-left', id)
1662
+ };
1663
+ export const addClassBorderPasteCell = (pasteCells, type, id) => {
1664
+ // thêm class border
1665
+
1666
+ addBorderClass(pasteCells, 'right', 'cell-paste-border-right', id);
1667
+ addBorderClass(pasteCells, 'left', 'cell-paste-border-left', id);
1668
+ if (type === 'up') {
1669
+ addBorderClass(pasteCells, 'top', 'cell-paste-border-top', id);
1670
+ }
1671
+ if (type === 'down') {
1672
+ addBorderClass(pasteCells, 'bottom', 'cell-paste-border-bottom', id);
1673
+ }
1674
+ };
1675
+ export const removeClassBorderPasteCell = (pasteCells, type, id) => {
1676
+ // remove class border
1677
+
1678
+ removeBorderClass(pasteCells, 'bottom', 'cell-paste-border-bottom', id);
1679
+ removeBorderClass(pasteCells, 'right', 'cell-paste-border-right', id);
1680
+ removeBorderClass(pasteCells, 'top', 'cell-paste-border-top', id);
1681
+ removeBorderClass(pasteCells, 'left', 'cell-paste-border-left', id);
1682
+ };
1683
+ export const addClassCellIndexSelected = (rowsSelected, id) => {
1684
+ // thêm class selected vào ô STT
1685
+ const table = document.querySelector(`#${id}`);
1686
+ if (rowsSelected && rowsSelected.size > 0) {
1687
+ const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
1688
+ const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
1689
+ const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
1690
+ if (cellsSelectedIndex) {
1691
+ cellsSelectedIndex.forEach(cell => {
1692
+ cell.classList.add('selected');
1693
+ });
1694
+ }
1695
+ }
1696
+ };
1697
+ export const removeClassCellIndexSelected = (rowsSelected, id) => {
1698
+ // thêm class selected vào ô STT
1699
+ const table = document.querySelector(`#${id}`);
1700
+ if (rowsSelected && rowsSelected.size > 0) {
1701
+ const rowsSelectedArray = [...new Set([...rowsSelected].map(item => item.split("-")[0]))];
1702
+ const rowsSelectedSelectors = rowsSelectedArray.map(r => `.rc-ui-cell-index[data-row-index="${r}"]`).join(", ");
1703
+ const cellsSelectedIndex = table && rowsSelectedSelectors.length > 0 ? table?.querySelectorAll(rowsSelectedSelectors) : null;
1704
+ if (cellsSelectedIndex) {
1705
+ cellsSelectedIndex.forEach(cell => {
1706
+ cell.classList.remove('selected');
1707
+ });
1708
+ }
1709
+ }
1710
+ };
1711
+ export const showDraggingPoint = (selectedCells, id) => {
1712
+ const row = getLastSelectCell(selectedCells).row;
1713
+ const col = getLastSelectCell(selectedCells).col;
1714
+ const table = document.querySelector(`#${id}`);
1715
+ const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
1716
+ const point = cell?.querySelector('.dragging-point');
1717
+ if (point) {
1718
+ point.classList.add('show');
1719
+ point.classList.remove('hidden');
1720
+ }
1721
+ };
1722
+ export const hideDraggingPoint = (selectedCells, id) => {
1723
+ const table = document.querySelector(`#${id}`);
1724
+
1725
+ // const point = table?.querySelector('.dragging-point.show')
1726
+ // const points = document.querySelectorAll('.dragging-point.show')
1727
+ const points = table?.querySelectorAll('.dragging-point.show');
1728
+
1729
+ // if (point) {
1730
+ // point.classList.add('hidden')
1731
+ // point.classList.remove('show')
1732
+ // }
1733
+
1734
+ if (points && points.length > 0) {
1735
+ points.forEach(cell => {
1736
+ cell.classList.add('hidden');
1737
+ cell.classList.remove('show');
1738
+ });
1739
+ }
1389
1740
  };
@@ -5,13 +5,17 @@ $rowHoverBg: #FBDED6 !default;
5
5
  $rowSelectedBg: #FEF2EF !default;
6
6
  //$tableBorderColor: red !default;
7
7
  $tableBorderColor: #e0e0e0 !default;
8
+ //$tableBorderColor: #C4C4C4 !default;
8
9
  //$tableBorderColor: #f0f0f0 !default;
9
10
  $border-radius: 6px !default;
10
11
  $border-selected-color: #0550C5 !default;
11
12
  $body-color: #ffffff !default;
12
- $cell-selected-bg: #E6EFFD !default;
13
- $cell-index-selected-bg: #0550C5 !default;
14
- $cell-index-focus-bg: #CEDBEF !default;
13
+ //$cell-selected-bg: #E6EFFD !default;
14
+ $cell-selected-bg: #F3F8FF !default;
15
+ //$cell-index-selected-bg: #0550C5 !default;
16
+ $cell-index-selected-bg: #1869E6 !default;
17
+ //$cell-index-focus-bg: #CEDBEF !default;
18
+ $cell-index-focus-bg: #E6EFFD !default;
15
19
  $rowSelectedHoverBg: 'ui-rc' !default;
16
20
  $boxShadowColor: rgba(5, 5, 5, 0.09) !default;
17
21
  $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
@@ -144,6 +148,19 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
144
148
 
145
149
  .#{$prefix}-table-cell {
146
150
  line-height: 22px;
151
+ &:focus-visible {
152
+ outline: none;
153
+ }
154
+
155
+
156
+ &.disable {
157
+ background-color: #f0f0f0;
158
+ }
159
+
160
+ &.selected {
161
+ //background: red;
162
+ background-color: $cell-selected-bg !important;
163
+ }
147
164
 
148
165
  .ui-rc-table-cell-content {
149
166
  line-height: 22px;
@@ -406,7 +423,20 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
406
423
  left: 8px;
407
424
  }
408
425
 
426
+ &.rc-ui-cell-index {
427
+ &.focus {
428
+ background-color: $cell-index-focus-bg;
429
+ font-weight: 500;
430
+ }
431
+ &.selected {
432
+ background-color: $cell-index-selected-bg !important;
433
+ color: #fff;
434
+ //font-weight: 500;
435
+ }
436
+ }
437
+
409
438
  &.cell-editable {
439
+
410
440
  &.cell-border-top {
411
441
  border-bottom: 1px solid $border-selected-color;
412
442
  }
@@ -415,29 +445,31 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
415
445
  border-bottom: 1px solid $border-selected-color;
416
446
  }
417
447
 
418
- &.cell-paste-border-bottom {
419
- border-bottom: 1px dashed #949494;
420
- }
421
-
422
448
  &.cell-border-left {
423
449
  border-inline-end: 1px solid $border-selected-color;
424
450
  }
425
451
 
426
- &.cell-paste-border-left {
427
- border-inline-end: 1px dashed #949494;
452
+ &.cell-border-right {
453
+ border-inline-end: 1px solid $border-selected-color;
428
454
  }
455
+
429
456
  &.cell-paste-border-top {
430
- border-bottom: 1px dashed #949494 !important;
457
+ border-bottom: 1px dashed #949494;
431
458
  }
432
459
 
433
- &.cell-border-right {
434
- border-inline-end: 1px solid $border-selected-color;
460
+ &.cell-paste-border-bottom {
461
+ border-bottom: 1px dashed #949494;
462
+ }
463
+
464
+ &.cell-paste-border-left {
465
+ border-inline-end: 1px dashed #949494;
435
466
  }
436
467
 
437
468
  &.cell-paste-border-right {
438
469
  border-inline-end: 1px dashed #949494;
439
470
  }
440
471
 
472
+
441
473
  &.#{$prefix}-table-cell-fix-left {
442
474
  &:has(.ui-rc_cell-content.selected) {
443
475
  }
@@ -620,18 +652,22 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
620
652
  height: 10px;
621
653
  position: absolute;
622
654
  cursor: crosshair;
623
- right: 0;
624
- bottom: 0;
655
+ right: -1px;
656
+ bottom: -1px;
625
657
  //background: red;
626
658
 
659
+ &.hidden {
660
+ display: none;
661
+ }
662
+
627
663
  .dot-point {
628
664
  position: absolute;
629
665
  width: 8px;
630
666
  height: 8px;
631
667
  border-radius: 6px;
632
668
  background-color: $border-selected-color;
633
- bottom: -4px;
634
- right: -4px;
669
+ bottom: -3px;
670
+ right: -3px;
635
671
  }
636
672
 
637
673
  }
@@ -641,9 +677,9 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
641
677
  background-color: $cell-selected-bg;
642
678
  }
643
679
 
644
- .ui-rc_cell-content.disable {
645
- background-color: #f0f0f0;
646
- }
680
+ //.ui-rc_cell-content.disable {
681
+ // background-color: #f0f0f0;
682
+ //}
647
683
 
648
684
  .ui-rc_cell-content--index {
649
685
  &.focus {
@@ -663,12 +699,12 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
663
699
  .#{$prefix}-table-row {
664
700
  &.#{$prefix}-table-row-selected {
665
701
  >.#{$prefix}-table-cell {
666
- background: #FEF2EF;
702
+ //background: #FEF2EF;
667
703
  }
668
704
  }
669
705
  >.#{$prefix}-table-cell {
670
706
  &.#{$prefix}-table-cell-row-hover {
671
- background: #FBDED6;
707
+ //background: #FBDED6;
672
708
  }
673
709
  }
674
710
 
@@ -14,7 +14,7 @@ const Grid = props => {
14
14
  ...rest
15
15
  } = props;
16
16
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
17
- heightTable: height,
17
+ $heightTable: height,
18
18
  style: {
19
19
  position: 'relative'
20
20
  }