@sheetxl/sdk 0.8.0-beta.15 → 0.8.0-beta.17

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 (195) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/{DDQtExVGSoCzAf6-.mjs → B-Q1-7RgSnA75J32.mjs} +506 -502
  3. package/browser/esm/{Cl3jq6y4Idilod82.mjs → BI6NwRrdLCbPdz6f.mjs} +3 -3
  4. package/browser/esm/{Blo0Hwg2ojXt99Dl.mjs → BWNQcQyx8wt6huOq.mjs} +2 -2
  5. package/browser/esm/{Do8TQqQvnFXRlFu-.mjs → BY_-BTa5h6HnnZ1W.mjs} +3 -3
  6. package/browser/esm/{D4ZCoKyNCJvDQAkx.mjs → BlkstmZEklk6Y1QD.mjs} +23 -22
  7. package/browser/esm/{DpaqR081c-Q7WemN.mjs → BuKA3E-Ev8Dp5W2I.mjs} +2 -2
  8. package/browser/esm/{Bbrhl946_QbCz5WS.mjs → Byp_bvP9G-tN6hcz.mjs} +588 -587
  9. package/browser/esm/{CMSeF5rGzeuMUydM.mjs → C0o6WpBojS7XhV5m.mjs} +3 -3
  10. package/browser/esm/CAjITJT3eLst9Rhi.mjs +686 -0
  11. package/browser/esm/{CZ_ZPliIkoh8BViV.mjs → CFywn1iiD35nNNUP.mjs} +10 -10
  12. package/browser/esm/{DJNLo8Rd_5UQP0U5.mjs → CHByUyHFA3ESf7DX.mjs} +2 -2
  13. package/browser/esm/CLT3qGy_brDIwbYd.mjs +2017 -0
  14. package/browser/esm/{Blo0jHze0bQxnKh4.mjs → CVV4xqwD8gIjYj1E.mjs} +78 -78
  15. package/browser/esm/{FHp0QfwZMIfP0Sry.mjs → CWkaF7gYWCkW7vDA.mjs} +2 -2
  16. package/browser/esm/{CNM5d4p0Y7In0rTf.mjs → DCs7bk-yx0UhCvQ4.mjs} +3 -3
  17. package/browser/esm/{BsGN0Tk0jVc2n0hy.mjs → DDNerAeet8uDYKhf.mjs} +3 -3
  18. package/browser/esm/{D6OqcO9IWPaY211T.mjs → DGUOlgm1_WFmf_xO.mjs} +2 -2
  19. package/browser/esm/{Dp4OIVjjAVhpD815.mjs → DJTEQZiR9IFTuN_4.mjs} +3 -3
  20. package/browser/esm/{KgTozk3nvOZzEG27.mjs → DJrnSjYjFxJvpQiH.mjs} +2 -2
  21. package/browser/esm/{D0KMmRjGOQUs7Ls-.mjs → DTXsi--x2wgqgwtf.mjs} +3 -3
  22. package/browser/esm/{CPUobTehcKZllBDS.mjs → DUB6Oj_aiV3f8s5_.mjs} +51 -49
  23. package/browser/esm/{Bw66vzKThXKvXvPI.mjs → DW3kFc5t4Wnh5E9S.mjs} +2 -2
  24. package/browser/esm/{BzG0p8RdGDWHttVr.mjs → DkmqFp_-iUIy_l3D.mjs} +4 -4
  25. package/browser/esm/{zjEXdQiQruTkUyf5.mjs → Dlk1kRgkiBIpUxd9.mjs} +22 -22
  26. package/browser/esm/{tm7XJ-Zd_04xWKG6.mjs → DnMFW_oKYQxRjP1l.mjs} +2 -2
  27. package/browser/esm/{DA4S5eqog20pG7b2.mjs → DrmOaEx6CQ91zBsP.mjs} +29 -29
  28. package/browser/esm/{D8PxKK6OrmancpLT.mjs → DsWDvmky7CgzX_7W.mjs} +3 -3
  29. package/browser/esm/{DMbcmIZ-G2fbWn8v.mjs → Dx_dZ7jrw5Hxeoot.mjs} +2 -2
  30. package/browser/esm/{BN1MW1nuBndrzryn.mjs → Dy0TAi9WafVT8eke.mjs} +3 -3
  31. package/browser/esm/{L7SKr6r1tmMwFx6Q.mjs → JmmPE8Vsj85wdV8H.mjs} +2 -2
  32. package/browser/esm/{CIab4UYcHQQKTHeD.mjs → O970I8lbI7okqG7N.mjs} +404 -404
  33. package/browser/esm/{DwH4H_p6gTAcpQ17.mjs → WR3-xqcK1gF3ewAR.mjs} +4 -4
  34. package/browser/esm/XHhDDWrJiZJgWxPM.mjs +165 -0
  35. package/browser/esm/{KsfZhE6ocmYobGjY.mjs → YwDdO4YwcIE4OB0D.mjs} +2 -2
  36. package/browser/esm/aYpwVCDSwMUuz147.mjs +527 -0
  37. package/browser/esm/{BGPT-k25jo0UhtT5.mjs → gQzj95vSMXdKhpWf.mjs} +29032 -24101
  38. package/browser/esm/index.mjs +886 -578
  39. package/browser/esm/{CxhXbk-5XhaK8UNs.mjs → jotvQFBWO2jXAhWx.mjs} +2 -2
  40. package/browser/esm/{CWyzk_3eDCR9bKq6.mjs → mufbL88lyIKJEWyP.mjs} +1528 -1433
  41. package/browser/esm/{BVsG6Vpvb1ZzpURJ.mjs → qNv1x-Ny9TPbvZzj.mjs} +2 -2
  42. package/browser/esm/{XrasOsWQ-64jwMn1.mjs → taTjDyUIIxq2eClH.mjs} +4 -4
  43. package/browser/esm/{CqzKBrmmV-fWRoK7.mjs → yudASWe8CWXYcGt3.mjs} +22 -22
  44. package/licenses/dependencies.txt +69 -69
  45. package/node/esm/{CjwmkzMtjj6OMJbO.mjs → -q1xF3_2jmk3QHIY.mjs} +487 -483
  46. package/node/esm/{DDIiQZTdeY4vdK8_.mjs → 7ZwdVIsOdcziHpMD.mjs} +189 -189
  47. package/node/esm/{C7h7SvhWNwQ9TfGh.mjs → B6BQYUDRxbRnzca4.mjs} +4 -4
  48. package/node/esm/{DjsOfZn5vYpB7L6U.mjs → B8MYgBe4XICBSROW.mjs} +52 -50
  49. package/node/esm/{B8KEX44VZTFTTKb3.mjs → BBUVvO9Ma1RzbKux.mjs} +3 -3
  50. package/node/esm/{D9RwzPR5s2mWrbCQ.mjs → BQko-9y6mf2oQK7u.mjs} +2 -2
  51. package/node/esm/{BNiG1ISiMjs-G2mE.mjs → BSlFO0_8UZ38gfeE.mjs} +22 -22
  52. package/node/esm/{DUft-qpAS4MMANwG.mjs → Bgy7uWJVGwkN7AlD.mjs} +3 -3
  53. package/node/esm/{DyIASfKKPuNl5Xx-.mjs → BhosJbKOPgbJSZMY.mjs} +2 -2
  54. package/node/esm/BoLecFnIxhYKGor-.mjs +2040 -0
  55. package/node/esm/{WBHD7ECKG6HZ5UpY.mjs → BwyoLlHutolJw7OW.mjs} +2 -2
  56. package/node/esm/{Dh8o-woVpmUL50BD.mjs → CDgUHRW6vSASfqNr.mjs} +2 -2
  57. package/node/esm/{BZ0IRjh2hYuI86xW.mjs → CHS84ZGEoH6aeHsZ.mjs} +31 -30
  58. package/node/esm/{BRnNpoS8VpkAhdVk.mjs → CIlH2fSEpdYBZwUA.mjs} +2 -2
  59. package/node/esm/{BlzPuXtKvF3Qfr0p.mjs → CIxb44vA81H9lRip.mjs} +2 -2
  60. package/node/esm/{Cx9nQSsuyqhayyBS.mjs → Cb1-r2RCxcJZB6fM.mjs} +32675 -27215
  61. package/node/esm/{DKdFasYVvjAitASZ.mjs → CjCqcGyCYGkaMQI9.mjs} +2 -2
  62. package/node/esm/{D7ia4o3y5Wvl__9Y.mjs → ClJJC8tBpgsqHwdn.mjs} +2 -2
  63. package/node/esm/{C-JEySqMuKdpcKe0.mjs → Cle-_21jebWv_-D4.mjs} +3 -3
  64. package/node/esm/{j8DqCwPgfIPICFtf.mjs → D51xu0rubo34Ppeg.mjs} +1005 -1004
  65. package/node/esm/{Ddd1y3TP0kqnnSs7.mjs → DCSJKgcCQzOV-dMJ.mjs} +3 -3
  66. package/node/esm/{ZtF9EuipL7Z9Iwfs.mjs → DCaLNIs-_4Y6hJ8S.mjs} +2 -2
  67. package/node/esm/DTkV7IK2_ODMJAP5.mjs +115 -0
  68. package/node/esm/DfbVTAhNutxM74E8.mjs +169 -0
  69. package/node/esm/{DVejVdSBXzAFQbqo.mjs → DfrxGbxxowFmm3SF.mjs} +2 -2
  70. package/node/esm/{DW3u4bBJIUaHZ6m-.mjs → DgsBYF3xbjgx9Mzp.mjs} +2 -2
  71. package/node/esm/{CHBlLTJaoPUVxA2J.mjs → DxnBYzOueAKEqaQT.mjs} +22 -22
  72. package/node/esm/M3jahkTgfUxGyeZv.mjs +530 -0
  73. package/node/esm/{-afI0SRg_vgXtea7.mjs → NnrDjio_xwTBs05n.mjs} +3 -3
  74. package/node/esm/{BqvqbFsPQB0gEvwF.mjs → OCrS6pBT6lGRu82d.mjs} +1762 -1674
  75. package/node/esm/XhDjStxKy-dd3WKa.mjs +199 -0
  76. package/node/esm/{D9zb5xVRehABdbXL.mjs → Yo7_havHbr9VL8R4.mjs} +2 -2
  77. package/node/esm/{MtRwC1PMkOEb1Nty.mjs → btVWSwUwMjM0J5fS.mjs} +3 -3
  78. package/node/esm/{DQqXPS05dvF0F-gh.mjs → cRz94rkuvDrA8mr9.mjs} +2 -2
  79. package/node/esm/{BfXLtDqsXXYeZ6LX.mjs → fwfAgq8qIADcHmY4.mjs} +78 -78
  80. package/node/esm/index.mjs +913 -598
  81. package/node/esm/{OnkJkCGFDjamqIUQ.mjs → jqBKdf9DG54xqpaw.mjs} +3 -3
  82. package/node/esm/{C6b4rM62pIWIywlM.mjs → nxxwAZZF8NsdErJW.mjs} +2 -2
  83. package/node/esm/{B07QPde9GloqsW8e.mjs → oGGVbqahqfK45-Uz.mjs} +4 -4
  84. package/node/esm/{BlHlBRvKGt-4CS0A.mjs → zh6vcRzFqdV1aYh5.mjs} +2 -2
  85. package/package.json +7 -7
  86. package/resources/locales/de/model.msg.json +82 -1
  87. package/resources/locales/en/model.msg.json +80 -1
  88. package/types/scripting-api.json +9967 -9497
  89. package/types/scripting-enums.json +27 -0
  90. package/types/scripting.d.ts +2282 -166
  91. package/types/src/.generated/wasm/sdk.d.ts +332 -0
  92. package/types/src/calculation/Calculation.d.ts +8 -0
  93. package/types/src/calculation/ICalculation.d.ts +51 -0
  94. package/types/src/calculation/compiler/Types.d.ts +5 -0
  95. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +1 -1
  96. package/types/src/calculation/formula/FormulaBlock.d.ts +2 -0
  97. package/types/src/calculation/formula/IFormulaBlock.d.ts +18 -0
  98. package/types/src/calculation/grid/CalcGrid.d.ts +5 -1
  99. package/types/src/calculation/grid/CalcGridBackend.d.ts +36 -1
  100. package/types/src/calculation/grid/CalcGridProxy.d.ts +2 -0
  101. package/types/src/calculation/grid/CalcGridUtils.d.ts +4 -2
  102. package/types/src/calculation/grid/FormulaHost.d.ts +3 -1
  103. package/types/src/calculation/grid/ICalcGrid.d.ts +88 -0
  104. package/types/src/calculation/grid/_CalcRequest.d.ts +9 -0
  105. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +2 -0
  106. package/types/src/calculation/spatial/SpillEntry.d.ts +55 -4
  107. package/types/src/calculation/state/CalcNode.d.ts +6 -3
  108. package/types/src/calculation/state/CalculationContext.d.ts +4 -2
  109. package/types/src/calculation/state/_PivotView.d.ts +22 -0
  110. package/types/src/cell/ICell.d.ts +1 -21
  111. package/types/src/cellRange/ICellRange.d.ts +18 -2
  112. package/types/src/collections/MixedTypedArrayList.d.ts +16 -2
  113. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +10 -0
  114. package/types/src/condition/BuiltInOperators/GreaterThanEqualToOperator.d.ts +3 -0
  115. package/types/src/condition/BuiltInOperators/GreaterThanOperator.d.ts +3 -0
  116. package/types/src/condition/BuiltInOperators/LessThanEqualToOperator.d.ts +3 -0
  117. package/types/src/condition/BuiltInOperators/LessThanOperator.d.ts +3 -0
  118. package/types/src/condition/BuiltInOperators/MatchesOperator.d.ts +10 -0
  119. package/types/src/condition/BuiltInOperators/TimePeriodOperator.d.ts +2 -0
  120. package/types/src/condition/BuiltInOperators/index.d.ts +2 -0
  121. package/types/src/condition/Condition.d.ts +1 -0
  122. package/types/src/condition/ICondition.d.ts +15 -0
  123. package/types/src/condition/_ConditionUtils.d.ts +14 -0
  124. package/types/src/conditionalFormat/ConditionalFormat.d.ts +2 -1
  125. package/types/src/conditionalFormat/IConditionalFormat.d.ts +4 -3
  126. package/types/src/license/LicenseDetails.d.ts +27 -0
  127. package/types/src/license/LicenseManager.d.ts +24 -7
  128. package/types/src/license/_Utils.d.ts +34 -3
  129. package/types/src/license/index.d.ts +1 -0
  130. package/types/src/license/runtime.browser.d.ts +32 -4
  131. package/types/src/license/runtime.node.d.ts +8 -5
  132. package/types/src/license/summary.d.ts +18 -0
  133. package/types/src/pivot/IPivotTable.d.ts +1549 -13
  134. package/types/src/pivot/IPivotTableCollection.d.ts +70 -4
  135. package/types/src/pivot/PivotCache.d.ts +95 -11
  136. package/types/src/pivot/PivotDataField.d.ts +73 -0
  137. package/types/src/pivot/PivotField.d.ts +142 -0
  138. package/types/src/pivot/PivotTable.d.ts +548 -14
  139. package/types/src/pivot/PivotTableCollection.d.ts +18 -3
  140. package/types/src/pivot/_PivotAreas.d.ts +48 -0
  141. package/types/src/pivot/_PivotControls.d.ts +140 -0
  142. package/types/src/pivot/_PivotEngine.d.ts +9 -0
  143. package/types/src/pivot/_PivotGroups.d.ts +25 -0
  144. package/types/src/pivot/_PivotItems.d.ts +167 -0
  145. package/types/src/pivot/_PivotStructure.d.ts +237 -0
  146. package/types/src/pivot/_PivotStylePreview.d.ts +21 -0
  147. package/types/src/pivot/_PivotUtils.d.ts +37 -0
  148. package/types/src/pivot/engine/PivotAdd.d.ts +37 -0
  149. package/types/src/pivot/engine/PivotData.d.ts +65 -0
  150. package/types/src/pivot/engine/PivotEdit.d.ts +45 -0
  151. package/types/src/pivot/engine/PivotFilters.d.ts +50 -0
  152. package/types/src/pivot/engine/PivotFormulas.d.ts +72 -0
  153. package/types/src/pivot/engine/PivotLayout.d.ts +133 -0
  154. package/types/src/pivot/engine/PivotMove.d.ts +24 -0
  155. package/types/src/pivot/engine/PivotRefresh.d.ts +87 -0
  156. package/types/src/pivot/engine/PivotSort.d.ts +26 -0
  157. package/types/src/pivot/engine/PivotViewBuilder.d.ts +22 -0
  158. package/types/src/pivot/engine/index.d.ts +15 -0
  159. package/types/src/pivot/index.d.ts +4 -0
  160. package/types/src/pivot/kernel/KernelPivot.d.ts +63 -0
  161. package/types/src/pivot/kernel/_KernelLeaves.d.ts +100 -0
  162. package/types/src/pivot/kernel/_PivotAxisTree.d.ts +71 -0
  163. package/types/src/primitives/Range.d.ts +12 -1
  164. package/types/src/sheet/IWorksheet.d.ts +35 -0
  165. package/types/src/sheet/SheetCell.d.ts +21 -14
  166. package/types/src/sheet/SheetRange.d.ts +3 -0
  167. package/types/src/sheet/Worksheet.d.ts +175 -7
  168. package/types/src/sheet/_PivotFootprint.d.ts +42 -0
  169. package/types/src/sheet/_SheetAutoFitUtils.d.ts +12 -1
  170. package/types/src/sheet/_SheetMutations.d.ts +47 -0
  171. package/types/src/sheet/_SheetStateTypes.d.ts +11 -0
  172. package/types/src/sheet/style/SheetCellStyle.d.ts +6 -0
  173. package/types/src/sheet/style/SheetPivotStyle.d.ts +83 -0
  174. package/types/src/sheet/style/_IndentUnit.d.ts +14 -0
  175. package/types/src/sheetHeader/SheetCellHeader.d.ts +1 -1
  176. package/types/src/slicer/ISlicer.d.ts +114 -34
  177. package/types/src/slicer/ITimeline.d.ts +61 -0
  178. package/types/src/slicer/Slicer.d.ts +76 -3
  179. package/types/src/slicer/_PivotSlicer.d.ts +51 -0
  180. package/types/src/slicer/index.d.ts +1 -0
  181. package/types/src/table/AnchoredTable.d.ts +11 -1
  182. package/types/src/table/ITable.d.ts +5 -6
  183. package/types/src/table/ITableStyle.d.ts +50 -34
  184. package/types/src/table/_BuiltInPivotStyles.d.ts +8 -0
  185. package/types/src/table/_BuiltInTableStyles.d.ts +0 -1
  186. package/types/src/type/ITypes.d.ts +5 -1
  187. package/types/src/workbook/IWorkbook.d.ts +8 -2
  188. package/types/src/workbook/Workbook.d.ts +72 -6
  189. package/browser/esm/BrHplg4RuI5jOmmr.mjs +0 -357
  190. package/browser/esm/eImPONkfn5DstmS8.mjs +0 -184
  191. package/node/esm/03AYPvCda2x9EOlY.mjs +0 -360
  192. package/node/esm/BmVQRGAijOHzgHmz.mjs +0 -199
  193. package/node/esm/Dk4KLs5GoRRuD8J4.mjs +0 -115
  194. package/types/src/pivot/_PivotXml.d.ts +0 -24
  195. package/types/src/primitives/Grouping.d.ts +0 -65
