@visactor/vtable-sheet 1.21.1-alpha.0 → 1.22.0

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.
@@ -142,9 +142,15 @@
142
142
  this.sheets.set(sheetKey, sheetId);
143
143
  this.reverseSheets.set(sheetId, sheetKey);
144
144
  const sheetData = data || [['']];
145
- this.sheetData.set(sheetId, this.normalizeData(sheetData));
145
+ this.sheetData.set(sheetId, sheetData);
146
146
  return sheetId;
147
147
  }
148
+ updateSheetData(sheetKey, data) {
149
+ const sheetId = this.sheets.get(sheetKey);
150
+ if (sheetId !== undefined && sheetId !== null) {
151
+ this.sheetData.set(sheetId, data);
152
+ }
153
+ }
148
154
  normalizeData(data) {
149
155
  if (!Array.isArray(data) || data.length === 0) {
150
156
  return [['']];
@@ -177,6 +183,57 @@
177
183
  }
178
184
  return sheetId;
179
185
  }
186
+ getFormulaString(cell) {
187
+ const cellKey = this.getCellKey(cell);
188
+ return this.formulaCells.get(cellKey) || null;
189
+ }
190
+ clearDependencies(cellKey) {
191
+ const oldDeps = this.dependencies.get(cellKey) || new Set();
192
+ for (const dep of oldDeps) {
193
+ const depDependents = this.dependents.get(dep) || new Set();
194
+ depDependents.delete(cellKey);
195
+ if (depDependents.size === 0) {
196
+ this.dependents.delete(dep);
197
+ }
198
+ else {
199
+ this.dependents.set(dep, depDependents);
200
+ }
201
+ }
202
+ this.dependencies.delete(cellKey);
203
+ }
204
+ setCellContentWithoutDependencyUpdate(cell, value) {
205
+ if (!cell || cell.sheet === undefined || cell.row === undefined || cell.col === undefined) {
206
+ throw new Error('Invalid cell parameter');
207
+ }
208
+ if (cell.row < 0 || cell.col < 0) {
209
+ throw new Error(`Cell coordinates out of bounds: row=${cell.row}, col=${cell.col}`);
210
+ }
211
+ const sheetId = this.getSheetId(cell.sheet);
212
+ if (!this.sheetData.has(sheetId)) {
213
+ this.sheetData.set(sheetId, [['']]);
214
+ }
215
+ const sheet = this.sheetData.get(sheetId);
216
+ if (!sheet) {
217
+ throw new Error(`Sheet data not found for ID: ${sheetId}`);
218
+ }
219
+ while (sheet.length <= cell.row) {
220
+ sheet.push([]);
221
+ }
222
+ while (sheet[cell.row].length <= cell.col) {
223
+ sheet[cell.row].push('');
224
+ }
225
+ let processedValue = value;
226
+ if (processedValue === null || processedValue === undefined) {
227
+ processedValue = '';
228
+ }
229
+ if (typeof processedValue === 'string' && !processedValue.startsWith('=')) {
230
+ const numericValue = Number(processedValue);
231
+ if (!isNaN(numericValue) && processedValue.trim() !== '') {
232
+ processedValue = numericValue;
233
+ }
234
+ }
235
+ sheet[cell.row][cell.col] = processedValue;
236
+ }
180
237
  setCellContent(cell, value) {
181
238
  if (!cell || cell.sheet === undefined || cell.row === undefined || cell.col === undefined) {
182
239
  throw new Error('Invalid cell parameter');
@@ -261,6 +318,9 @@
261
318
  return { value: formula, error: undefined };
262
319
  }
263
320
  const expression = formula.substring(1).trim();
321
+ if (expression.includes('#REF!')) {
322
+ return { value: '#REF!', error: undefined };
323
+ }
264
324
  const result = this.parseExpression(expression);
265
325
  return result;
266
326
  }
@@ -1405,11 +1465,356 @@
1405
1465
  }
1406
1466
  return result;
1407
1467
  }
