@sheetxl/sdk 0.8.0-beta.1 → 0.8.0-beta.2

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 (353) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/cjs/4f5eoQQfV-V7LO2_.cjs +1 -0
  3. package/browser/cjs/BEnEDC1m546-gzWS.cjs +1 -0
  4. package/browser/cjs/CwCUa4IzGNGissLL.cjs +1 -0
  5. package/browser/cjs/{a0Z-SXs_N71CtqYb.cjs → Dg3GaW0QWwnlqetX.cjs} +1 -1
  6. package/browser/cjs/KWQPie2u7AP69web.cjs +93 -0
  7. package/browser/cjs/index.cjs +2 -2
  8. package/browser/esm/{B0HS42a7lga1k1U_.mjs → BJ9hcZAGY8Tj5_9L.mjs} +1 -1
  9. package/browser/esm/C8vpA2ZBtZf6w4nq.mjs +394 -0
  10. package/browser/esm/DDojiE2-oycJ7qGi.mjs +20 -0
  11. package/browser/esm/DEPT7zmpiMdZ-_qC.mjs +70253 -0
  12. package/browser/esm/DOvCi3lf49To36WP.mjs +8 -0
  13. package/browser/esm/{uyWBMSIxMlt8n5Z3.mjs → Dq3sc4B_HQHBrT5N.mjs} +2 -2
  14. package/browser/esm/index.mjs +871 -696
  15. package/browser/esm/{DlPMeIyxT9tG_WDk.mjs → trwZArJQQq7K9kL7.mjs} +2 -2
  16. package/licenses/dependencies.txt +204 -204
  17. package/node/esm/CGWsQOMWdnDeF4dX.mjs +8 -0
  18. package/node/esm/{Cku7XiUvw1xrRasi.mjs → CL9MI-b6D9BmtVXW.mjs} +1 -1
  19. package/node/esm/CressiwiIhxCVp1v.mjs +28 -0
  20. package/node/esm/O2cOO3xIynWUgOWe.mjs +403 -0
  21. package/node/esm/index.mjs +52356 -37345
  22. package/package.json +6 -7
  23. package/resources/locales/de/model.msg.json +45 -9
  24. package/resources/locales/en/model.msg.json +42 -9
  25. package/types/scripting-api.json +7093 -0
  26. package/types/scripting-enums.json +54 -8
  27. package/types/scripting.d.ts +7006 -1202
  28. package/types/src/anchored/AbstractAnchored.d.ts +18 -8
  29. package/types/src/anchored/AnchoredMap.d.ts +2 -0
  30. package/types/src/anchored/IAnchoredMap.d.ts +52 -4
  31. package/types/src/autoFill/AutoFill.d.ts +316 -32
  32. package/types/src/autoFill/IAutoFill.d.ts +232 -15
  33. package/types/src/border/{IBorder.d.ts → IBorders.d.ts} +41 -40
  34. package/types/src/border/index.d.ts +1 -1
  35. package/types/src/calculation/Calculation.d.ts +740 -35
  36. package/types/src/calculation/ExternalBookBindings.d.ts +118 -0
  37. package/types/src/calculation/FormulaText.d.ts +74 -0
  38. package/types/src/calculation/ICalculation.d.ts +318 -81
  39. package/types/src/calculation/INamedFormulasCollection.d.ts +5 -8
  40. package/types/src/calculation/NamedFormulaCollection.d.ts +139 -107
  41. package/types/src/calculation/NamedLambdaFunction.d.ts +28 -0
  42. package/types/src/calculation/TokenType.d.ts +9 -0
  43. package/types/src/calculation/Types.d.ts +83 -2
  44. package/types/src/calculation/_CloneBoundary.d.ts +80 -0
  45. package/types/src/calculation/compiler/ASTTypes.d.ts +58 -0
  46. package/types/src/calculation/compiler/CompilerUtils.d.ts +134 -12
  47. package/types/src/calculation/compiler/FormulaCompiler.d.ts +29 -4
  48. package/types/src/calculation/compiler/FormulaParser.d.ts +1 -2
  49. package/types/src/calculation/compiler/LiteTransform.d.ts +17 -0
  50. package/types/src/calculation/compiler/ParserUtils.d.ts +26 -1
  51. package/types/src/calculation/compiler/SRParser.d.ts +2 -1
  52. package/types/src/calculation/compiler/Types.d.ts +79 -9
  53. package/types/src/calculation/executor/CalcExecutor.d.ts +312 -33
  54. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +43 -2
  55. package/types/src/calculation/executor/CircularReference.d.ts +2 -0
  56. package/types/src/calculation/formula/Formula.d.ts +58 -21
  57. package/types/src/calculation/formula/FormulaBlock.d.ts +124 -21
  58. package/types/src/calculation/formula/FormulaRecordView.d.ts +79 -0
  59. package/types/src/calculation/formula/IFormulaBlock.d.ts +261 -67
  60. package/types/src/calculation/formula/LambdaValue.d.ts +15 -16
  61. package/types/src/calculation/formula/LazyValue.d.ts +96 -0
  62. package/types/src/calculation/formula/TokenUtils.d.ts +25 -1
  63. package/types/src/calculation/formula/index.d.ts +1 -0
  64. package/types/src/calculation/functions/FunctionDeclarations.d.ts +31 -0
  65. package/types/src/calculation/functions/initializeFunctions.d.ts +15 -2
  66. package/types/src/calculation/grid/CalcGrid.d.ts +384 -158
  67. package/types/src/calculation/grid/CalcGridBackend.d.ts +450 -0
  68. package/types/src/calculation/grid/CalcGridProxy.d.ts +133 -0
  69. package/types/src/calculation/grid/CalcGridUtils.d.ts +62 -12
  70. package/types/src/calculation/grid/FormulaEntry.d.ts +129 -0
  71. package/types/src/calculation/grid/FormulaHost.d.ts +236 -0
  72. package/types/src/calculation/grid/ICalcGrid.d.ts +456 -143
  73. package/types/src/calculation/grid/_CalcRequest.d.ts +272 -0
  74. package/types/src/calculation/grid/index.d.ts +4 -0
  75. package/types/src/calculation/index.d.ts +2 -0
  76. package/types/src/calculation/spatial/ContentfulSpatialValue.d.ts +6 -2
  77. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +339 -11
  78. package/types/src/calculation/spatial/SpillEntry.d.ts +20 -5
  79. package/types/src/calculation/spatial/TouchedWindows.d.ts +86 -0
  80. package/types/src/calculation/spatial/index.d.ts +1 -0
  81. package/types/src/calculation/state/CalcInputs.d.ts +41 -0
  82. package/types/src/calculation/state/CalcNode.d.ts +141 -30
  83. package/types/src/calculation/state/CalcScope.d.ts +37 -0
  84. package/types/src/calculation/state/CalcState.d.ts +22 -1
  85. package/types/src/calculation/state/CalculationContext.d.ts +36 -2
  86. package/types/src/calculation/state/IContextContainer.d.ts +129 -27
  87. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +163 -0
  88. package/types/src/calculation/state/_ReadObservedGrid.d.ts +74 -8
  89. package/types/src/calculation/state/index.d.ts +1 -0
  90. package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +80 -0
  91. package/types/src/calculation/symbol/ISymbolRegistry.d.ts +23 -0
  92. package/types/src/calculation/symbol/IndirectSymbolProvider.d.ts +16 -2
  93. package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +63 -3
  94. package/types/src/calculation/symbol/SymbolRegistry.d.ts +20 -0
  95. package/types/src/calculation/symbol/index.d.ts +3 -2
  96. package/types/src/cell/ICell.d.ts +78 -23
  97. package/types/src/cell/ICellProtection.d.ts +50 -10
  98. package/types/src/cellRange/ICellRange.d.ts +329 -72
  99. package/types/src/cellRange/ICellRanges.d.ts +9 -7
  100. package/types/src/chart/Chart.d.ts +72 -2
  101. package/types/src/chart/ChartCollection.d.ts +26 -0
  102. package/types/src/chart/IChart.d.ts +162 -9
  103. package/types/src/chart/IChartCollection.d.ts +25 -0
  104. package/types/src/chart/_ChartXml.d.ts +70 -0
  105. package/types/src/chart/index.d.ts +1 -3
  106. package/types/src/collections/ArraysGrid.d.ts +1 -1
  107. package/types/src/collections/IGrid.d.ts +1 -1
  108. package/types/src/collections/ISparseGrid.d.ts +9 -0
  109. package/types/src/collections/ISpatialMap.d.ts +59 -21
  110. package/types/src/collections/ImmutableList.d.ts +28 -0
  111. package/types/src/collections/MixedTypedArrayList.d.ts +168 -108
  112. package/types/src/collections/OverlappingRangeIterator.d.ts +13 -17
  113. package/types/src/collections/RepeatingList.d.ts +7 -0
  114. package/types/src/collections/ScalarGrid.d.ts +50 -0
  115. package/types/src/collections/SparseGrid.d.ts +1 -1
  116. package/types/src/collections/SpatialMap.d.ts +13 -21
  117. package/types/src/collections/Tuple.d.ts +128 -16
  118. package/types/src/collections/_GridUtils.d.ts +19 -6
  119. package/types/src/collections/_RangeSweep.d.ts +97 -0
  120. package/types/src/collections/_SpatialUtils.d.ts +20 -2
  121. package/types/src/collections/index.d.ts +1 -0
  122. package/types/src/comment/Comment.d.ts +159 -0
  123. package/types/src/comment/CommentCollection.d.ts +40 -0
  124. package/types/src/comment/IComment.d.ts +319 -48
  125. package/types/src/comment/ICommentCollection.d.ts +90 -0
  126. package/types/src/comment/_CommentUtils.d.ts +28 -0
  127. package/types/src/comment/index.d.ts +1 -0
  128. package/types/src/condition/AnchoredConditional.d.ts +76 -17
  129. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +8 -7
  130. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +2 -1
  131. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +3 -6
  132. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +1 -1
  133. package/types/src/condition/BuiltinSelectors/BaseSelector.d.ts +7 -0
  134. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +9 -0
  135. package/types/src/condition/Condition.d.ts +16 -0
  136. package/types/src/condition/ICondition.d.ts +86 -33
  137. package/types/src/condition/_ConditionFormula.d.ts +152 -0
  138. package/types/src/condition/_ConditionUtils.d.ts +73 -10
  139. package/types/src/conditionalFormat/ConditionalFormat.d.ts +21 -10
  140. package/types/src/conditionalFormat/ConditionalFormatCollection.d.ts +19 -8
  141. package/types/src/conditionalFormat/IConditionalFormat.d.ts +5 -3
  142. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +2 -0
  143. package/types/src/dataValidation/DataValidation.d.ts +50 -3
  144. package/types/src/dataValidation/DataValidationCollection.d.ts +20 -9
  145. package/types/src/dataValidation/IDataValidation.d.ts +119 -30
  146. package/types/src/dataValidation/IDataValidationCollection.d.ts +10 -2
  147. package/types/src/date/DateUtils.d.ts +20 -0
  148. package/types/src/date/_DateUtils.d.ts +91 -7
  149. package/types/src/externalBook/ExternalBookCollection.d.ts +145 -12
  150. package/types/src/externalBook/ExternalBookName.d.ts +96 -0
  151. package/types/src/externalBook/IExternalBook.d.ts +170 -18
  152. package/types/src/externalBook/IExternalBookCollection.d.ts +79 -7
  153. package/types/src/externalBook/index.d.ts +1 -0
  154. package/types/src/fill/IStroke.d.ts +1 -1
  155. package/types/src/filter/IFilter.d.ts +29 -4
  156. package/types/src/font/IFont.d.ts +17 -0
  157. package/types/src/history/IHistory.d.ts +3 -2
  158. package/types/src/i18n/LanguagePack.d.ts +12 -4
  159. package/types/src/index.d.ts +3 -0
  160. package/types/src/io/AbstractBackingStore.d.ts +24 -1
  161. package/types/src/io/ArrayBackingStore.d.ts +1 -1
  162. package/types/src/io/EmbeddedPart.d.ts +20 -0
  163. package/types/src/io/IEmbeddedPart.d.ts +63 -0
  164. package/types/src/io/IWorkbookIO.d.ts +185 -18
  165. package/types/src/io/WorkbookIO.d.ts +9 -0
  166. package/types/src/io/WorkbookOrigin.d.ts +20 -11
  167. package/types/src/io/WorkbookOriginProvider.d.ts +46 -0
  168. package/types/src/io/_XmlFragment.d.ts +49 -0
  169. package/types/src/io/index.d.ts +1 -0
  170. package/types/src/lib/file/file.browser.d.ts +19 -5
  171. package/types/src/lib/file/file.node.d.ts +5 -0
  172. package/types/src/lib/utils/_Utils.d.ts +11 -0
  173. package/types/src/lib/utils/utils.browser.d.ts +9 -3
  174. package/types/src/license/license-key.d.ts +27 -0
  175. package/types/src/listener/IListener.d.ts +12 -7
  176. package/types/src/listener/ListenerEmitter.d.ts +46 -5
  177. package/types/src/model/AbstractModel.d.ts +14 -5
  178. package/types/src/movable/Control.d.ts +57 -0
  179. package/types/src/movable/IControl.d.ts +84 -0
  180. package/types/src/movable/IMovable.d.ts +23 -1
  181. package/types/src/movable/IMovableCollection.d.ts +2 -0
  182. package/types/src/movable/Movable.d.ts +4 -6
  183. package/types/src/movable/MovableCollection.d.ts +7 -7
  184. package/types/src/movable/index.d.ts +4 -0
  185. package/types/src/named/AbstractNamed.d.ts +1 -1
  186. package/types/src/named/INamed.d.ts +4 -1
  187. package/types/src/named/INamedCollection.d.ts +26 -0
  188. package/types/src/named/NamedCollection.d.ts +16 -15
  189. package/types/src/numFmt/BuiltInFormats.d.ts +15 -7
  190. package/types/src/numFmt/IFormatEngine.d.ts +2 -0
  191. package/types/src/numFmt/NumfmtFormatEngine.d.ts +2 -0
  192. package/types/src/person/IPerson.d.ts +99 -0
  193. package/types/src/person/IPersonCollection.d.ts +51 -0
  194. package/types/src/person/Person.d.ts +32 -0
  195. package/types/src/person/PersonCollection.d.ts +49 -0
  196. package/types/src/person/index.d.ts +3 -0
  197. package/types/src/picture/IPicture.d.ts +2 -0
  198. package/types/src/picture/Picture.d.ts +2 -0
  199. package/types/src/pivot/IPivotTable.d.ts +107 -0
  200. package/types/src/pivot/IPivotTableCollection.d.ts +25 -0
  201. package/types/src/pivot/PivotTable.d.ts +57 -0
  202. package/types/src/pivot/PivotTableCollection.d.ts +25 -0
  203. package/types/src/pivot/index.d.ts +6 -0
  204. package/types/src/primitives/CompositeRangeStats.d.ts +2 -0
  205. package/types/src/primitives/Criteria.d.ts +1 -1
  206. package/types/src/primitives/LambdaBrand.d.ts +21 -0
  207. package/types/src/primitives/PrimitiveUtils.d.ts +56 -19
  208. package/types/src/primitives/Range.d.ts +102 -24
  209. package/types/src/primitives/RangeStats.d.ts +24 -1
  210. package/types/src/primitives/ReferenceRange.d.ts +42 -0
  211. package/types/src/primitives/Runtime.d.ts +15 -2
  212. package/types/src/primitives/stats/FrequencyStats.d.ts +9 -0
  213. package/types/src/primitives/stats/LookupIndex.d.ts +46 -0
  214. package/types/src/primitives/stats/SortedNumbers.d.ts +2 -0
  215. package/types/src/primitives/stats/index.d.ts +1 -0
  216. package/types/src/print/IPrint.d.ts +0 -22
  217. package/types/src/protectedRange/IProtectedRange.d.ts +4 -0
  218. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +2 -0
  219. package/types/src/protectedRange/ProtectedRange.d.ts +1 -4
  220. package/types/src/protectedRange/ProtectedRangeCollection.d.ts +19 -8
  221. package/types/src/protection/DefaultProtection.d.ts +12 -1
  222. package/types/src/protection/IProtection.d.ts +36 -2
  223. package/types/src/reference/ReferenceUtils.d.ts +80 -0
  224. package/types/src/reference/index.d.ts +2 -0
  225. package/types/src/resource/IResource.d.ts +21 -1
  226. package/types/src/resource/IResourceCollection.d.ts +9 -1
  227. package/types/src/resource/ResourceCollection.d.ts +6 -6
  228. package/types/src/scripting/FunctionCollection.d.ts +41 -11
  229. package/types/src/scripting/IFunctionCollection.d.ts +41 -0
  230. package/types/src/scripting/IModule.d.ts +25 -0
  231. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  232. package/types/src/scripting/IScript.d.ts +18 -0
  233. package/types/src/scripting/Module.d.ts +34 -6
  234. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  235. package/types/src/scripting/Runtime.d.ts +15 -0
  236. package/types/src/scripting/Scripts.d.ts +2 -0
  237. package/types/src/scripting/TypedFunction.d.ts +151 -18
  238. package/types/src/scripting/_FunctionIndex.d.ts +5 -0
  239. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  240. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  241. package/types/src/scripting/declarations.browser.d.ts +10 -0
  242. package/types/src/scripting/declarations.d.ts +49 -0
  243. package/types/src/scripting/declarations.node.d.ts +9 -0
  244. package/types/src/scripting/index.d.ts +3 -0
  245. package/types/src/selection/IRangeSelection.d.ts +9 -4
  246. package/types/src/selection/RangeSelection.d.ts +2 -0
  247. package/types/src/shape/IShape.d.ts +41 -3
  248. package/types/src/shape/Shape.d.ts +10 -0
  249. package/types/src/shape/_ShapeXml.d.ts +28 -0
  250. package/types/src/sheet/CellRegion.d.ts +6 -0
  251. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  252. package/types/src/sheet/ISheet.d.ts +224 -41
  253. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  254. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  255. package/types/src/sheet/Sheet.d.ts +749 -114
  256. package/types/src/sheet/SheetCell.d.ts +81 -21
  257. package/types/src/sheet/SheetCollection.d.ts +19 -8
  258. package/types/src/sheet/SheetRange.d.ts +62 -14
  259. package/types/src/sheet/SheetRanges.d.ts +4 -6
  260. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  261. package/types/src/sheet/_InvalidSheetRange.d.ts +5 -5
  262. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  263. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  264. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  265. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  266. package/types/src/sheet/_SheetAutoFitUtils.d.ts +2 -2
  267. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  268. package/types/src/sheet/_SheetFilterUtils.d.ts +32 -1
  269. package/types/src/sheet/_SheetIntents.d.ts +250 -0
  270. package/types/src/sheet/_SheetMutations.d.ts +179 -59
  271. package/types/src/sheet/_SheetStateReader.d.ts +16 -10
  272. package/types/src/sheet/_SheetStateTypes.d.ts +57 -73
  273. package/types/src/sheet/_SheetUtils.d.ts +2 -18
  274. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  275. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  276. package/types/src/sheet/spatial/index.d.ts +1 -0
  277. package/types/src/sheet/style/SheetCellStyle.d.ts +91 -64
  278. package/types/src/sheet/style/SheetDirectStyle.d.ts +16 -5
  279. package/types/src/sheet/style/_Resolvers.d.ts +5 -3
  280. package/types/src/sheet/style/_StyleUtils.d.ts +37 -7
  281. package/types/src/sheetHeader/ISheetHeader.d.ts +2 -0
  282. package/types/src/sheetHeader/SheetHeader.d.ts +14 -0
  283. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  284. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  285. package/types/src/sheetView/ISheetView.d.ts +45 -1
  286. package/types/src/sheetView/SheetView.d.ts +11 -0
  287. package/types/src/slicer/ISlicer.d.ts +2 -0
  288. package/types/src/slicer/Slicer.d.ts +2 -0
  289. package/types/src/sort/ISort.d.ts +2 -0
  290. package/types/src/string/IStringCollection.d.ts +5 -0
  291. package/types/src/string/StringCollection.d.ts +6 -6
  292. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  293. package/types/src/style/IStyle.d.ts +30 -10
  294. package/types/src/style/IStyleCollection.d.ts +63 -42
  295. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  296. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  297. package/types/src/style/StyleCollection.d.ts +41 -5
  298. package/types/src/style/TableStyleCollection.d.ts +49 -0
  299. package/types/src/style/_BuiltInStyleDefs.d.ts +3 -3
  300. package/types/src/style/index.d.ts +4 -0
  301. package/types/src/table/AnchoredTable.d.ts +644 -68
  302. package/types/src/table/AutoTable.d.ts +5 -5
  303. package/types/src/table/ITable.d.ts +228 -30
  304. package/types/src/table/ITableCollection.d.ts +2 -0
  305. package/types/src/table/TableCollection.d.ts +19 -8
  306. package/types/src/table/_FilterField.d.ts +7 -5
  307. package/types/src/table/_NamedTable.d.ts +17 -1
  308. package/types/src/table/_NamedTableSource.d.ts +1 -0
  309. package/types/src/table/_SortField.d.ts +2 -0
  310. package/types/src/table/_TableColumn.d.ts +13 -2
  311. package/types/src/table/_TableMessages.d.ts +1 -0
  312. package/types/src/table/_TableUtils.d.ts +40 -0
  313. package/types/src/text/Bullet.d.ts +4 -0
  314. package/types/src/text/ITextFrame.d.ts +25 -1
  315. package/types/src/text/TextBoxAlignment.d.ts +15 -6
  316. package/types/src/text/TextFrame.d.ts +4 -0
  317. package/types/src/text/TextLine.d.ts +4 -0
  318. package/types/src/text/TextParagraph.d.ts +4 -0
  319. package/types/src/text/TextRun.d.ts +9 -0
  320. package/types/src/text/TextStacked.d.ts +83 -0
  321. package/types/src/text/index.d.ts +1 -0
  322. package/types/src/theme/ITheme.d.ts +2 -0
  323. package/types/src/theme/IThemeCollection.d.ts +2 -0
  324. package/types/src/theme/ThemeCollection.d.ts +8 -7
  325. package/types/src/transaction/ITransaction.d.ts +238 -36
  326. package/types/src/transaction/Transaction.d.ts +99 -11
  327. package/types/src/type/AbstractCollection.d.ts +101 -0
  328. package/types/src/type/ICollection.d.ts +117 -0
  329. package/types/src/type/ITypes.d.ts +9 -7
  330. package/types/src/type/index.d.ts +1 -0
  331. package/types/src/utils/_CSSUtils.d.ts +3 -3
  332. package/types/src/workbook/IWorkbook.d.ts +171 -40
  333. package/types/src/workbook/Workbook.d.ts +103 -7
  334. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  335. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  336. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  337. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  338. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  339. package/browser/cjs/BatsV2UUraVDCRXm.cjs +0 -57
  340. package/browser/cjs/CUz53T65cRGQRgvv.cjs +0 -33
  341. package/browser/cjs/DU0kYUtdFa3jK-im.cjs +0 -1
  342. package/browser/cjs/Dv4yIPLV98M5zLHa.cjs +0 -1
  343. package/browser/esm/6JKSOvc5czaQB2Bj.mjs +0 -109
  344. package/browser/esm/BtuJ9AGzeURtAsGo.mjs +0 -51241
  345. package/browser/esm/DGU6sM25u0EWCKl1.mjs +0 -824
  346. package/browser/esm/f2G3QRgEbvFJcoa2.mjs +0 -4436
  347. package/node/esm/-pxdn3M3tc6PLHs7.mjs +0 -114
  348. package/node/esm/0n5bslM9jhO1JnI2.mjs +0 -843
  349. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  350. package/types/src/dataValidation/_Utils.d.ts +0 -10
  351. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  352. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  353. package/types/src/sheet/listener/index.d.ts +0 -3