@@ -1,50 +1,584 @@
1
- import { IRange } from '@sheetxl/primitives';
1
+ import { IRange, Scalar } from '@sheetxl/primitives';
2
2
  import { IResource } from '../resource';
3
+ import { ITransaction } from '../transaction';
3
4
  import { IWorksheet } from '../sheet';
5
+ import { ICellRange } from '../cellRange';
6
+ import { IPivotTableCollection } from './IPivotTableCollection';
7
+ import { PivotCache } from './PivotCache';
8
+ import { ICellStyle } from '../style';
9
+ import { IProperties } from '../type';
10
+ import { ITableStyle } from '../table';
4
11
  import { Anchored } from '../anchored/Anchored';
5
12
  import { AbstractAnchored } from '../anchored/AbstractAnchored';
6
13
  import { IEmbeddedPart } from '../io';
14
+ import { ICalcGrid } from '../calculation/grid/ICalcGrid';
15
+ import { Tuple } from '../collections';
16
+ import { ISlicer } from '../slicer/ISlicer';
17
+ import { ITimeline } from '../slicer/ITimeline';
7
18
  import { IPivotTable } from './IPivotTable';
19
+ import { PivotEngineModule } from './_PivotEngine';
20
+ import { PivotCacheRemap } from './engine/PivotRefresh';
21
+ import { PivotFilterResult } from './engine/PivotFilters';
22
+ import { PivotFormatRegion, PivotStructure, PivotCacheFieldFormats } from './_PivotStructure';
23
+ import { PivotControl, PivotLabelInset } from './_PivotControls';
8
24
  interface State extends AbstractAnchored.State {
9
25
  anchorCoords: IRange.Coords;
10
26
  cacheId: number;
11
27
  name: string | null;
28
+ /** The fields, axes, data fields and layout; `null` for a table that is not modeled. */
29
+ model: PivotTable.Model | null;
30
+ /** The part as read, written while the table is unchanged; `null` once it is laid out again. */
31
+ part: IEmbeddedPart | null;
32
+ /** What the part's format ids named when read, for a table that is not modeled. */
33
+ partFormats: IPivotTable.PartFormatsJSON | null;
34
+ /** The location as the part spells it. While the location still says the same, the part is as read. */
35
+ ref: string | null;
36
+ /** As read, relative to the table's top-left cell; for a table never laid out. */
37
+ buttons: readonly string[] | null;
38
+ /** How many rows and columns the location covers, as read or as last laid out: the size it wants while blocked. */
39
+ size: PivotTable.Size;
40
+ /** It shows `#SPILL!` at its anchor, stored there, and covers that cell alone. */
41
+ blocked: boolean;
12
42
  }