1468
+ adjustFormulaReferences(sheetKey, type, dimension, index, count, totalColCount, totalRowCount) {
1469
+ try {
1470
+ const adjustedFormulas = [];
1471
+ const movedFormulas = [];
1472
+ const deletedCells = new Set();
1473
+ if (type === 'delete') {
1474
+ for (let i = 0; i < count; i++) {
1475
+ if (dimension === 'row') {
1476
+ for (let col = 0; col < totalColCount; col++) {
1477
+ const deletedCell = { sheet: sheetKey, row: index + i, col };
1478
+ const deletedCellKey = this.getCellKey(deletedCell);
1479
+ deletedCells.add(deletedCellKey);
1480
+ }
1481
+ }
1482
+ else if (dimension === 'column') {
1483
+ for (let row = 0; row < totalRowCount; row++) {
1484
+ const deletedCell = { sheet: sheetKey, row, col: index + i };
1485
+ const deletedCellKey = this.getCellKey(deletedCell);
1486
+ deletedCells.add(deletedCellKey);
1487
+ }
1488
+ }
1489
+ }
1490
+ }
1491
+ for (const [cellKey, formula] of Array.from(this.formulaCells.entries())) {
1492
+ const cell = this.parseCellKey(cellKey);
1493
+ if (!cell || cell.sheet !== sheetKey) {
1494
+ continue;
1495
+ }
1496
+ const newCell = { ...cell };
1497
+ let cellNeedsMove = false;
1498
+ if (dimension === 'row') {
1499
+ if (type === 'insert' && cell.row >= index) {
1500
+ newCell.row = cell.row + count;
1501
+ cellNeedsMove = true;
1502
+ }
1503
+ else if (type === 'delete' && cell.row > index) {
1504
+ newCell.row = cell.row - count;
1505
+ cellNeedsMove = true;
1506
+ }
1507
+ else if (type === 'delete' && cell.row >= index && cell.row < index + count) {
1508
+ this.formulaCells.delete(cellKey);
1509
+ continue;
1510
+ }
1511
+ }
1512
+ else if (dimension === 'column') {
1513
+ if (type === 'insert' && cell.col >= index) {
1514
+ newCell.col = cell.col + count;
1515
+ cellNeedsMove = true;
1516
+ }
1517
+ else if (type === 'delete' && cell.col > index) {
1518
+ newCell.col = cell.col - count;
1519
+ cellNeedsMove = true;
1520
+ }
1521
+ else if (type === 'delete' && cell.col >= index && cell.col < index + count) {
1522
+ this.formulaCells.delete(cellKey);
1523
+ continue;
1524
+ }
1525
+ }
1526
+ const newFormula = this.adjustFormulaReference(formula, type, dimension, index, count);
1527
+ if (cellNeedsMove) {
1528
+ movedFormulas.push({ oldCellKey: cellKey, newCell, formula: newFormula });
1529
+ this.formulaCells.delete(cellKey);
1530
+ this.clearDependencies(cellKey);
1531
+ }
1532
+ else if (newFormula !== formula) {
1533
+ adjustedFormulas.push({ cell, oldFormula: formula, newFormula });
1534
+ this.clearDependencies(cellKey);
1535
+ }
1536
+ }
1537
+ for (const { newCell, formula } of movedFormulas) {
1538
+ const newCellKey = this.getCellKey(newCell);
1539
+ this.formulaCells.set(newCellKey, formula);
1540
+ this.updateDependencies(newCellKey, formula);
1541
+ this.setCellContentWithoutDependencyUpdate(newCell, formula);
1542
+ }
1543
+ for (const { cell, newFormula } of adjustedFormulas) {
1544
+ const cellKey = this.getCellKey(cell);
1545
+ this.formulaCells.set(cellKey, newFormula);
1546
+ this.updateDependencies(cellKey, newFormula);
1547
+ this.setCellContentWithoutDependencyUpdate(cell, newFormula);
1548
+ }
1549
+ const totalChanges = adjustedFormulas.length + movedFormulas.length;
1550
+ if (totalChanges > 0) {
1551
+ }
1552
+ const adjustedCells = adjustedFormulas.map(item => item.cell);
1553
+ const movedCells = movedFormulas.map(item => item.newCell);
1554
+ return { adjustedCells, movedCells };
1555
+ }
1556
+ catch (error) {
1557
+ return { adjustedCells: [], movedCells: [] };
1558
+ }
1559
+ }
1560
+ adjustFormulaReference(formula, type, dimension, index, count) {
1561
+ if (!formula || !formula.startsWith('=')) {
1562
+ return formula;
1563
+ }
1564
+ const expression = formula.substring(1);
1565
+ const cellRefRegex = /([A-Z]+)([0-9]+)/g;
1566
+ const rangeRefRegex = /([A-Z]+[0-9]+):([A-Z]+[0-9]+)/g;
1567
+ let newExpression = expression;
1568
+ let match;
1569
+ const replacements = [];
1570
+ while ((match = rangeRefRegex.exec(expression)) !== null) {
1571
+ const fullRangeMatch = match[0];
1572
+ const startCell = match[1];
1573
+ const endCell = match[2];
1574
+ if (type === 'delete') {
1575
+ const rangeContainsDeletedCells = this.rangeContainsDeletedCells(startCell, endCell, dimension, index, count);
1576
+ if (rangeContainsDeletedCells) {
1577
+ const newRange = this.adjustRangeForDeletion(startCell, endCell, dimension, index, count);
1578
+ if (newRange !== fullRangeMatch) {
1579
+ replacements.push({
1580
+ start: match.index,
1581
+ end: match.index + fullRangeMatch.length,
1582
+ replacement: newRange
1583
+ });
1584
+ }
1585
+ }
1586
+ }
1587
+ }
1588
+ cellRefRegex.lastIndex = 0;
1589
+ while ((match = cellRefRegex.exec(expression)) !== null) {
1590
+ const fullMatch = match[0];
1591
+ const colLetters = match[1];
1592
+ const rowNumber = parseInt(match[2], 10);
1593
+ const currentMatchIndex = match.index;
1594
+ const isPartOfRange = replacements.some(replacement => currentMatchIndex >= replacement.start && currentMatchIndex < replacement.end);
1595
+ if (isPartOfRange) {
1596
+ continue;
1597
+ }
1598
+ let needsAdjustment = false;
1599
+ let newRowNumber = rowNumber;
1600
+ let newColLetters = colLetters;
1601
+ if (dimension === 'row') {
1602
+ const zeroBasedRowNumber = rowNumber - 1;
1603
+ if (type === 'insert' && zeroBasedRowNumber >= index) {
1604
+ newRowNumber = rowNumber + count;
1605
+ needsAdjustment = true;
1606
+ }
1607
+ else if (type === 'delete' && zeroBasedRowNumber >= index) {
1608
+ if (zeroBasedRowNumber >= index + count) {
1609
+ newRowNumber = rowNumber - count;
1610
+ needsAdjustment = true;
1611
+ }
1612
+ else if (zeroBasedRowNumber >= index && zeroBasedRowNumber < index + count) {
1613
+ newRowNumber = index;
1614
+ needsAdjustment = true;
1615
+ }
1616
+ }
1617
+ }
1618
+ else if (dimension === 'column') {
1619
+ const colIndex = this.columnLettersToIndex(colLetters);
1620
+ if (type === 'insert' && colIndex >= index) {
1621
+ newColLetters = this.indexToColumnLetters(colIndex + count);
1622
+ needsAdjustment = true;
1623
+ }
1624
+ else if (type === 'delete' && colIndex >= index) {
1625
+ if (colIndex >= index + count) {
1626
+ newColLetters = this.indexToColumnLetters(colIndex - count);
1627
+ needsAdjustment = true;
1628
+ }
1629
+ else if (colIndex >= index && colIndex < index + count) {
1630
+ newColLetters = this.indexToColumnLetters(index);
1631
+ needsAdjustment = true;
1632
+ }
1633
+ }
1634
+ }
1635
+ if (needsAdjustment) {
1636
+ let replacement;
1637
+ if (dimension === 'row' && newRowNumber === index) {
1638
+ replacement = '#REF!';
1639
+ }
1640
+ else if (dimension === 'column' &&
1641
+ this.indexToColumnLetters(this.columnLettersToIndex(newColLetters)) === this.indexToColumnLetters(index)) {
1642
+ replacement = '#REF!';
1643
+ }
1644
+ else {
1645
+ replacement = newColLetters + newRowNumber;
1646
+ }
1647
+ replacements.push({
1648
+ start: match.index,
1649
+ end: match.index + fullMatch.length,
1650
+ replacement: replacement
1651
+ });
1652
+ }
1653
+ }
1654
+ replacements.sort((a, b) => b.start - a.start);
1655
+ for (const { start, end, replacement } of replacements) {
1656
+ newExpression = newExpression.substring(0, start) + replacement + newExpression.substring(end);
1657
+ }
1658
+ return '=' + newExpression;
1659
+ }
1660
+ columnLettersToIndex(letters) {
1661
+ let index = 0;
1662
+ for (let i = 0; i < letters.length; i++) {
1663
+ index = index * 26 + (letters.charCodeAt(i) - 64);
1664
+ }
1665
+ return index - 1;
1666
+ }
1667
+ indexToColumnLetters(index) {
1668
+ let letters = '';
1669
+ do {
1670
+ letters = String.fromCharCode(65 + (index % 26)) + letters;
1671
+ index = Math.floor(index / 26) - 1;
1672
+ } while (index >= 0);
1673
+ return letters;
1674
+ }
1675
+ rangeContainsDeletedCells(startCell, endCell, dimension, index, count) {
1676
+ try {
1677
+ const start = this.parseA1Notation(startCell);
1678
+ const end = this.parseA1Notation(endCell);
1679
+ const minRow = Math.min(start.row, end.row);
1680
+ const maxRow = Math.max(start.row, end.row);
1681
+ const minCol = Math.min(start.col, end.col);
1682
+ const maxCol = Math.max(start.col, end.col);
1683
+ if (dimension === 'row') {
1684
+ const deleteStartRow = index;
1685
+ const deleteEndRow = index + count - 1;
1686
+ if (deleteEndRow >= minRow && deleteStartRow <= maxRow) {
1687
+ return true;
1688
+ }
1689
+ }
1690
+ else if (dimension === 'column') {
1691
+ const deleteStartCol = index;
1692
+ const deleteEndCol = index + count - 1;
1693
+ if (deleteEndCol >= minCol && deleteStartCol <= maxCol) {
1694
+ return true;
1695
+ }
1696
+ }
1697
+ return false;
1698
+ }
1699
+ catch {
1700
+ return false;
1701
+ }
1702
+ }
1703
+ adjustRangeForDeletion(startCell, endCell, dimension, index, count) {
1704
+ try {
1705
+ const start = this.parseA1Notation(startCell);
1706
+ const end = this.parseA1Notation(endCell);
1707
+ const minRow = Math.min(start.row, end.row);
1708
+ const maxRow = Math.max(start.row, end.row);
1709
+ const minCol = Math.min(start.col, end.col);
1710
+ const maxCol = Math.max(start.col, end.col);
1711
+ let newMinRow = minRow;
1712
+ let newMaxRow = maxRow;
1713
+ let newMinCol = minCol;
1714
+ let newMaxCol = maxCol;
1715
+ if (dimension === 'row') {
1716
+ const deleteStartRow = index;
1717
+ const deleteEndRow = index + count - 1;
1718
+ if (minRow >= deleteStartRow && minRow <= deleteEndRow) {
1719
+ newMinRow = deleteStartRow > 0 ? deleteStartRow - 1 : 0;
1720
+ }
1721
+ else if (minRow > deleteEndRow) {
1722
+ newMinRow = minRow - count;
1723
+ if (newMinRow < 0) {
1724
+ newMinRow = 0;
1725
+ }
1726
+ }
1727
+ if (maxRow >= deleteStartRow && maxRow <= deleteEndRow) {
1728
+ newMaxRow = deleteStartRow > 0 ? deleteStartRow - 1 : 0;
1729
+ }
1730
+ else if (maxRow > deleteEndRow) {
1731
+ newMaxRow = maxRow - count;
1732
+ if (newMaxRow < 0) {
1733
+ newMaxRow = 0;
1734
+ }
1735
+ }
1736
+ if (newMinRow > newMaxRow) {
1737
+ return '#REF!';
1738
+ }
1739
+ }
1740
+ else if (dimension === 'column') {
1741
+ const deleteStartCol = index;
1742
+ const deleteEndCol = index + count - 1;
1743
+ if (minCol >= deleteStartCol && minCol <= deleteEndCol) {
1744
+ newMinCol = deleteStartCol > 0 ? deleteStartCol - 1 : 0;
1745
+ }
1746
+ else if (minCol > deleteEndCol) {
1747
+ newMinCol = minCol - count;
1748
+ if (newMinCol < 0) {
1749
+ newMinCol = 0;
1750
+ }
1751
+ }
1752
+ if (maxCol >= deleteStartCol && maxCol <= deleteEndCol) {
1753
+ newMaxCol = deleteStartCol > 0 ? deleteStartCol - 1 : 0;
1754
+ }
1755
+ else if (maxCol > deleteEndCol) {
1756
+ newMaxCol = maxCol - count;
1757
+ if (newMaxCol < 0) {
1758
+ newMaxCol = 0;
1759
+ }
1760
+ }
1761
+ if (newMinCol > newMaxCol) {
1762
+ return '#REF!';
1763
+ }
1764
+ if (newMinCol === -1 || newMaxCol === -1) {
1765
+ return '#REF!';
1766
+ }
1767
+ }
1768
+ if ((dimension === 'row' && newMinRow === -1 && newMaxRow === -1) ||
1769
+ (dimension === 'column' && newMinCol === -1 && newMaxCol === -1)) {
1770
+ return '#REF!';
1771
+ }
1772
+ let newStartCell;
1773
+ let newEndCell;
1774
+ if (dimension === 'row') {
1775
+ if (newMinRow === -1) {
1776
+ newStartCell = '#REF!';
1777
+ }
1778
+ else {
1779
+ newStartCell = this.getA1Notation(newMinRow, newMinCol);
1780
+ }
1781
+ if (newMaxRow === -1) {
1782
+ newEndCell = '#REF!';
1783
+ }
1784
+ else {
1785
+ newEndCell = this.getA1Notation(newMaxRow, newMaxCol);
1786
+ }
1787
+ }
1788
+ else {
1789
+ if (newMinCol === -1) {
1790
+ newStartCell = '#REF!';
1791
+ }
1792
+ else {
1793
+ newStartCell = this.getA1Notation(newMinRow, newMinCol);
1794
+ }
1795
+ if (newMaxCol === -1) {
1796
+ newEndCell = '#REF!';
1797
+ }
1798
+ else {
1799
+ newEndCell = this.getA1Notation(newMaxRow, newMaxCol);
1800
+ }
1801
+ }
1802
+ if (newStartCell === newEndCell) {
1803
+ return newStartCell;
1804
+ }
1805
+ return `${newStartCell}:${newEndCell}`;
1806
+ }
1807
+ catch {
1808
+ return '#REF!';
1809
+ }
1810
+ }
1408
1811
  }
