@sheetxl/sdk 0.8.0-beta.5 → 0.8.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/browser/cjs/{BV3LBQXG3kA013a2.cjs → CrcmEew-dr51xpf9.cjs} +1 -1
  2. package/browser/cjs/CwzIjMpnMKeypivl.cjs +1 -0
  3. package/browser/cjs/D3Vlh9UOBKtvlXBL.cjs +93 -0
  4. package/browser/cjs/{D_hl_D3IBlVqjbUu.cjs → E08wpSuqr-UadjSZ.cjs} +1 -1
  5. package/browser/cjs/{CvjJnxfMX3aal6Zj.cjs → O6F5xVsoF2hTiprv.cjs} +1 -1
  6. package/browser/cjs/index.cjs +2 -2
  7. package/browser/esm/{DWJJtu3q6iMfUbbN.mjs → B7v0PdbyuBlceMLG.mjs} +2 -2
  8. package/browser/esm/{BiUnakUlo61EtntE.mjs → BADV_AABAw-3U9iO.mjs} +1 -1
  9. package/browser/esm/{CoiupvxiR8tLrCa4.mjs → CFDfAmU2o5HFRTu4.mjs} +2 -2
  10. package/browser/esm/{CLfbadk6S57dy8sc.mjs → DRpWwH6CWI0QaNlp.mjs} +9549 -8412
  11. package/browser/esm/{ahTq_KBqu4jWkQ8A.mjs → DkHfJEJlvjDJnXEU.mjs} +2 -2
  12. package/browser/esm/{B45qhpdlbHHa6-gu.mjs → bSQdR4WlmM40WWFR.mjs} +2 -2
  13. package/browser/esm/index.mjs +9 -8
  14. package/browser/esm/{B6t-k7D3HcTIJ-Xl.mjs → tBEZ_r7Bkp7CrFLF.mjs} +2 -2
  15. package/node/esm/{BP9JmWMpUInDk4OG.mjs → BShIHUY7pxerJVT8.mjs} +1 -1
  16. package/node/esm/{CDh1Fw2maXvyOhIs.mjs → CWJELJxqO-1z0tJU.mjs} +1 -1
  17. package/node/esm/{B2dQyLw_fQU5VuXt.mjs → DbAKZ-Ythj1VwgyS.mjs} +1 -1
  18. package/node/esm/{K4Xw9Ur7uFf9M5Gh.mjs → HMR0po5avaUU1XUZ.mjs} +1 -1
  19. package/node/esm/index.mjs +11533 -10368
  20. package/package.json +6 -6
  21. package/resources/locales/de/model.msg.json +16 -0
  22. package/resources/locales/en/model.msg.json +16 -0
  23. package/types/scripting-api.json +6891 -6844
  24. package/types/scripting.d.ts +493 -137
  25. package/types/src/calculation/_TableRename.d.ts +13 -0
  26. package/types/src/calculation/grid/CalcGrid.d.ts +18 -3
  27. package/types/src/calculation/grid/CalcGridBackend.d.ts +49 -0
  28. package/types/src/calculation/grid/CalcGridProxy.d.ts +5 -0
  29. package/types/src/calculation/grid/ICalcGrid.d.ts +37 -0
  30. package/types/src/calculation/grid/_CalcRequest.d.ts +22 -0
  31. package/types/src/calculation/state/CalculationContext.d.ts +7 -1
  32. package/types/src/cell/ICell.d.ts +21 -1
  33. package/types/src/chart/Chart.d.ts +5 -18
  34. package/types/src/chart/ChartCollection.d.ts +1 -1
  35. package/types/src/chart/IChart.d.ts +11 -10
  36. package/types/src/chart/IChartCollection.d.ts +3 -3
  37. package/types/src/color/_BuiltInIndexDefs.d.ts +6 -0
  38. package/types/src/comment/Comment.d.ts +69 -7
  39. package/types/src/comment/IComment.d.ts +70 -51
  40. package/types/src/comment/NoteMovable.d.ts +26 -0
  41. package/types/src/comment/_CommentUtils.d.ts +23 -1
  42. package/types/src/comment/_NoteBox.d.ts +50 -0
  43. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +27 -2
  44. package/types/src/condition/BuiltInOperators/AfterEqualToOperator.d.ts +2 -0
  45. package/types/src/condition/BuiltInOperators/AfterOperator.d.ts +2 -0
  46. package/types/src/condition/BuiltInOperators/AndOperator.d.ts +3 -1
  47. package/types/src/condition/BuiltInOperators/AverageOperator.d.ts +2 -0
  48. package/types/src/condition/BuiltInOperators/BeforeEqualToOperator.d.ts +2 -0
  49. package/types/src/condition/BuiltInOperators/BeforeOperator.d.ts +2 -0
  50. package/types/src/condition/BuiltInOperators/BetweenOperator.d.ts +2 -0
  51. package/types/src/condition/BuiltInOperators/ContainsOperator.d.ts +2 -0
  52. package/types/src/condition/BuiltInOperators/EndsWithOperator.d.ts +2 -0
  53. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +2 -0
  54. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +2 -0
  55. package/types/src/condition/BuiltInOperators/GreaterThanEqualToOperator.d.ts +2 -0
  56. package/types/src/condition/BuiltInOperators/GreaterThanOperator.d.ts +2 -0
  57. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +2 -0
  58. package/types/src/condition/BuiltInOperators/LessThanEqualToOperator.d.ts +2 -0
  59. package/types/src/condition/BuiltInOperators/LessThanOperator.d.ts +2 -0
  60. package/types/src/condition/BuiltInOperators/NotOperator.d.ts +2 -0
  61. package/types/src/condition/BuiltInOperators/OrOperator.d.ts +3 -1
  62. package/types/src/condition/BuiltInOperators/StartsWithOperator.d.ts +2 -0
  63. package/types/src/condition/BuiltInOperators/TimePeriodOperator.d.ts +2 -0
  64. package/types/src/condition/BuiltInOperators/TopNOperator.d.ts +6 -0
  65. package/types/src/condition/Condition.d.ts +2 -0
  66. package/types/src/condition/ICondition.d.ts +59 -2
  67. package/types/src/condition/_ConditionUtils.d.ts +10 -0
  68. package/types/src/filter/IFilter.d.ts +76 -1
  69. package/types/src/movable/AbstractMovableContent.d.ts +54 -0
  70. package/types/src/movable/Control.d.ts +5 -7
  71. package/types/src/movable/CustomElement.d.ts +4 -5
  72. package/types/src/movable/IControl.d.ts +7 -5
  73. package/types/src/movable/ICustomElement.d.ts +7 -2
  74. package/types/src/movable/IMovable.d.ts +74 -42
  75. package/types/src/movable/IMovableCollection.d.ts +6 -0
  76. package/types/src/movable/Movable.d.ts +53 -32
  77. package/types/src/numFmt/_FormatCell.d.ts +9 -0
  78. package/types/src/person/index.d.ts +1 -0
  79. package/types/src/picture/IPicture.d.ts +7 -1
  80. package/types/src/picture/Picture.d.ts +5 -4
  81. package/types/src/primitives/Range.d.ts +31 -1
  82. package/types/src/primitives/RangeStats.d.ts +7 -2
  83. package/types/src/primitives/ReferenceRange.d.ts +2 -0
  84. package/types/src/primitives/stats/AggregateStats.d.ts +49 -15
  85. package/types/src/primitives/stats/FrequencyStats.d.ts +1 -1
  86. package/types/src/primitives/stats/Ranked.d.ts +1 -1
  87. package/types/src/primitives/stats/SortedNumbers.d.ts +2 -2
  88. package/types/src/shape/IShape.d.ts +6 -4
  89. package/types/src/shape/Shape.d.ts +5 -10
  90. package/types/src/sheet/ISheet.d.ts +3 -2
  91. package/types/src/sheet/Sheet.d.ts +73 -21
  92. package/types/src/sheet/SheetCell.d.ts +1 -1
  93. package/types/src/sheet/_SheetFilterUtils.d.ts +17 -0
  94. package/types/src/sheet/_SheetStateTypes.d.ts +18 -0
  95. package/types/src/sheet/_SheetUtils.d.ts +15 -0
  96. package/types/src/sheetHeader/ISheetHeader.d.ts +17 -0
  97. package/types/src/sheetHeader/SheetHeader.d.ts +11 -0
  98. package/types/src/slicer/ISlicer.d.ts +7 -2
  99. package/types/src/slicer/Slicer.d.ts +5 -9
  100. package/types/src/table/AnchoredTable.d.ts +46 -6
  101. package/types/src/table/ITable.d.ts +10 -1
  102. package/types/src/table/ITableCollection.d.ts +10 -0
  103. package/types/src/table/_FilterField.d.ts +9 -1
  104. package/types/src/text/richtext/IRichText.d.ts +36 -0
  105. package/types/src/text/richtext/index.d.ts +1 -0
  106. package/types/src/transaction/ITransaction.d.ts +11 -0
  107. package/types/src/transaction/Transaction.d.ts +2 -0
  108. package/browser/cjs/By2s44r4eRFvMq6H.cjs +0 -93
  109. package/browser/cjs/Nt1C8528otcBXJ2J.cjs +0 -1