@@ -16,22 +16,30 @@ import { Anchored } from '../anchored/Anchored';
16
16
  import { ColumnPropertiesState, SortPropertiesState, FilterPropertiesState } from './_TableUtils';
17
17
  import { ITableStyle } from './ITableStyle';
18
18
  import { ITable } from './ITable';
19
+ import * as _Utils from './_TableUtils';
19
20
  /**
20
21
  * Implementation of {@link ITable}.
21
22
  */
22
- export declare class AnchoredTable extends AbstractAnchored<State, CommitView, ITable.Events> implements ITable {
23
+ export declare class AnchoredTable extends AbstractAnchored<State, ITable.Events> implements ITable {
23
24
  protected _sheet: ISheet | undefined;
24
25
  private _styles;
25
26
  private _stylesRemoveListener;
26
27
  private _columnListener;
27
- private _lastTransactionId;
28
28
  private _emptyColumnName;
29
29
  private _emptyColumnNamer;
30
- private _autoExpandRemoveListener;
30
+ private _headerRemoveListener;
31
+ private _headerListenerCoords;
32
+ private _expandRemoveListener;
33
+ private _expandListenerCoords;
34
+ private _heldTotals;
35
+ private _heldCalculated;
31
36
  private _styleCache;
32
37
  private _stylePropsCache;
33
38
  private _processTableUpdate;
39
+ private _symbolsChanged;
34
40
  private _setContainerName;
41
+ private _releaseReferences;
42
+ private _refitBodyRows;
35
43
  private _names;
36
44
  private _namedItem;
37
45
  private _colHeadersSizeUnlistener;
@@ -44,14 +52,56 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
44
52
  private _createColumn;
45
53
  private _createSort;
46
54
  private _createFilter;
55
+ private _columnFacades;
56
+ private _sortFacades;
57
+ private _filterFacades;
58
+ /** What {@link _views} last derived, and the props it derived them from. */
59
+ private _columnViews;
47
60
  constructor(options: AnchoredTable.ConstructorOptions);
48
61
  protected _initializeOptions(options: AnchoredTable.ConstructorOptions): AnchoredTable.ConstructorOptions;
49
- 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): (id: number | string) => ITable.IColumn;
62
+ 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;
50
63
  protected initializeSortCreator(table: ITable, getProps: (id: number | string) => SortPropertiesState, getColumnProps: (id: number | string) => ColumnPropertiesState): (id: number | string) => ISort;
51
64
  protected initializeFilterCreator(table: ITable, getProps: (id: number | string) => FilterPropertiesState, getColumnProps: (id: number | string) => ColumnPropertiesState): (id: number | string) => IFilter;
52
65
  protected _initialize(options: AnchoredTable.ConstructorOptions): void;
53
66
  /** {@inheritDoc ITable.getNamed} */
54
67
  getNamed(): INamed | null;
68
+ /**
69
+ * The stored properties of one column, by id, or an empty set when this table has no such
70
+ * column - which is also what a table with no state in this snapshot answers.
71
+ *
72
+ * @remarks
73
+ * The three readers below are what the column, sort and filter facades are built on. Each is
74
+ * asked afresh on every read, so a facade handed out before an undo reads that undo rather than
75
+ * whatever it was holding.
76
+ */
77
+ private _columnPropsOf;
78
+ /**
79
+ * Everything the public getters answer with about the columns, derived from the props.
80
+ *
81
+ * @remarks
82
+ * State holds the props and nothing else, so there is no second copy to keep in step - which is
83
+ * what the old `sortsActive` / `filtersActive` / `mapColumnBy*` fields were, and what made a
84
+ * column rebuild able to leave a level behind pointing at a column that had gone.
85
+ *
86
+ * Rebuilt when the props are a different object, which is every write: they are frozen and
87
+ * replaced, never edited. So this is a cache with one entry and an exact test, not a guess.
88
+ */
89
+ private _views;
90
+ /** The facade for a column, made on first ask. */
91
+ private _columnOf;
92
+ /** {@link _columnOf} for a column's sort. A column that is not sorted still has one. */
93
+ private _sortOf;
94
+ /** {@link _columnOf} for a column's filter. A column that is not filtered still has one. */
95
+ private _filterOf;
96
+ /** {@link _columnPropsOf} for a column's sort, or an empty set when it is not sorted. */
97
+ private _sortPropsOf;
98
+ /** {@link _columnPropsOf} for a column's filter, or an empty set when it is not filtered. */
99
+ private _filterPropsOf;
100
+ /**
101
+ * A table style was added, changed or deleted, or the default changed: the style this table
102
+ * resolves to may differ even though nothing about the table did.
103
+ */
104
+ private _onTableStylesChange;
55
105
  /**
56
106
  * Recompute the derived visible state (`_visibleRange` and the visible flags), which depend on
57
107
  * the sheet's hidden rows/columns.
@@ -87,6 +137,180 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
87
137
  addRows(index: number, count?: number, options?: ITransaction.OperationOptions): this;
88
138
  /** {@inheritDoc ITable.deleteRowsAt} */
89
139
  deleteRowsAt(index: number, count?: number, options?: ITransaction.OperationOptions): this;
140
+ /**
141
+ * The one write path for a column's own properties.
142
+ *
143
+ * @remarks
144
+ * A key that is present is a change, whatever its value: an empty label or formula clears it.
145
+ * `null` resets the column to its name. A totals cell holds a label or a formula, never both, so
146
+ * the one being set replaces the other. The cell that shows the change - the header for a name,
147
+ * the totals cell for a label or a formula - is written in the same transaction.
148
+ *
149
+ * While the totals row is on the sheet the totals cell is ALL that is written: the props hold a
150
+ * column's totals only while there is no cell to hold them - see {@link _totalsOf}.
151
+ */
152
+ private _updateColumnProps;
153
+ /**
154
+ * Formula text as the table holds it: every structured reference with its table's name.
155
+ *
156
+ * @remarks
157
+ * A cell stores `SUM([Amount])` as `SUM(Table1[Amount])` when it is committed, and which
158
+ * references show without the name is decided when the text is displayed. Text the table is
159
+ * handed for a column - a totals formula for a row that is not showing, a calculated formula
160
+ * read from a cell the engine has not compiled yet - has been through no commit, so it is
161
+ * given the name here: compiled at the column's first body cell, which is inside the table an
162
+ * unqualified reference names, and imaged from there, which leaves an A1 reference as it is.
163
+ *
164
+ * As typed when it cannot be compiled: no sheet, no engine, or text that does not parse.
165
+ */
166
+ private _qualified;
167
+ /**
168
+ * Whether the totals row is a row of cells: it is shown, and there is a sheet to show it on.
169
+ */
170
+ private _isTotalsOnSheet;
171
+ /**
172
+ * What a column totals: its label or its formula.
173
+ *
174
+ * @remarks
175
+ * While the totals row is on the sheet this is read from the column's totals cell, every time.
176
+ * The cell is where the user edits it and where the engine keeps it right - through a column
177
+ * rename, a table rename, an insert - and a copy held beside it could only fall behind. The props
178
+ * hold a column's totals when there is no cell to: the row is hidden, or there is no sheet.
179
+ * {@link _holdTotalsFromCells} and {@link _showTotalsFromProps} carry them across.
180
+ */
181
+ private _totalsOf;
182
+ /**
183
+ * One column's cell in the totals row.
184
+ *
185
+ * @remarks
186
+ * Asked for cell by cell rather than by walking the row: a range iterator hands out the cell it
187
+ * had BEFORE a clear until the store settles (async mode), and these are read straight after one.
188
+ */
189
+ private _totalsCellAt;
190
+ /**
191
+ * A totals cell as a column's totals. A formula that is the built-in form for this column -
192
+ * `SUBTOTAL(109,[Name])` - reads as its function number, however it got there.
193
+ *
194
+ * @returns `null` for a cell that cannot say: protection hides its formula, and the value it
195
+ * shows instead is not what the column totals.
196
+ */
197
+ private _readTotalsCell;
198
+ /**
199
+ * Make a column's totals cell show `totals`, or empty it when there are none. Only while the
200
+ * totals row is on the sheet.
201
+ */
202
+ private _writeTotalsCellAt;
203
+ /**
204
+ * The totals row is about to leave the sheet: keep what each of its cells holds in that column's
205
+ * props, where {@link _showTotalsFromProps} finds it when the row comes back.
206
+ */
207
+ private _holdTotalsFromCells;
208
+ /**
209
+ * Keep every totals EXPRESSION a live formula while its row is hidden.
210
+ *
211
+ * @remarks
212
+ * Excel's held totals formulas are live (probed, T2): hidden, they follow a column rename, a table
213
+ * rename, a row inserted above and a row added to the table, A1 references included. Text in the
214
+ * props follows none of that. So while the row is hidden each expression is ALSO a watch - a
215
+ * formula the engine holds without a cell, which gets everything a cell formula gets - anchored
216
+ * on the row below the table, where the totals row was and will be again. It moves with that row
217
+ * on an insert, as the table's end does; when the table's end moves without one (a resize, an
218
+ * auto expansion) it is re-anchored with the text it has by then, which is a move and leaves its
219
+ * references where they were. Only the row matters: the text is A1, so it reads the same from
220
+ * any column, and a column shift inside the table is no reason to touch it.
221
+ *
222
+ * The props keep the text the watch was made from. They are what a snapshot can restore and what
223
+ * there is to read until the engine has registered the watch; {@link _readHeldTotal} prefers what
224
+ * the engine has. A function number needs none of this - it is spelled from the column's name
225
+ * when it is shown - and neither does a label.
226
+ *
227
+ * Derived from state, like the listeners, and called wherever they are re-derived.
228
+ */
229
+ private _syncHeldTotals;
230
+ /**
231
+ * A held expression as the model's grid holds it, or `null` when it holds none - not registered
232
+ * yet, or not in this snapshot.
233
+ */
234
+ private _readHeldTotal;
235
+ private _removeHeldTotals;
236
+ /**
237
+ * Keep every calculated column's formula a live formula.
238
+ *
239
+ * @remarks
240
+ * A calculated column remembers its formula apart from its cells - any of them may hold
241
+ * something else, the first included - and Excel's is live (probed, G5 of
242
+ * `probe-table-columnfill-edges.ps1`): it follows a sheet row inserted above the table, a column
243
+ * inserted inside it and a column rename, exceptions or not. It is the problem
244
+ * {@link _syncHeldTotals} solves and the same holder: the text in the column props, and a watch
245
+ * made from it, here on a body cell of the column.
246
+ *
247
+ * The text is always the formula as it reads in the FIRST body row, which is how a file stores
248
+ * it and what {@link _readHeldCalculated} images, wherever in the body the watch has been pushed
249
+ * to. So a watch is only made again when it has left the column's body, or when the props hold
250
+ * a different text.
251
+ */
252
+ private _syncHeldCalculated;
253
+ /**
254
+ * A calculated column's formula as the engine has it now, as it reads in the first body row, or
255
+ * `null` when it holds none - not registered yet, or not in this snapshot.
256
+ */
257
+ private _readHeldCalculated;
258
+ private _removeHeldCalculated;
259
+ /**
260
+ * The formula a column calculates its rows with, without its `=` and as it reads in the first
261
+ * body row, or `null` for a column that is not calculated.
262
+ */
263
+ private _calculatedOf;
264
+ /**
265
+ * A calculated column's formula as it reads in `rowIndex`, or `null` when it cannot be said.
266
+ *
267
+ * @remarks
268
+ * Asked BEFORE the rows it is for are made. Once a shift is part of the commit the engine has
269
+ * not re-imaged anything yet, and the text it hands out is from before the shift at a cell from
270
+ * after it.
271
+ */
272
+ private _calculatedTextAt;
273
+ /**
274
+ * What Excel gives a totals row the FIRST time it is shown, and never again: an aggregate in the
275
+ * last column, chosen by what the column holds. Held in the props, which is where
276
+ * {@link _showTotalsFromProps} is about to look.
277
+ *
278
+ * @remarks
279
+ * Probed (`probe-table-totals-firstshow.ps1`): `109` (sum) when every cell of the body that holds
280
+ * anything holds a number - a formula's result counts, and so does a currency or a percent
281
+ * format - and `103` (count) as soon as one is text, a boolean, an error, or a number shown as a
282
+ * date or a time, and for a column with nothing in it. A row shown a second time is given
283
+ * nothing, even when the aggregate was cleared in between, which is what `totalsRowShown` records.
284
+ * The `Total` label is the first column's from the day the table is made.
285
+ */
286
+ private _holdFirstShowTotals;
287
+ /**
288
+ * The region a bare cursor on this table traverses within, or `null` to leave the move alone.
289
+ *
290
+ * @remarks
291
+ * Tab wraps within the body, so a row of entries runs on to the next row of the table. Tab from
292
+ * the last visible body cell adds a row first, as its own step, and the wrap lands in it - when
293
+ * the table grows down (see {@link ITable.AutoExpand}). Enter is not the table's: it walks off
294
+ * the bottom as it does on the bare sheet.
295
+ *
296
+ * @internal
297
+ */
298
+ _getTraverseRegion(cell: IRange.CellCoords, axis: IRange.Axis, reverse: boolean): IRange.Coords | null;
299
+ /**
300
+ * The totals row has just arrived on the sheet: give each column's totals to its cell, and take
301
+ * them out of the props - from here the cell is the record.
302
+ *
303
+ * @remarks
304
+ * A cell that already holds something is left as it is. The row is blank when it is shown again
305
+ * after being hidden; it may not be when a resize lands it on cells that were already there, and
306
+ * what the user put in a cell is not the table's to replace.
307
+ *
308
+ * The sheet calls this for a table it has just made, once the table is registered: a totals
309
+ * formula names its table, and does not bind while the table cannot be found.
310
+ *
311
+ * @internal
312
+ */
313
+ _showTotalsFromProps(): void;
90
314
  protected _deleteColumn(id: number | string, options?: ITransaction.OperationOptions): void;
91
315
  /** {@inheritDoc ITable.addColumn} */
92
316
  addColumn(index?: number, values?: Scalar[], name?: string, options?: ITransaction.OperationOptions): ITable.IColumn;
@@ -98,6 +322,14 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
98
322
  getColumnById(id: string): ITable.IColumn | null;
99
323
  /** {@inheritDoc ITable.getColumns} */
100
324
  getColumnByName(name: string): ITable.IColumn | null;
325
+ /** {@inheritDoc ITable.delete} */
326
+ delete(options?: ITransaction.OperationOptions): void;
327
+ /**
328
+ * @internal
329
+ * Removes the table and leaves its cells as they are. `release` is what its references become;
330
+ * `null` leaves them, for a removal the table outlives (a cut re-adds it).
331
+ */
332
+ _remove(release?: 'error' | 'address' | null): void;
101
333
  /** {@inheritDoc ITable.convertToRange} */
102
334
  convertToRange(maxCells?: number, options?: ITransaction.OperationOptions): ICellRange;
103
335
  /** {@inheritDoc ITable.resizeTo} */
@@ -116,10 +348,35 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
116
348
  /** {@inheritDoc ITable.select} */
117
349
  select(options?: ICellRange.SelectOptions): Promise<ICellRange>;
118
350
  /** @internal */
119
- protected _processRestoreOrRevert(state: State, view: CommitView, commit: ITransaction.ICommit): void;
351
+ protected _processRestoreOrRevert(state: State, commit: ITransaction.ICommit): void;
352
+ /**
353
+ * Bring the header and expand listeners in line with the anchor this snapshot holds.
354
+ *
355
+ * @remarks
356
+ * A restore lands on whatever references the snapshot's listener map carries, but the callbacks
357
+ * for them live on this instance, and only the ones registered most recently are still here. So
358
+ * the subscription is re-derived from the restored anchor: a listener whose coords are still the
359
+ * header's (or the ring's) is kept, any other is replaced. This is what keeps the subscription
360
+ * attached to the table rather than to the commit that registered it.
361
+ */
362
+ private _syncListenersToAnchor;
363
+ /**
364
+ * The sheet has moved this table whole, as a same-sheet cut does.
365
+ *
366
+ * @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
371
+ */
372
+ _processAfterMove(): void;
120
373
  /** @internal */
121
374
  protected _processAnchorCoords(): void;
122
- /** @internal */
375
+ /**
376
+ * A table is one rectangle and holds its anchor as one, where the base holds the container's list.
377
+ *
378
+ * @internal
379
+ */
123
380
  protected _processAfterContainerShift(before: IRange.Coords[], after: IRange.Coords[]): void;
124
381
  /** {@inheritDoc ITable.getDataRange} */
125
382
  getDataRange(): ICellRange;
@@ -162,26 +419,163 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
162
419
  isShowBandedRows(): boolean;
163
420
  /** {@inheritDoc ITable.setShowBandedRows} */
164
421
  setShowBandedRows(showBandedRows: boolean, options?: ITransaction.OperationOptions): this;
165
- protected _setupAutoExpand(): void;
166
- /** {@inheritDoc ITable.setDisabledAutoExpand} */
167
- setDisabledAutoExpand(disabledAutoSize: boolean, options?: ITransaction.OperationOptions): this;
168
- /** {@inheritDoc ITable.isDisabledAutoExpand} */
169
- isDisabledAutoExpand(): boolean;
422
+ /**
423
+ * What the auto-expand listener watches: the table grown by one row and one column, clipped to
424
+ * the sheet. `null` when there is nothing to watch.
425
+ *
426
+ * @remarks
427
+ * The extra column is the right strip and the extra row is the bottom strip; content arriving in
428
+ * either grows the table. The cell the two share diagonally belongs to neither.
429
+ */
430
+ private _getExpandListenerCoords;
431
+ private _removeExpandListener;
432
+ /** @internal */
433
+ protected _processExpandListener(): void;
434
+ private _onExpandListenerEvent;
435
+ /**
436
+ * A formula has been entered in the row just below the table: that row becomes the totals row, in
437
+ * the one step of the expansion (Excel: `Table AutoExpansion`).
438
+ *
439
+ * @remarks
440
+ * Probed (`probe-table-autototals.ps1`). What was entered stays where it is and is its column's
441
+ * total from here on. The other columns total nothing - not the `Total` label a table is made
442
+ * with, not the aggregate a first showing gives - unless the table has shown a totals row before,
443
+ * whose totals then come back beside it as they would with the row toggled on.
444
+ */
445
+ private _takeRowBelowAsTotals;
446
+ /**
447
+ * What a commit that wrote into the body means for the columns it wrote to: a formula to fill
448
+ * down the column, a formula to remember, or one to forget.
449
+ *
450
+ * @remarks
451
+ * Probed (`probe-table-columnfill.ps1` and `-edges.ps1`). A formula written to ONE body cell is
452
+ * filled down its column when every other body cell of the column is blank, or when the column
453
+ * is calculated and every other body cell still holds one formula - so editing the formula of
454
+ * a calculated column edits the column, and a column holding an exception, a blank one
455
+ * included, is left alone. Nothing is asked about what the written cell held before. A write of
456
+ * two cells or more never fills, whatever it wrote. The fill is a commit of its own (Excel:
457
+ * `Fill`), recorded after the write it follows, so the first undo takes back the fill and
458
+ * leaves the formula that was typed. Hidden and filtered rows are filled like any other, and
459
+ * the totals row never is.
460
+ *
461
+ * A write that fills nothing can still change what the column remembers, and that is part of
462
+ * the write, not a step of its own: a formula written over the whole body in one write is
463
+ * remembered, and a column left with no formula in it at all remembers none.
464
+ *
465
+ * Everything here is asked of whole rectangles and of formula blocks - a filled column is one
466
+ * block - never cell by cell.
467
+ *
468
+ * @param changed Every range the commit changed, unclipped.
469
+ * @param bodyBefore The body as it was when the commit landed. A row the table has taken since
470
+ * is not one the write could have filled from: a formula written just below a table becomes a
471
+ * row of it and fills nothing.
472
+ */
473
+ private _processBodyWrite;
474
+ /**
475
+ * A table has just been made over cells that were already there: a column whose cells hold one
476
+ * formula is a calculated column from the start.
477
+ *
478
+ * @remarks
479
+ * Probed (`probe-table-columnfill-created.ps1`). Excel looks at the LAST five body rows and no
480
+ * further. The column remembers the formula of its last body cell when at most one of the other
481
+ * four holds anything else - another formula, a constant, a blank. So `aaaaaabbbb` remembers
482
+ * `b`, `baaaa` and `ab` remember `a` and `b`, and `aabbb`, `aaab` and `aaa_` remember nothing.
483
+ * It is not a majority, and nothing above the five rows is ever asked.
484
+ *
485
+ * The sheet calls this for a table it has just made, never for one it loads: a file says which
486
+ * of its columns are calculated, and a column of identical formulas is not one unless it does.
487
+ *
488
+ * @internal
489
+ */
490
+ _detectCalculatedColumns(): void;
491
+ /**
492
+ * Every calculated column's formula as it reads in `rowIndex`, by column index, or `null` when
493
+ * no column is calculated.
494
+ *
495
+ * @remarks
496
+ * For rows about to become rows of the table, and asked BEFORE they are made: once a shift is
497
+ * part of the commit the engine has re-imaged nothing yet, and the text it hands out is from
498
+ * before the shift at a cell from after it. The price is an absolute reference to a cell below
499
+ * an insert, which the new row names as it was before the insert moved it.
500
+ */
501
+ private _calculatedTextsAt;
502
+ /**
503
+ * Give new body rows each calculated column's formula (probed, F4: a row added to the table is
504
+ * given it whatever the column's other cells hold). A column whose new cells already hold
505
+ * something - the write the table expanded for - keeps it.
506
+ *
507
+ * @param texts From {@link _calculatedTextsAt}, for `rowStart`.
508
+ */
509
+ private _writeCalculatedRows;
510
+ /**
511
+ * Fill the formula in `from` down the body of its column, and have the column remember it.
512
+ */
513
+ private _fillColumn;
514
+ /**
515
+ * Write what columns remember as their formula. `null` forgets.
516
+ */
517
+ private _rememberCalculated;
518
+ /**
519
+ * The anchor a commit grows the table to, or `null` when it grows nothing.
520
+ *
521
+ * @remarks
522
+ * The strip is the one column right of the table, or the one row below it. The table takes it
523
+ * when the commit wrote something there and everything the table would take, OUTSIDE what that
524
+ * commit touched, is blank. Nothing is asked about what the written cells held before: typing
525
+ * over a value that sits beside a table expands it in Excel, and so does writing the same value
526
+ * again. So an update expands and a delete does not, for the same reason a format does not - the
527
+ * cell has to hold something afterwards.
528
+ *
529
+ * A block written across the edge is taken whole. A block that also runs past the table the
530
+ * other way - across its corner - is not beside the table, and takes nothing.
531
+ *
532
+ * @param changed Every range the commit changed, unclipped.
533
+ */
534
+ private _getAutoExpandCoords;
535
+ /** {@inheritDoc ITable.setAutoExpand} */
536
+ setAutoExpand(autoExpand: ITable.AutoExpand, options?: ITransaction.OperationOptions): this;
537
+ /** {@inheritDoc ITable.getAutoExpand} */
538
+ getAutoExpand(): ITable.AutoExpand;
539
+ /** {@inheritDoc ITable.setFormulaBelow} */
540
+ setFormulaBelow(formulaBelow: ITable.FormulaBelow, options?: ITransaction.OperationOptions): this;
541
+ /** {@inheritDoc ITable.getFormulaBelow} */
542
+ getFormulaBelow(): ITable.FormulaBelow;
543
+ /** {@inheritDoc ITable.setDisabledColumnFill} */
544
+ setDisabledColumnFill(disabledColumnFill: boolean, options?: ITransaction.OperationOptions): this;
545
+ /** {@inheritDoc ITable.isDisabledColumnFill} */
546
+ isDisabledColumnFill(): boolean;
547
+ /**
548
+ * The active levels as indexed conditions, in level order — what an apply re-runs.
549
+ *
550
+ * A level can outlive its condition (a column rebuild leaves the filter behind), and there is
551
+ * nothing to reapply for one that has none.
552
+ */
553
+ private _filterLevels;
170
554
  /** {@inheritDoc ITable.applyFilters} */
171
- applyFilters(options?: ITransaction.OperationOptions): this;
555
+ applyFilters(options?: ITransaction.OperationOptions): Promise<this>;
172
556
  /** {@inheritDoc ITable.deleteFilters} */
173
- deleteFilters(options?: ITransaction.OperationOptions): this;
557
+ deleteFilters(options?: ITransaction.OperationOptions): Promise<this>;
174
558
  /** {@inheritDoc ITable.getActiveFilters} */
175
559
  getActiveFilters(): readonly IFilter[];
176
560
  /** {@inheritDoc ITable.getFilterAt} */
177
561
  getFilterAt(index: number): IFilter | null;
178
- protected _updateSorts(sorts: ISort.Options[] | undefined, originalSorts: readonly ISort[], orderedColumnsProps: ColumnPropertiesState[], mapColumnPropsById: Map<string | number, ColumnPropertiesState>): readonly ISort[];
179
- protected _updateFilters(conditions: ICondition.Input[] | undefined, originalFilters: readonly IFilter[], orderedColumnsProps: ColumnPropertiesState[], mapColumnPropsById: Map<string | number, ColumnPropertiesState>): readonly IFilter[];
180
- /** {@inheritDoc ITable.filter} */
181
562
  /**
182
- * Perform filtering on the table.
563
+ * Replace every sort on the table with `sorts`, in `orderedColumnsProps`.
564
+ *
565
+ * @remarks
566
+ * The props are the only place a sort lives, so setting them IS the change - there is no list of
567
+ * active sorts to keep alongside. Levels are written by input order and made dense by
568
+ * {@link _renumberLevels} when the props are written, which is what covers an entry naming a
569
+ * column that is not there.
570
+ *
571
+ * Entries are replaced rather than edited: the array the caller built shares its entries with the
572
+ * props an undo restores, and writing through one would rewrite history in place.
183
573
  */
184
- filter(conditions?: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions): this;
574
+ protected _updateSorts(sorts: ISort.Options[] | undefined, orderedColumnsProps: ColumnPropertiesState[]): void;
575
+ /** {@link _updateSorts} for the filters. */
576
+ protected _updateFilters(conditions: ICondition.Input[] | undefined, orderedColumnsProps: ColumnPropertiesState[]): void;
577
+ /** {@inheritDoc ITable.filter} */
578
+ filter(conditions?: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions): Promise<this>;
185
579
  /** {@inheritDoc ITable.sort} */
186
580
  sort(options?: ISort.RangeOptions & ITransaction.OperationOptions): this;
187
581
  /** {@inheritDoc ITable.applySorts} */
@@ -189,9 +583,9 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
189
583
  /** {@inheritDoc ITable.deleteSorts} */
190
584
  deleteSorts(options?: ITransaction.OperationOptions): this;
191
585
  /** {@inheritDoc ITable.applySortsAndFilters} */
192
- applySortsAndFilters(options?: ITransaction.OperationOptions): this;
586
+ applySortsAndFilters(options?: ITransaction.OperationOptions): Promise<this>;
193
587
  /** {@inheritDoc ITable.deleteSortsAndFilters} */
194
- deleteSortsAndFilters(options?: ITransaction.OperationOptions): this;
588
+ deleteSortsAndFilters(options?: ITransaction.OperationOptions): Promise<this>;
195
589
  /** {@inheritDoc ITable.getActiveSorts} */
196
590
  getActiveSorts(): readonly ISort[];
197
591
  /** {@inheritDoc ITable.getSortAt} */
@@ -204,8 +598,26 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
204
598
  setHiddenButtons(hidden: boolean): this;
205
599
  /** {@inheritDoc ITable.isHiddenButtons} */
206
600
  isHiddenButtons(): boolean;
207
- /** @internal */
208
- private _applyFilters;
601
+ /**
602
+ * The read-only half of a filter: the runs `conditions` settle over the header and body rows.
603
+ * `null` for a table with no sheet (a preview), which has no rows to hide.
604
+ *
605
+ * @remarks
606
+ * The header row is never evaluated or hidden, and neither is the totals row. `headerRowCount`
607
+ * decides the header, not `isShowHeaders()`: the sheet AutoFilter answers `false` to the band
608
+ * question yet has a header row.
609
+ */
610
+ private _evalFilter;
611
+ /** The write half of a filter: the rows, then the listeners. Inside the caller's transaction. */
612
+ private _applyFilterRuns;
613
+ /** The levels, then the rows ({@link _applyFilterRuns}). Inside the caller's transaction. */
614
+ private _writeFilters;
615
+ /**
616
+ * Take over an absorbed AutoFilter's criteria: the levels alone, never the rows. The table took
617
+ * the AutoFilter's own range, so the rows already sit as its criteria left them.
618
+ * @internal
619
+ */
620
+ _carryFilters(conditions: ICondition.Input[]): void;
209
621
  /** @internal */
210
622
  private _applySorts;
211
623
  /** {@inheritDoc ITable.getColumnAt} */
@@ -224,20 +636,18 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
224
636
  *
225
637
  * @internal
226
638
  */
227
- protected _updateColumnsState(columnPropsNews: Partial<ColumnPropertiesState>[], options?: string | ITransaction.OperationOptions): ITable.IColumn[];
639
+ protected _updateColumnsState(columnPropsNews: Partial<ColumnPropertiesState>[], options?: string | ITransaction.OperationOptions): readonly ITable.IColumn[];
228
640
  /**
229
- * Re-derives the active filter and sort levels from the column props.
641
+ * The one write path for the column props.
230
642
  *
231
643
  * @remarks
232
- * A level is bound to a column id, but the column props are where a filter or sort actually
233
- * lives. Rebuilding the columns (a delete, a sheet sync) can therefore take a column out from
234
- * under its level, and a level that outlives its column reads back as unfiltered while its rows
235
- * stay hidden. Deriving the levels from the props instead of carrying them alongside keeps the
236
- * two from drifting, and closes the gap in `level` left by whatever was dropped.
644
+ * Levels are made dense here, whatever the caller did to the array - see
645
+ * {@link _renumberLevels}. Everything the getters answer with is derived from what this writes
646
+ * ({@link _views}), so there is nothing else to bring along.
237
647
  *
238
648
  * @internal
239
649
  */
240
- private _rebuildActiveLevels;
650
+ private _writeColumnProps;
241
651
  /** {@inheritDoc ITable.getVisibleRefRangeCoords} */
242
652
  getVisibleRefRangeCoords(): IRange.Coords;
243
653
  /** {@inheritDoc ITable.getVisibleCellCoords} */
@@ -251,45 +661,157 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
251
661
  /** {@inheritDoc ITable.isLastColumnVisible} */
252
662
  isLastColumnVisible(): boolean;
253
663
  /**
254
- * Builds columns from state and sheet (if available).
664
+ * Bring the header row and the column names back into step.
255
665
  *
256
666
  * @remarks
257
- * The `converted` is true if the sheet is out of sync from the state.columns.
667
+ * `from: 'table'` writes the names to the header row. `from: 'sheet'` reads the header row into
668
+ * the names, and does nothing when the sheet already shows what the table holds. A header cell the
669
+ * table cannot take as it is - a number, a duplicate, a blank - is named for it, and that name is
670
+ * written back to the cell unless `write` is `false`.
671
+ *
672
+ * The totals row is not synced here: its cells are never mirrored into the columns - see
673
+ * {@link _totalsOf}.
258
674
  *
259
675
  * @internal
260
676
  */
261
- protected _readSyncSheet(ignoreBlanks?: boolean, ignoreTotal?: boolean): {
262
- columns: ITable.ColumnProperties[];
263
- converted: boolean;
264
- } | null;
677
+ protected _syncHeader(options: {
678
+ from: 'sheet' | 'table';
679
+ /** A blank header cell keeps the column's name, rather than being given a default one. */
680
+ keepNameOnBlank?: boolean;
681
+ description?: string;
682
+ /** `false` leaves a converted cell as it is on the sheet, for the caller to write. *default* `true`. */
683
+ write?: boolean;
684
+ }): void;
265
685
  /**
266
- * This takes a list of columns headers and then validates them
267
- * and if there is a sheet it will set the values back into the sheet.
268
- *
269
- * 1. They must be unique. (case insensitive)
270
- * 2. They can't be blank.
271
- * 3. They must be text
272
- *
273
- * @param isRemove If true we are removing so we don't update the sheet.
274
- * @internal
686
+ * Builds columns from state and the header row of the sheet (if available). `converted` is true
687
+ * when a header cell had to be named for the table rather than taken as it is.
688
+ */
689
+ private _readHeader;
690
+ /**
691
+ * Writes the column names to the header row.
275
692
  */
276
- protected _writeSyncSheet(isRemove?: boolean): void;
693
+ private _writeHeader;
277
694
  /** @internal */
278
695
  protected _processDelete(): void;
279
- /** @internal */
280
- protected _processFilterUpdate(): void;
696
+ /**
697
+ * Make a write to this table's own sheet, recorded as the table's - see {@link IntentTableOwnWrites}.
698
+ * The record and the write are one root commit, whether or not the caller has one open.
699
+ */
700
+ private _ownWrite;
701
+ /**
702
+ * The ranges of `changed` that this table did not write itself in the commit `commitId`, which
703
+ * is the root commit a sheet listener's event names.
704
+ */
705
+ private _notOwnWrites;
706
+ /**
707
+ * Asks for the A1 references that spanned the body to be re-fitted to `to` - see
708
+ * {@link AnchoredTable.ConstructorOptions.refitBodyRows}. Whatever part of it runs later runs only
709
+ * while the body is still `to`: an undo, or another edit that moved the table, ends it.
710
+ */
711
+ protected _refitBody(columns: {
712
+ colStart: number;
713
+ colEnd: number;
714
+ }, match: {
715
+ rowStart: number;
716
+ rowEnd: number;
717
+ }, headerRow: number | null, to: {
718
+ rowStart: number;
719
+ rowEnd: number;
720
+ }, afterShift: boolean): void;
281
721
  /** @internal */
282
722
  protected _processContainerShift(options: Anchored.ShiftOptions): IRange.Coords | null | void;
283
- protected _beginCommit(options?: string | ITransaction.OperationOptions): ITransaction;
284
- private _modifyTable;
723
+ /**
724
+ * Write the table's own properties: its name, its description, its style, its flags.
725
+ *
726
+ * @remarks
727
+ * Nothing here reaches the sheet. The bands and the anchor have writers of their own because
728
+ * they do - see {@link _setBands} and {@link _setAnchor}. Which of the three a public setter
729
+ * calls is fixed by the setter, never worked out from the keys it was handed.
730
+ */
731
+ private _setProps;
732
+ /**
733
+ * Show or hide the header row, the totals row, or both.
734
+ *
735
+ * @remarks
736
+ * A band is a row on the sheet, so showing one has to find the space for it and hiding one has
737
+ * to clear it - {@link _ensureHeightForHeaderTotals} does that, and moves the anchor when the
738
+ * table grew or shrank. A totals row takes what its cells hold with it when it goes
739
+ * ({@link _holdTotalsFromCells}) and gives it back to them when it returns
740
+ * ({@link _showTotalsFromProps}), all in this one transaction: Excel's `Toggle Total Row` is a
741
+ * single undo step, label and formulas together.
742
+ *
743
+ * @param headerRowCount `undefined` leaves the header as it is.
744
+ * @param totalsRowCount `undefined` leaves the totals row as it is.
745
+ */
746
+ private _setBands;
747
+ /**
748
+ * Move the table, or change what it covers.
749
+ *
750
+ * @remarks
751
+ * The columns follow the width ({@link _spliceColumnsToAnchor}), and the header row is then read
752
+ * back, so a column the table has just covered is named by the text that was already sitting in
753
+ * its header cell rather than by a generated one.
754
+ */
755
+ private _setAnchor;
756
+ /**
757
+ * Move the totals row to the row a resize ends the table on.
758
+ *
759
+ * @remarks
760
+ * Excel moves the row rather than rewriting it (probed, `probe-table-totals-refit.ps1`): what it
761
+ * passes on the way becomes body - growing over `70, 80` makes them the last two body rows, and
762
+ * shrinking leaves the body rows given up sitting below the totals - and nothing outside the
763
+ * table's columns or below the two rows involved ends up anywhere else.
764
+ *
765
+ * That is a rotation of the totals row past the rows between, done here with the sheet's own
766
+ * shifts - inserts and deletes of the table's columns - so that what names a cell follows it and
767
+ * nothing below the two rows is left anywhere else. A shift carries cells but cannot reorder
768
+ * them, so one side of the rotation has to be written again, and which side depends on what the
769
+ * totals row passes:
770
+ *
771
+ * - **Growing over blank rows**, the usual case, the blank rows are the side given up. Rows are
772
+ * inserted above the totals row, which carries it down whole - its formats, its formulas and
773
+ * every reference to its cells, exactly as Excel has them - and the blank rows it pushed out
774
+ * below are deleted.
775
+ * - **Growing over content, and shrinking**, the rows between are the user's and have to travel,
776
+ * so the totals row is the side written again: a blank row is opened where it is going, its
777
+ * cells are written there - formula, value and the cell's own format - and the row they came
778
+ * from is deleted, which closes the gap. Two divergences follow from writing rather than
779
+ * moving. A reference to a totals CELL from elsewhere (`=C7`) becomes `#REF!` where Excel
780
+ * re-points it; `Table[[#Totals],[Column]]` is unaffected. And, shrinking, an A1 reference
781
+ * into the rows being given up is not pushed down with them (Excel: `SUM(C3:C5)` becomes
782
+ * `SUM(C3:C6)`), because the engine re-images a formula for a shift once it has settled and
783
+ * the text written here is from before; Excel's own result there is a circular reference,
784
+ * the totals cell sitting inside that range.
785
+ *
786
+ * The table steps back above both rows first. A shift inside a table is the table's business
787
+ * ({@link _processContainerShift} would hide a totals row whose row is deleted); one below it is
788
+ * not.
789
+ *
790
+ * @param from The anchor the table has now, totals row included.
791
+ * @param rowEnd The row the totals row is going to.
792
+ */
793
+ private _moveTotalsRow;
794
+ /**
795
+ * Bring the column properties in line with a new width: a column taken in is appended (or
796
+ * prepended) and named, a column given up is dropped.
797
+ *
798
+ * @returns Whether the columns changed.
799
+ */
800
+ private _spliceColumnsToAnchor;
285
801
  /** {@inheritDoc IListener.ISource.addListeners} */
286
802
  addListeners(listeners: ITable.IListeners, options?: IListener.Options): IListener.Remove;
287
803
  /** @internal */
288
- protected _processAfterStateChange(state: State, view: CommitView, commit: ITransaction.ICommit): void;
804
+ protected _processAfterStateChange(state: State, commit: ITransaction.ICommit): void;
289
805
  /** @internal */
290
- protected _processHeaderListener(): void;
806
+ protected _isAnyChangeFromState(): boolean;
807
+ /**
808
+ * The row the header listener watches: the header row, or the first data row when there is no
809
+ * header, so a table without one still syncs its columns from the sheet.
810
+ */
811
+ private _getHeaderListenerCoords;
812
+ private _removeHeaderListener;
291
813
  /** @internal */
292
- protected _processTotalsListener(): void;
814
+ protected _processHeaderListener(): void;
293
815
  get [Symbol.toStringTag](): string;
294
816
  /** {@inheritDoc ICellRanges.toString} */
295
817
  toString(): string;
@@ -302,6 +824,32 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
302
824
  private _fromJSON;
303
825
  /** {@inheritDoc ITable.close} */
304
826
  close(): void;
827
+ /**
828
+ * A table is deleted when its state says so - and when it has no state at all.
829
+ *
830
+ * @remarks
831
+ * Undoing the commit that created a table (an add, a paste, the re-add of a cut) removes its
832
+ * state but cannot close the instance: a redo brings the state back, and the sheet's table map
833
+ * hands out this same instance again. In between it is a deleted table.
834
+ */
835
+ isDeleted(): boolean;
836
+ /**
837
+ * The state of a table that can be worked on, or `null` for one that is deleted, closed, or has
838
+ * no state in the current snapshot. Callbacks registered on the sheet outlive the table and ask
839
+ * this first.
840
+ */
841
+ private _getLiveState;
842
+ /** {@link _getLiveState}, for a mutator: a table that is gone refuses the write. */
843
+ private _requireLive;
844
+ /**
845
+ * The sheet this table is on, for an operation that reaches cells.
846
+ *
847
+ * @remarks
848
+ * A preview table ({@link Table}) has none: it is a style rendered over coordinates, with no
849
+ * ranges behind it. Its getters answer an invalid range, as an unanchored table's do; anything
850
+ * that would read or write cells says so here rather than failing on a `null` range further in.
851
+ */
852
+ private _requireSheet;
305
853
  /** {@inheritDoc ITable.isITable} */
306
854
  get isITable(): true;
307
855
  }
