@guiexpert/table 1.1.97 → 1.1.99

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 (110) hide show
  1. package/README.md +12 -0
  2. package/css/main.css +381 -27
  3. package/css/table-classes.css +33 -9
  4. package/css/table-clipboard.css +41 -0
  5. package/css/table-color-vars.css +56 -0
  6. package/css/table-fill-batch.css +9 -2
  7. package/css/table-master-detail.css +20 -0
  8. package/css/table-sheet-editing.css +149 -0
  9. package/css/table-spreadsheet.css +50 -0
  10. package/css/table-tree.css +23 -16
  11. package/index.cjs +54 -67
  12. package/index.d.ts +52 -0
  13. package/index.js +18968 -11475
  14. package/lib/table/action/action-id.type.d.ts +1 -1
  15. package/lib/table/action/shortcut.service.d.ts +9 -0
  16. package/lib/table/aria/aria-texts.d.ts +26 -0
  17. package/lib/table/aria/aria-texts.if.d.ts +196 -0
  18. package/lib/table/batch-edit/batch-edit-service.d.ts +22 -0
  19. package/lib/table/batch-edit/cell-change.if.d.ts +6 -2
  20. package/lib/table/batch-edit/pending-cell-changes.d.ts +7 -0
  21. package/lib/table/batch-edit/write-row-value.d.ts +14 -0
  22. package/lib/table/calc/column-values.d.ts +2 -0
  23. package/lib/table/clipboard/clipboard-html.d.ts +41 -0
  24. package/lib/table/clipboard/clipboard-keymap.d.ts +18 -0
  25. package/lib/table/clipboard/clipboard-options.d.ts +30 -0
  26. package/lib/table/clipboard/clipboard-options.if.d.ts +67 -0
  27. package/lib/table/clipboard/clipboard-service.d.ts +122 -0
  28. package/lib/table/clipboard/input-pipes.d.ts +59 -0
  29. package/lib/table/clipboard/paste-plan.d.ts +96 -0
  30. package/lib/table/clipboard/tsv.d.ts +31 -0
  31. package/lib/table/crud/crud-object-edit.d.ts +2 -0
  32. package/lib/table/crud/crud-object-view.d.ts +2 -0
  33. package/lib/table/crud/crud-table-model-factory.d.ts +2 -0
  34. package/lib/table/data/common/event/ge-edit-event.d.ts +46 -0
  35. package/lib/table/data/common/event/ge-row-drag-event.d.ts +2 -2
  36. package/lib/table/data/common/event/ge-undo-event.d.ts +29 -0
  37. package/lib/table/data/options/table-options.d.ts +34 -0
  38. package/lib/table/data/options/table-options.if.d.ts +116 -1
  39. package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +11 -2
  40. package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +14 -0
  41. package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +14 -0
  42. package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +11 -0
  43. package/lib/table/data/tablemodel/column/column-def.d.ts +13 -0
  44. package/lib/table/data/tablemodel/column/column-def.if.d.ts +36 -1
  45. package/lib/table/data/tablemodel/column/default-editable.d.ts +18 -0
  46. package/lib/table/ele-scope.d.ts +37 -0
  47. package/lib/table/event-adapter.d.ts +6 -0
  48. package/lib/table/event-listener-hub.d.ts +10 -0
  49. package/lib/table/event-listener.if.d.ts +16 -0
  50. package/lib/table/factory/pivot-factory.d.ts +1 -1
  51. package/lib/table/factory/row-group-factory.d.ts +1 -1
  52. package/lib/table/factory/table-factory.d.ts +14 -0
  53. package/lib/table/formula/formula-ast.if.d.ts +32 -2
  54. package/lib/table/formula/formula-error.d.ts +4 -2
  55. package/lib/table/formula/parser.d.ts +5 -2
  56. package/lib/table/formula/tokenizer.d.ts +5 -2
  57. package/lib/table/input-handler.d.ts +8 -0
  58. package/lib/table/master-detail/master-detail-service.d.ts +9 -0
  59. package/lib/table/render-scope.d.ts +40 -0
  60. package/lib/table/row-drag/row-drag-service.d.ts +3 -2
  61. package/lib/table/rtl/rtl-util.d.ts +126 -0
  62. package/lib/table/rtl/table-direction.type.d.ts +23 -0
  63. package/lib/table/selection/selection-service.d.ts +48 -0
  64. package/lib/table/service/convenience-dom.service.d.ts +49 -1
  65. package/lib/table/service/excel-export-options.if.d.ts +23 -0
  66. package/lib/table/service/excel-service.d.ts +12 -2
  67. package/lib/table/service/excel-service.if.d.ts +38 -1
  68. package/lib/table/sheet/cell-address.d.ts +100 -0
  69. package/lib/table/sheet/cell-formula-options.d.ts +27 -0
  70. package/lib/table/sheet/cell-formula-options.if.d.ts +27 -0
  71. package/lib/table/sheet/excel-formula.d.ts +20 -0
  72. package/lib/table/sheet/format-formula.d.ts +19 -0
  73. package/lib/table/sheet/sheet-cells.if.d.ts +17 -0
  74. package/lib/table/sheet/sheet-compiler.d.ts +47 -0
  75. package/lib/table/sheet/sheet-engine.d.ts +207 -0
  76. package/lib/table/sheet/sheet-function-info.d.ts +25 -0
  77. package/lib/table/sheet/sheet-functions.d.ts +27 -0
  78. package/lib/table/sheet/sheet-values.d.ts +154 -0
  79. package/lib/table/sheet/shift-formula.d.ts +71 -0
  80. package/lib/table/sheet/table-sheet.d.ts +214 -0
  81. package/lib/table/sheet-editing/cell-editor-service.d.ts +105 -0
  82. package/lib/table/sheet-editing/cell-editor.if.d.ts +110 -0
  83. package/lib/table/sheet-editing/editing-keymap.d.ts +17 -0
  84. package/lib/table/sheet-editing/editing-options.d.ts +34 -0
  85. package/lib/table/sheet-editing/editing-options.if.d.ts +49 -0
  86. package/lib/table/sheet-editing/editors/date-cell-editor.d.ts +23 -0
  87. package/lib/table/sheet-editing/editors/number-cell-editor.d.ts +18 -0
  88. package/lib/table/sheet-editing/editors/select-cell-editor.d.ts +36 -0
  89. package/lib/table/sheet-editing/editors/text-cell-editor.d.ts +35 -0
  90. package/lib/table/sheet-editing/formula-assist.d.ts +103 -0
  91. package/lib/table/sheet-editing/formula-text.d.ts +61 -0
  92. package/lib/table/sheet-editing/sheet-navigation.d.ts +26 -0
  93. package/lib/table/spreadsheet/area-model-sheet.d.ts +170 -0
  94. package/lib/table/spreadsheet/formula-bar.d.ts +53 -0
  95. package/lib/table/spreadsheet/spreadsheet-factory.d.ts +111 -0
  96. package/lib/table/spreadsheet/spreadsheet-options.if.d.ts +28 -0
  97. package/lib/table/spreadsheet/spreadsheet-preset.d.ts +37 -0
  98. package/lib/table/spreadsheet/structure-edit.d.ts +35 -0
  99. package/lib/table/table-api.d.ts +533 -4
  100. package/lib/table/table-scope.d.ts +299 -1
  101. package/lib/table/undo/cell-changes-undoable.d.ts +34 -0
  102. package/lib/table/undo/model-rows.d.ts +17 -0
  103. package/lib/table/undo/pending-changes-undoable.d.ts +35 -0
  104. package/lib/table/undo/undo-keymap.d.ts +17 -0
  105. package/lib/table/undo/undo-options.d.ts +26 -0
  106. package/lib/table/undo/undo-options.if.d.ts +30 -0
  107. package/lib/table/undo/undo-service.d.ts +103 -0
  108. package/lib/table/undo/undo-stack.d.ts +62 -0
  109. package/lib/table/undo/undoable.if.d.ts +36 -0
  110. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { ResolvedTableDirection } from './rtl/table-direction.type.js';