13
43
  /**
14
- * Implementation for {@link IPivotTable}: the part it was read from, anchored on the sheet at its
15
- * `<location ref>`.
44
+ * Implementation for {@link IPivotTable}: the part it was read from, anchored on the sheet at what
45
+ * it holds, as a table is at its range.
16
46
  *
17
47
  * @remarks
18
- * The location is where the table SITS, so it is the anchor, as a table's range is, and the
19
- * sheet's anchored map moves it with structural edits inside their commit. The table rules on
20
- * those edits as a table does ({@link _processContainerShift}), with Excel's rule: an edit before
21
- * it moves it whole, one taking every cell of it deletes it, anything that would move part of it
22
- * is refused. {@link getXML} restates the anchor into the part; the rest of the part is as read.
48
+ * The anchor is what the table holds ({@link PivotTable.heldOf}): its page fields, the blank row
49
+ * under them and its location, or its location's top-left cell alone while it shows `#SPILL!`
50
+ * there. So the sheet's anchored map indexes it, a search finds it, and the map moves it with
51
+ * structural edits; an edit that takes it deletes the table. Each layout anchors it anew
52
+ * ({@link _refreshFrom}), as a table's resize does. The location is the anchor's bottom rows, the
53
+ * size it is laid out at, from its left column: the page fields only ever sit above it.
54
+ *
55
+ * The grid places the laid-out cells as a spill of kind `pivot`, or `#SPILL!` at the location when
56
+ * something is in the way (`ICalcGrid.setPivots`). That spill refuses an edit that would move part
57
+ * of it, as Excel refuses it (`SpillEntry.checkShift`), so the anchor only ever moves whole.
58
+ * {@link toJSON} restates the location into the part; the rest of the part is as read.
59
+ *
60
+ * The model, the part and the buttons are state, so a refresh is undone with the cells it wrote.
23
61
  */