1409
1812
  class FormulaError {
1410
1813
  message;
1411
- constructor(message) {
1814
+ type;
1815
+ constructor(message, type = 'VALUE') {
1412
1816
  this.message = message;
1817
+ this.type = type;
1413
1818
  }
1414
1819
  }
1415
1820
 
@@ -37668,6 +38073,8 @@
37668
38073
  AFTER_RENDER: "after_render",
37669
38074
  INITIALIZED: "initialized",
37670
38075
  UPDATED: "updated",
38076
+ AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
38077
+ AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
37671
38078
  CHANGE_CELL_VALUE: "change_cell_value",
37672
38079
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
37673
38080
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
@@ -37677,7 +38084,12 @@
37677
38084
  BUTTON_CLICK: "button_click",
37678
38085
  BEFORE_CACHE_CHART_IMAGE: "before_cache_chart_image",
37679
38086
  PASTED_DATA: "pasted_data",
37680
- PLUGIN_EVENT: "plugin_event"
38087
+ PLUGIN_EVENT: "plugin_event",
38088
+ ADD_RECORD: "add_record",
38089
+ DELETE_RECORD: "delete_record",
38090
+ UPDATE_RECORD: "update_record",
38091
+ ADD_COLUMN: "add_column",
38092
+ DELETE_COLUMN: "delete_column"
37681
38093
  };
37682
38094
 
37683
38095
  const judgeType = value => {
@@ -41443,7 +41855,7 @@
41443
41855
  }
41444
41856
  constructor(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
41445
41857
  let _isGrouped;
41446
- isArray$a(null == dataConfig ? void 0 : dataConfig.groupByRules) && (rowHierarchyType = "tree", _isGrouped = !0), super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel), this._isGrouped = _isGrouped, this._recordCache = [], this._fieldCache = {};
41858
+ isArray$a(null == dataConfig ? void 0 : dataConfig.groupByRules) && (_isGrouped = !0), super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel), this._isGrouped = _isGrouped, this._recordCache = [], this._fieldCache = {};
41447
41859
  }
41448
41860
  getOriginalRecord(index) {
41449
41861
  return isNumber$4(index) && this._recordCache && this._recordCache[index] ? this._recordCache[index] : super.getOriginalRecord(index);
@@ -42059,9 +42471,13 @@
42059
42471
  })];