@@ -331,9 +879,41 @@ export declare namespace AnchoredTable {
331
879
  */
332
880
  syncSheet?: boolean;
333
881
  processTableUpdate?: () => void;
882
+ /**
883
+ * Called, inside the operation, when the table's name or its columns are set - and once when
884
+ * it is created - for whoever keeps a copy of them (the calculation's replica).
885
+ */
886
+ symbolsChanged?: (table: ITable) => void;
887
+ /**
888
+ * Called before {@link ITable.delete} (`'error'`) or {@link ITable.convertToRange} (`'address'`)
889
+ * removes the table, while it still exists, so the formulas that reference it can be rewritten.
890
+ */
891
+ releaseReferences?: (table: ITable, release: 'error' | 'address') => void;
892
+ /**
893
+ * Called when the body's rows have changed in a way a shift does not carry a reference through:
894
+ * rows taken or given up at its end, or a row inserted at its first row. The A1 references
895
+ * that spanned the body are re-fitted to it - see `Calculation._refitTableRows`.
896
+ *
897
+ * @param columns The table's columns.
898
+ * @param match The rows a reference spans now, if it spanned the body before.
899
+ * @param headerRow The header's row, when a reference from it to `match.rowEnd` counts too.
900
+ * @param to The body's rows now.
901
+ * @param afterShift `match` is where a shift this edit makes WILL put the reference.
902
+ * @param isCurrent Whether the table is still as this change left it; a re-fit that runs later
903
+ * does nothing once it is not.
904
+ */
905
+ refitBodyRows?: (columns: {
906
+ colStart: number;
907
+ colEnd: number;
908
+ }, match: {
909
+ rowStart: number;
910
+ rowEnd: number;
911
+ }, headerRow: number | null, to: {
912
+ rowStart: number;
913
+ rowEnd: number;
914
+ }, afterShift: boolean, isCurrent: () => boolean) => void;
334
915
  }