24
62
  export declare class PivotTable extends AbstractAnchored<State, IPivotTable.Events> implements IPivotTable {
25
63
  protected _sheet: IWorksheet;
26
- protected _part: IEmbeddedPart | null;
27
- /** The location as the part spells it. While the anchor still says the same, the part is as read. */
28
- private _ref;
64
+ /** Its values and size, once computed ({@link _getPivotView}); `undefined` until asked, and after a change. */
65
+ private _view;
66
+ /** Its cells are being moved by a cut or written by its own layout ({@link _setSettling}). */
67
+ private _settling;
68
+ /** Its style over its cells, for the model, style and location it was made for ({@link _getRangedStyle}). */
69
+ private _ranged;
70
+ /** Where its layout puts it, for the model and location it was found for ({@link _getWanted}). */
71
+ private _placement;
72
+ /** Its cell layer, for the placement, style and cache fields it was made for ({@link _getCellLayer}). */
73
+ private _layer;
74
+ /** Its date regions, at sheet cells, for the placement and cache fields they were found for ({@link _getDateFormatsIn}). */
75
+ private _dates;
76
+ /** What its filters keep, for the filters, fields and cache contents they were evaluated over ({@link _prepareFilters}). */
77
+ private _filtered;
78
+ /** The model a relayout was prepared for and the one it lays out, anchored ({@link _prepareRelayout}); taken by {@link _refresh}. */
79
+ private _anchored;
80
+ /** The evaluation of its filters under way, if any ({@link _prepareFilters}). */
81
+ private _filtering;
29
82
  constructor(options: PivotTable.ConstructorOptions);
30
83
  protected _initialize(options: PivotTable.ConstructorOptions): void;
31
84
  /** {@inheritDoc IPivotTable.getName} */
32
85
  getName(): string;
86
+ /** {@inheritDoc IPivotTable.setName} */
87
+ setName(name: string, options?: ITransaction.OperationOptions): Promise<void>;
33
88
  /** {@inheritDoc IPivotTable.getWorksheet} */
34
89
  getWorksheet(): IWorksheet;
35
- /** {@inheritDoc IPivotTable.getXML} */
36
- getXML(): string | null;
90
+ /** {@inheritDoc IPivotTable.getRange} */
91
+ getRange(options?: ICellRange.GetRangeOptions): ICellRange;
92
+ /** {@inheritDoc IPivotTable.getPageRange} */
93
+ getPageRange(options?: ICellRange.GetRangeOptions): ICellRange | null;
94
+ /** {@inheritDoc IPivotTable.getBodyAndTotalRange} */
95
+ getBodyAndTotalRange(options?: ICellRange.GetRangeOptions): ICellRange | null;
96
+ /** {@inheritDoc IPivotTable.getRowLabelRange} */
97
+ getRowLabelRange(options?: ICellRange.GetRangeOptions): ICellRange | null;
98
+ /** {@inheritDoc IPivotTable.getColumnLabelRange} */
99
+ getColumnLabelRange(options?: ICellRange.GetRangeOptions): ICellRange | null;
100
+ /**
101
+ * A part of the laid-out table, as Excel's `PageRange`, `DataBodyRange`, `RowRange` and
102
+ * `ColumnRange` answer (`probe-pivot-add.ps1`, A08; `probe-pivot-table-api.ps1`, R01-R09): `null`
103
+ * when it has none, or is blocked, where Excel answers the anchor cell.
104
+ */
105
+ private _rangeOfPart;
106
+ /** {@inheritDoc IPivotTable.moveTo} */
107
+ moveTo(cell: ICellRange.Address, options?: IPivotTable.MoveOptions): Promise<void>;
108
+ /** {@inheritDoc IPivotTable.getSource} */
109
+ getSource(): string | null;
110
+ /**
111
+ * {@inheritDoc IPivotTable.setSource}
112
+ *
113
+ * @remarks
114
+ * The table always moves to a cache of its own, as Excel's `ChangePivotCache` does
115
+ * (`pivot-probes/probe-pivot-change-source.ps1`, C02, C07); one no table names is not written.
116
+ */
117
+ setSource(source: IPivotTableCollection.Source, options?: ITransaction.OperationOptions): Promise<void>;
118
+ /**
119
+ * {@inheritDoc IPivotTable.addSlicer}
120
+ *
121
+ * @remarks
122
+ * The cache lists the field's items, as Excel does for a slicer's field
123
+ * (`pivot-probes/probe-pivot-slicer-caption.ps1`, C07): a slicer's items are the cache's.
124
+ */
125
+ addSlicer(field: IPivotTable.IField | string, options?: ISlicer.AddOptions): Promise<ISlicer>;
126
+ /**
127
+ * Sets a field's label or date filter to a range of dates, or removes it for `null`: what a
128
+ * timeline's selection writes to each table it filters, the field on an axis or not.
129
+ *
130
+ * @throws ExpectedError When the table is not modeled.
131
+ * @internal
132
+ */
133
+ _setDateRange(field: number, name: string, range: ITimeline.DateRange | null): Promise<void>;
134
+ /**
135
+ * Shows the cache items `shown` of a field, or every item for `null`: what a slicer's selection
136
+ * writes to each table it filters. A field the table lists no items for lists them first.
137
+ *
138
+ * @throws ExpectedError When the table is not modeled.
139
+ * @internal
140
+ */
141
+ _showSlicerItems(field: number, shown: ReadonlySet<number> | null): Promise<void>;
142
+ /**
143
+ * Where the table is laid out: its location's top-left cell ({@link _locationCell}) and the size
144
+ * it is laid out at, or that cell alone while it shows `#SPILL!` there. `null` once deleted.
145
+ */
146
+ private _getLocation;
147
+ /**
148
+ * The top-left cell of the table's location: the first of the anchor's bottom rows, the size it
149
+ * holds, in its left column; the anchor itself while blocked. `null` once deleted.
150
+ * @internal
151
+ */
152
+ _locationCell(): IRange.Coords | null;
153
+ /**
154
+ * Takes the size it covers now as its own, before a cut moves it with its cells, and is anchored
155
+ * at what it holds at that size; the cut then moves the anchor in the sheet's map. A blocked table
156
+ * keeps the size it wants: it moves its anchor alone.
157
+ * @internal
158
+ */
159
+ _holdLocation(): void;
160
+ /** {@inheritDoc IPivotTable.isStale} */
161
+ isStale(): boolean;
162
+ /**
163
+ * Whether the table is modeled: its values can be computed (`ICalcGrid.setPivots`).
164
+ * @internal
165
+ */
166
+ _isModeled(): boolean;
167
+ /**
168
+ * The values the table shows and where it sits now, for the grid to hold its extent and for
169
+ * `GETPIVOTDATA`: computed once by `build`, from the location as saved (its top-left cell and
170
+ * the size read or last laid out) and whether it is blocked. `null` when the table is not modeled
171
+ * or `build` cannot lay it out.
172
+ * @internal
173
+ */
174
+ _getPivotView(build: (json: IPivotTable.JSON, saved: IRange.Coords, blocked: boolean) => PivotTable.View | null): ICalcGrid.PivotJSON | null;
175
+ /** @internal */
176
+ protected _processAnchorCoords(): void;
177
+ /**
178
+ * The table's pivot table style over its cells, page fields included, where it is placed
179
+ * ({@link _getPlacement}): `null` when it is not placed, names no style, or names one the workbook
180
+ * does not have. The extent it styles is its `getCoords`.
181
+ * @internal
182
+ */
183
+ _getRangedStyle(): IProperties.ICellRanged<ICellStyle.Properties> | null;
184
+ /**
185
+ * Where the table is laid out on the sheet, from its definition and location: its bands, the
186
+ * top-left cell of its page fields and location, and the cells it covers. `null` when it is not
187
+ * laid out (no saved layout), deleted, or blocked.
188
+ * @internal
189
+ */
190
+ _getPlacement(): PivotTable.Placement | null;
191
+ /**
192
+ * Where the table's layout puts it from its location, whether or not something is in the way:
193
+ * what {@link _getPlacement} answers when it is not blocked, and the cells it waits on when it is.
194
+ * @internal
195
+ */
196
+ _getWanted(): PivotTable.Placement | null;
197
+ /**
198
+ * Marks the table's cells as being moved by a cut, anchored where it lands before they get
199
+ * there, or written by its own layout: until they settle, the guard on them stands aside, as
200
+ * those writes are the table's, and a blocked table does not take them for its way clearing.
201
+ * @internal
202
+ */
203
+ _setSettling(settling: boolean): void;
204
+ /** @internal */
205
+ _isSettling(): boolean;
206
+ /**
207
+ * Whether the table shows `#SPILL!` at its anchor.
208
+ * @internal
209
+ */
210
+ _isBlocked(): boolean;
211
+ /**
212
+ * The cells the table holds now: its page fields' and its location as read or last laid out -
213
+ * which a file can save at another size than its layout says - its location's top-left cell
214
+ * alone while blocked, none when it is not laid out.
215
+ * @internal
216
+ */
217
+ _getOwnCells(): IRange.Coords[];
218
+ /**
219
+ * The table's field dropdowns and the expand/collapse boxes within `coords`, at sheet cells.
220
+ * @internal
221
+ */
222
+ _getControlsIn(coords: IRange.Coords): PivotControl[];
223
+ /**
224
+ * How the label in the sheet cell at `row`, `column` is set in, or `null` for a cell that is not
225
+ * a label of the placed table.
226
+ * @internal
227
+ */
228
+ _getLabelInsetAt(row: number, column: number): PivotLabelInset | null;
229
+ /** {@inheritDoc IPivotTable.getStyleOptions} */
230
+ getStyleOptions(): IPivotTable.StyleOptions;
231
+ /** {@inheritDoc IPivotTable.updateStyleOptions} */
232
+ updateStyleOptions(options: IPivotTable.StyleOptions, operation?: ITransaction.OperationOptions): this;
233
+ /** {@inheritDoc IPivotTable.setHiddenDrillIndicators} */
234
+ setHiddenDrillIndicators(hidden: boolean, options?: ITransaction.OperationOptions): this;
235
+ /** {@inheritDoc IPivotTable.isHiddenDrillIndicators} */
236
+ isHiddenDrillIndicators(): boolean;
237
+ /** {@inheritDoc IPivotTable.setHiddenFieldHeaders} */
238
+ setHiddenFieldHeaders(hidden: boolean, options?: ITransaction.OperationOptions): Promise<this>;
239
+ /** {@inheritDoc IPivotTable.isHiddenFieldHeaders} */
240
+ isHiddenFieldHeaders(): boolean;
241
+ /** What the fields on the row and column axes agree on; `null` where they differ, `none` with none on them. */
242
+ private _axisFieldsAgree;
243
+ /** A setting edit that lays the table out again. */
244
+ private _editSetting;
245
+ /** Sets a property of every field, on the table or not. */
246
+ private _editEveryField;
247
+ /**
248
+ * Changes one field's definition and lays the table out again, as one step that can be undone.
249
+ * @internal
250
+ */
251
+ _editField(field: number, edit: (json: IPivotTable.PivotFieldJSON) => IPivotTable.PivotFieldJSON, options?: ITransaction.OperationOptions): Promise<this>;
252
+ /**
253
+ * Sets a property of one field's definition, or leaves it out for `undefined`.
254
+ * @internal
255
+ */
256
+ _editFieldSetting<K extends keyof IPivotTable.PivotFieldJSON>(field: number, key: K, value: IPivotTable.PivotFieldJSON[K] | undefined, options?: ITransaction.OperationOptions): Promise<void>;
257
+ /** {@inheritDoc IPivotTable.getForm} */
258
+ getForm(): 'compact' | IPivotTable.PivotForm | null;
259
+ /** {@inheritDoc IPivotTable.setForm} */
260
+ setForm(form: 'compact' | IPivotTable.PivotForm, options?: ITransaction.OperationOptions): Promise<this>;
261
+ /** {@inheritDoc IPivotTable.getRepeatLabels} */
262
+ getRepeatLabels(): boolean | null;
263
+ /** {@inheritDoc IPivotTable.setRepeatLabels} */
264
+ setRepeatLabels(repeat: boolean, options?: ITransaction.OperationOptions): Promise<this>;
265
+ /** {@inheritDoc IPivotTable.getBlankRowAfterItems} */
266
+ getBlankRowAfterItems(): boolean | null;
267
+ /** {@inheritDoc IPivotTable.setBlankRowAfterItems} */
268
+ setBlankRowAfterItems(blank: boolean, options?: ITransaction.OperationOptions): Promise<this>;
269
+ /** {@inheritDoc IPivotTable.getSubtotalsOnTop} */
270
+ getSubtotalsOnTop(): boolean | null;
271
+ /** {@inheritDoc IPivotTable.setSubtotalsOnTop} */
272
+ setSubtotalsOnTop(top: boolean, options?: ITransaction.OperationOptions): Promise<this>;
273
+ /** {@inheritDoc IPivotTable.isShowRowGrandTotals} */
274
+ isShowRowGrandTotals(): boolean;
275
+ /** {@inheritDoc IPivotTable.setShowRowGrandTotals} */
276
+ setShowRowGrandTotals(show: boolean, options?: ITransaction.OperationOptions): Promise<this>;
277
+ /** {@inheritDoc IPivotTable.isShowColumnGrandTotals} */
278
+ isShowColumnGrandTotals(): boolean;
279
+ /** {@inheritDoc IPivotTable.setShowColumnGrandTotals} */
280
+ setShowColumnGrandTotals(show: boolean, options?: ITransaction.OperationOptions): Promise<this>;
281
+ /** {@inheritDoc IPivotTable.getEmptyCaption} */
282
+ getEmptyCaption(): string | null;
283
+ /** {@inheritDoc IPivotTable.setEmptyCaption} */
284
+ setEmptyCaption(text: string | null, options?: ITransaction.OperationOptions): Promise<this>;
285
+ /** {@inheritDoc IPivotTable.getErrorCaption} */
286
+ getErrorCaption(): string | null;
287
+ /** {@inheritDoc IPivotTable.setErrorCaption} */
288
+ setErrorCaption(text: string | null, options?: ITransaction.OperationOptions): Promise<this>;
289
+ /** {@inheritDoc IPivotTable.isPreserveFormatting} */
290
+ isPreserveFormatting(): boolean;
291
+ /** {@inheritDoc IPivotTable.setPreserveFormatting} */
292
+ setPreserveFormatting(preserve: boolean, options?: ITransaction.OperationOptions): this;
293
+ /** {@inheritDoc IPivotTable.isAutoFitColumns} */
294
+ isAutoFitColumns(): boolean;
295
+ /** {@inheritDoc IPivotTable.setAutoFitColumns} */
296
+ setAutoFitColumns(autoFit: boolean, options?: ITransaction.OperationOptions): this;
297
+ /** {@inheritDoc IPivotTable.isMultipleFiltersPerField} */
298
+ isMultipleFiltersPerField(): boolean;
299
+ /** {@inheritDoc IPivotTable.setMultipleFiltersPerField} */
300
+ setMultipleFiltersPerField(multiple: boolean, options?: ITransaction.OperationOptions): Promise<this>;
301
+ /** {@inheritDoc IPivotTable.getStyle} */
302
+ getStyle(): ITableStyle | null;
303
+ /** {@inheritDoc IPivotTable.getStyleAt} */
304
+ getStyleAt(row: number, column: number): ICellStyle;
305
+ /**
306
+ * The table's style ({@link _getRangedStyle}) with the formats its definition sets, as Excel
307
+ * writes them into the cells: each cell's number format ({@link pivotNumberFormatAt}), a row
308
+ * label or row total set left and indented by its level, and the formats a user put on the
309
+ * table ({@link pivotUserFormatAt}). An empty table draws its box ({@link pivotEmptyBoxAt}) and
310
+ * nothing of its style, as Excel does. The pivot tier of a cell's style.
311
+ * @internal
312
+ */
313
+ _getCellLayer(): IProperties.ICellRanged<ICellStyle.Properties>;
314
+ /**
315
+ * A style written over cells of the table, as Excel takes it: formats of the table over the
316
+ * areas those cells are ({@link pivotAreasOf}), which follow their items through every relayout,
317
+ * not the cells' own styles. A format over an area the table already formats is merged into it.
318
+ *
319
+ * @param coords Sheet cells; those that are not the table's are left out.
320
+ * @returns Whether the table took any of them.
321
+ * @internal
322
+ */
323
+ _formatCells(coords: readonly IRange.Coords[], style: ICellStyle.Properties): boolean;
324
+ /**
325
+ * The cells within `coords` whose number format from the table's definition shows a date or a
326
+ * time, at sheet cells, with the code each renders with: what the sheet's date readers add to
327
+ * the date formats of its direct styles. Empty when the table is not placed.
328
+ * @internal
329
+ */
330
+ _getDateFormatsIn(coords: IRange.Coords): PivotFormatRegion[];
331
+ /** The cache's contents as the workbook holds them now: one identity per version; `null` when it holds none. */
332
+ private _getCacheData;
333
+ /**
334
+ * What the filters of `model` keep over the cache as it is now, for a layout to read: `null` for a
335
+ * table with no filters, `undefined` while they are not evaluated ({@link _prepareFilters}).
336
+ * @internal
337
+ */
338
+ _getFilterResult(model?: PivotTable.Model | null): PivotFilterResult | null | undefined;
339
+ /**
340
+ * What of the slicers on the table its held filter result depends on: the fields they filter when
341
+ * a value filter totals or a calculated item counts the records they keep out, else nothing, as
342
+ * each label and date filter is evaluated whether it applies or not. So adding or deleting a
343
+ * slicer lays the table out again from what is held ({@link _relayForSlicers}).
344
+ */
345
+ private _slicerKey;
346
+ /**
347
+ * The fields the slicers on the table filter, by cache index, ascending: their hidden items filter
348
+ * the table, on an axis or not (`pivot-probes/probe-pivot-slicer-offaxis.ps1`).
349
+ * @internal
350
+ */
351
+ _slicerFields(): number[];
352
+ /**
353
+ * Lays the table out again in the caller's operation, a slicer on it added or deleted. Nothing when
354
+ * its filters are not evaluated for its slicers yet: the next layout takes them.
355
+ * @internal
356
+ */
357
+ _relayForSlicers(): void;
358
+ /**
359
+ * Evaluates the filters of `model` over the cache as it is now and holds what they keep, for the
360
+ * layouts that follow, async or not; nothing when that is held already. Async, as every condition
361
+ * is: one may carry a formula.
362
+ * @internal
363
+ */
364
+ _prepareFilters(engine: PivotEngineModule, model?: PivotTable.Model | null): Promise<void>;
365
+ /**
366
+ * Evaluates the filters a relayout of the table lays it out with, which {@link _refresh} takes:
367
+ * its model with each relative date filter anchored to today.
368
+ * @internal
369
+ */
370
+ _prepareRelayout(engine: PivotEngineModule): Promise<void>;
371
+ /** `model` with its relative date filters anchored to the runtime's today, as a relayout evaluates them. */
372
+ private _anchoredToday;
373
+ /**
374
+ * Evaluates the table's filters once at a time, for a caller that cannot wait ({@link _prepareFilters}).
375
+ * @internal
376
+ */
377
+ _prepareFiltersOnce(engine: PivotEngineModule): Promise<void>;
378
+ /** The fields of the cache the table summarizes, as the workbook holds them; their identity changes with the cache's contents. */
379
+ private _getCacheFields;
380
+ /** Per version of a cache's contents, its fields: contents are replaced, never changed in place. */
381
+ private static _cacheFields;
37
382
  /** {@inheritDoc IPivotTable.getCacheId} */
38
383
  getCacheId(): number;
384
+ /** {@inheritDoc IPivotTable.refresh} */
385
+ refresh(options?: IPivotTable.RefreshOptions): Promise<void>;
386
+ /**
387
+ * Carries the table over to its cache as a refresh from the source rebuilt it, in the caller's
388
+ * commit; laid out again by the caller ({@link _refresh}).
389
+ * @internal
390
+ */
391
+ _remapCache(remap: PivotCacheRemap, engine: PivotEngineModule): void;
392
+ /**
393
+ * A refresh in the caller's batch: the table is laid out again ({@link _refreshFrom}), its relative
394
+ * date filters anchored as {@link _prepareRelayout} prepared them. With `preserveFormatting` off a
395
+ * table holds no formats of its own making, but a file can say both, and a refresh drops those first.
396
+ * @internal
397
+ */
398
+ _refresh(engine: PivotEngineModule): void;
399
+ /**
400
+ * A refresh is refused on a protected sheet, whatever its lock allows: Excel refuses it even
401
+ * where pivot tables are allowed (`pivot-probes/probe-pivot-protected.ps1`).
402
+ * @internal
403
+ */
404
+ _assertRefreshAllowed(): void;
405
+ /**
406
+ * Lays the table out from its cache inside the caller's batch: the model's lines, offsets and
407
+ * size, and its cells, written as stored values in the same commit. When a cell it needs holds
408
+ * anything, it gives up its cells and stores `#SPILL!` at its location instead, keeping the size
409
+ * it wants, and is laid out again once those cells are clear (`Worksheet._unblockPivots`). It is
410
+ * anchored at what it holds then ({@link PivotTable.heldOf}), as a table's resize anchors it, and
411
+ * the grid is told where it sits (`ICalcGrid.setPivots`).
412
+ *
413
+ * @param own The cells it holds now, for a caller that has changed what they follow from.
414
+ * @param place Given when the table is being placed: then nothing in its way is taken as a block.
415
+ * Values are cleared when `discardValues` asks, and refused otherwise; another pivot table or an
416
+ * array's cells are always refused. A refusal throws, for the caller's batch to roll back.
417
+ * @param at The top-left cell of the location it moves to ({@link moveTo}); where it is, absent.
418
+ * @internal
419
+ */
420
+ _refreshFrom(engine: PivotEngineModule, own?: readonly IRange.Coords[], place?: PivotTable.Place, at?: IRange.Coords): void;
421
+ /**
422
+ * A value typed over one of the table's cells, as Excel takes it: a label or a caption renamed,
423
+ * an item moved, a page field's item chosen (`typeOverPivot`); the table is laid out again in
424
+ * the caller's commit. A cell that is neither - a value, a total - is refused.
425
+ *
426
+ * @param row The cell, on the sheet.
427
+ * @throws ExpectedError where Excel refuses the value.
428
+ * @internal
429
+ */
430
+ _typeAt(row: number, column: number, value: Scalar): void;
431
+ /** {@inheritDoc IPivotTable.getFields} */
432
+ getFields(): readonly IPivotTable.IField[];
433
+ /** {@inheritDoc IPivotTable.getField} */
434
+ getField(name: string): IPivotTable.IField | null;
435
+ /** {@inheritDoc IPivotTable.getRowFields} */
436
+ getRowFields(): readonly IPivotTable.IField[];
437
+ /** {@inheritDoc IPivotTable.getColumnFields} */
438
+ getColumnFields(): readonly IPivotTable.IField[];
439
+ /** {@inheritDoc IPivotTable.getPageFields} */
440
+ getPageFields(): readonly IPivotTable.IField[];
441
+ /** The fields of an axis's slots, in order; the values' slot (a negative index) is not a field. */
442
+ private _fieldsOf;
443
+ /** {@inheritDoc IPivotTable.getDataFields} */
444
+ getDataFields(): readonly IPivotTable.IDataField[];
445
+ /** {@inheritDoc IPivotTable.getDataField} */
446
+ getDataField(name: string): IPivotTable.IDataField | null;
447
+ /** {@inheritDoc IPivotTable.addDataField} */
448
+ addDataField(field: string | IPivotTable.IField, input?: Omit<IPivotTable.IDataField.Input, 'field'>, options?: ITransaction.OperationOptions): Promise<IPivotTable.IDataField>;
449
+ /** {@inheritDoc IPivotTable.getValuesField} */
450
+ getValuesField(): IPivotTable.IValuesField | null;
451
+ /**
452
+ * The table's model: its definition and layout; `null` for a table that is not modeled.
453
+ * @internal
454
+ */
455
+ _getModel(): PivotTable.Model | null;
456
+ /**
457
+ * The cache the table summarizes, or `null` when the workbook does not hold it.
458
+ * @internal
459
+ */
460
+ _getCache(): IPivotTable.CacheJSON | null;
461
+ /**
462
+ * Changes the model and lays the table out again from its cache, as one step that can be
463
+ * undone; nothing when `edit` returns the model it was given.
464
+ *
465
+ * @throws What `edit` throws, or when the table is not modeled.
466
+ * @internal
467
+ */
468
+ _editModel(edit: (model: PivotTable.Model) => PivotTable.Model, description: string, options?: ITransaction.OperationOptions): Promise<void>;
469
+ /** Takes `model` and lays the table out from it, inside the caller's batch. */
470
+ private _relayAs;
471
+ /**
472
+ * A field to an axis, or off the table for `null`, as one step that can be undone. The cache lists
473
+ * a field placed for the first time, shared with whichever tables hold it, in the same step.
474
+ *
475
+ * @throws ExpectedError where Excel refuses the move, or when the table is not modeled.
476
+ * @internal
477
+ */
478
+ _moveField(field: number, axis: IPivotTable.Axis | null, position: number | undefined, options?: ITransaction.OperationOptions): Promise<void>;
39
479
  /** {@inheritDoc IPivotTable.toJSON} */
40
480
  toJSON(toResourceId?: (resource: IResource) => number | null): IPivotTable.JSON | null;
41
- protected _processContainerShift(options: Anchored.ShiftOptions): IRange.Coords | null | void;
481
+ /** @internal */
482
+ protected _processUpdateState(prevState: Partial<State>, newState: Partial<State>): void;
483
+ /** @internal */
484
+ protected _processAfterStateChange(state: State, commit: ITransaction.ICommit, isRevert?: boolean, isRestore?: boolean): void;
485
+ /** @internal */
486
+ protected _isAnyChangeFromState(): boolean;
487
+ /** @internal */
488
+ protected _processRestoreOrRevert(state: State, commit: ITransaction.ICommit): void;
42
489
  /** @internal */
43
490
  protected _getActionDescription(action: 'delete' | 'initialize' | 'updateListener'): string | null;
44
491
  /** {@inheritDoc IPivotTable.isIPivotTable} */
45
492
  get isIPivotTable(): true;
46
493
  }