42060
42472
  }
42061
42473
  function _setRecords(table, records = []) {
42474
+ const tableWithPlugins = table;
42062
42475
  _dealWithUpdateDataSource(table, () => {
42476
+ var _a;
42063
42477
  table.internalProps.records = records;
42064
- const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table));
42478
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42479
+ isArray$a(null === (_a = table.internalProps.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) && (rowHierarchyType = "tree"), tableWithPlugins.pluginManager.getPluginByName("Master Detail Plugin") && (rowHierarchyType = "grid");
42480
+ const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
42065
42481
  table.addReleaseObj(newDataSource);
42066
42482
  });
42067
42483
  }
@@ -43553,14 +43969,28 @@
43553
43969
  } else "mark" === child.name && child.setAttribute("x", cellGroup.attribute.width);
43554
43970
  }), autoRowHeight) {
43555
43971
  let newHeight = Math.max(leftIconHeight, contentHeight, rightIconHeight);
43556
- if (isCellHeightUpdate(scene, cellGroup, Math.round(newHeight + padding[0] + padding[2]), oldCellHeight)) return !0;
43972
+ if (isCellHeightUpdate(scene, cellGroup, Math.round(newHeight + padding[0] + padding[2]), oldCellHeight)) return scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) && scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
43973
+ col: cellGroup.col,
43974
+ row: cellGroup.row,
43975
+ cellHeight: cellHeight,
43976
+ cellGroup: cellGroup,
43977
+ padding: padding,
43978
+ textBaseline: textBaseline
43979
+ }), !0;
43557
43980
  newHeight = (null !== (_d = cellGroup.contentHeight) && void 0 !== _d ? _d : cellHeight) - (padding[0] + padding[2]), cellGroup.forEachChildren(child => {
43558
43981
  "rect" !== child.type && "chart" !== child.type && child.name !== CUSTOM_CONTAINER_NAME && ("mark" === child.name ? child.setAttribute("y", 0) : "middle" === textBaseline ? child.setAttribute("y", padding[0] + (newHeight - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", padding[0] + newHeight - child.AABBBounds.height()) : child.setAttribute("y", padding[0]));
43559
43982
  });
43560
43983
  } else "middle" !== textBaseline && "bottom" !== textBaseline || cellGroup.forEachChildren(child => {
43561
43984
  "rect" !== child.type && "chart" !== child.type && child.name !== CUSTOM_CONTAINER_NAME && ("mark" === child.name ? child.setAttribute("y", 0) : "middle" === textBaseline ? child.setAttribute("y", (cellHeight - padding[2] + padding[0] - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", cellHeight - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]));
43562
43985
  });
43563
- return !1;
43986
+ return scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) && scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
43987
+ col: cellGroup.col,
43988
+ row: cellGroup.row,
43989
+ cellHeight: cellHeight,
43990
+ cellGroup: cellGroup,
43991
+ padding: padding,
43992
+ textBaseline: textBaseline
43993
+ }), !1;
43564
43994
  }
43565
43995
  function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline, table) {
43566
43996
  var _a;
@@ -49157,7 +49587,8 @@
49157
49587
  } else if (this.rowEnd === this.bodyBottomRow) {
49158
49588
  const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, this.rowEnd, !0);
49159
49589
  if ("cell" === cellGroup.role) {
49160
- const deltaY = cellGroup.attribute.y + cellGroup.attribute.height - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
49590
+ const actualRowHeight = this.table.getRowHeight(this.rowEnd),
49591
+ deltaY = cellGroup.attribute.y + actualRowHeight - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
49161
49592
  this.deltaY = -deltaY;
49162
49593
  }
49163
49594
  } else if (isValid$4(screenTopY) && isValid$4(screenTopRow)) {
@@ -49298,6 +49729,11 @@
49298
49729
  width: colsWidth,
49299
49730
  height: rowsHeight,
49300
49731
  visible: !0
49732
+ }), table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT) && table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT, {
49733
+ startRow: computeRectCellRangeStartRow,
49734
+ endRow: computeRectCellRangeEndRow,
49735
+ currentHeight: rowsHeight,
49736
+ selectComp: selectComp
49301
49737
  }), selectComp.fillhandle) {
49302
49738
  const fillHandle = null === (_a = scene.table.options.excelOptions) || void 0 === _a ? void 0 : _a.fillHandle;
49303
49739
  let lastCellBound,
@@ -51327,7 +51763,7 @@
51327
51763
  var _a, _b, _c, _d, _e, _f;
51328
51764
  const firstBodyCell = null !== (_b = null === (_a = this.bodyGroup.firstChild) || void 0 === _a ? void 0 : _a.firstChild) && void 0 !== _b ? _b : null === (_c = this.rowHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.firstChild,
51329
51765
  lastBodyCell = null !== (_e = null === (_d = this.bodyGroup.firstChild) || void 0 === _d ? void 0 : _d.lastChild) && void 0 !== _e ? _e : null === (_f = this.rowHeaderGroup.firstChild) || void 0 === _f ? void 0 : _f.lastChild;
51330
- 0 === y && firstBodyCell && firstBodyCell.row === this.table.frozenRowCount && firstBodyCell.attribute.y + y < 0 ? y = -firstBodyCell.attribute.y : lastBodyCell && this.table.tableNoFrameHeight < this.table.getAllRowsHeight() && lastBodyCell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 && lastBodyCell.attribute.y + lastBodyCell.attribute.height + y < this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() && (y = this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() - lastBodyCell.attribute.y - lastBodyCell.attribute.height), this.colHeaderGroup.attribute.height + y !== this.bodyGroup.attribute.y && (this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height + y), this.table.rightFrozenColCount > 0 && this.rightFrozenGroup.setAttribute("y", this.rightTopCornerGroup.attribute.height + y), this.updateNextFrame());
51766
+ 0 === y && firstBodyCell && firstBodyCell.row === this.table.frozenRowCount && firstBodyCell.attribute.y + y < 0 ? y = -firstBodyCell.attribute.y : lastBodyCell && this.table.tableNoFrameHeight < this.table.getAllRowsHeight() && lastBodyCell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 && lastBodyCell.attribute.y + this.table.getRowHeight(lastBodyCell.row) + y < this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() && (y = this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() - lastBodyCell.attribute.y - this.table.getRowHeight(lastBodyCell.row)), this.colHeaderGroup.attribute.height + y !== this.bodyGroup.attribute.y && (this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height + y), this.table.rightFrozenColCount > 0 && this.rightFrozenGroup.setAttribute("y", this.rightTopCornerGroup.attribute.height + y), this.updateNextFrame());
51331
51767
  }
51332
51768
  setBodyAndColHeaderX(x) {
51333
51769
  const firstBodyCol = this.bodyGroup.firstChild,
@@ -54329,8 +54765,9 @@
54329
54765
  (null === (_b = table.options.customConfig) || void 0 === _b ? void 0 : _b.cancelSelectCellHook) ? (null === (_c = table.options.customConfig) || void 0 === _c ? void 0 : _c.cancelSelectCellHook(e)) && eventManager.dealTableSelect() : (null === (_e = null === (_d = table.options.select) || void 0 === _d ? void 0 : _d.blankAreaClickDeselect) || void 0 === _e || _e) && eventManager.dealTableSelect(), stateManager.endSelectCells(!0, isHasSelected), stateManager.updateCursor(), table.scenegraph.updateChartState(null);
54330
54766
  }