1
2
  import { GeOverlayKind } from './overlay/ge-overlay-kind.type.js';
2
3
  import { TableStateIf, TableStatePart } from './state/table-state.if.js';
3
4
  import { SortState } from './data/common/sort-state.type.js';
@@ -18,10 +19,14 @@ import { FormulaOptionsIf } from './formula/formula-options.if.js';
18
19
  import { FormulaError } from './formula/formula-error.js';
19
20
  import { RowDropTargetIf } from './row-drag/row-drop-target.if.js';
20
21
  import { CellChangeIf, CellChangeSource } from './batch-edit/cell-change.if.js';
22
+ import { GeUndoEvent } from './data/common/event/ge-undo-event.js';
21
23
  import { CellValueChangeIf } from './batch-edit/cell-value-change.if.js';
22
24
  import { FillDirection } from './fill/fill-direction.type.js';
23
25
  import { FillMode } from './fill/fill-series.js';
24
26
  import { CellRange } from './data/common/cell-range.js';
27
+ import { EventListenerIf } from './event-listener.if.js';
28
+ import { ExcelExportOptionsIf } from './service/excel-export-options.if.js';
29
+ import { SheetEngine } from './sheet/sheet-engine.js';
25
30
 
26
31
  /**
27
32
  * The public API of one table – everything you do with a table after it has been created:
@@ -52,6 +57,7 @@ import { CellRange } from './data/common/cell-range.js';
52
57
  * | columns | {@link autoResizeColumns}, {@link setColumnWidth}, {@link recalcColumnWidths}, {@link getColumnIndex} |
53
58
  * | tree | {@link expandAll}, {@link collapseAll}, {@link setRowExpanded} |
54
59
  * | state | {@link getState}, {@link applyState}, {@link resetState} (with {@link TableOptionsIf.autoRestoreOptions}) |
60
+ * | right-to-left | {@link getDirection} (with {@link TableOptionsIf.direction}) |
55
61
  * | lifecycle | {@link destroy} |
56
62
  *
57
63
  * @example
@@ -218,7 +224,8 @@ export declare class TableApi {
218
224
  * This method allows programmatic scrolling of the table viewport to exact pixel positions.
219
225
  * It delegates the scrolling operation to the underlying TableScope instance.
220
226
  *
221
- * @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0 (leftmost position).
227
+ * @param {number} px - The horizontal pixel coordinate to scroll to: px from the start of the row – 0 = the first
228
+ * column (leftmost position; right-to-left the rightmost, see {@link TableOptionsIf.direction}). Defaults to 0.
222
229
  * @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0 (topmost position).
223
230
  * @returns {void}
224
231
  *
@@ -233,7 +240,7 @@ export declare class TableApi {
233
240
  * @example
234
241
  * // Scroll only vertically, keeping the current horizontal position
235
242
  * // (an omitted or undefined px means 0; for rows use scrollToIndex(-1, rowIndex))
236
- * tableApi.scrollToPixel(tableApi.getTableScope().scrollViewport.scrollLeft, 300);
243
+ * tableApi.scrollToPixel(tableApi.getTableScope().getViewportScrollLeft(), 300);
237
244
  *
238
245
  * @example
239
246
  * // Example in a component that needs precise scrolling control
@@ -263,6 +270,23 @@ export declare class TableApi {
263
270
  * @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
264
271
  */