@@ -22,6 +22,7 @@ import { INamedCollection } from '../named';
22
22
  import { IModuleCollection } from '../scripting';
23
23
  import { ModuleCollection } from '../scripting/ModuleCollection';
24
24
  import { IMovable, IMovableCollection } from '../movable';
25
+ import { Movable } from '../movable/Movable';
25
26
  import { IChartCollection } from '../chart';
26
27
  import { IPicture } from '../picture';
27
28
  import { Chart } from '../chart/Chart';
@@ -40,6 +41,8 @@ import { IDataValidationCollection, IDataValidation } from '../dataValidation';
40
41
  import { DataValidation } from '../dataValidation/DataValidation';
41
42
  import { ProtectedRange } from '../protectedRange/ProtectedRange';
42
43
  import { Comment } from '../comment/Comment';
44
+ import { NoteMovable } from '../comment/NoteMovable';
45
+ import { NoteLayout } from '../comment/_NoteBox';
43
46
  import { ISheetProtection } from '../sheetProtection';
44
47
  import { ISheetHeader } from '../sheetHeader';
45
48
  import { ISheetView } from '../sheetView';
@@ -51,7 +54,7 @@ import { EventCategory, SheetEvents } from './_SheetEvents';
51
54
  import { SheetHeader } from '../sheetHeader/SheetHeader';
52
55
  import { SheetDirectStyle } from './style/SheetDirectStyle';
53
56
  import { IUsedRangeSpatialMap } from './style/UsedRangeSpatialMap';
54
- import { RangeState, CellState, State, MovableEntry, InternalTupleUpdate } from './_SheetStateTypes';
57
+ import { RangeState, CellState, State, MovableEntry, MovableIndex, InternalTupleUpdate } from './_SheetStateTypes';
55
58
  import { CellBuffer } from './_CellBuffer';
56
59
  import { SheetReadContext, GetTypedRangeOptions, OverFlowsAndStops } from './_SheetStateReader';
57
60
  import { AutoFillProjection, AutoFillPreviewCache } from './_SheetAutoFillUtils';