54331
54767
  }), table.scenegraph.stage.addEventListener("pointermove", e => {
54768
+ var _a, _b, _c;
54332
54769
  const eventArgsSet = getCellEventArgsSet(e);
54333
- stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("col-resize") : stateManager.isResizeRow() || eventManager.checkRowResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("row-resize") : stateManager.isMoveCol() || stateManager.updateCursor();
54770
+ null !== (_c = null === (_b = null === (_a = e.target) || void 0 === _a ? void 0 : _a.isDescendantsOf) || void 0 === _b ? void 0 : _b.call(_a, table.scenegraph.tableGroup)) && void 0 !== _c && _c && (stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("col-resize") : stateManager.isResizeRow() || eventManager.checkRowResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("row-resize") : stateManager.isMoveCol() || stateManager.updateCursor());
54334
54771
  }), table.scenegraph.tableGroup.addEventListener("checkbox_state_change", e => {
54335
54772
  var _a, _b;
54336
54773
  const eventArgsSet = getCellEventArgsSet(e),
@@ -58351,7 +58788,7 @@
58351
58788
  }
58352
58789
  constructor(container, options = {}) {
58353
58790
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
58354
- if (super(), this.showFrozenIcon = !0, this.version = "1.21.1-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
58791
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
58355
58792
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
58356
58793
  options: options,
58357
58794
  container: container
@@ -63006,140 +63443,152 @@
63006
63443
  }
63007
63444
  function listTableAddRecord(record, recordIndex, table) {
63008
63445
  var _a, _b, _c, _d;
63009
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63010
- (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
63011
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63012
- table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
63013
- const oldRowCount = table.rowCount;
63014
- if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
63015
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
63016
- if (table.pagination) {
63017
- const {
63018
- perPageCount: perPageCount,
63019
- currentPage: currentPage
63020
- } = table.pagination,
63021
- endIndex = perPageCount * (currentPage || 0) + perPageCount;
63022
- if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63023
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63024
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
63025
- const updateRows = [];
63026
- for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63027
- col: row,
63028
- row: 0
63029
- }) : updateRows.push({
63030
- col: 0,
63031
- row: row
63032
- });
63033
- table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63034
- } else {
63035
- const addRows = [];
63036
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
63037
- col: row,
63038
- row: 0
63039
- }) : addRows.push({
63040
- col: 0,
63041
- row: row
63042
- });
63043
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63446
+ try {
63447
+ if (!record) return !1;
63448
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63449
+ (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
63450
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63451
+ table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
63452
+ const oldRowCount = table.rowCount;
63453
+ if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
63454
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
63455
+ if (table.pagination) {
63456
+ const {
63457
+ perPageCount: perPageCount,
63458
+ currentPage: currentPage
63459
+ } = table.pagination,
63460
+ endIndex = perPageCount * (currentPage || 0) + perPageCount;
63461
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63462
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63463
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
63464
+ const updateRows = [];
63465
+ for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63466
+ col: row,
63467
+ row: 0
63468
+ }) : updateRows.push({
63469
+ col: 0,
63470
+ row: row
63471
+ });
63472
+ table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63473
+ } else {
63474
+ const addRows = [];
63475
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
63476
+ col: row,
63477
+ row: 0
63478
+ }) : addRows.push({
63479
+ col: 0,
63480
+ row: row
63481
+ });
63482
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63483
+ }
63044
63484
  }
63485
+ } else {
63486
+ const addRows = [];
63487
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
63488
+ col: row,
63489
+ row: 0
63490
+ }) : addRows.push({
63491
+ col: 0,
63492
+ row: row
63493
+ });
63494
+ const updateRows = [],
63495
+ topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63496
+ bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
63497
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63498
+ col: row,
63499
+ row: 0
63500
+ }) : updateRows.push({
63501
+ col: 0,
63502
+ row: row
63503
+ });
63504
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63505
+ col: row,
63506
+ row: 0
63507
+ }) : updateRows.push({
63508
+ col: 0,
63509
+ row: row
63510
+ });
63511
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63045
63512
  }
63046
- } else {
63047
- const addRows = [];
63048
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
63049
- col: row,
63050
- row: 0
63051
- }) : addRows.push({
63052
- col: 0,
63053
- row: row
63054
- });
63055
- const updateRows = [],
63056
- topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63057
- bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
63058
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63059
- col: row,
63060
- row: 0
63061
- }) : updateRows.push({
63062
- col: 0,
63063
- row: row
63064
- });
63065
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63066
- col: row,
63067
- row: 0
63068
- }) : updateRows.push({
63069
- col: 0,
63070
- row: row
63071
- });
63072
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63073
63513
  }
63514
+ return !0;
63515
+ } catch (error) {
63516
+ return !1;
63074
63517
  }
63075
63518
  }
63076
63519
  function listTableAddRecords(records, recordIndex, table) {
63077
63520
  var _a, _b, _c, _d;
63078
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63079
- void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
63080
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63081
- table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
63082
- const oldRowCount = table.transpose ? table.colCount : table.rowCount;
63083
- if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
63084
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
63085
- if (table.pagination) {
63086
- const {
63087
- perPageCount: perPageCount,
63088
- currentPage: currentPage
63089
- } = table.pagination,
63090
- endIndex = perPageCount * (currentPage || 0) + perPageCount;
63091
- if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63092
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63093
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
63094
- const updateRows = [];
63095
- for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63096
- col: row,
63097
- row: 0
63098
- }) : updateRows.push({
63099
- col: 0,
63100
- row: row
63101
- });
63102
- table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63103
- } else {
63104
- const addRows = [];
63105
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
63106
- col: row,
63107
- row: 0
63108
- }) : addRows.push({
63109
- col: 0,
63110
- row: row
63111
- });
63112
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63521
+ try {
63522
+ if (!records || 0 === records.length) return !1;
63523
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63524
+ void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
63525
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63526
+ table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
63527
+ const oldRowCount = table.transpose ? table.colCount : table.rowCount;
63528
+ if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
63529
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
63530
+ if (table.pagination) {
63531
+ const {
63532
+ perPageCount: perPageCount,
63533
+ currentPage: currentPage
63534
+ } = table.pagination,
63535
+ endIndex = perPageCount * (currentPage || 0) + perPageCount;
63536
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63537
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63538
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
63539
+ const updateRows = [];
63540
+ for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63541
+ col: row,
63542
+ row: 0
63543
+ }) : updateRows.push({
63544
+ col: 0,
63545
+ row: row
63546
+ });
63547
+ table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63548
+ } else {
63549
+ const addRows = [];
63550
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
63551
+ col: row,
63552
+ row: 0
63553
+ }) : addRows.push({
63554
+ col: 0,
63555
+ row: row
63556
+ });
63557
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63558
+ }
63113
63559
  }