265
272
  scrollToPixel(px?: number, py?: number): void;
273
+ /**
274
+ * The writing direction of the table – {@link TableOptionsIf.direction} with `"auto"` already decided (from the page
275
+ * when the table was built).
276
+ *
277
+ * In `"rtl"` the first column is on the right; positions of the API stay "from the start": {@link scrollToPixel},
278
+ * {@link GeScrollEvent.scrollLeft} and the scroll part of {@link getState} count from the right edge.
279
+ *
280
+ * @returns {ResolvedTableDirection} `"ltr"` or `"rtl"`
281
+ *
282
+ * @example
283
+ * if (tableApi.getDirection() === "rtl") {
284
+ * console.info("first column on the right");
285
+ * }
286
+ *
287
+ * @since 1.1.98
288
+ */
289
+ getDirection(): ResolvedTableDirection;
266
290
  /**
267
291
  * Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
268
292
  *
@@ -819,8 +843,19 @@ export declare class TableApi {
819
843
  * @example
820
844
  * // Download table data with custom filename only
821
845
  * tableApi.downloadExcel('quarterly-data.xlsx');
846
+ *
847
+ * @example
848
+ * // cell formulas as Excel formulas (since 1.1.99, tableOptions.cellFormulas)
849
+ * tableApi.downloadExcel('budget.xlsx', '', { cellFormulas: true });
850
+ */
851
+ downloadExcel(fileName?: string, author?: string, exportOptions?: Partial<ExcelExportOptionsIf>): Promise<void>;
852
+ /**
853
+ * Where the data of a sheet start in the Excel file (rows above, columns in front) – `undefined` with a warning if
854
+ * the export is not the sheet: no cell formulas, a filter, sorting, a hidden data column or no formula support.
822
855
  */
823
- downloadExcel(fileName?: string, author?: string): Promise<void>;
856
+ private getExcelFormulaOffset;
857
+ /** A body cell with a cell formula as Excel formula cell (`undefined` for other cells). */
858
+ private getExcelFormulaCell;
824
859
  /** The value of a cell for the Excel export – the shown number in a row number column (body; footer empty). */
825
860
  private getExportValue;
826
861
  /**
@@ -1482,6 +1517,8 @@ export declare class TableApi {
1482
1517
  *
1483
1518
  * @param {CellValueChangeIf[]} changes - display row index, column (index or property) and value per cell
1484
1519
  * @param {CellChangeSource} [source="api"] - reported in {@link GeModelChangeEvent.source}
1520
+ * @param {{ undoable?: boolean }} [opts] - `undoable`: record the change for undo ({@link TableOptionsIf.undo}) – default:
1521
+ * `UndoOptionsIf.recordApiChanges` for `"api"`, recorded for the other sources (since 1.1.99)
1485
1522
  * @returns {CellChangeIf[]} the written (batch edit: newly pending) cells
1486
1523
  *
1487
1524
  * @example
@@ -1497,7 +1534,9 @@ export declare class TableApi {
1497
1534
  *
1498
1535
  * @since 1.1.96
1499
1536
  */