335
916
  }
336
- /** @internal */
337
917
  interface State extends AbstractAnchored.State {
338
918
  /** Single rectangle — this type is never anchored to more than one range. */
339
919
  anchorCoords: IRange.Coords;
@@ -341,25 +921,21 @@ interface State extends AbstractAnchored.State {
341
921
  description: string;
342
922
  headerRowCount: number;
343
923
  totalsRowCount: number;
924
+ /** Whether a totals row has EVER been shown. The first show is given defaults; no other is. */
925
+ totalsRowShown: boolean;
344
926
  style: ITableStyle.StyleOptions;
345
- disabledAutoExpand: boolean;
346
- mapColumnById: Map<string | number, ITable.IColumn>;
347
- mapColumnByIndex: Map<number, ITable.IColumn>;
348
- mapColumnByName: Map<string, ITable.IColumn>;
349
- orderedColumns: readonly ITable.IColumn[];
350
- mapColumnPropsById: Map<string | number, ColumnPropertiesState>;
927
+ autoExpand: ITable.AutoExpand;
928
+ formulaBelow: ITable.FormulaBelow;
929
+ disabledColumnFill: boolean;
930
+ /**
931
+ * The columns, and everything about them: their names, their sort and their filter. The only
932
+ * record of any of it - what the getters answer with is derived from this, never stored beside
933
+ * it. See {@link AnchoredTable._views}.
934
+ */
351
935
  orderedColumnsProps: readonly ColumnPropertiesState[];
352
- sortsActive: readonly ISort[];
353
- filtersActive: readonly IFilter[];
354
936
  hiddenButtons: boolean;
355
937
  mapHiddenButtons: Map<number, boolean>;
356
- headerRemoveListener: IListener.Remove | null;
357
- totalsRemoveListener: IListener.Remove | null;
358
938
  lastColId: number;
359
- shownTotalsRow: boolean;
360
- }
361
- /** @internal */
362
- interface CommitView extends AbstractAnchored.CommitView {
363
939
  }
364
940
  export {};
365
941
  //# sourceMappingURL=AnchoredTable.d.ts.map