@@ -247,6 +250,15 @@ export declare class Sheet implements ISheet {
247
250
  protected _rowHeadersRemoveListener: IListener.Remove | null;
248
251
  protected _rowHeadersHiddenRemoveListener: IListener.Remove | null;
249
252
  protected _isAdjustHeaders: boolean;
253
+ /** Built by the movables moved in the shift under way, and taken by it when it writes. */
254
+ protected _shiftedMovableModels: Map<IMovable, ISpatialMap.Entry<MovableEntry>> | null;
255
+ /** The same for the note boxes, which shift as their own index. */
256
+ protected _shiftedNoteModels: Map<IMovable, ISpatialMap.Entry<MovableEntry>> | null;
257
+ /** The placed movables' index and the note boxes' index, as the entry builder addresses them. */
258
+ protected _placedIndex: MovableIndex;
259
+ protected _noteIndex: MovableIndex;
260
+ /** What every comment on this sheet places its note's box through. */
261
+ protected _noteBoxes: Comment.Boxes;
250
262
  protected _emptyCell: ICell;
251
263
  protected _cellOptions: SheetCellOptions;
252
264
  protected _closed: boolean;
@@ -319,6 +331,7 @@ export declare class Sheet implements ISheet {
319
331
  filter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions) => Promise<IRange.Coords>;
320
332
  evalFilter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions | null | undefined) => Promise<_SheetFilterUtils.FilterRuns>;
321
333
  applyFilterRuns: (runs: _SheetFilterUtils.FilterRuns, options?: ITransaction.OperationOptions) => void;
334
+ filteredTables: () => ITable[];
322
335
  setHyperlinks: (ranges: readonly ISpatialMap.Entry<IHyperlink.Update>[], defaultUpdate?: IHyperlink.Update, options?: ITransaction.OperationOptions) => void;
323
336
  setComments: (ranges: readonly ISpatialMap.Entry<IComment.Update>[], comments?: IComment.Update | IComment.JSON, options?: ITransaction.OperationOptions) => void;
324
337
  getBoundsAtCoords: (coords: IRange.Coords) => Bounds;
@@ -381,6 +394,10 @@ export declare class Sheet implements ISheet {
381
394
  protectionCheck: (check?: ProtectionCheck | null, coords?: Readonly<IRange.Coords> | readonly IRange.Coords[] | null, action?: string | null) => void;
382
395
  getDefaultShiftAxis: (coords?: IRange.Coords) => IRange.Axis;
383
396
  processLayoutChange: () => void;
397
+ /** The movables' by-model index as a shift left it, or `null` if the shift moved none. */
398
+ takeShiftedMovableModels: () => Map<IMovable, ISpatialMap.Entry<MovableEntry>> | null;
399
+ /** The same for the note boxes' index. */
400
+ takeShiftedNoteModels: () => Map<IMovable, ISpatialMap.Entry<MovableEntry>> | null;
384
401
  markColumnHeaderTableNames: () => void;
385
402
  commitWithDirectives: (trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, options?: ICellRange.OperationOptions, directives?: CommitDirectives) => void;
386
403
  readonly styles: IStyleCollection;
@@ -422,7 +439,7 @@ export declare class Sheet implements ISheet {
422
439
  cellStateIterator: (options?: CellState.IteratorOptions) => CellState.Iterator;
423
440
  rangeToCoords: (address: ICellRange.Address, protectionCheck?: ProtectionCheck | null, lookupNames?: boolean) => IRange.Coords;
424
441
  getCell: (address?: ICell.Address) => ICell;
425
- createCell: (update: ICell.Update, coords?: IRange.CellCoords | null) => ICell;
442
+ createCell: (update: ICell.Update, coords?: IRange.CellCoords | null, options?: ICell.CreateCellOptions) => ICell;
426
443
  getAutoFillPreviewCache: () => AutoFillPreviewCache | null;
427
444
  setAutoFillPreviewCache: (cache: AutoFillPreviewCache) => void;
428
445
  };
@@ -492,6 +509,7 @@ export declare class Sheet implements ISheet {
492
509
  filter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions) => Promise<IRange.Coords>;
493
510
  evalFilter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions | null | undefined) => Promise<_SheetFilterUtils.FilterRuns>;
494
511
  applyFilterRuns: (runs: _SheetFilterUtils.FilterRuns, options?: ITransaction.OperationOptions) => void;
512
+ filteredTables: () => ITable[];
495
513
  setHyperlinks: (ranges: readonly ISpatialMap.Entry<IHyperlink.Update>[], defaultUpdate?: IHyperlink.Update, options?: ITransaction.OperationOptions) => void;
496
514
  setComments: (ranges: readonly ISpatialMap.Entry<IComment.Update>[], comments?: IComment.Update | IComment.JSON, options?: ITransaction.OperationOptions) => void;
497
515
  getBoundsAtCoords: (coords: IRange.Coords) => Bounds;