1500
- applyCellChanges(changes: CellValueChangeIf[], source?: CellChangeSource): CellChangeIf[];
1537
+ applyCellChanges(changes: CellValueChangeIf[], source?: CellChangeSource, opts?: {
1538
+ undoable?: boolean;
1539
+ }): CellChangeIf[];
1501
1540
  /**
1502
1541
  * Fills cells next to a range – what dragging the fill handle does ({@link TableOptionsIf.fillHandle} is not
1503
1542
  * needed for this call): continues series (1, 2 → 3, 4; dates; `Item 1` → `Item 2`) or copies, writes with
@@ -1538,6 +1577,496 @@ export declare class TableApi {
1538
1577
  * @since 1.1.96
1539
1578
  */
1540
1579
  cancelFill(): void;
1580
+ /**
1581
+ * Adds an event listener next to the one the table was created with – e.g. for a toolbar or an own formula bar
1582
+ * that lives outside the component that created the table. Every `on…` method you give is called after the main
1583
+ * listener's; a listener that throws is logged and does not stop the others.
1584
+ *
1585
+ * @param {Partial<EventListenerIf>} listener - the events of interest
1586
+ * @returns {() => void} call it to remove the listener (the table also removes all on `destroy()`)
1587
+ *
1588
+ * @example
1589
+ * const unsubscribe = tableApi.subscribe({
1590
+ * onEditingChanged: (evt: GeEditEvent) => { hint.textContent = evt.type === "input" ? evt.input ?? "" : ""; },
1591
+ * onModelChanged: (evt: GeModelChangeEvent) => console.log(`${evt.changes?.length ?? 0} cells changed`),
1592
+ * });
1593
+ * // later
1594
+ * unsubscribe();
1595
+ *
1596
+ * @since 1.1.99
1597
+ */
1598
+ subscribe(listener: Partial<EventListenerIf>): () => void;
1599
+ /**
1600
+ * Opens the cell editor of a body cell – like F2 (caret at the end) or, with `typedText`, like typing that text.
1601
+ * With Excel-style editing ({@link TableOptionsIf.editing}) the editor sits above the cell; otherwise (or for
1602
+ * columns with an own `getEditRenderer`) it is rendered into the cell.
1603
+ *
1604
+ * @param {number} rowIndex - display row index of the body
1605
+ * @param {number | string} column - model column index or property
1606
+ * @param {string} [typedText] - starts in "enter" mode with this text (it replaces the content)
1607
+ * @returns {boolean} true if an editor is open (`false` for a cell that cannot be edited)
1608
+ *
1609
+ * @example
1610
+ * tableApi.startEditing(0, "price"); // edit the price of the first row
1611
+ * tableApi.startEditing(4, "name", "Ad"); // as if "Ad" had been typed
1612
+ *
1613
+ * @since 1.1.99
1614
+ */
1615
+ startEditing(rowIndex: number, column: number | string, typedText?: string): boolean;
1616
+ /**
1617
+ * Closes an open cell editor: commits its input (like Enter without moving) or, with `cancel`, discards it (like
1618
+ * Escape).
1619
+ *
1620
+ * @param {boolean} [cancel=false] - discard the input
1621
+ * @returns {boolean} true if no editor is open afterwards (an invalid input keeps the editor open)
1622
+ *
1623
+ * @example
1624
+ * saveButton.addEventListener("click", () => {
1625
+ * tableApi.stopEditing(); // the value being typed belongs to the data that is saved
1626
+ * });
1627
+ *
1628
+ * @since 1.1.99
1629
+ */
1630
+ stopEditing(cancel?: boolean): boolean;
1631
+ /**
1632
+ * True while a cell editor is open.
1633
+ *
1634
+ * @returns {boolean} true while editing
1635
+ *
1636
+ * @example
1637
+ * if (!tableApi.isEditing()) {
1638
+ * tableApi.updateCells([], true); // live data: don't repaint under the user's input
1639
+ * }
1640
+ *
1641
+ * @since 1.1.99
1642
+ */
1643
+ isEditing(): boolean;
1644
+ /**
1645
+ * The cell whose editor is open.
1646
+ *
1647
+ * @returns {[number, number] | undefined} display row and model column, `undefined` without editor
1648
+ *
1649
+ * @example
1650
+ * const cell = tableApi.getEditingCell();
1651
+ * if (cell) console.log(`editing row ${cell[0]}, column ${cell[1]}`);
1652
+ *
1653
+ * @since 1.1.99
1654
+ */
1655
+ getEditingCell(): [number, number] | undefined;
1656
+ /**
1657
+ * Clears body cells like Delete in Excel-style editing: editable cells get their empty value
1658
+ * ({@link ColumnDefIf.emptyValue}, default `""`), **one** `onModelChanged` with the source `"clear"` (batch edit:
1659
+ * marked). Works without {@link TableOptionsIf.editing} too.
1660
+ *
1661
+ * @param {CellRange[]} [ranges] - body ranges; default: the selected cells, or the focused cell
1662
+ * @returns {number} the number of cleared cells, `-1` if there were too many (`EditingOptionsIf.maxClearCells`)
1663
+ *
1664
+ * @example
1665
+ * tableApi.clearCells([new CellRange(0, 2, 9, 2)]); // rows 0–9 of column 2
1666
+ *
1667
+ * @since 1.1.99
1668
+ */
1669
+ clearCells(ranges?: CellRange[]): number;
1670
+ /**
1671
+ * Copies the selected cells (the last selected range, everything after Ctrl/⌘+A, otherwise the focused cell) with
1672
+ * the asynchronous clipboard API – for an own button or menu. Tab-separated text with Excel's quoting plus an HTML
1673
+ * table (`ClipboardOptionsIf.html`); pasting it into this table pastes the values. The browser may ask for
1674
+ * permission; Ctrl/⌘+C needs none ({@link TableOptionsIf.clipboard}). Works without the option (defaults).
1675
+ *
1676
+ * @returns {Promise<void>} resolves when the clipboard was written
1677
+ *
1678
+ * @example
1679
+ * copyButton.addEventListener("click", () => tableApi.copySelection());
1680
+ *
1681
+ * @since 1.1.99
1682
+ */
1683
+ copySelection(): Promise<void>;
1684
+ /**
1685
+ * Like {@link copySelection}, and the cells are marked (dashed frame): the next paste of this content moves them –
1686
+ * the cut cells are emptied in the same change (`source: "cut"`). Escape or another change removes the mark.
1687
+ *
1688
+ * @returns {Promise<void>} resolves when the clipboard was written
1689
+ *
1690
+ * @example
1691
+ * cutButton.addEventListener("click", () => tableApi.cutSelection());
1692
+ *
1693
+ * @since 1.1.99
1694
+ */
1695
+ cutSelection(): Promise<void>;
1696
+ /**
1697
+ * Pastes tab-separated text like Ctrl/⌘+V – without clipboard permissions: from `target` (once), otherwise from the
1698
+ * selection (tiled over a selected range that is an integer multiple, one value into every selected cell) or the
1699
+ * focused cell. Hidden columns are skipped, read-only cells left out, the rest is cut off at the last column;
1700
+ * **one** `onModelChanged` with `source: "paste"` (batch edit: marked). Works without {@link TableOptionsIf.clipboard}.
1701
+ *
1702
+ * @param {string} text - rows separated by line breaks, cells by tabs (quoted cells like Excel)
1703
+ * @param {[number, number] | undefined} [target] - display row and model column of the first cell
1704
+ * @returns {CellChangeIf[]} the written (batch edit: newly pending) cells
1705
+ *
1706
+ * @example
1707
+ * tableApi.pasteText("a\tb\n1\t2", [0, 1]); // A 2×2 block from row 0, column 1
1708
+ *
1709
+ * @since 1.1.99
1710
+ */
1711
+ pasteText(text: string, target?: [number, number]): CellChangeIf[];
1712
+ /**
1713
+ * The selected cells as tab-separated text, exactly as Ctrl/⌘+C copies them (Excel's quoting, `copyHeaders`,
1714
+ * `copyValue`). `""` without cells or with more than `CopyService.maxCopyCells`.
1715
+ *
1716
+ * @returns {string} the text
1717
+ *
1718
+ * @example
1719
+ * console.log(tableApi.getSelectionAsText()); // "a\tb\n1\t2"
1720
+ *
1721
+ * @since 1.1.99
1722
+ */
1723
+ getSelectionAsText(): string;
1724
+ /**
1725
+ * Removes the mark of cut cells (like Escape): the next paste copies instead of moving.
1726
+ *
1727
+ * @example
1728
+ * tableApi.cancelCut();
1729
+ *
1730
+ * @since 1.1.99
1731
+ */
1732
+ cancelCut(): void;
1733
+ /**
1734
+ * Undoes the last change like Ctrl/⌘+Z ({@link TableOptionsIf.undo}): the old values are written back
1735
+ * (`onModelChanged` with source `"undo"`), the cells are selected and scrolled into view. Not while the cell editor
1736
+ * is open (it has its own text undo).
1737
+ *
1738
+ * @returns {boolean} true if a step was undone; false without the option or with nothing to undo
1739
+ *
1740
+ * @example
1741
+ * undoButton.addEventListener("click", () => tableApi.undo());
1742
+ *
1743
+ * @since 1.1.99
1744
+ */
1745
+ undo(): boolean;
1746
+ /**
1747
+ * Redoes the last undone change like Ctrl+Y / Ctrl/⌘+Shift+Z (source `"redo"`).
1748
+ *
1749
+ * @returns {boolean} true if a step was redone
1750
+ *
1751
+ * @example
1752
+ * redoButton.addEventListener("click", () => tableApi.redo());
1753
+ *
1754
+ * @since 1.1.99
1755
+ */
1756
+ redo(): boolean;
1757
+ /**
1758
+ * True if there is a change to undo – for buttons (or listen to `onUndoStackChanged`).
1759
+ *
1760
+ * @returns {boolean} true if {@link undo} would undo something
1761
+ *
1762
+ * @example
1763
+ * undoButton.disabled = !tableApi.canUndo();
1764
+ *
1765
+ * @since 1.1.99
1766
+ */
1767
+ canUndo(): boolean;
1768
+ /**
1769
+ * True if there is an undone change to redo.
1770
+ *
1771
+ * @returns {boolean} true if {@link redo} would redo something
1772
+ *
1773
+ * @example
1774
+ * redoButton.disabled = !tableApi.canRedo();
1775
+ *
1776
+ * @since 1.1.99
1777
+ */
1778
+ canRedo(): boolean;
1779
+ /**
1780
+ * Empties the undo history (e.g. after saving or loading new data).
1781
+ *
1782
+ * @example
1783
+ * await save(rows);
1784
+ * tableApi.clearUndoHistory();
1785
+ *
1786
+ * @since 1.1.99
1787
+ */
1788
+ clearUndoHistory(): void;
1789
+ /**
1790
+ * The state of the undo history (what `onUndoStackChanged` reports).
1791
+ *
1792
+ * @returns {GeUndoEvent | undefined} can undo/redo, labels, size; `undefined` without the option
1793
+ *
1794
+ * @example
1795
+ * const state = tableApi.getUndoState();
1796
+ * undoButton.title = state?.undoLabel ? `Undo ${state.undoLabel}` : "Undo";
1797
+ *
1798
+ * @since 1.1.99
1799
+ */
1800
+ getUndoState(): GeUndoEvent | undefined;
1801
+ /**
1802
+ * Records all changes `fn` makes (several {@link applyCellChanges} calls, a fill and a paste …) as **one** undo step.
1803
+ * Without the option `fn` just runs.
1804
+ *
1805
+ * @param {string} label - the label of the step ("Undo Import")
1806
+ * @param {() => T} fn - the changes
1807
+ * @returns {T} what `fn` returns
1808
+ *
1809
+ * @example
1810
+ * tableApi.batchUndoable("Import", () => {
1811
+ * tableApi.applyCellChanges(firstChanges, "api", { undoable: true });
1812
+ * tableApi.applyCellChanges(secondChanges, "api", { undoable: true });
1813
+ * });
1814
+ *
1815
+ * @since 1.1.99
1816
+ */
1817
+ batchUndoable<T>(label: string, fn: () => T): T;
1818
+ /**
1819
+ * True if the table calculates cell formulas ({@link TableOptionsIf.cellFormulas}, flat body).
1820
+ *
1821
+ * @returns {boolean} whether cell formulas are on
1822
+ *
1823
+ * @example
1824
+ * const showAddresses = tableApi.hasCellFormulas();
1825
+ *
1826
+ * @since 1.1.99
1827
+ */
1828
+ hasCellFormulas(): boolean;
1829
+ /**
1830
+ * The address of a body cell in cell formulas: `"B3"` = second data column, third row of `getAllRows()` (the
1831
+ * physical row – sorting and filtering don't change it). `undefined` without cell formulas or for a row number or
1832
+ * checkbox column.
1833
+ *
1834
+ * @param {number} rowIndex - display row
1835
+ * @param {number | string} column - model column index or property
1836
+ * @returns {string | undefined} the address
1837
+ *
1838
+ * @example
1839
+ * tableApi.getCellAddress(1, "total"); // "D2" – the second row of getAllRows()
1840
+ *
1841
+ * @since 1.1.99
1842
+ */
1843
+ getCellAddress(rowIndex: number, column: number | string): string | undefined;
1844
+ /**
1845
+ * The body cell of an address (`"B3"`, `"$B$3"`): display row (`-1` if a filter hides it) and model column;
1846
+ * `undefined` without cell formulas or for an address outside the data.
1847
+ *
1848
+ * @param {string} address - the address
1849
+ * @returns {[number, number] | undefined} display row and model column
1850
+ *
1851
+ * @example
1852
+ * const cell = tableApi.getCellByAddress("D5");
1853
+ * if (cell && cell[0] >= 0) tableApi.scrollToIndex(cell[1], cell[0]);
1854
+ *
1855
+ * @since 1.1.99
1856
+ */
1857
+ getCellByAddress(address: string): [number, number] | undefined;
1858
+ /**
1859
+ * The input of a body cell – what was typed: the formula text of a cell formula (`"=B2*C2"`), otherwise the value.
1860
+ *
1861
+ * @param {number} rowIndex - display row
1862
+ * @param {number | string} column - model column index or property
1863
+ * @returns {unknown} the input
1864
+ *
1865
+ * @example
1866
+ * tableApi.getCellInput(1, "total"); // "=B2*C2"
1867
+ *
1868
+ * @since 1.1.99
1869
+ */
1870
+ getCellInput(rowIndex: number, column: number | string): unknown;
1871
+ /**
1872
+ * The value of a body cell – the result of a cell formula (`2598`), otherwise the value (= `getValueAt`).
1873
+ *
1874
+ * @param {number} rowIndex - display row
1875
+ * @param {number | string} column - model column index or property
1876
+ * @returns {unknown} the value
1877
+ *
1878
+ * @example
1879
+ * tableApi.getCellValue(1, "total"); // 2598
1880
+ *
1881
+ * @since 1.1.99
1882
+ */
1883
+ getCellValue(rowIndex: number, column: number | string): unknown;
1884
+ /**
1885
+ * Writes the input of a body cell (a value or a formula `"=B2*C2"`) like the editor: one {@link applyCellChanges}.
1886
+ *
1887
+ * @param {number} rowIndex - display row
1888
+ * @param {number | string} column - model column index or property
1889
+ * @param {unknown} input - the input
1890
+ * @returns {boolean} true if written (or marked in a batch edit)
1891
+ *
1892
+ * @example
1893
+ * tableApi.setCellInput(4, "total", "=SUM(D2:D4)");
1894
+ *
1895
+ * @since 1.1.99
1896
+ */
1897
+ setCellInput(rowIndex: number, column: number | string, input: unknown): boolean;
1898
+ /**
1899
+ * Calculates a formula once against the sheet (not stored), e.g. for a preview: `"=SUM(D2:D4)"`.
1900
+ * `undefined` without cell formulas.
1901
+ *
1902
+ * @param {string} source - the formula (the `=` is optional)
1903
+ * @returns {unknown} the result (a {@link FormulaError} for an error)
1904
+ *
1905
+ * @example
1906
+ * tableApi.evaluateFormula("=SUM(D2:D4)"); // 3895
1907
+ *
1908
+ * @since 1.1.99
1909
+ */
1910
+ evaluateFormula(source: string): unknown;
1911
+ /**
1912
+ * The value of a cell by its address – also of a row a filter hides. `undefined` without cell formulas.
1913
+ *
1914
+ * @param {string} address - e.g. `"D5"`
1915
+ * @returns {unknown} the value
1916
+ *
1917
+ * @example
1918
+ * tableApi.getSheetValue("D5"); // 3895
1919
+ *
1920
+ * @since 1.1.99
1921
+ */
1922
+ getSheetValue(address: string): unknown;
1923
+ /**
1924
+ * Calculates all cell formulas again – after the app changed the data without the table ({@link updateCells},
1925
+ * {@link applyCellChanges} and the editor recalculate by themselves; {@link repaint} does not). Also renews
1926
+ * `TODAY()`, `NOW()` and `RAND()`.
1927
+ *
1928
+ * @example
1929
+ * rows[3].price = 30; // changed outside the table
1930
+ * tableApi.recalculate();
1931
+ *
1932
+ * @since 1.1.99
1933
+ */
1934
+ recalculate(): void;
1935
+ /**
1936
+ * The cells and ranges a cell formula reads, as addresses.
1937
+ *
1938
+ * @param {number} rowIndex - display row
1939
+ * @param {number | string} column - model column index or property
1940
+ * @returns {string[]} e.g. `["B2", "C2"]` (empty for a value cell or without cell formulas)
1941
+ *
1942
+ * @example
1943
+ * tableApi.getPrecedents(1, "total"); // ["B2", "C2"]
1944
+ *
1945
+ * @since 1.1.99
1946
+ */
1947
+ getPrecedents(rowIndex: number, column: number | string): string[];
1948
+ /**
1949
+ * The cells whose formulas read a cell directly (display row, model column; rows a filter hides are left out).
1950
+ *
1951
+ * @param {number} rowIndex - display row
1952
+ * @param {number | string} column - model column index or property
1953
+ * @returns {Array<[number, number]>} the dependent cells
1954
+ *
1955
+ * @example
1956
+ * tableApi.getDependents(1, "price"); // [[1, 3]] – D2 reads B2
1957
+ *
1958
+ * @since 1.1.99
1959
+ */
1960
+ getDependents(rowIndex: number, column: number | string): Array<[number, number]>;
1961
+ /**
1962
+ * The formula engine of the cell formulas (`undefined` without them) – physical rows, data columns.
1963
+ *
1964
+ * @returns {SheetEngine | undefined} the engine
1965
+ *
1966
+ * @example
1967
+ * tableApi.getSheetEngine()?.getFormulaCount(); // 4
1968
+ *
1969
+ * @since 1.1.99
1970
+ */
1971
+ getSheetEngine(): SheetEngine | undefined;
1972
+ /**
1973
+ * The active body cell (the focused cell), `undefined` if there is none or the header has the focus.
1974
+ *
1975
+ * @returns {[number, number] | undefined} display row and model column
1976
+ *
1977
+ * @example
1978
+ * const cell = tableApi.getActiveCell();
1979
+ * if (cell) console.log(tableApi.getCellAddress(cell[0], cell[1])); // "B3"
1980
+ *
1981
+ * @since 1.1.99
1982
+ */
1983
+ getActiveCell(): [number, number] | undefined;
1984
+ /**
1985
+ * Goes to a cell or range of the sheet by its address (cell formulas): `"D10"` makes it the active cell, `"B2:C5"`
1986
+ * selects the range (its first cell becomes active); the view scrolls to it. `false` for an invalid address, one
1987
+ * outside the data or a row a filter hides.
1988
+ *
1989
+ * @param {string} address - e.g. `"D10"`, `"$B$2:C5"`
1990
+ * @returns {boolean} true if it went there
1991
+ *
1992
+ * @example
1993
+ * tableApi.goToAddress("B2:C5");
1994
+ *
1995
+ * @since 1.1.99
1996
+ */
1997
+ goToAddress(address: string): boolean;
1998
+ /**
1999
+ * Inserts empty rows before a row of the sheet (`at` = row number − 1, the physical row: also when sorted or
2000
+ * filtered) and adjusts the cell formulas (`=SUM(D2:D4)` grows when rows are inserted inside). One undo step, one
2001
+ * `onModelChanged` (source `"structure"`). Works for a spreadsheet ({@link SpreadsheetFactory}), object rows (new
2002
+ * objects from `clipboard.createRow`, otherwise `{}` – the app's array changes in place) and arrays.
2003
+ *
2004
+ * @param {number} at - the physical row the new rows come before (row count = append)
2005
+ * @param {number} [count=1] - rows
2006
+ * @returns {boolean} true if inserted
2007
+ *
2008
+ * @example
2009
+ * tableApi.insertRows(4, 2); // two empty rows before row 5
2010
+ *
2011
+ * @since 1.1.99
2012
+ */
2013
+ insertRows(at: number, count?: number): boolean;
2014
+ /**
2015
+ * Deletes rows of the sheet (`at` = row number − 1) and adjusts the cell formulas (a deleted reference becomes
2016
+ * `#REF!`). One undo step.
2017
+ *
2018
+ * @param {number} at - the first physical row
2019
+ * @param {number} [count=1] - rows
2020
+ * @returns {boolean} true if deleted
2021
+ *
2022
+ * @example
2023
+ * tableApi.deleteRows(2); // row 3
2024
+ *
2025
+ * @since 1.1.99
2026
+ */
2027
+ deleteRows(at: number, count?: number): boolean;
2028
+ /**
2029
+ * Inserts empty columns before a column of a spreadsheet ({@link SpreadsheetFactory}; `at` = letter index, A = 0)
2030
+ * and adjusts the cell formulas. One undo step.
2031
+ *
2032
+ * @param {number} at - the data column the new columns come before
2033
+ * @param {number} [count=1] - columns
2034
+ * @returns {boolean} true if inserted (`false` for other models)
2035
+ *
2036
+ * @example
2037
+ * tableApi.insertColumns(1); // a new column B
2038
+ *
2039
+ * @since 1.1.99
2040
+ */
2041
+ insertColumns(at: number, count?: number): boolean;
2042
+ /**
2043
+ * Deletes columns of a spreadsheet (`at` = letter index, A = 0) and adjusts the cell formulas. One undo step.
2044
+ *
2045
+ * @param {number} at - the first data column
2046
+ * @param {number} [count=1] - columns
2047
+ * @returns {boolean} true if deleted (`false` for other models)
2048
+ *
2049
+ * @example
2050
+ * tableApi.deleteColumns(2); // column C
2051
+ *
2052
+ * @since 1.1.99
2053
+ */
2054
+ deleteColumns(at: number, count?: number): boolean;
2055
+ /**
2056
+ * The inputs of a spreadsheet ({@link SpreadsheetFactory}) as rows × columns – formulas as text, up to the last
2057
+ * filled row and column (empty cells `""`). Save them; `SpreadsheetFactory.create({ data })` loads them again.
2058
+ * `undefined` for other models (their data are the app's rows).
2059
+ *
2060
+ * @returns {unknown[][] | undefined} the data
2061
+ *
2062
+ * @example
2063
+ * localStorage.setItem("sheet", JSON.stringify(tableApi.getSheetData()));
2064
+ *
2065
+ * @since 1.1.99
2066
+ */
2067
+ getSheetData(): unknown[][] | undefined;
2068
+ /** A column index or property → index (`-1` if unknown). */
2069
+ private toColumnIndex;
1541
2070
  /**
1542
2071
  * Expands or collapses the detail row of a master row (master/detail, {@link TableOptionsIf.masterDetail}). The
1543
2072
  * content is created when the detail row becomes visible; collapsing destroys it. Reports