63560
+ } else {
63561
+ const addRows = [];
63562
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
63563
+ col: row,
63564
+ row: 0
63565
+ }) : addRows.push({
63566
+ col: 0,
63567
+ row: row
63568
+ });
63569
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63570
+ bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount,
63571
+ updateRows = [];
63572
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63573
+ col: row,
63574
+ row: 0
63575
+ }) : updateRows.push({
63576
+ col: 0,
63577
+ row: row
63578
+ });
63579
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63580
+ col: row,
63581
+ row: 0
63582
+ }) : updateRows.push({
63583
+ col: 0,
63584
+ row: row
63585
+ });
63586
+ table.transpose ? table.scenegraph.updateCol([], addRows, updateRows) : table.scenegraph.updateRow([], addRows, updateRows);
63114
63587
  }
63115
- } else {
63116
- const addRows = [];
63117
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
63118
- col: row,
63119
- row: 0
63120
- }) : addRows.push({
63121
- col: 0,
63122
- row: row
63123
- });
63124
- const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63125
- bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount,
63126
- updateRows = [];
63127
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63128
- col: row,
63129
- row: 0
63130
- }) : updateRows.push({
63131
- col: 0,
63132
- row: row
63133
- });
63134
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63135
- col: row,
63136
- row: 0
63137
- }) : updateRows.push({
63138
- col: 0,
63139
- row: row
63140
- });
63141
- table.transpose ? table.scenegraph.updateCol([], addRows, updateRows) : table.scenegraph.updateRow([], addRows, updateRows);
63142
63588
  }
63589
+ return !0;
63590
+ } catch (error) {
63591
+ return !1;
63143
63592
  }
63144
63593
  }
63145
63594
  function listTableDeleteRecords(recordIndexs, table) {
@@ -63549,21 +63998,33 @@
63549
63998
  };
63550
63999
  this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
63551
64000
  }
63552
- addColumn(column, colIndex, isMaintainArrayData = !0) {
64001
+ addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
63553
64002
  const columns = this.options.columns;
63554
- if (void 0 === colIndex) columns.push(column);else {
63555
- if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) "number" == typeof columns[i].field && columns[i].field >= colIndex && (columns[i].field = columns[i].field + 1);
63556
- columns.splice(colIndex, 0, column);
63557
- }
63558
- if (isMaintainArrayData) for (let i = 0; i < this.records.length; i++) {
63559
- const record = this.records[i];
63560
- Array.isArray(record) && record.splice(colIndex, 0, void 0);
64003
+ if (void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns), isMaintainArrayData) {
64004
+ for (let i = 0; i < columns.length; i++) columns[i].field = i;
64005
+ for (let i = 0; i < this.records.length; i++) {
64006
+ const record = this.records[i];
64007
+ Array.isArray(record) && record.splice(colIndex, 0, ...Array(toAddColumns.length).fill(void 0));
64008
+ }
63561
64009
  }
63562
- this.updateColumns(columns);
64010
+ this.updateColumns(columns), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
64011
+ columnIndex: colIndex,
64012
+ columnCount: toAddColumns.length,
64013
+ columns: columns
64014
+ });
63563
64015
  }
63564
- deleteColumn(colIndex) {
64016
+ deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
63565
64017
  const columns = this.options.columns;
63566
- columns.splice(colIndex, 1), this.updateColumns(columns);
64018
+ deleteColIndexs.sort((a, b) => b - a);
64019
+ for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
64020
+ const record = this.records[j];
64021
+ Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
64022
+ }
64023
+ if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) columns[i].field = i;
64024
+ this.updateColumns(columns), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
64025
+ deleteColIndexs: deleteColIndexs,
64026
+ columns: columns
64027
+ });
63567
64028
  }
63568
64029
  get columns() {
63569
64030
  return this.internalProps.layoutMap.columnTree.getCopiedTree();
@@ -63965,6 +64426,9 @@
63965
64426
  updateFilterRules(filterRules) {
63966
64427
  this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(), this.resize();
63967
64428
  }
64429
+ getFilteredRecords() {
64430
+ return this.dataSource.records;
64431
+ }
63968
64432
  getCheckboxState(field) {
63969
64433
  if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount && this.stateManager.initLeftRecordsCheckState(this.records), isValid$4(field)) {
63970
64434
  let stateArr = Array.from(this.stateManager.checkedState.keys()).sort((a, b) => {
@@ -64104,18 +64568,39 @@
64104
64568
  }
64105
64569
  addRecord(record, recordIndex) {
64106
64570
  var _a;
64107
- listTableAddRecord(record, recordIndex, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
64571
+ const success = listTableAddRecord(record, recordIndex, this);
64572
+ null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
64573
+ records: [record],
64574
+ recordIndex: recordIndex,
64575
+ recordCount: 1
64576
+ });
64108
64577
  }
64109
64578
  addRecords(records, recordIndex) {
64110
64579
  var _a;
64111
- listTableAddRecords(records, recordIndex, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
64580
+ const success = listTableAddRecords(records, recordIndex, this);
64581
+ null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
64582
+ records: records,
64583
+ recordIndex: recordIndex,
64584
+ recordCount: records.length
64585
+ });
64112
64586
  }
64113
64587
  deleteRecords(recordIndexs) {
64114
64588
  var _a;
64115
64589
  listTableDeleteRecords(recordIndexs, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
64590
+ const rowIndexs = [];
64591
+ for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
64592
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
64593
+ recordIndexs: recordIndexs,
64594
+ rowIndexs: rowIndexs,
64595
+ deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
64596
+ });
64116
64597
  }
64117
64598
  updateRecords(records, recordIndexs) {
64118
- listTableUpdateRecords(records, recordIndexs, this);
64599
+ listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
64600
+ records: records,
64601
+ recordIndexs: recordIndexs,
64602
+ updateCount: records.length
64603
+ });
64119
64604
  }
64120
64605
  _hasCustomRenderOrLayout() {
64121
64606
  var _a, _b, _c, _d;
@@ -68329,7 +68814,7 @@
68329
68814
  }
68330
68815
 
68331
68816
  function createProgressBarCell(progressBarDefine, style, width, value, dataValue, col, row, padding, table, range) {
68332
- var _a, _b, _c, _d, _e;
68817
+ var _a, _b, _c, _d, _e, _f;
68333
68818
  if (progressBarDefine.dependField) {
68334
68819
  const dependField = getOrApply(progressBarDefine.dependField, {
68335
68820
  col: col,
@@ -68366,7 +68851,14 @@
68366
68851
  cellHeaderPaths: void 0
68367
68852
  })) && void 0 !== _e ? _e : min + 100;
68368
68853
  let height = 0;
68369
- height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row);
68854
+ if (height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row), table.pluginManager) {
68855
+ if (table.pluginManager.getPluginByName("Master Detail Plugin")) {
68856
+ const bodyRowIndex = row - table.columnHeaderLevelCount,
68857
+ internalProps = table.internalProps,
68858
+ originalHeight = null === (_f = null == internalProps ? void 0 : internalProps.originalRowHeights) || void 0 === _f ? void 0 : _f.get(bodyRowIndex);
68859
+ void 0 !== originalHeight && originalHeight > 0 && (height = originalHeight);
68860
+ }
68861
+ }
68370
68862
  let contentWidth = width,