@@ -760,6 +778,18 @@ export declare class Sheet implements ISheet {
760
778
  addAutoTable(address?: ICellRange.Address, options?: ICellRange.AddAutoTableOptions): ITable;
761
779
  /** {@inheritDoc ISheet.getAutoTable} */
762
780
  getAutoTable(): ITable | null;
781
+ /**
782
+ * The tables on this sheet that hold a filter condition: the AutoTable, then the tables. What
783
+ * makes the sheet "filtered" ({@link ISheetHeader.getFilteredRanges}).
784
+ */
785
+ private _filteredTables;
786
+ /**
787
+ * Tells the grid whether this sheet is filtered now ({@link _filteredTables}), from
788
+ * inside the operation that may have changed it: a table's condition set or cleared, a table
789
+ * added or deleted. The grid writes only a different answer, so telling it more often than it
790
+ * changes costs a walk of the tables. A restore is not told, as {@link _tellHidden}.
791
+ */
792
+ protected _tellFiltered(): void;
763
793
  /** @internal */
764
794
  protected _getDefaultShiftAxis(coords?: IRange.Coords): IRange.Axis;
765
795
  /** @internal */
@@ -876,6 +906,13 @@ export declare class Sheet implements ISheet {
876
906
  * @internal
877
907
  */
878
908
  protected _registerWatch(coords: IRange.Coords, expression: string, authoredAt: IRange.CellCoords, handlers: WatchAnchor.Handlers, arrayFirstCell: boolean): IListener.Remove;
909
+ /**
910
+ * A watch's body is a grid the engine holds once, for every snapshot, so a watch is made and
911
+ * removed against the commit the store is at. Inside an amend of any other commit its node and
912
+ * its grid's maps would land in that snapshot alone: the engine would hold a grid the current
913
+ * snapshot has no record of, and removing it later would leave the engine its body.
914
+ */
915
+ protected _ensureWatchAtCurrent(action: 'added' | 'removed'): void;
879
916
  /**
880
917
  * Hold formulas that belong to no cell - a chart's series - in the calculation engine.
881
918
  *
@@ -913,22 +950,6 @@ export declare class Sheet implements ISheet {
913
950
  * @internal
914
951
  */
915
952
  protected _moveReferences(from: IRange.Coords, to: IRange.Coords): void;
916
- /**
917
- * Carries the tables a same-sheet cut moved to where the cut put them, as the same instances.
918
- *
919
- * @remarks
920
- * A table moved this way is never deleted, so a handle to it, its name and the structured
921
- * references to it all stay as they were, and one undo puts it back. Called after
922
- * {@link _moveReferences}: the node a table watches its header through travels with the cut
923
- * there, and the table re-registers what did not travel (the ring outside it) from where it now
924
- * is. Each table is re-anchored by itself, so a table the cut does not carry is never split.
925
- *
926
- * @param tables The tables the cut encloses and moves.
927
- * @param from The cut's source.
928
- * @param to Where the cut's source lands.
929
- * @internal
930
- */
931
- protected _moveTables(tables: readonly ITable[], from: IRange.Coords, to: IRange.Coords): void;
932
953
  /**
933
954
  * Drop a node from the current snapshot.
934
955
  *
@@ -990,6 +1011,8 @@ export declare class Sheet implements ISheet {
990
1011
  */
991
1012
  protected _notifyConditionalFormatsChange(): void;
992
1013
  /** {@inheritDoc Sheet._notifyConditionalFormatsChange} @internal */
1014
+ protected _notifyTablesChange(): void;
1015
+ /** {@inheritDoc Sheet._notifyConditionalFormatsChange} @internal */
993
1016
  protected _notifyDataValidationsChange(): void;
994
1017
  /** {@inheritDoc Sheet._notifyConditionalFormatsChange} @internal */
995
1018
  protected _notifyProtectedRangesChange(): void;
@@ -1390,8 +1413,26 @@ export declare class Sheet implements ISheet {
1390
1413
  getTransactions(): ITransaction.IStore;
1391
1414
  /** {@inheritDoc ISheet.getStrings} */
1392
1415
  getStrings(): IStringCollection;
1393
- /** @internal */
1416
+ /**
1417
+ * The sheet's movables: those placed on it, then the boxes of its notes.
1418
+ * @internal
1419
+ */
1394
1420
  protected _searchMovables(options?: IMovableCollection.GetItemsOptions): IMovable[];
1421
+ /**
1422
+ * Places a note's box among the sheet's movables. See {@link Comment.Boxes.add}.
1423
+ * @internal
1424
+ */
1425
+ protected _addNoteBox(comment: Comment, anchor: IMovable.AnchorOffset | null, hidden: boolean): NoteMovable;
1426
+ /**
1427
+ * The cell geometry a note's box is placed with.
1428
+ * @internal
1429
+ */
1430
+ protected _noteLayout(): NoteLayout;
1431
+ /**
1432
+ * The movables of one index that match the filter, in z-order.
1433
+ * @internal
1434
+ */
1435
+ protected _searchMovableIndex(spatial: ISpatialMap<MovableEntry>, options?: IMovableCollection.GetItemsOptions): IMovable[];
1395
1436
  /** @internal */
1396
1437
  /**
1397
1438
  * @param description A COMPLETE undo description (callers pass a `messageKey`). It used to be a
@@ -1503,7 +1544,7 @@ export declare class Sheet implements ISheet {
1503
1544
  */
1504
1545
  protected _addComment(address: ICellRange.Address, content: IComment.Content, options?: ICommentCollection.AddOptions): IComment;
1505
1546
  /** {@inheritDoc ISheet.createCell} */
1506
- createCell(update: ICell.Update, coords?: IRange.CellCoords | null): ICell;
1547
+ createCell(update: ICell.Update, coords?: IRange.CellCoords | null, options?: ICell.CreateCellOptions): ICell;
1507
1548
  /** @internal */
1508
1549
  protected _getBoundsAtCoords(coords: IRange.Coords): Bounds;
1509
1550
  /** @internal */
@@ -1587,6 +1628,17 @@ export declare class Sheet implements ISheet {
1587
1628
  protected _getStyle(ranges: IRange.Coords[], anchor?: IRangeSelection.Coords, updateStyles?: (update: IStyle.Update, options?: IStyle.UpdateOptions) => void): IStyle;
1588
1629
  /** @internal */
1589
1630
  protected _initHeadersState(jsonColumns?: ISheetHeader.JSON, jsonRows?: ISheetHeader.JSON): void;
1631
+ /**
1632
+ * Tells the grid which rows or columns are hidden now, from inside the operation that changed
1633
+ * them: the formulas that skip hidden cells recalculate under that operation.
1634
+ *
1635
+ * @remarks
1636
+ * A restore is heard here too, with no operation open, and is not told: the grid's record of
1637
+ * the set is restored with the sheet's, and the engine's with its own history
1638
+ * (DESIGN-CALC-SERVICE §7.5). Telling it as well would land the restored set under the snapshot
1639
+ * being left.
1640
+ */
1641
+ protected _tellHidden(axis: IRange.Axis): void;
1590
1642
  /**
1591
1643
  * Drop every read-through cache that a data change can invalidate.
1592
1644
  *
@@ -1633,7 +1685,7 @@ export declare class Sheet implements ISheet {
1633
1685
  */
1634
1686
  protected _newCommentJSON(modifiers: IComment.Modifiers): IComment.JSON;
1635
1687
  /** @internal */
1636
- protected _createMovableEntry(json: IMovable.JSON, zIndex: number, fromResourceId?: (resourceId: number) => IResource): ISpatialMap.Entry<MovableEntry>;
1688
+ protected _createMovableEntry(json: IMovable.JSON, zIndex: number, fromResourceId?: (resourceId: number) => IResource, index?: MovableIndex, contentGiven?: Movable.Content): ISpatialMap.Entry<MovableEntry>;
1637
1689
  /** @internal */
1638
1690
  protected _fromJSON(json: ISheet.JSON | undefined, disableLoadAutoFit?: boolean): void;
1639
1691
  /** {@inheritDoc ITransaction.ITransactional.getId} */
@@ -321,7 +321,7 @@ export declare class SheetCell implements ICell {
321
321
  /** {@inheritDoc ICell.getStyle} */
322
322
  getStyle(direct?: boolean): IStyle;
323
323
  /** {@inheritDoc ICell.createCell} */
324
- createCell(update: ICell.Update): ICell;
324
+ createCell(update: ICell.Update, options?: ICell.CreateCellOptions): ICell;
325
325
  /**
326
326
  * A copy of this cell that reports `coords` as its merge.
327
327
  *
@@ -2,7 +2,24 @@ import { IRange } from '@sheetxl/primitives';
2
2
  import { RunCoords } from '@sheetxl/utils';
3
3
  import { ITransaction } from '../transaction';
4
4
  import { ICondition } from '../condition';
5
+ import { NumberFormatRef } from '../numFmt/BuiltInFormats';
6
+ import { ISheet } from './ISheet';
5
7
  import { Sheet } from './Sheet';
8
+ /** A run of one column's rows that show their values under the same number format. */
9
+ export interface TextFormatRun {
10
+ rowStart: number;
11
+ rowEnd: number;
12
+ format: NumberFormatRef;
13
+ }
14
+ /**
15
+ * The rows of a column by the number format they show their values under, ascending and
16
+ * covering `coords`; adjacent rows of one format are one run.
17
+ *
18
+ * @remarks
19
+ * What a cell shows follows from its value and its number format. The formats lie in few runs
20
+ * whatever the number of rows, so a reader of the column's text formats values and builds no cell.
21
+ */
22
+ export declare function getTextFormatRuns(sheet: ISheet, coords: Readonly<IRange.Coords>): TextFormatRun[];
6
23
  /**
7
24
  * What a filter evaluation settles: on one axis, the runs that stay visible and the runs that hide.
8
25
  *
@@ -359,6 +359,18 @@ export interface MovableEntry extends Anchored.Entry<IMovable> {
359
359
  callbacks: Movable.ContainerCallbacks;
360
360
  zIndex: number;
361
361
  }
362
+ /**
363
+ * One of the sheet's movable indexes: the placed movables, or the note boxes. Names the state
364
+ * keys the index lives under, what its z-order starts above, and what it builds.
365
+ * @internal
366
+ */
367
+ export interface MovableIndex {
368
+ spatial: 'movableSpatial' | 'noteSpatial';
369
+ byModel: 'movableMapModel' | 'noteMapModel';
370
+ /** What the index's lowest movable is drawn above. */
371
+ zIndexBase: () => number;
372
+ create: (options: Movable.ConstructorOptions) => Movable;
373
+ }
362
374
  /**
363
375
  * The versioned per-sheet state record held in the transaction store (see `Sheet._getState`).
364
376
  * A pure data record: sparse grids, spatial maps, and anchored maps. Behaviour lives beside it in
@@ -375,6 +387,12 @@ export interface State {
375
387
  hyperlinkSpatial: ISpatialMap<IHyperlink.Properties>;
376
388
  movableSpatial: ISpatialMap<MovableEntry>;
377
389
  movableMapModel: Map<IMovable, ISpatialMap.Entry<MovableEntry>>;
390
+ /**
391
+ * The boxes of the sheet's notes: movables whose content is a comment, kept apart from the
392
+ * placed ones so they draw above them and are saved with their comments, not as movables.
393
+ */
394
+ noteSpatial: ISpatialMap<MovableEntry>;
395
+ noteMapModel: Map<IMovable, ISpatialMap.Entry<MovableEntry>>;
378
396
  picture?: IPicture | null;
379
397
  autoTables: IAnchoredMap<ITable, ITable.JSON>;
380
398
  tables: IAnchoredMap<ITable, ITable.JSON>;
@@ -99,6 +99,21 @@ export declare function createCellModifiersFromString(runtime: IRuntime, strValu
99
99
  export declare function calcAccountingBottomInset(style: IStyle): number;
100
100
  /** @internal */
101
101
  export declare function getHiddenRuns(header: ISheetHeader): readonly RunCoords[];
102
+ /**
103
+ * A skip (`IRange.IteratorOptions.processRowSkip` / `processColumnSkip`) over the indexes the
104
+ * header hides, asked with sheet indexes; `null` when none of `min..max` is hidden.
105
+ *
106
+ * @remarks
107
+ * One per hidden set, kept: the statistics cache their zones by the skip they were walked under,
108
+ * and a set that changed is a new array and so a new skip.
109
+ * @internal
110
+ */
111
+ export declare function getHiddenSkip(header: ISheetHeader, min: number, max: number): ((index: number, reverse?: boolean) => number) | null;
112
+ /**
113
+ * One skip that leaves out what either does; `hidden` itself when the caller brought none.
114
+ * @internal
115
+ */
116
+ export declare function composeSkips(own: ((index: number, reverse?: boolean) => number) | undefined, hidden: (index: number, reverse?: boolean) => number): (index: number, reverse?: boolean) => number;
102
117
  /**
103
118
  * Merges an array of rangeStateIntersections into a single RangeStateIntersection.
104
119
  *
@@ -139,6 +139,23 @@ export interface ISheetHeader extends ITransaction.ITransactional, IListener.ISo
139
139
  * Returns true if any of the headers have the isHidden flag set to true or if any sizes are 0.
140
140
  */
141
141
  hasHidden(): boolean;
142
+ /**
143
+ * Returns the ranges of headers a filter holds a condition over: on the row axis, the data rows
144
+ * of the AutoTable and of every table whose {@link ITable.getActiveFilters} is not empty; on
145
+ * the column axis none, as nothing filters columns.
146
+ *
147
+ * @param coords Only the ranges that meet this run, when given (a viewport).
148
+ *
149
+ * @remarks
150
+ * A sheet with any is "filtered", as Excel has it: `SUBTOTAL` 1-11 leave out every hidden row
151
+ * of a filtered sheet, hand-hidden ones included, and count them all on an unfiltered one; the
152
+ * visible headers of these ranges are the ones drawn as filtered. A condition counts whether
153
+ * or not it hides a row.
154
+ *
155
+ * A row hidden by hand and a row hidden by a filter are the same hidden row; nothing records
156
+ * which, and clearing a filter shows both ({@link ITable.deleteFilters}).
157
+ */
158
+ getFilteredRanges(coords?: Readonly<RunCoords>): readonly ICellHeaderRange[];
142
159
  /**
143
160
  * Returns true if header has a max selection at the given index.
144
161
  */
@@ -88,6 +88,8 @@ export declare class SheetHeader implements ISheetHeader {
88
88
  } | void;
89
89
  /** {@inheritDoc ISheetHeader.getRange} */
90
90
  getRange(address: ICellHeaderRange.Address, options?: ICellHeaderRange.GetRangeOptions): ICellHeaderRange;
91
+ /** {@inheritDoc ISheetHeader.getFilteredRanges} */
92
+ getFilteredRanges(coords?: Readonly<RunCoords>): readonly ICellHeaderRange[];
91
93
  /** {@inheritDoc ISheetHeader.getRanges} */
92
94
  getRanges(address: ICellHeaderRanges.Address, options?: ICellHeaderRange.GetRangeOptions): ICellHeaderRanges;
93
95
  /** {@inheritDoc ISheetHeader.getSelectedRange} */
@@ -245,6 +247,15 @@ export declare namespace SheetHeader {
245
247
  * @param amount
246
248
  */
247
249
  setContainerShiftedCallback?: (callback: ShiftCallback) => void;
250
+ /**
251
+ * Called when the set of hidden headers changes, as it changes: inside the operation that
252
+ * changed it, or with none open for an undo or a redo.
253
+ *
254
+ * @remarks
255
+ * The `onHiddenChange` listener hears of the same change once the operation has closed. This
256
+ * is for an owner that has to act within the operation.
257
+ */
258
+ hiddenChanged?: () => void;
248
259
  /**
249
260
  * JSON state to load.
250
261
  */
@@ -1,5 +1,7 @@
1
+ import { ITransaction } from '../transaction';
1
2
  import { IResource } from '../resource';
2
3
  import { IModel } from '../model';
4
+ import { IMovable } from '../movable';
3
5
  /**
4
6
  * ISplicer
5
7
  *
@@ -9,9 +11,12 @@ import { IModel } from '../model';
9
11
  * @hidden
10
12
  * @internal
11
13
  */
12
- export interface ISlicer extends IModel {
14
+ export interface ISlicer extends IModel, IMovable.IContent {
13
15
  toJSON(toResourceId?: (resource: IResource) => number | null): ISlicer.JSON | null;
14
- getDescription(): string;
16
+ /**
17
+ * Deletes the slicer, and with it the movable that places it.
18
+ */
19
+ delete(options?: ITransaction.OperationOptions): void;
15
20
  /** For runtime type checking. */
16
21
  readonly isISlicer: true;
17
22
  }
@@ -1,18 +1,16 @@
1
1
  import { IResource } from '../resource';
2
- import { IModel, AbstractModel } from '../model';
2
+ import { AbstractMovableContent } from '../movable/AbstractMovableContent';
3
3
  import { ISlicer } from './ISlicer';
4
4
  /**
5
5
  * Implementation for {@link ISlicer}.
6
6
  */
7
- export declare class Slicer extends AbstractModel<State, ISlicer.JSON> implements ISlicer {
7
+ export declare class Slicer extends AbstractMovableContent<State, ISlicer.JSON> implements ISlicer {
8
8
  constructor(options: Slicer.ConstructorOptions);
9
9
  /** {@inheritDoc IModel.getType} */
10
10
  getType(): string;
11
- /** {@inheritDoc Movable.Content.getDescription} */
12
- getDescription(): string;
13
11
  /** {@inheritDoc Movable.Content.toJSON} */
14
12
  toJSON(_toResourceId?: (resource: IResource) => number | null): ISlicer.JSON | null;
15
- /** {@inheritDoc Movable.Content.getTypeDescription} */
13
+ /** {@inheritDoc IMovable.IContent.getTypeDescription} */
16
14
  getTypeDescription(): string;
17
15
  get [Symbol.toStringTag](): string;
18
16
  toString(): string;
@@ -31,13 +29,11 @@ export declare namespace Slicer {
31
29
  /**
32
30
  * Options for creating a chart.
33
31
  */
34
- interface ConstructorOptions extends IModel.ConstructorOptions<ISlicer.JSON> {
35
- name: string;
32
+ interface ConstructorOptions extends AbstractMovableContent.ConstructorOptions<ISlicer.JSON> {
36
33
  }
37
34
  }
38
- interface State extends AbstractModel.State {
35
+ interface State extends AbstractMovableContent.State {
39
36
  data?: any;
40
- name?: string;
41
37
  }
42
38
  export {};
43
39
  //# sourceMappingURL=Slicer.d.ts.map
@@ -37,6 +37,7 @@ export declare class AnchoredTable extends AbstractAnchored<State, ITable.Events
37
37
  private _stylePropsCache;
38
38
  private _processTableUpdate;
39
39
  private _symbolsChanged;
40
+ private _filteredChanged;
40
41
  private _setContainerName;
41
42
  private _releaseReferences;
42
43
  private _refitBodyRows;
@@ -62,6 +63,12 @@ export declare class AnchoredTable extends AbstractAnchored<State, ITable.Events
62
63
  protected initializeColumnCreator(table: ITable, getProps: (id: number | string) => ColumnPropertiesState, updateProps: (id: number | string, update: Partial<ITable.ColumnProperties> | null, options?: string | ITransaction.OperationOptions) => void, deleteColumn: (id: number | string, options?: ITransaction.OperationOptions) => void, getTotals?: (id: number | string) => _Utils.ColumnTotals, getCalculated?: (id: number | string) => string | null): (id: number | string) => ITable.IColumn;
63
64
  protected initializeSortCreator(table: ITable, getProps: (id: number | string) => SortPropertiesState, getColumnProps: (id: number | string) => ColumnPropertiesState): (id: number | string) => ISort;
64
65
  protected initializeFilterCreator(table: ITable, getProps: (id: number | string) => FilterPropertiesState, getColumnProps: (id: number | string) => ColumnPropertiesState): (id: number | string) => IFilter;
66
+ /**
67
+ * The rows the filter levels hide, as sheet row runs, evaluated without the level on column
68
+ * `exceptIndex` (every level when `null`); empty when no level is left. Read-only: the rows
69
+ * are judged by the levels, whatever is hidden now.
70
+ */
71
+ private _hiddenByLevels;
65
72
  protected _initialize(options: AnchoredTable.ConstructorOptions): void;
66
73
  /** {@inheritDoc ITable.getNamed} */
67
74
  getNamed(): INamed | null;
@@ -126,6 +133,25 @@ export declare class AnchoredTable extends AbstractAnchored<State, ITable.Events
126
133
  protected _calcVisible(): void;
127
134
  /** {@inheritDoc ITable.getSnapshot} */
128
135
  getSnapshot(options?: ReferenceableClipboard.CopyOptions): ITable.ISnapshot;
136
+ /**
137
+ * This table has just been made by a paste, as a copy of the table `fromName`.
138
+ *
139
+ * @remarks
140
+ * Everything the paste writes is part of making the copy, the cells that came across beside it
141
+ * included: none of it was typed next to a table, so none of it is an auto expansion or a
142
+ * column fill. The whole sheet is recorded as the table's own write for the paste's commit.
143
+ */
144
+ private _adoptPaste;
145
+ /**
146
+ * Re-point the formulas in this table's cells that name the table `fromName` at this table.
147
+ *
148
+ * @remarks
149
+ * For a table pasted as a copy, once its cells are across. A copied formula keeps the table it
150
+ * referenced, as it keeps a defined name; inside a copy of that table the reference was to the
151
+ * table the formula sits in, so Excel re-points it: the copy of `Table1`'s totals row totals
152
+ * `Table2`. A formula outside the copy keeps naming the original.
153
+ */
154
+ private _retargetCopiedFormulas;
129
155
  /** {@inheritDoc ITable.getAnchorType} */
130
156
  getAnchorType(): IAnchored.Type;
131
157
  /** {@inheritDoc ITable.getStyle} */
@@ -361,15 +387,15 @@ export declare class AnchoredTable extends AbstractAnchored<State, ITable.Events
361
387
  */
362
388
  private _syncListenersToAnchor;
363
389
  /**
364
- * The sheet has moved this table whole, as a same-sheet cut does.
390
+ * Move this table whole to `coords`, as a same-sheet cut does once its cells are across.
365
391
  *
366
392
  * @remarks
367
- * The listener nodes the cut enclosed moved with it; the rest stayed where the table was, so the
368
- * subscription is brought in line with the new anchor.
369
- *
370
- * @internal
393
+ * The table is never deleted, so a handle to it, its name and the structured references to it
394
+ * all stay as they were, and one undo puts it back. The listener nodes the cut enclosed moved
395
+ * with it; the rest stayed where the table was, so the subscription is brought in line with the
396
+ * new anchor.
371
397
  */
372
- _processAfterMove(): void;
398
+ private _moveTo;
373
399
  /** @internal */
374
400
  protected _processAnchorCoords(): void;
375
401
  /**
@@ -513,6 +539,9 @@ export declare class AnchoredTable extends AbstractAnchored<State, ITable.Events
513
539
  private _fillColumn;
514
540
  /**
515
541
  * Write what columns remember as their formula. `null` forgets.
542
+ *
543
+ * @param syncHeld `false` writes the columns alone and leaves the watches as they are: for a
544
+ * write that lands in a snapshot other than the one the store is at.
516
545
  */
517
546
  private _rememberCalculated;
518
547
  /**
@@ -878,12 +907,23 @@ export declare namespace AnchoredTable {
878
907
  * If this is true then this will sync header and footers if they are visible on load.
879
908
  */
880
909
  syncSheet?: boolean;
910
+ /**
911
+ * With `syncSheet`: the coords already end with the totals row the JSON asks for, so its cells
912
+ * are the table's totals and no row is added.
913
+ */
914
+ hasTotals?: boolean;
881
915
  processTableUpdate?: () => void;
882
916
  /**
883
917
  * Called, inside the operation, when the table's name or its columns are set - and once when
884
918
  * it is created - for whoever keeps a copy of them (the calculation's replica).
885
919
  */
886
920
  symbolsChanged?: (table: ITable) => void;
921
+ /**
922
+ * Called, inside the operation, when the table starts or stops holding a filter condition
923
+ * (see {@link ISheet.getFilteredRanges}). A change of condition that leaves one held is not
924
+ * a change here.
925
+ */
926
+ filteredChanged?: (table: ITable) => void;
887
927
  /**
888
928
  * Called before {@link ITable.delete} (`'error'`) or {@link ITable.convertToRange} (`'address'`)
889
929
  * removes the table, while it still exists, so the formulas that reference it can be rewritten.
@@ -354,11 +354,20 @@ export declare namespace ITable {
354
354
  */
355
355
  interface SnapshotDestination {
356
356
  tables: ITableCollection;
357
+ /** Where the table lands: its top-left is used, its size is the table's own. */
357
358
  range: IRange.Coords;
358
359
  }
359
360
  interface ISnapshot extends IHistory.ISnapshot<ITable.SnapshotDestination, ITable, IRange.Coords> {
360
361
  /**
361
- * Called when the table is copied to a new collection.
362
+ * Copies, or moves, the table to the destination.
363
+ *
364
+ * @remarks
365
+ * The table's cells are expected at the destination already: the table takes its header,
366
+ * body and totals rows from what is there.
367
+ *
368
+ * With `isCut` the source table is moved. Within its own sheet it is the same table at a new
369
+ * place, so its name and the references to it stay as they are; anywhere else it is removed
370
+ * and added again under its name.
362
371
  */
363
372
  copyTo(destination: ITable.SnapshotDestination, options?: ReferenceableClipboard.CopyOptions): Promise<IRange.Coords>;
364
373
  }
@@ -53,8 +53,18 @@ export declare namespace ITableCollection {
53
53
  * A default value of false will create a new row.
54
54
  */
55
55
  hasHeader?: boolean;
56
+ /**
57
+ * Whether the range already ends with the totals row the `properties` ask for. The table then
58
+ * takes those cells as its totals row rather than adding one below the range.
59
+ *
60
+ * @defaultValue false
61
+ */
62
+ hasTotals?: boolean;
56
63
  /**
57
64
  * Properties to set on the table when created.
65
+ *
66
+ * @remarks
67
+ * With `headerRowCount: 0` the range has no header row: all of it is data.
58
68
  */
59
69
  properties?: ITable.Properties;
60
70
  /**
@@ -1,3 +1,4 @@
1
+ import { RunCoords } from '@sheetxl/utils';
1
2
  import { ITransaction } from '../transaction';
2
3
  import { ICellRange } from '../cellRange';
3
4
  import { ICondition } from '../condition';
@@ -9,7 +10,12 @@ export declare class FilterField implements IFilter {
9
10
  private _id;
10
11
  private _getProps;
11
12
  private _getColumnProps;
12
- constructor(table: ITable, id: number | string, getProps: (id: number | string) => FilterPropertiesState, getColumnProps: (id: number | string) => ColumnPropertiesState);
13
+ /**
14
+ * The sheet rows the table's filter levels hide, evaluated without the level on column
15
+ * `exceptIndex`; with every level when `null`.
16
+ */
17
+ private _getHiddenByLevels;
18
+ constructor(table: ITable, id: number | string, getProps: (id: number | string) => FilterPropertiesState, getColumnProps: (id: number | string) => ColumnPropertiesState, getHiddenByLevels: (exceptIndex: number | null) => Promise<readonly RunCoords[]>);
13
19
  /** {@inheritDoc IFilter.IFilterable.filter} */
14
20
  filter(condition?: ICondition.Input | null, options?: ITransaction.OperationOptions): Promise<this>;
15
21
  /** {@inheritDoc IFilter.getCondition} */
@@ -22,6 +28,8 @@ export declare class FilterField implements IFilter {
22
28
  getIndex(): number;
23
29
  /** {@inheritDoc IFilter.getRange} */
24
30
  getRange(): ICellRange;
31
+ /** {@inheritDoc IFilter.getItems} */
32
+ getItems(options?: IFilter.GetItemsOptions): Promise<IFilter.Items>;
25
33
  /** {@inheritDoc IFilter.getLevel} */
26
34
  getLevel(): number;
27
35
  /** {@inheritDoc IFilter.delete} */
@@ -0,0 +1,36 @@
1
+ import { IStyledFont } from './IStyledFont';
2
+ /**
3
+ * Text with formatting: a list of {@link IRichText.Run | runs}, each a span of text with the font
4
+ * properties it sets.
5
+ *
6
+ * @remarks
7
+ * A run records only what it sets. Everything it leaves out is inherited from the font of whatever
8
+ * holds the text (a note's default, a cell's style).
9
+ */
10
+ export declare namespace IRichText {
11
+ /**
12
+ * One formatted span.
13
+ */
14
+ interface Run {
15
+ /**
16
+ * The text of the span.
17
+ */
18
+ text: string;
19
+ /**
20
+ * The font properties this span sets, or nothing when it has none of its own.
21
+ *
22
+ * @remarks
23
+ * The same properties a cell's font has, so a bold span is `{ weight: 700 }`, italic is
24
+ * `{ style: 'italic' }`. The color is any string a font's color takes; one read from a file keeps
25
+ * its theme or indexed color that way.
26
+ */
27
+ font?: IStyledFont.JSON;
28
+ }
29
+ /**
30
+ * The serialized form: the runs, in order.
31
+ */
32
+ interface JSON {
33
+ runs: Run[];
34
+ }
35
+ }
36
+ //# sourceMappingURL=IRichText.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export * from './IStyledFont';
2
+ export * from './IRichText';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -367,6 +367,17 @@ export declare namespace ITransaction {
367
367
  * needs to know that the change it is hearing about is a restore, not an operation.
368
368
  */
369
369
  isRestoring(): boolean;
370
+ /**
371
+ * Returns `true` while the open operation is an {@link amend} of a commit other than the one
372
+ * the store is at.
373
+ *
374
+ * @remarks
375
+ * Its writes land in that commit's snapshot alone, and the current state does not change. So
376
+ * anything made inside it that is not versioned by this store - a resource held outside it,
377
+ * once for every snapshot - would exist where the current snapshot has no record of it. Code
378
+ * that makes such a thing asks this first.
379
+ */
380
+ isAmendingOtherCommit(): boolean;
370
381
  /**
371
382
  * The root transaction of the operation that is open.
372
383
  *
@@ -90,6 +90,8 @@ export declare class TransactionStore implements ITransaction.IStore {
90
90
  isOpenTransaction(): boolean;
91
91
  /** {@inheritDoc ITransaction.IStore.isRestoring} */
92
92
  isRestoring(): boolean;
93
+ /** {@inheritDoc ITransaction.IStore.isAmendingOtherCommit} */
94
+ isAmendingOtherCommit(): boolean;
93
95
  /** {@inheritDoc ITransaction.IStore.getPendingTransaction} */
94
96
  getPendingTransaction(): ITransaction | null;
95
97
  /** {@inheritDoc ITransaction.IStore.getCurrentTransaction} */