47
494
  export declare namespace PivotTable {
495
+ /** What a modeled table's JSON holds besides its name, cache, location, part and buttons. */
496
+ type Model = Omit<IPivotTable.JSON, 'name' | 'cacheId' | 'location' | 'part' | 'partFormats' | 'buttons'>;
497
+ /** How many rows and columns a table's location covers. */
498
+ interface Size {
499
+ rows: number;
500
+ columns: number;
501
+ }
502
+ /** Where a laid-out table sits on its sheet ({@link PivotTable._getPlacement}). */
503
+ interface Placement {
504
+ structure: PivotStructure;
505
+ /** The top-left cell of its page fields and location. */
506
+ origin: IRange.CellCoords;
507
+ /** What it covers, page fields included: the extent its style and its shift guard span. */
508
+ extent: IRange.Coords;
509
+ /** Its own cells: the page fields' and the location's, without the blank row between ({@link cellsOf}). */
510
+ cells: IRange.Coords[];
511
+ }
512
+ /** The workbook, as a refresh from the source reaches it. */
513
+ interface CacheRefresher {
514
+ doBatch(callback: () => void | Promise<void>, options?: ITransaction.OperationOptions): unknown;
515
+ _refreshPivotCaches(cacheIds: ReadonlySet<number>, engine: PivotEngineModule): Promise<void>;
516
+ }
517
+ /** The workbook, as adding a table reaches it. */
518
+ interface CacheAdder extends CacheRefresher {
519
+ _pivotSourceOf(source: IPivotTableCollection.Source, sheet: IWorksheet): IPivotTable.CacheSourceJSON | null;
520
+ _pivotSourceRangeOf(source: IPivotTable.CacheSourceJSON): Promise<ICellRange | null>;
521
+ _findPivotCache(source: IPivotTable.CacheSourceJSON): PivotCache | null;
522
+ _addPivotCache(model: PivotCache.Model): PivotCache;
523
+ getPivotTables(): IPivotTableCollection;
524
+ }
525
+ /** The workbook, as a field move that must list a field reaches it. */
526
+ interface CacheRestater extends CacheRefresher {
527
+ _getPivotCache(cacheId: number): PivotCache | null;
528
+ }
529
+ /** What is in a table's way, most binding first: another pivot table, an array's cells, a value. */
530
+ type Obstruction = 'pivot' | 'array' | 'value';
531
+ /** How a table being placed ({@link IPivotTableCollection.add}, {@link IPivotTable.moveTo}) takes what is in its way. */
532
+ interface Place {
533
+ /** Clear the values in its way, rather than refuse them. */
534
+ discardValues: boolean;
535
+ }
536
+ /** What a table asks of its sheet to lay itself out ({@link PivotTable._refreshFrom}). */
537
+ interface SheetWriter {
538
+ /** The top-left cell of the location a table placed at `location` takes, or throws where it cannot go. */
539
+ _pivotAnchorAt(location: ICellRange.Address, pageCount: number, table: IPivotTable | null): IRange.Coords;
540
+ /** Throws for a name the table cannot take on its sheet. */
541
+ _assertPivotName(name: string, table: IPivotTable | null): void;
542
+ /** What, but `table`, is in `wanted` past the cells `own` it holds now; `null` for nothing. */
543
+ _pivotObstructionOf(table: IPivotTable, wanted: readonly IRange.Coords[], own: readonly IRange.Coords[]): Obstruction | null;
544
+ /** The order the sheet stores its cells in, which `_writePivotCells` takes them in. */
545
+ _getPivotCellOrder(): 'rows' | 'columns';
546
+ /**
547
+ * Clears the values and direct styles of `clears`, then writes `cells`, in the sheet's order
548
+ * ({@link _getPivotCellOrder}) from `origin` and sparse, as stored values; the table is settling
549
+ * ({@link PivotTable._setSettling}) while it does.
550
+ */
551
+ _writePivotCells(clears: readonly IRange.Coords[], cells: Tuple.GridTuple<Scalar>, origin: {
552
+ row: number;
553
+ column: number;
554
+ }): void;
555
+ /** Tells the grid where the sheet's tables sit. */
556
+ _tellPivots(): void;
557
+ /** Fits the columns `extent` covers to its cells alone. */
558
+ _autoFitPivotColumns(extent: IRange.Coords): void;
559
+ }
560
+ /**
561
+ * Whether a table was saved showing `#SPILL!`: laid out larger than the one cell its location
562
+ * is, as Excel saves it (its top-left cell alone, offsets 0).
563
+ */
564
+ const isSavedBlocked: (model: Model | null, size: Size) => boolean;
565
+ /**
566
+ * What a table holds, which it is anchored at: its page fields, the blank row under them and its
567
+ * `location`, as `structure` lays the page fields out above it; the location alone with no
568
+ * layout or no page fields; its top-left cell alone while it shows `#SPILL!` there.
569
+ */
570
+ const heldOf: (structure: PivotStructure | null, location: IRange.Coords, blocked: boolean) => IRange.Coords;
571
+ /** What the table `json` describes holds as saved ({@link heldOf}), or `null` when it states no location. */
572
+ const anchorOf: (json: IPivotTable.JSON) => IRange.Coords | null;
573
+ /** The fields of a table's cache, as its number formats read them. */
574
+ type CacheFields = PivotCacheFieldFormats;
575
+ /** A table laid out where it sits: what the grid is told, and the size of its location. */
576
+ interface View {
577
+ view: ICalcGrid.PivotJSON;
578
+ size: Size;
579
+ }
580
+ /** The model of a table's JSON, or `null` when it has none. */
581
+ const modelOf: (json: IPivotTable.JSON) => Model | null;
48
582
  interface ConstructorOptions extends Anchored.ConstructorOptions<IPivotTable.JSON> {
49
583
  sheet: IWorksheet;
50
584
  fromResourceId?: (resourceId: number) => IResource;
@@ -1,3 +1,5 @@
1
+ import { ICellRange } from '../cellRange';
2
+ import { ITransaction } from '../transaction';
1
3
  import { AbstractCollection } from '../type';
2
4
  import { IPivotTable } from './IPivotTable';
3
5
  import { IPivotTableCollection } from './IPivotTableCollection';
@@ -6,20 +8,33 @@ import { IPivotTableCollection } from './IPivotTableCollection';
6
8
  *
7
9
  * @remarks
8
10
  * A front over storage held elsewhere — the sheet's own tables, or a walk over every sheet's for
9
- * the workbook — so the same class serves both. Nothing edits a pivot table yet, so there is
10
- * nothing to announce.
11
+ * the workbook — so the same class serves both.
11
12
  */
12
13
  export declare class PivotTableCollection extends AbstractCollection<IPivotTable> implements IPivotTableCollection {
13
14
  private _getItemsDelegate;
15
+ private _doBatch;
16
+ private _addDelegate;
14
17
  /**
15
18
  * @param getItems Returns the tables, as an array the caller may keep.
19
+ * @param doBatch Runs one step on the owner's undo stack.
20
+ * @param add Adds a table; absent for the workbook's, which holds no sheet to add to.
16
21
  */
17
- constructor(getItems: () => IPivotTable[]);
22
+ constructor(getItems: () => IPivotTable[], doBatch: PivotTableCollection.DoBatch, add?: PivotTableCollection.Add | null);
23
+ /** {@inheritDoc IPivotTableCollection.add} */
24
+ add(source: IPivotTableCollection.Source, location: ICellRange.Address, options?: IPivotTableCollection.AddOptions): Promise<IPivotTable>;
18
25
  /** {@inheritDoc AbstractCollection._getItems} */
19
26
  protected _getItems(): IPivotTable[];
20
27
  /** {@inheritDoc IPivotTableCollection.getByName} */
21
28
  getByName(name: string): IPivotTable | null;
29
+ /** {@inheritDoc IPivotTableCollection.refreshAll} */
30
+ refreshAll(options?: IPivotTable.RefreshOptions): Promise<void>;
22
31
  /** {@inheritDoc IPivotTableCollection.isIPivotTableCollection} */
23
32
  get isIPivotTableCollection(): true;
24
33
  }
34
+ export declare namespace PivotTableCollection {
35
+ /** The owner's `doBatch`: one step on its undo stack. */
36
+ type DoBatch = (callback: () => void, options: ITransaction.OperationOptions) => Promise<void> | void;
37
+ /** The sheet's add. */
38
+ type Add = (source: IPivotTableCollection.Source, location: ICellRange.Address, options?: IPivotTableCollection.AddOptions) => Promise<IPivotTable>;
39
+ }
25
40
  //# sourceMappingURL=PivotTableCollection.d.ts.map