68371
68863
  contentHeight = height,
68372
68864
  _contentOffset = 0;
@@ -69150,11 +69642,11 @@
69150
69642
  const isLeft = "left" === this.addIconForAddColumn.dataset.addIconType,
69151
69643
  col = (this.table.options.columns, this.hoverCell.col),
69152
69644
  addColIndex = isLeft ? col : col + 1;
69153
- this.pluginOptions.addColumnCallback ? this.pluginOptions.addColumnCallback(addColIndex, this.table) : this.table.addColumn({
69645
+ this.pluginOptions.addColumnCallback ? this.pluginOptions.addColumnCallback(addColIndex, this.table) : this.table.addColumns([{
69154
69646
  field: addColIndex,
69155
69647
  title: `New Column ${col}`,
69156
69648
  width: 100
69157
- }, addColIndex, !0), this.delayHideAllForAddColumn(0);
69649
+ }], addColIndex, !0), this.delayHideAllForAddColumn(0);
69158
69650
  });
69159
69651
  }
69160
69652
  showDotForAddColumn(top, left, right, isShowLeft = !0, isShowRight = !0) {
@@ -70852,14 +71344,22 @@
70852
71344
  if (void 0 !== rowIndex && "function" == typeof table.addRecord) for (let i = 0; i < count; i++) table.addRecord([], rowIndex + i);
70853
71345
  }
70854
71346
  handleInsertColumnLeft(table, colIndex, count = 1) {
70855
- if (void 0 !== colIndex && "function" == typeof table.addColumn) for (let i = 0; i < count; i++) table.addColumn({
70856
- field: colIndex
70857
- }, colIndex, !0);
71347
+ if (void 0 !== colIndex && "function" == typeof table.addColumns) {
71348
+ const toAddColumns = [];
71349
+ for (let i = 0; i < count; i++) toAddColumns.push({
71350
+ field: colIndex - i
71351
+ });
71352
+ table.addColumns(toAddColumns, colIndex, !0);
71353
+ }
70858
71354
  }
70859
71355
  handleInsertColumnRight(table, colIndex, count = 1) {
70860
- if (void 0 !== colIndex && "function" == typeof table.addColumn) for (let i = 0; i < count; i++) table.addColumn({
70861
- field: colIndex + 1
70862
- }, colIndex + 1, !0);
71356
+ if (void 0 !== colIndex && "function" == typeof table.addColumns) {
71357
+ const toAddColumns = [];
71358
+ for (let i = 0; i < count; i++) toAddColumns.push({
71359
+ field: colIndex + 1
71360
+ });
71361
+ table.addColumns(toAddColumns, colIndex + 1, !0);
71362
+ }
70863
71363
  }
70864
71364
  handleDeleteRow(table, rowIndex) {
70865
71365
  if (void 0 !== rowIndex && "function" == typeof table.deleteRecords) {
@@ -70877,15 +71377,14 @@
70877
71377
  }
70878
71378
  }
70879
71379
  handleDeleteColumn(table, colIndex) {
70880
- if (void 0 !== colIndex && "function" == typeof table.deleteColumn) {
71380
+ if (void 0 !== colIndex && "function" == typeof table.deleteColumns) {
70881
71381
  const selectRanges = table.stateManager.select.ranges,
70882
71382
  deleteColIndexs = [];
70883
71383
  for (let i = 0; i < selectRanges.length; i++) {
70884
71384
  const range = selectRanges[i];
70885
71385
  for (let j = range.start.col; j <= range.end.col; j++) deleteColIndexs.includes(j) || deleteColIndexs.push(j);
70886
71386
  }
70887
- deleteColIndexs.sort((a, b) => b - a);
70888
- for (let i = 0; i < deleteColIndexs.length; i++) table.deleteColumn(deleteColIndexs[i]);
71387
+ table.deleteColumns(deleteColIndexs, !0);
70889
71388
  }
70890
71389
  }
70891
71390
  handleHideColumn(table, colIndex) {
@@ -75222,7 +75721,7 @@
75222
75721
  return cell;
75223
75722
  }
75224
75723
  const num = Number(cell);
75225
- return !isNaN(num) ? num : cell;
75724
+ return !isNaN(num) && cell.trim() !== '' ? num : cell;
75226
75725
  }
75227
75726
  return cell ?? '';
75228
75727
  })
@@ -75355,17 +75854,81 @@
75355
75854
  throw new Error('Batch update failed');
75356
75855
  }
75357
75856
  }
75358
- addRows(_sheetKey, rowIndex, numberOfRows = 1) {
75857
+ addRows(sheetKey, rowIndex, numberOfRows = 1) {
75359
75858
  this.ensureInitialized();
75859
+ try {
75860
+ const { adjustedCells, movedCells } = this.formulaEngine.adjustFormulaReferences(sheetKey, 'insert', 'row', rowIndex, numberOfRows, this.sheet.getSheet(sheetKey).columnCount, this.sheet.getSheet(sheetKey).rowCount);
75861
+ [...adjustedCells, ...movedCells].forEach(cell => {
75862
+ const result = this.sheet.formulaManager.getCellValue({
75863
+ sheet: sheetKey,
75864
+ row: cell.row,
75865
+ col: cell.col
75866
+ });
75867
+ this.sheet
75868
+ .getActiveSheet()
75869
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
75870
+ });
75871
+ }
75872
+ catch (error) {
75873
+ throw new Error(`Failed to add ${numberOfRows} rows at index ${rowIndex}`);
75874
+ }
75360
75875
  }
75361
- removeRows(_sheetKey, rowIndex, numberOfRows = 1) {
75876
+ removeRows(sheetKey, rowIndex, numberOfRows = 1) {
75362
75877
  this.ensureInitialized();
75878
+ try {
75879
+ const { adjustedCells, movedCells } = this.formulaEngine.adjustFormulaReferences(sheetKey, 'delete', 'row', rowIndex, numberOfRows, this.sheet.getSheet(sheetKey).columnCount, this.sheet.getSheet(sheetKey).rowCount);
75880
+ [...adjustedCells, ...movedCells].forEach(cell => {
75881
+ const result = this.sheet.formulaManager.getCellValue({
75882
+ sheet: sheetKey,
75883
+ row: cell.row,
75884
+ col: cell.col
75885
+ });
75886
+ this.sheet
75887
+ .getActiveSheet()
75888
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
75889
+ });
75890
+ }
75891
+ catch (error) {
75892
+ throw new Error(`Failed to remove ${numberOfRows} rows at index ${rowIndex}`);
75893
+ }
75363
75894
  }
75364
- addColumns(_sheetKey, columnIndex, numberOfColumns = 1) {
75895
+ addColumns(sheetKey, columnIndex, numberOfColumns = 1) {
75365
75896
  this.ensureInitialized();
75897
+ try {
75898
+ const { adjustedCells, movedCells } = this.formulaEngine.adjustFormulaReferences(sheetKey, 'insert', 'column', columnIndex, numberOfColumns, this.sheet.getSheet(sheetKey).columnCount, this.sheet.getSheet(sheetKey).rowCount);
75899
+ [...adjustedCells, ...movedCells].forEach(cell => {
75900
+ const result = this.sheet.formulaManager.getCellValue({
75901
+ sheet: sheetKey,
75902
+ row: cell.row,
75903
+ col: cell.col
75904
+ });
75905
+ this.sheet
75906
+ .getActiveSheet()
75907
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
75908
+ });
75909
+ }
75910
+ catch (error) {
75911
+ throw new Error(`Failed to add ${numberOfColumns} columns at index ${columnIndex}`);
75912
+ }
75366
75913
  }
75367
- removeColumns(_sheetKey, columnIndex, numberOfColumns = 1) {
75914
+ removeColumns(sheetKey, columnIndex, numberOfColumns = 1) {
75368
75915
  this.ensureInitialized();
75916
+ try {
75917
+ const { adjustedCells, movedCells } = this.formulaEngine.adjustFormulaReferences(sheetKey, 'delete', 'column', columnIndex, numberOfColumns, this.sheet.getSheet(sheetKey).columnCount, this.sheet.getSheet(sheetKey).rowCount);
75918
+ [...adjustedCells, ...movedCells].forEach(cell => {
75919
+ const result = this.sheet.formulaManager.getCellValue({
75920
+ sheet: sheetKey,
75921
+ row: cell.row,
75922
+ col: cell.col
75923
+ });
75924
+ this.sheet
75925
+ .getActiveSheet()
75926
+ .tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
75927
+ });
75928
+ }
75929
+ catch (error) {
75930
+ throw new Error(`Failed to remove ${numberOfColumns} columns at index ${columnIndex}`);
75931
+ }
75369
75932
  }
75370
75933
  getSheetSerialized(sheetKey) {
75371
75934
  this.ensureInitialized();
@@ -75384,9 +75947,6 @@
75384
75947
  return Object.entries(formulas);
75385
75948
  }
75386
75949
  }
75387
- setSheetContent(sheetKey, _normalizedData) {
75388
- this.ensureInitialized();
75389
- }
75390
75950
  hasCircularReference() {
75391
75951
  try {
75392
75952
  return false;
@@ -76020,6 +76580,18 @@
76020
76580
  this.tableInstance.on('change_cell_value', (event) => {
76021
76581
  this.handleCellValueChanged(event);
76022
76582
  });
76583
+ this.tableInstance.on('add_record', (event) => {
76584
+ this.handleDataRecordsChanged('add', event);
76585
+ });
76586
+ this.tableInstance.on('delete_record', (event) => {
76587
+ this.handleDataRecordsChanged('delete', event);
76588
+ });
76589
+ this.tableInstance.on('add_column', (event) => {
76590
+ this.handleColumnsChanged('add', event);
76591
+ });
76592
+ this.tableInstance.on('delete_column', (event) => {
76593
+ this.handleColumnsChanged('delete', event);
76594
+ });
76023
76595
  this.tableInstance.on('click_cell', () => {
76024
76596
  this.element.classList.add('vtable-excel-cursor');
76025
76597
  });
@@ -76090,6 +76662,59 @@
76090
76662
  };
76091
76663
  this.fire(WorkSheetEventType.CELL_VALUE_CHANGED, cellValueChangedEvent);
76092
76664
  }
76665
+ handleDataRecordsChanged(type, event) {
76666
+ try {
76667
+ const sheetKey = this.getKey();
76668
+ const normalizedData = this.vtableSheet.formulaManager.normalizeSheetData(this.tableInstance.records, this.tableInstance);
76669
+ this.vtableSheet.formulaManager.formulaEngine.updateSheetData(sheetKey, normalizedData);
76670
+ if (type === 'add') {
76671
+ const { recordIndex, recordCount } = event;
76672
+ if (recordIndex !== undefined && recordCount > 0) {
76673
+ this.vtableSheet.formulaManager.addRows(sheetKey, recordIndex, recordCount);
76674
+ }
76675
+ else {
76676
+ const currentRowCount = this.getRowCount();
76677
+ this.vtableSheet.formulaManager.addRows(sheetKey, currentRowCount, recordCount);
76678
+ }
76679
+ }
76680
+ else if (type === 'delete') {
76681
+ const { rowIndexs, deletedCount } = event;
76682
+ if (rowIndexs && rowIndexs.length > 0) {
76683
+ const minIndex = Math.min(...rowIndexs.flat());
76684
+ this.vtableSheet.formulaManager.removeRows(sheetKey, minIndex, deletedCount);
76685
+ }
76686
+ }
76687
+ }
76688
+ catch (error) {
76689
+ }
76690
+ }
76691
+ handleColumnsChanged(type, event) {
76692
+ try {
76693
+ const sheetKey = this.getKey();
76694
+ const normalizedData = this.vtableSheet.formulaManager.normalizeSheetData(this.tableInstance.records, this.tableInstance);
76695
+ this.vtableSheet.formulaManager.formulaEngine.updateSheetData(sheetKey, normalizedData);
76696
+ if (type === 'add') {
76697
+ const { columnIndex, columnCount } = event;
76698
+ if (columnIndex !== undefined && columnCount > 0) {
76699
+ this.vtableSheet.formulaManager.addColumns(sheetKey, columnIndex, columnCount);
76700
+ }
76701
+ else {
76702
+ const currentColumnCount = this.getColumnCount();
76703
+ this.vtableSheet.formulaManager.addColumns(sheetKey, currentColumnCount, columnCount);
76704
+ }
76705
+ }
76706
+ else if (type === 'delete') {
76707
+ const { deleteColIndexs } = event;
76708
+ if (deleteColIndexs && deleteColIndexs.length > 0) {
76709
+ const minIndex = Math.min(...deleteColIndexs.flat());
76710
+ const deletedCount = deleteColIndexs.length;
76711
+ this.vtableSheet.formulaManager.removeColumns(sheetKey, minIndex, deletedCount);
76712
+ }
76713
+ }
76714
+ }
76715
+ catch (error) {
76716
+ }
76717
+ }
76093
76718
  fireEvent(eventName, eventData) {
76094
76719
  this.fire(eventName, eventData);
76095
76720
  }
@@ -76159,22 +76784,6 @@
76159
76784
  getCopiedData() {
76160
76785
  return this.getData().map(row => (Array.isArray(row) ? row.slice() : []));
76161
76786
  }
76162
- setData(data) {
76163
- this.options.data = data;
76164
- if (this.tableInstance) {
76165
- this.tableInstance.updateOption({
76166
- records: data
76167
- });
76168
- if (this.vtableSheet?.formulaManager) {
76169
- try {
76170
- const normalizedData = this.vtableSheet.formulaManager.normalizeSheetData(data, this.tableInstance);
76171
- this.vtableSheet.formulaManager.setSheetContent(this.sheetKey, normalizedData);
76172
- }
76173
- catch (e) {
76174
- }
76175
- }
76176
- }
76177
- }
76178
76787
  getCellValue(row, col) {
76179
76788
  if (this.tableInstance) {
76180
76789
  try {
@@ -79161,7 +79770,7 @@
79161
79770
  importStyle();
79162
79771
  }
79163
79772
 
79164
- const version = "1.21.1-alpha.0";
79773
+ const version = "1.22.0";
79165
79774
  importStyles();
79166
79775
 
79167
79776
  exports.TYPES = index;