@rowsncolumns/spreadsheet-state 29.0.0 → 29.1.1

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 (603) hide show
  1. package/dist/cjs/api/anchored-objects.d.ts +131 -7
  2. package/dist/cjs/api/anchored-objects.d.ts.map +1 -1
  3. package/dist/cjs/api/anchored-objects.js +488 -43
  4. package/dist/cjs/api/copy-paste.d.ts +1 -2
  5. package/dist/cjs/api/copy-paste.d.ts.map +1 -1
  6. package/dist/cjs/api/copy-paste.js +1 -3
  7. package/dist/cjs/api/filter.d.ts +15 -1
  8. package/dist/cjs/api/filter.d.ts.map +1 -1
  9. package/dist/cjs/api/filter.js +32 -2
  10. package/dist/cjs/api/formula.d.ts +63 -0
  11. package/dist/cjs/api/formula.d.ts.map +1 -1
  12. package/dist/cjs/api/formula.js +278 -8
  13. package/dist/cjs/api/paint-format.d.ts +22 -1
  14. package/dist/cjs/api/paint-format.d.ts.map +1 -1
  15. package/dist/cjs/api/paint-format.js +57 -1
  16. package/dist/cjs/api/sort.d.ts +23 -1
  17. package/dist/cjs/api/sort.d.ts.map +1 -1
  18. package/dist/cjs/api/sort.js +52 -6
  19. package/dist/cjs/api/structural-guards.d.ts +57 -0
  20. package/dist/cjs/api/structural-guards.d.ts.map +1 -1
  21. package/dist/cjs/api/structural-guards.js +93 -1
  22. package/dist/cjs/api/structural-table-refs.d.ts +58 -3
  23. package/dist/cjs/api/structural-table-refs.d.ts.map +1 -1
  24. package/dist/cjs/api/structural-table-refs.js +177 -16
  25. package/dist/cjs/api/table.d.ts +26 -2
  26. package/dist/cjs/api/table.d.ts.map +1 -1
  27. package/dist/cjs/api/table.js +93 -60
  28. package/dist/cjs/api/validation.d.ts.map +1 -1
  29. package/dist/cjs/api/validation.js +53 -8
  30. package/dist/cjs/atoms/creating-table.atom.d.ts +22 -0
  31. package/dist/cjs/atoms/creating-table.atom.d.ts.map +1 -0
  32. package/dist/cjs/atoms/creating-table.atom.js +4 -0
  33. package/dist/cjs/atoms/dialog-state.atom.d.ts +8 -0
  34. package/dist/cjs/atoms/dialog-state.atom.d.ts.map +1 -1
  35. package/dist/cjs/atoms/dialog-state.atom.js +28 -0
  36. package/dist/cjs/atoms/editing-slicer.atom.d.ts +9 -0
  37. package/dist/cjs/atoms/editing-slicer.atom.d.ts.map +1 -0
  38. package/dist/cjs/atoms/editing-slicer.atom.js +6 -0
  39. package/dist/cjs/atoms/index.d.ts +4 -0
  40. package/dist/cjs/atoms/index.d.ts.map +1 -1
  41. package/dist/cjs/atoms/index.js +4 -0
  42. package/dist/cjs/atoms/inserting-slicer.atom.d.ts +8 -0
  43. package/dist/cjs/atoms/inserting-slicer.atom.d.ts.map +1 -0
  44. package/dist/cjs/atoms/inserting-slicer.atom.js +5 -0
  45. package/dist/cjs/atoms/resizing-table.atom.d.ts +8 -0
  46. package/dist/cjs/atoms/resizing-table.atom.d.ts.map +1 -0
  47. package/dist/cjs/atoms/resizing-table.atom.js +5 -0
  48. package/dist/cjs/commands.d.ts +129 -2
  49. package/dist/cjs/commands.d.ts.map +1 -1
  50. package/dist/cjs/components/editors/embed-editor.d.ts +4 -2
  51. package/dist/cjs/components/editors/embed-editor.d.ts.map +1 -1
  52. package/dist/cjs/components/editors/embed-editor.js +38 -9
  53. package/dist/cjs/components/editors/slicer-editor.d.ts +15 -0
  54. package/dist/cjs/components/editors/slicer-editor.d.ts.map +1 -0
  55. package/dist/cjs/components/editors/slicer-editor.js +87 -0
  56. package/dist/cjs/components/editors/table-editor.d.ts +58 -2
  57. package/dist/cjs/components/editors/table-editor.d.ts.map +1 -1
  58. package/dist/cjs/components/editors/table-editor.js +261 -20
  59. package/dist/cjs/components/index.d.ts +1 -0
  60. package/dist/cjs/components/index.d.ts.map +1 -1
  61. package/dist/cjs/components/index.js +1 -0
  62. package/dist/cjs/constants.d.ts +9 -1
  63. package/dist/cjs/constants.d.ts.map +1 -1
  64. package/dist/cjs/constants.js +12 -0
  65. package/dist/cjs/generated-names.d.ts +13 -3
  66. package/dist/cjs/generated-names.d.ts.map +1 -1
  67. package/dist/cjs/generated-names.js +3 -1
  68. package/dist/cjs/helpers.d.ts +5 -0
  69. package/dist/cjs/helpers.d.ts.map +1 -1
  70. package/dist/cjs/helpers.js +10 -1
  71. package/dist/cjs/hooks/use-on-change-batch.d.ts +19 -2
  72. package/dist/cjs/hooks/use-on-change-batch.d.ts.map +1 -1
  73. package/dist/cjs/hooks/use-on-change-batch.js +43 -35
  74. package/dist/cjs/hooks/use-on-change-calculated-column.d.ts +10 -1
  75. package/dist/cjs/hooks/use-on-change-calculated-column.d.ts.map +1 -1
  76. package/dist/cjs/hooks/use-on-change-calculated-column.js +17 -5
  77. package/dist/cjs/hooks/use-on-change-table-column.d.ts +6 -1
  78. package/dist/cjs/hooks/use-on-change-table-column.d.ts.map +1 -1
  79. package/dist/cjs/hooks/use-on-change-table-column.js +17 -5
  80. package/dist/cjs/hooks/use-on-change.d.ts +36 -3
  81. package/dist/cjs/hooks/use-on-change.d.ts.map +1 -1
  82. package/dist/cjs/hooks/use-on-change.js +218 -136
  83. package/dist/cjs/hooks/use-on-create-custom-table-style.d.ts +17 -0
  84. package/dist/cjs/hooks/use-on-create-custom-table-style.d.ts.map +1 -0
  85. package/dist/cjs/hooks/use-on-create-custom-table-style.js +28 -0
  86. package/dist/cjs/hooks/use-on-create-named-range.d.ts +4 -2
  87. package/dist/cjs/hooks/use-on-create-named-range.d.ts.map +1 -1
  88. package/dist/cjs/hooks/use-on-create-named-range.js +11 -1
  89. package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts +2 -1
  90. package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -1
  91. package/dist/cjs/hooks/use-on-delete-cells-shift-left.js +3 -1
  92. package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts +2 -1
  93. package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -1
  94. package/dist/cjs/hooks/use-on-delete-cells-shift-up.js +3 -1
  95. package/dist/cjs/hooks/use-on-delete-column.d.ts +2 -1
  96. package/dist/cjs/hooks/use-on-delete-column.d.ts.map +1 -1
  97. package/dist/cjs/hooks/use-on-delete-column.js +3 -1
  98. package/dist/cjs/hooks/use-on-delete-row.d.ts +2 -1
  99. package/dist/cjs/hooks/use-on-delete-row.d.ts.map +1 -1
  100. package/dist/cjs/hooks/use-on-delete-row.js +3 -1
  101. package/dist/cjs/hooks/use-on-delete-sheet.d.ts +10 -1
  102. package/dist/cjs/hooks/use-on-delete-sheet.d.ts.map +1 -1
  103. package/dist/cjs/hooks/use-on-delete-sheet.js +19 -1
  104. package/dist/cjs/hooks/use-on-delete-table-row.d.ts +4 -1
  105. package/dist/cjs/hooks/use-on-delete-table-row.d.ts.map +1 -1
  106. package/dist/cjs/hooks/use-on-delete-table-row.js +19 -1
  107. package/dist/cjs/hooks/use-on-delete.d.ts +5 -2
  108. package/dist/cjs/hooks/use-on-delete.d.ts.map +1 -1
  109. package/dist/cjs/hooks/use-on-delete.js +5 -1
  110. package/dist/cjs/hooks/use-on-embeds.d.ts +7 -4
  111. package/dist/cjs/hooks/use-on-embeds.d.ts.map +1 -1
  112. package/dist/cjs/hooks/use-on-embeds.js +26 -24
  113. package/dist/cjs/hooks/use-on-fill.d.ts +17 -2
  114. package/dist/cjs/hooks/use-on-fill.d.ts.map +1 -1
  115. package/dist/cjs/hooks/use-on-fill.js +29 -15
  116. package/dist/cjs/hooks/use-on-filter-table.d.ts.map +1 -1
  117. package/dist/cjs/hooks/use-on-filter-table.js +209 -103
  118. package/dist/cjs/hooks/use-on-import-excel.d.ts +2 -1
  119. package/dist/cjs/hooks/use-on-import-excel.d.ts.map +1 -1
  120. package/dist/cjs/hooks/use-on-import-excel.js +22 -19
  121. package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts +2 -1
  122. package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -1
  123. package/dist/cjs/hooks/use-on-insert-cells-shift-down.js +3 -1
  124. package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts +2 -1
  125. package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -1
  126. package/dist/cjs/hooks/use-on-insert-cells-shift-right.js +3 -1
  127. package/dist/cjs/hooks/use-on-insert-column.d.ts +2 -1
  128. package/dist/cjs/hooks/use-on-insert-column.d.ts.map +1 -1
  129. package/dist/cjs/hooks/use-on-insert-column.js +3 -1
  130. package/dist/cjs/hooks/use-on-insert-row.d.ts +2 -1
  131. package/dist/cjs/hooks/use-on-insert-row.d.ts.map +1 -1
  132. package/dist/cjs/hooks/use-on-insert-row.js +3 -1
  133. package/dist/cjs/hooks/use-on-insert-table-row.d.ts +5 -2
  134. package/dist/cjs/hooks/use-on-insert-table-row.d.ts.map +1 -1
  135. package/dist/cjs/hooks/use-on-insert-table-row.js +19 -1
  136. package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts +3 -2
  137. package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -1
  138. package/dist/cjs/hooks/use-on-merge-unmerge-cells.js +14 -1
  139. package/dist/cjs/hooks/use-on-move-columns.d.ts +3 -1
  140. package/dist/cjs/hooks/use-on-move-columns.d.ts.map +1 -1
  141. package/dist/cjs/hooks/use-on-move-columns.js +14 -1
  142. package/dist/cjs/hooks/use-on-move-rows.d.ts +3 -1
  143. package/dist/cjs/hooks/use-on-move-rows.d.ts.map +1 -1
  144. package/dist/cjs/hooks/use-on-move-rows.js +14 -1
  145. package/dist/cjs/hooks/use-on-move-selection.d.ts +3 -1
  146. package/dist/cjs/hooks/use-on-move-selection.d.ts.map +1 -1
  147. package/dist/cjs/hooks/use-on-move-selection.js +88 -25
  148. package/dist/cjs/hooks/use-on-paste.d.ts +22 -1
  149. package/dist/cjs/hooks/use-on-paste.d.ts.map +1 -1
  150. package/dist/cjs/hooks/use-on-paste.js +993 -776
  151. package/dist/cjs/hooks/use-on-remove-duplicates.d.ts +5 -2
  152. package/dist/cjs/hooks/use-on-remove-duplicates.d.ts.map +1 -1
  153. package/dist/cjs/hooks/use-on-remove-duplicates.js +5 -1
  154. package/dist/cjs/hooks/use-on-request-create-table.d.ts +13 -0
  155. package/dist/cjs/hooks/use-on-request-create-table.d.ts.map +1 -0
  156. package/dist/cjs/hooks/use-on-request-create-table.js +44 -0
  157. package/dist/cjs/hooks/use-on-request-insert-slicer.d.ts +7 -0
  158. package/dist/cjs/hooks/use-on-request-insert-slicer.d.ts.map +1 -0
  159. package/dist/cjs/hooks/use-on-request-insert-slicer.js +15 -0
  160. package/dist/cjs/hooks/use-on-request-resize-table.d.ts +7 -0
  161. package/dist/cjs/hooks/use-on-request-resize-table.d.ts.map +1 -0
  162. package/dist/cjs/hooks/use-on-request-resize-table.js +15 -0
  163. package/dist/cjs/hooks/use-on-resize-table.d.ts +5 -1
  164. package/dist/cjs/hooks/use-on-resize-table.d.ts.map +1 -1
  165. package/dist/cjs/hooks/use-on-resize-table.js +110 -33
  166. package/dist/cjs/hooks/use-on-sort-column.d.ts +28 -3
  167. package/dist/cjs/hooks/use-on-sort-column.d.ts.map +1 -1
  168. package/dist/cjs/hooks/use-on-sort-column.js +136 -90
  169. package/dist/cjs/hooks/use-on-sort-range.d.ts +26 -3
  170. package/dist/cjs/hooks/use-on-sort-range.d.ts.map +1 -1
  171. package/dist/cjs/hooks/use-on-sort-range.js +113 -67
  172. package/dist/cjs/hooks/use-on-sort-table.d.ts +18 -1
  173. package/dist/cjs/hooks/use-on-sort-table.d.ts.map +1 -1
  174. package/dist/cjs/hooks/use-on-sort-table.js +128 -98
  175. package/dist/cjs/hooks/use-on-subtotal.d.ts +10 -3
  176. package/dist/cjs/hooks/use-on-subtotal.d.ts.map +1 -1
  177. package/dist/cjs/hooks/use-on-subtotal.js +13 -9
  178. package/dist/cjs/hooks/use-on-table.d.ts +39 -7
  179. package/dist/cjs/hooks/use-on-table.d.ts.map +1 -1
  180. package/dist/cjs/hooks/use-on-table.js +257 -49
  181. package/dist/cjs/hooks/use-on-undo-calculated-column.d.ts +23 -0
  182. package/dist/cjs/hooks/use-on-undo-calculated-column.d.ts.map +1 -0
  183. package/dist/cjs/hooks/use-on-undo-calculated-column.js +70 -0
  184. package/dist/cjs/hooks/use-on-undo-table-auto-expansion.d.ts +28 -0
  185. package/dist/cjs/hooks/use-on-undo-table-auto-expansion.d.ts.map +1 -0
  186. package/dist/cjs/hooks/use-on-undo-table-auto-expansion.js +96 -0
  187. package/dist/cjs/hooks/use-on-update-named-range.d.ts +4 -2
  188. package/dist/cjs/hooks/use-on-update-named-range.d.ts.map +1 -1
  189. package/dist/cjs/hooks/use-on-update-named-range.js +13 -1
  190. package/dist/cjs/hooks/use-sheet-properties.d.ts +1 -0
  191. package/dist/cjs/hooks/use-sheet-properties.d.ts.map +1 -1
  192. package/dist/cjs/hooks/use-sheet-properties.js +54 -34
  193. package/dist/cjs/hooks/use-slicers.d.ts +2 -2
  194. package/dist/cjs/hooks/use-slicers.d.ts.map +1 -1
  195. package/dist/cjs/hooks/use-slicers.js +17 -26
  196. package/dist/cjs/hooks/use-sparkline-groups.d.ts +50 -0
  197. package/dist/cjs/hooks/use-sparkline-groups.d.ts.map +1 -0
  198. package/dist/cjs/hooks/use-sparkline-groups.js +192 -0
  199. package/dist/cjs/hooks/use-spreadsheet-state.d.ts +56 -10
  200. package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -1
  201. package/dist/cjs/hooks/use-spreadsheet-state.js +323 -100
  202. package/dist/cjs/hooks/use-structured-reference.d.ts.map +1 -1
  203. package/dist/cjs/hooks/use-structured-reference.js +17 -0
  204. package/dist/cjs/hooks/use-undo-redo-actions.d.ts +2 -1
  205. package/dist/cjs/hooks/use-undo-redo-actions.d.ts.map +1 -1
  206. package/dist/cjs/hooks/use-undo-redo-actions.js +10 -2
  207. package/dist/cjs/hooks/use-undo-redo.d.ts +12 -0
  208. package/dist/cjs/hooks/use-undo-redo.d.ts.map +1 -1
  209. package/dist/cjs/hooks/use-undo-redo.js +169 -10
  210. package/dist/cjs/hooks/utils/sort-rows.d.ts.map +1 -1
  211. package/dist/cjs/hooks/utils/sort-rows.js +4 -3
  212. package/dist/cjs/index.d.ts +7 -0
  213. package/dist/cjs/index.d.ts.map +1 -1
  214. package/dist/cjs/index.js +8 -0
  215. package/dist/cjs/interface/apply-fill.d.ts +26 -3
  216. package/dist/cjs/interface/apply-fill.d.ts.map +1 -1
  217. package/dist/cjs/interface/apply-fill.js +207 -98
  218. package/dist/cjs/interface/change-batch.d.ts +1 -1
  219. package/dist/cjs/interface/change-batch.d.ts.map +1 -1
  220. package/dist/cjs/interface/change-batch.js +112 -15
  221. package/dist/cjs/interface/change-calculated-column.d.ts +6 -2
  222. package/dist/cjs/interface/change-calculated-column.d.ts.map +1 -1
  223. package/dist/cjs/interface/change-calculated-column.js +87 -17
  224. package/dist/cjs/interface/change-table-column.d.ts +81 -7
  225. package/dist/cjs/interface/change-table-column.d.ts.map +1 -1
  226. package/dist/cjs/interface/change-table-column.js +336 -76
  227. package/dist/cjs/interface/create-table.d.ts +15 -3
  228. package/dist/cjs/interface/create-table.d.ts.map +1 -1
  229. package/dist/cjs/interface/create-table.js +100 -25
  230. package/dist/cjs/interface/delete-cells-shift-left.d.ts +1 -1
  231. package/dist/cjs/interface/delete-cells-shift-left.d.ts.map +1 -1
  232. package/dist/cjs/interface/delete-cells-shift-left.js +17 -2
  233. package/dist/cjs/interface/delete-cells-shift-up.d.ts +1 -1
  234. package/dist/cjs/interface/delete-cells-shift-up.d.ts.map +1 -1
  235. package/dist/cjs/interface/delete-cells-shift-up.js +17 -2
  236. package/dist/cjs/interface/delete-cells.d.ts +1 -1
  237. package/dist/cjs/interface/delete-cells.d.ts.map +1 -1
  238. package/dist/cjs/interface/delete-cells.js +106 -44
  239. package/dist/cjs/interface/delete-column.d.ts +1 -1
  240. package/dist/cjs/interface/delete-column.d.ts.map +1 -1
  241. package/dist/cjs/interface/delete-column.js +16 -3
  242. package/dist/cjs/interface/delete-row.d.ts +1 -1
  243. package/dist/cjs/interface/delete-row.d.ts.map +1 -1
  244. package/dist/cjs/interface/delete-row.js +230 -19
  245. package/dist/cjs/interface/delete-sheet.d.ts +2 -2
  246. package/dist/cjs/interface/delete-sheet.d.ts.map +1 -1
  247. package/dist/cjs/interface/delete-sheet.js +149 -2
  248. package/dist/cjs/interface/delete-table-column.d.ts +1 -1
  249. package/dist/cjs/interface/delete-table-column.d.ts.map +1 -1
  250. package/dist/cjs/interface/delete-table-column.js +11 -1
  251. package/dist/cjs/interface/delete-table-row.d.ts +1 -1
  252. package/dist/cjs/interface/delete-table-row.d.ts.map +1 -1
  253. package/dist/cjs/interface/delete-table-row.js +361 -275
  254. package/dist/cjs/interface/duplicate-sheet.d.ts.map +1 -1
  255. package/dist/cjs/interface/duplicate-sheet.js +83 -31
  256. package/dist/cjs/interface/embeds.d.ts +10 -1
  257. package/dist/cjs/interface/embeds.d.ts.map +1 -1
  258. package/dist/cjs/interface/embeds.js +120 -6
  259. package/dist/cjs/interface/insert-cells-shift-down.d.ts +1 -1
  260. package/dist/cjs/interface/insert-cells-shift-down.d.ts.map +1 -1
  261. package/dist/cjs/interface/insert-cells-shift-down.js +11 -1
  262. package/dist/cjs/interface/insert-cells-shift-right.d.ts +1 -1
  263. package/dist/cjs/interface/insert-cells-shift-right.d.ts.map +1 -1
  264. package/dist/cjs/interface/insert-cells-shift-right.js +11 -1
  265. package/dist/cjs/interface/insert-column.d.ts +2 -2
  266. package/dist/cjs/interface/insert-column.d.ts.map +1 -1
  267. package/dist/cjs/interface/insert-column.js +68 -38
  268. package/dist/cjs/interface/insert-row.d.ts +1 -1
  269. package/dist/cjs/interface/insert-row.d.ts.map +1 -1
  270. package/dist/cjs/interface/insert-row.js +10 -2
  271. package/dist/cjs/interface/insert-table-row.d.ts +2 -1
  272. package/dist/cjs/interface/insert-table-row.d.ts.map +1 -1
  273. package/dist/cjs/interface/insert-table-row.js +70 -19
  274. package/dist/cjs/interface/remove-duplicates.d.ts +1 -1
  275. package/dist/cjs/interface/remove-duplicates.d.ts.map +1 -1
  276. package/dist/cjs/interface/remove-duplicates.js +46 -6
  277. package/dist/cjs/interface/remove-table.d.ts +1 -1
  278. package/dist/cjs/interface/remove-table.d.ts.map +1 -1
  279. package/dist/cjs/interface/remove-table.js +72 -16
  280. package/dist/cjs/interface/slicers.d.ts +12 -1
  281. package/dist/cjs/interface/slicers.d.ts.map +1 -1
  282. package/dist/cjs/interface/slicers.js +47 -2
  283. package/dist/cjs/interface/spreadsheet-interface.d.ts +1 -1
  284. package/dist/cjs/interface/spreadsheet-interface.d.ts.map +1 -1
  285. package/dist/cjs/interface/spreadsheet-interface.js +64 -1
  286. package/dist/cjs/interface/table-totalrow.d.ts +13 -1
  287. package/dist/cjs/interface/table-totalrow.d.ts.map +1 -1
  288. package/dist/cjs/interface/table-totalrow.js +107 -73
  289. package/dist/cjs/interface/table-utils.d.ts +59 -6
  290. package/dist/cjs/interface/table-utils.d.ts.map +1 -1
  291. package/dist/cjs/interface/table-utils.js +211 -15
  292. package/dist/cjs/interface/update-table.d.ts +16 -1
  293. package/dist/cjs/interface/update-table.d.ts.map +1 -1
  294. package/dist/cjs/interface/update-table.js +190 -44
  295. package/dist/cjs/sheet-cell.d.ts.map +1 -1
  296. package/dist/cjs/test-setup.d.ts.map +1 -1
  297. package/dist/cjs/test-setup.js +6 -0
  298. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  299. package/dist/cjs/validation-schema/table.schema.d.ts +11 -0
  300. package/dist/cjs/validation-schema/table.schema.d.ts.map +1 -1
  301. package/dist/cjs/validation-schema/table.schema.js +20 -3
  302. package/dist/esm/api/anchored-objects.d.ts +131 -7
  303. package/dist/esm/api/anchored-objects.d.ts.map +1 -1
  304. package/dist/esm/api/anchored-objects.js +399 -15
  305. package/dist/esm/api/copy-paste.d.ts +1 -2
  306. package/dist/esm/api/copy-paste.d.ts.map +1 -1
  307. package/dist/esm/api/copy-paste.js +1 -3
  308. package/dist/esm/api/filter.d.ts +15 -1
  309. package/dist/esm/api/filter.d.ts.map +1 -1
  310. package/dist/esm/api/filter.js +28 -0
  311. package/dist/esm/api/formula.d.ts +63 -0
  312. package/dist/esm/api/formula.d.ts.map +1 -1
  313. package/dist/esm/api/formula.js +235 -8
  314. package/dist/esm/api/paint-format.d.ts +22 -1
  315. package/dist/esm/api/paint-format.d.ts.map +1 -1
  316. package/dist/esm/api/paint-format.js +44 -1
  317. package/dist/esm/api/sort.d.ts +23 -1
  318. package/dist/esm/api/sort.d.ts.map +1 -1
  319. package/dist/esm/api/sort.js +45 -6
  320. package/dist/esm/api/structural-guards.d.ts +57 -0
  321. package/dist/esm/api/structural-guards.d.ts.map +1 -1
  322. package/dist/esm/api/structural-guards.js +85 -0
  323. package/dist/esm/api/structural-table-refs.d.ts +58 -3
  324. package/dist/esm/api/structural-table-refs.d.ts.map +1 -1
  325. package/dist/esm/api/structural-table-refs.js +126 -6
  326. package/dist/esm/api/table.d.ts +26 -2
  327. package/dist/esm/api/table.d.ts.map +1 -1
  328. package/dist/esm/api/table.js +70 -48
  329. package/dist/esm/api/validation.d.ts.map +1 -1
  330. package/dist/esm/api/validation.js +53 -8
  331. package/dist/esm/atoms/creating-table.atom.d.ts +22 -0
  332. package/dist/esm/atoms/creating-table.atom.d.ts.map +1 -0
  333. package/dist/esm/atoms/creating-table.atom.js +4 -0
  334. package/dist/esm/atoms/dialog-state.atom.d.ts +8 -0
  335. package/dist/esm/atoms/dialog-state.atom.d.ts.map +1 -1
  336. package/dist/esm/atoms/dialog-state.atom.js +12 -0
  337. package/dist/esm/atoms/editing-slicer.atom.d.ts +9 -0
  338. package/dist/esm/atoms/editing-slicer.atom.d.ts.map +1 -0
  339. package/dist/esm/atoms/editing-slicer.atom.js +6 -0
  340. package/dist/esm/atoms/index.d.ts +4 -0
  341. package/dist/esm/atoms/index.d.ts.map +1 -1
  342. package/dist/esm/atoms/index.js +4 -0
  343. package/dist/esm/atoms/inserting-slicer.atom.d.ts +8 -0
  344. package/dist/esm/atoms/inserting-slicer.atom.d.ts.map +1 -0
  345. package/dist/esm/atoms/inserting-slicer.atom.js +5 -0
  346. package/dist/esm/atoms/resizing-table.atom.d.ts +8 -0
  347. package/dist/esm/atoms/resizing-table.atom.d.ts.map +1 -0
  348. package/dist/esm/atoms/resizing-table.atom.js +5 -0
  349. package/dist/esm/commands.d.ts +129 -2
  350. package/dist/esm/commands.d.ts.map +1 -1
  351. package/dist/esm/components/editors/embed-editor.d.ts +4 -2
  352. package/dist/esm/components/editors/embed-editor.d.ts.map +1 -1
  353. package/dist/esm/components/editors/embed-editor.js +40 -6
  354. package/dist/esm/components/editors/slicer-editor.d.ts +15 -0
  355. package/dist/esm/components/editors/slicer-editor.d.ts.map +1 -0
  356. package/dist/esm/components/editors/slicer-editor.js +85 -0
  357. package/dist/esm/components/editors/table-editor.d.ts +58 -2
  358. package/dist/esm/components/editors/table-editor.d.ts.map +1 -1
  359. package/dist/esm/components/editors/table-editor.js +243 -19
  360. package/dist/esm/components/index.d.ts +1 -0
  361. package/dist/esm/components/index.d.ts.map +1 -1
  362. package/dist/esm/components/index.js +1 -0
  363. package/dist/esm/constants.d.ts +9 -1
  364. package/dist/esm/constants.d.ts.map +1 -1
  365. package/dist/esm/constants.js +12 -0
  366. package/dist/esm/generated-names.d.ts +13 -3
  367. package/dist/esm/generated-names.d.ts.map +1 -1
  368. package/dist/esm/generated-names.js +3 -1
  369. package/dist/esm/helpers.d.ts +5 -0
  370. package/dist/esm/helpers.d.ts.map +1 -1
  371. package/dist/esm/helpers.js +7 -1
  372. package/dist/esm/hooks/use-on-change-batch.d.ts +19 -2
  373. package/dist/esm/hooks/use-on-change-batch.d.ts.map +1 -1
  374. package/dist/esm/hooks/use-on-change-batch.js +19 -3
  375. package/dist/esm/hooks/use-on-change-calculated-column.d.ts +10 -1
  376. package/dist/esm/hooks/use-on-change-calculated-column.d.ts.map +1 -1
  377. package/dist/esm/hooks/use-on-change-calculated-column.js +17 -5
  378. package/dist/esm/hooks/use-on-change-table-column.d.ts +6 -1
  379. package/dist/esm/hooks/use-on-change-table-column.d.ts.map +1 -1
  380. package/dist/esm/hooks/use-on-change-table-column.js +17 -5
  381. package/dist/esm/hooks/use-on-change.d.ts +36 -3
  382. package/dist/esm/hooks/use-on-change.d.ts.map +1 -1
  383. package/dist/esm/hooks/use-on-change.js +214 -124
  384. package/dist/esm/hooks/use-on-create-custom-table-style.d.ts +17 -0
  385. package/dist/esm/hooks/use-on-create-custom-table-style.d.ts.map +1 -0
  386. package/dist/esm/hooks/use-on-create-custom-table-style.js +26 -0
  387. package/dist/esm/hooks/use-on-create-named-range.d.ts +4 -2
  388. package/dist/esm/hooks/use-on-create-named-range.d.ts.map +1 -1
  389. package/dist/esm/hooks/use-on-create-named-range.js +11 -1
  390. package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts +2 -1
  391. package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -1
  392. package/dist/esm/hooks/use-on-delete-cells-shift-left.js +3 -1
  393. package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts +2 -1
  394. package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -1
  395. package/dist/esm/hooks/use-on-delete-cells-shift-up.js +3 -1
  396. package/dist/esm/hooks/use-on-delete-column.d.ts +2 -1
  397. package/dist/esm/hooks/use-on-delete-column.d.ts.map +1 -1
  398. package/dist/esm/hooks/use-on-delete-column.js +3 -1
  399. package/dist/esm/hooks/use-on-delete-row.d.ts +2 -1
  400. package/dist/esm/hooks/use-on-delete-row.d.ts.map +1 -1
  401. package/dist/esm/hooks/use-on-delete-row.js +3 -1
  402. package/dist/esm/hooks/use-on-delete-sheet.d.ts +10 -1
  403. package/dist/esm/hooks/use-on-delete-sheet.d.ts.map +1 -1
  404. package/dist/esm/hooks/use-on-delete-sheet.js +19 -1
  405. package/dist/esm/hooks/use-on-delete-table-row.d.ts +4 -1
  406. package/dist/esm/hooks/use-on-delete-table-row.d.ts.map +1 -1
  407. package/dist/esm/hooks/use-on-delete-table-row.js +19 -1
  408. package/dist/esm/hooks/use-on-delete.d.ts +5 -2
  409. package/dist/esm/hooks/use-on-delete.d.ts.map +1 -1
  410. package/dist/esm/hooks/use-on-delete.js +5 -1
  411. package/dist/esm/hooks/use-on-embeds.d.ts +7 -4
  412. package/dist/esm/hooks/use-on-embeds.d.ts.map +1 -1
  413. package/dist/esm/hooks/use-on-embeds.js +23 -6
  414. package/dist/esm/hooks/use-on-fill.d.ts +17 -2
  415. package/dist/esm/hooks/use-on-fill.d.ts.map +1 -1
  416. package/dist/esm/hooks/use-on-fill.js +27 -1
  417. package/dist/esm/hooks/use-on-filter-table.d.ts.map +1 -1
  418. package/dist/esm/hooks/use-on-filter-table.js +97 -26
  419. package/dist/esm/hooks/use-on-import-excel.d.ts +2 -1
  420. package/dist/esm/hooks/use-on-import-excel.d.ts.map +1 -1
  421. package/dist/esm/hooks/use-on-import-excel.js +4 -1
  422. package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts +2 -1
  423. package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -1
  424. package/dist/esm/hooks/use-on-insert-cells-shift-down.js +3 -1
  425. package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts +2 -1
  426. package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -1
  427. package/dist/esm/hooks/use-on-insert-cells-shift-right.js +3 -1
  428. package/dist/esm/hooks/use-on-insert-column.d.ts +2 -1
  429. package/dist/esm/hooks/use-on-insert-column.d.ts.map +1 -1
  430. package/dist/esm/hooks/use-on-insert-column.js +3 -1
  431. package/dist/esm/hooks/use-on-insert-row.d.ts +2 -1
  432. package/dist/esm/hooks/use-on-insert-row.d.ts.map +1 -1
  433. package/dist/esm/hooks/use-on-insert-row.js +3 -1
  434. package/dist/esm/hooks/use-on-insert-table-row.d.ts +5 -2
  435. package/dist/esm/hooks/use-on-insert-table-row.d.ts.map +1 -1
  436. package/dist/esm/hooks/use-on-insert-table-row.js +19 -1
  437. package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts +3 -2
  438. package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -1
  439. package/dist/esm/hooks/use-on-merge-unmerge-cells.js +12 -1
  440. package/dist/esm/hooks/use-on-move-columns.d.ts +3 -1
  441. package/dist/esm/hooks/use-on-move-columns.d.ts.map +1 -1
  442. package/dist/esm/hooks/use-on-move-columns.js +14 -1
  443. package/dist/esm/hooks/use-on-move-rows.d.ts +3 -1
  444. package/dist/esm/hooks/use-on-move-rows.d.ts.map +1 -1
  445. package/dist/esm/hooks/use-on-move-rows.js +14 -1
  446. package/dist/esm/hooks/use-on-move-selection.d.ts +3 -1
  447. package/dist/esm/hooks/use-on-move-selection.d.ts.map +1 -1
  448. package/dist/esm/hooks/use-on-move-selection.js +44 -1
  449. package/dist/esm/hooks/use-on-paste.d.ts +22 -1
  450. package/dist/esm/hooks/use-on-paste.d.ts.map +1 -1
  451. package/dist/esm/hooks/use-on-paste.js +815 -672
  452. package/dist/esm/hooks/use-on-remove-duplicates.d.ts +5 -2
  453. package/dist/esm/hooks/use-on-remove-duplicates.d.ts.map +1 -1
  454. package/dist/esm/hooks/use-on-remove-duplicates.js +5 -1
  455. package/dist/esm/hooks/use-on-request-create-table.d.ts +13 -0
  456. package/dist/esm/hooks/use-on-request-create-table.d.ts.map +1 -0
  457. package/dist/esm/hooks/use-on-request-create-table.js +43 -0
  458. package/dist/esm/hooks/use-on-request-insert-slicer.d.ts +7 -0
  459. package/dist/esm/hooks/use-on-request-insert-slicer.d.ts.map +1 -0
  460. package/dist/esm/hooks/use-on-request-insert-slicer.js +15 -0
  461. package/dist/esm/hooks/use-on-request-resize-table.d.ts +7 -0
  462. package/dist/esm/hooks/use-on-request-resize-table.d.ts.map +1 -0
  463. package/dist/esm/hooks/use-on-request-resize-table.js +15 -0
  464. package/dist/esm/hooks/use-on-resize-table.d.ts +5 -1
  465. package/dist/esm/hooks/use-on-resize-table.d.ts.map +1 -1
  466. package/dist/esm/hooks/use-on-resize-table.js +107 -27
  467. package/dist/esm/hooks/use-on-sort-column.d.ts +28 -3
  468. package/dist/esm/hooks/use-on-sort-column.d.ts.map +1 -1
  469. package/dist/esm/hooks/use-on-sort-column.js +105 -68
  470. package/dist/esm/hooks/use-on-sort-range.d.ts +26 -3
  471. package/dist/esm/hooks/use-on-sort-range.d.ts.map +1 -1
  472. package/dist/esm/hooks/use-on-sort-range.js +100 -64
  473. package/dist/esm/hooks/use-on-sort-table.d.ts +18 -1
  474. package/dist/esm/hooks/use-on-sort-table.d.ts.map +1 -1
  475. package/dist/esm/hooks/use-on-sort-table.js +107 -86
  476. package/dist/esm/hooks/use-on-subtotal.d.ts +10 -3
  477. package/dist/esm/hooks/use-on-subtotal.d.ts.map +1 -1
  478. package/dist/esm/hooks/use-on-subtotal.js +7 -5
  479. package/dist/esm/hooks/use-on-table.d.ts +39 -7
  480. package/dist/esm/hooks/use-on-table.d.ts.map +1 -1
  481. package/dist/esm/hooks/use-on-table.js +234 -26
  482. package/dist/esm/hooks/use-on-undo-calculated-column.d.ts +23 -0
  483. package/dist/esm/hooks/use-on-undo-calculated-column.d.ts.map +1 -0
  484. package/dist/esm/hooks/use-on-undo-calculated-column.js +62 -0
  485. package/dist/esm/hooks/use-on-undo-table-auto-expansion.d.ts +28 -0
  486. package/dist/esm/hooks/use-on-undo-table-auto-expansion.d.ts.map +1 -0
  487. package/dist/esm/hooks/use-on-undo-table-auto-expansion.js +75 -0
  488. package/dist/esm/hooks/use-on-update-named-range.d.ts +4 -2
  489. package/dist/esm/hooks/use-on-update-named-range.d.ts.map +1 -1
  490. package/dist/esm/hooks/use-on-update-named-range.js +13 -1
  491. package/dist/esm/hooks/use-sheet-properties.d.ts +1 -0
  492. package/dist/esm/hooks/use-sheet-properties.d.ts.map +1 -1
  493. package/dist/esm/hooks/use-sheet-properties.js +38 -19
  494. package/dist/esm/hooks/use-slicers.d.ts +2 -2
  495. package/dist/esm/hooks/use-slicers.d.ts.map +1 -1
  496. package/dist/esm/hooks/use-slicers.js +16 -8
  497. package/dist/esm/hooks/use-sparkline-groups.d.ts +50 -0
  498. package/dist/esm/hooks/use-sparkline-groups.d.ts.map +1 -0
  499. package/dist/esm/hooks/use-sparkline-groups.js +146 -0
  500. package/dist/esm/hooks/use-spreadsheet-state.d.ts +56 -10
  501. package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -1
  502. package/dist/esm/hooks/use-spreadsheet-state.js +260 -30
  503. package/dist/esm/hooks/use-structured-reference.d.ts.map +1 -1
  504. package/dist/esm/hooks/use-structured-reference.js +17 -0
  505. package/dist/esm/hooks/use-undo-redo-actions.d.ts +2 -1
  506. package/dist/esm/hooks/use-undo-redo-actions.d.ts.map +1 -1
  507. package/dist/esm/hooks/use-undo-redo-actions.js +8 -2
  508. package/dist/esm/hooks/use-undo-redo.d.ts +12 -0
  509. package/dist/esm/hooks/use-undo-redo.d.ts.map +1 -1
  510. package/dist/esm/hooks/use-undo-redo.js +158 -7
  511. package/dist/esm/hooks/utils/sort-rows.d.ts.map +1 -1
  512. package/dist/esm/hooks/utils/sort-rows.js +4 -3
  513. package/dist/esm/index.d.ts +7 -0
  514. package/dist/esm/index.d.ts.map +1 -1
  515. package/dist/esm/index.js +8 -0
  516. package/dist/esm/interface/apply-fill.d.ts +26 -3
  517. package/dist/esm/interface/apply-fill.d.ts.map +1 -1
  518. package/dist/esm/interface/apply-fill.js +188 -88
  519. package/dist/esm/interface/change-batch.d.ts +1 -1
  520. package/dist/esm/interface/change-batch.d.ts.map +1 -1
  521. package/dist/esm/interface/change-batch.js +89 -8
  522. package/dist/esm/interface/change-calculated-column.d.ts +6 -2
  523. package/dist/esm/interface/change-calculated-column.d.ts.map +1 -1
  524. package/dist/esm/interface/change-calculated-column.js +81 -16
  525. package/dist/esm/interface/change-table-column.d.ts +81 -7
  526. package/dist/esm/interface/change-table-column.d.ts.map +1 -1
  527. package/dist/esm/interface/change-table-column.js +295 -67
  528. package/dist/esm/interface/create-table.d.ts +15 -3
  529. package/dist/esm/interface/create-table.d.ts.map +1 -1
  530. package/dist/esm/interface/create-table.js +103 -27
  531. package/dist/esm/interface/delete-cells-shift-left.d.ts +1 -1
  532. package/dist/esm/interface/delete-cells-shift-left.d.ts.map +1 -1
  533. package/dist/esm/interface/delete-cells-shift-left.js +17 -2
  534. package/dist/esm/interface/delete-cells-shift-up.d.ts +1 -1
  535. package/dist/esm/interface/delete-cells-shift-up.d.ts.map +1 -1
  536. package/dist/esm/interface/delete-cells-shift-up.js +17 -2
  537. package/dist/esm/interface/delete-cells.d.ts +1 -1
  538. package/dist/esm/interface/delete-cells.d.ts.map +1 -1
  539. package/dist/esm/interface/delete-cells.js +69 -30
  540. package/dist/esm/interface/delete-column.d.ts +1 -1
  541. package/dist/esm/interface/delete-column.d.ts.map +1 -1
  542. package/dist/esm/interface/delete-column.js +16 -3
  543. package/dist/esm/interface/delete-row.d.ts +1 -1
  544. package/dist/esm/interface/delete-row.d.ts.map +1 -1
  545. package/dist/esm/interface/delete-row.js +180 -16
  546. package/dist/esm/interface/delete-sheet.d.ts +2 -2
  547. package/dist/esm/interface/delete-sheet.d.ts.map +1 -1
  548. package/dist/esm/interface/delete-sheet.js +132 -1
  549. package/dist/esm/interface/delete-table-column.d.ts +1 -1
  550. package/dist/esm/interface/delete-table-column.d.ts.map +1 -1
  551. package/dist/esm/interface/delete-table-column.js +11 -1
  552. package/dist/esm/interface/delete-table-row.d.ts +1 -1
  553. package/dist/esm/interface/delete-table-row.d.ts.map +1 -1
  554. package/dist/esm/interface/delete-table-row.js +312 -232
  555. package/dist/esm/interface/duplicate-sheet.d.ts.map +1 -1
  556. package/dist/esm/interface/duplicate-sheet.js +73 -26
  557. package/dist/esm/interface/embeds.d.ts +10 -1
  558. package/dist/esm/interface/embeds.d.ts.map +1 -1
  559. package/dist/esm/interface/embeds.js +84 -5
  560. package/dist/esm/interface/insert-cells-shift-down.d.ts +1 -1
  561. package/dist/esm/interface/insert-cells-shift-down.d.ts.map +1 -1
  562. package/dist/esm/interface/insert-cells-shift-down.js +11 -1
  563. package/dist/esm/interface/insert-cells-shift-right.d.ts +1 -1
  564. package/dist/esm/interface/insert-cells-shift-right.d.ts.map +1 -1
  565. package/dist/esm/interface/insert-cells-shift-right.js +11 -1
  566. package/dist/esm/interface/insert-column.d.ts +2 -2
  567. package/dist/esm/interface/insert-column.d.ts.map +1 -1
  568. package/dist/esm/interface/insert-column.js +49 -23
  569. package/dist/esm/interface/insert-row.d.ts +1 -1
  570. package/dist/esm/interface/insert-row.d.ts.map +1 -1
  571. package/dist/esm/interface/insert-row.js +10 -2
  572. package/dist/esm/interface/insert-table-row.d.ts +2 -1
  573. package/dist/esm/interface/insert-table-row.d.ts.map +1 -1
  574. package/dist/esm/interface/insert-table-row.js +67 -12
  575. package/dist/esm/interface/remove-duplicates.d.ts +1 -1
  576. package/dist/esm/interface/remove-duplicates.d.ts.map +1 -1
  577. package/dist/esm/interface/remove-duplicates.js +41 -6
  578. package/dist/esm/interface/remove-table.d.ts +1 -1
  579. package/dist/esm/interface/remove-table.d.ts.map +1 -1
  580. package/dist/esm/interface/remove-table.js +58 -10
  581. package/dist/esm/interface/slicers.d.ts +12 -1
  582. package/dist/esm/interface/slicers.d.ts.map +1 -1
  583. package/dist/esm/interface/slicers.js +44 -2
  584. package/dist/esm/interface/spreadsheet-interface.d.ts +1 -1
  585. package/dist/esm/interface/spreadsheet-interface.d.ts.map +1 -1
  586. package/dist/esm/interface/spreadsheet-interface.js +73 -1
  587. package/dist/esm/interface/table-totalrow.d.ts +13 -1
  588. package/dist/esm/interface/table-totalrow.d.ts.map +1 -1
  589. package/dist/esm/interface/table-totalrow.js +98 -68
  590. package/dist/esm/interface/table-utils.d.ts +59 -6
  591. package/dist/esm/interface/table-utils.d.ts.map +1 -1
  592. package/dist/esm/interface/table-utils.js +155 -14
  593. package/dist/esm/interface/update-table.d.ts +16 -1
  594. package/dist/esm/interface/update-table.d.ts.map +1 -1
  595. package/dist/esm/interface/update-table.js +203 -42
  596. package/dist/esm/sheet-cell.d.ts.map +1 -1
  597. package/dist/esm/test-setup.d.ts.map +1 -1
  598. package/dist/esm/test-setup.js +6 -0
  599. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  600. package/dist/esm/validation-schema/table.schema.d.ts +11 -0
  601. package/dist/esm/validation-schema/table.schema.d.ts.map +1 -1
  602. package/dist/esm/validation-schema/table.schema.js +15 -2
  603. package/package.json +19 -11
@@ -1,4 +1,5 @@
1
1
  import { __assign, __read, __values } from "tslib";
2
+ import { cellToAddress } from "@rowsncolumns/utils";
2
3
  /**
3
4
  * Shift the `[start, end]` span of a range along the edited axis. Returns the
4
5
  * new span, or `null` when a delete consumes it entirely.
@@ -89,11 +90,26 @@ var isSheetRangeLike = function (value) {
89
90
  * (`sources`), nulled on properties (`dataRange`) — the chart's `#REF!`.
90
91
  * Unknown keys are left untouched. Mutates in place; returns whether anything
91
92
  * changed.
93
+ *
94
+ * `band` restricts the rewrite to ranges whose PERPENDICULAR span lies wholly
95
+ * inside it — the insert/delete-CELLS shift of columns `B:C` only touches
96
+ * ranges living entirely in B..C, exactly like `expandRangesInFormula` /
97
+ * `contractRangesInFormula` with the same `bandSpan` (SHF-07 / SHF-08), so a
98
+ * chart and a formula reading the same cells always agree. A range that only
99
+ * partially overlaps the band keeps its address, as in Excel.
92
100
  */
93
- export var shiftChartSpecRanges = function (spec, sheetId, axis, op, index, count) {
101
+ export var shiftChartSpecRanges = function (spec, sheetId, axis, op, index, count, band) {
94
102
  var changed = false;
103
+ var _a = __read(axis === "row"
104
+ ? ["startColumnIndex", "endColumnIndex"]
105
+ : ["startRowIndex", "endRowIndex"], 2), acrossStartKey = _a[0], acrossEndKey = _a[1];
106
+ var isWithinBand = function (range) {
107
+ return !band ||
108
+ (range[acrossStartKey] >= band.startIndex &&
109
+ range[acrossEndKey] <= band.endIndex);
110
+ };
95
111
  var shiftRange = function (range) {
96
- if (range.sheetId !== sheetId)
112
+ if (range.sheetId !== sheetId || !isWithinBand(range))
97
113
  return range;
98
114
  var next = shiftGridRangeLikeReference(range, axis, op, index, count);
99
115
  if (next !== range)
@@ -146,59 +162,132 @@ export var shiftChartSpecRanges = function (spec, sheetId, axis, op, index, coun
146
162
  walk(spec);
147
163
  return changed;
148
164
  };
149
- /** Shift the anchor cell of every embed (picture, shape, text box…) on the edited sheet. */
165
+ /**
166
+ * Record (or clear) the second anchor a move / resize gesture reported —
167
+ * `moveAndSize` objects carry one, `moveOnly` / `absolute` never do.
168
+ */
169
+ export var setOverlayToAnchor = function (overlay, toAnchor) {
170
+ if (toAnchor) {
171
+ overlay.toCell = toAnchor.toCell;
172
+ overlay.toOffsetXPixels = toAnchor.toOffsetXPixels;
173
+ overlay.toOffsetYPixels = toAnchor.toOffsetYPixels;
174
+ return;
175
+ }
176
+ delete overlay.toCell;
177
+ delete overlay.toOffsetXPixels;
178
+ delete overlay.toOffsetYPixels;
179
+ };
180
+ /**
181
+ * Shift a floating object's anchors for a whole row / column insert or
182
+ * delete, per its placement mode. Returns `"removed"` when a delete consumed
183
+ * the whole span of a `moveAndSize` object (Excel deletes it), otherwise
184
+ * whether anything moved.
185
+ */
186
+ export var shiftOverlayOnStructuralChange = function (overlay, axis, op, index, count) {
187
+ var _a;
188
+ if (!overlay.anchorCell || overlay.placement === "absolute")
189
+ return false;
190
+ var moveAndSize = ((_a = overlay.placement) !== null && _a !== void 0 ? _a : "moveAndSize") === "moveAndSize";
191
+ var toCell = moveAndSize ? overlay.toCell : undefined;
192
+ if (toCell && op === "delete" && count > 0) {
193
+ var key = axis === "row" ? "rowIndex" : "columnIndex";
194
+ var start = overlay.anchorCell[key];
195
+ // `to` sits on the cell the corner lands in; a corner flush with the
196
+ // cell's leading edge does not occupy it.
197
+ var offset = axis === "row" ? overlay.toOffsetYPixels : overlay.toOffsetXPixels;
198
+ var end = (offset !== null && offset !== void 0 ? offset : 0) > 0 ? toCell[key] : Math.max(start, toCell[key] - 1);
199
+ if (index <= start && index + count - 1 >= end)
200
+ return "removed";
201
+ }
202
+ var changed = false;
203
+ var next = shiftAnchorCell(overlay.anchorCell, axis, op, index, count);
204
+ if (next !== overlay.anchorCell) {
205
+ overlay.anchorCell = next;
206
+ changed = true;
207
+ }
208
+ if (toCell) {
209
+ var nextTo = shiftAnchorCell(toCell, axis, op, index, count);
210
+ if (nextTo !== toCell) {
211
+ overlay.toCell = nextTo;
212
+ changed = true;
213
+ }
214
+ }
215
+ return changed;
216
+ };
217
+ /** Shift the anchors of every embed (picture, shape, text box…) on the edited sheet. */
150
218
  export var shiftEmbedsOnStructuralChange = function (draft, sheetId, axis, op, index, count) {
151
- var e_2, _a;
152
- try {
153
- for (var draft_1 = __values(draft), draft_1_1 = draft_1.next(); !draft_1_1.done; draft_1_1 = draft_1.next()) {
154
- var embed = draft_1_1.value;
155
- var position = embed.position;
156
- if (!position || position.sheetId !== sheetId)
157
- continue;
158
- var overlay = position.overlayPosition;
159
- if (!(overlay === null || overlay === void 0 ? void 0 : overlay.anchorCell))
160
- continue;
161
- var next = shiftAnchorCell(overlay.anchorCell, axis, op, index, count);
162
- if (next !== overlay.anchorCell)
163
- overlay.anchorCell = next;
219
+ for (var i = draft.length - 1; i >= 0; i--) {
220
+ var position = draft[i].position;
221
+ if (!position || position.sheetId !== sheetId)
222
+ continue;
223
+ var overlay = position.overlayPosition;
224
+ if (!(overlay === null || overlay === void 0 ? void 0 : overlay.anchorCell))
225
+ continue;
226
+ if (shiftOverlayOnStructuralChange(overlay, axis, op, index, count) ===
227
+ "removed") {
228
+ draft.splice(i, 1);
164
229
  }
165
230
  }
166
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
167
- finally {
168
- try {
169
- if (draft_1_1 && !draft_1_1.done && (_a = draft_1.return)) _a.call(draft_1);
231
+ };
232
+ /**
233
+ * Shift the anchors of every slicer on the edited sheet — a slicer is a
234
+ * floating frame with the same placement modes as a picture (#668 C-46).
235
+ */
236
+ export var shiftSlicersOnStructuralChange = function (draft, sheetId, axis, op, index, count) {
237
+ for (var i = draft.length - 1; i >= 0; i--) {
238
+ var position = draft[i].position;
239
+ if (!position || position.sheetId !== sheetId)
240
+ continue;
241
+ var overlay = position.overlayPosition;
242
+ if (!(overlay === null || overlay === void 0 ? void 0 : overlay.anchorCell))
243
+ continue;
244
+ if (shiftOverlayOnStructuralChange(overlay, axis, op, index, count) ===
245
+ "removed") {
246
+ draft.splice(i, 1);
170
247
  }
171
- finally { if (e_2) throw e_2.error; }
172
248
  }
173
249
  };
174
250
  /**
175
- * Shift every chart on the edited sheet: its anchor cell like a floating
251
+ * Shift every chart on the edited sheet: its anchors like a floating
176
252
  * object, and the ranges inside its spec like references.
177
253
  */
178
254
  export var shiftChartsOnStructuralChange = function (draft, sheetId, axis, op, index, count) {
179
- var e_3, _a;
180
- var _b;
255
+ var _a;
256
+ for (var i = draft.length - 1; i >= 0; i--) {
257
+ var chart = draft[i];
258
+ var position = chart.position;
259
+ if ((position === null || position === void 0 ? void 0 : position.sheetId) === sheetId &&
260
+ ((_a = position.overlayPosition) === null || _a === void 0 ? void 0 : _a.anchorCell) &&
261
+ shiftOverlayOnStructuralChange(position.overlayPosition, axis, op, index, count) === "removed") {
262
+ draft.splice(i, 1);
263
+ continue;
264
+ }
265
+ // Series ranges may point at ANY sheet, so the spec walk is not gated on
266
+ // the chart's own sheet.
267
+ shiftChartSpecRanges(chart.spec, sheetId, axis, op, index, count);
268
+ }
269
+ };
270
+ /**
271
+ * Insert/delete CELLS with shift (SHF-*): only the ranges a chart reads move —
272
+ * those wholly inside the shifted band's columns (shift down/up) or rows
273
+ * (shift right/left), with the reference rule along the shift axis. Excel
274
+ * moves drawing anchors only for whole row/column edits, so the chart frame
275
+ * stays where it is.
276
+ */
277
+ export var shiftChartsOnCellShift = function (draft, sheetId, axis, op, index, count, band) {
278
+ var e_2, _a;
181
279
  try {
182
- for (var draft_2 = __values(draft), draft_2_1 = draft_2.next(); !draft_2_1.done; draft_2_1 = draft_2.next()) {
183
- var chart = draft_2_1.value;
184
- var position = chart.position;
185
- if ((position === null || position === void 0 ? void 0 : position.sheetId) === sheetId && ((_b = position.overlayPosition) === null || _b === void 0 ? void 0 : _b.anchorCell)) {
186
- var overlay = position.overlayPosition;
187
- var next = shiftAnchorCell(overlay.anchorCell, axis, op, index, count);
188
- if (next !== overlay.anchorCell)
189
- overlay.anchorCell = next;
190
- }
191
- // Series ranges may point at ANY sheet, so the spec walk is not gated on
192
- // the chart's own sheet.
193
- shiftChartSpecRanges(chart.spec, sheetId, axis, op, index, count);
280
+ for (var draft_1 = __values(draft), draft_1_1 = draft_1.next(); !draft_1_1.done; draft_1_1 = draft_1.next()) {
281
+ var chart = draft_1_1.value;
282
+ shiftChartSpecRanges(chart.spec, sheetId, axis, op, index, count, band);
194
283
  }
195
284
  }
196
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
285
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
197
286
  finally {
198
287
  try {
199
- if (draft_2_1 && !draft_2_1.done && (_a = draft_2.return)) _a.call(draft_2);
288
+ if (draft_1_1 && !draft_1_1.done && (_a = draft_1.return)) _a.call(draft_1);
200
289
  }
201
- finally { if (e_3) throw e_3.error; }
290
+ finally { if (e_2) throw e_2.error; }
202
291
  }
203
292
  };
204
293
  /**
@@ -206,7 +295,7 @@ export var shiftChartsOnStructuralChange = function (draft, sheetId, axis, op, i
206
295
  * (sheet-scoped protection) is untouched; one the delete consumes is removed.
207
296
  */
208
297
  export var shiftProtectedRangesOnStructuralChange = function (draft, sheetId, axis, op, index, count) {
209
- var e_4, _a;
298
+ var e_3, _a;
210
299
  var _b = __read(axis === "row"
211
300
  ? ["startRowIndex", "endRowIndex"]
212
301
  : ["startColumnIndex", "endColumnIndex"], 2), startKey = _b[0], endKey = _b[1];
@@ -232,7 +321,7 @@ export var shiftProtectedRangesOnStructuralChange = function (draft, sheetId, ax
232
321
  var kept = [];
233
322
  var unprotectedChanged = false;
234
323
  try {
235
- for (var _c = (e_4 = void 0, __values(protectedRange.unprotectedRanges)), _d = _c.next(); !_d.done; _d = _c.next()) {
324
+ for (var _c = (e_3 = void 0, __values(protectedRange.unprotectedRanges)), _d = _c.next(); !_d.done; _d = _c.next()) {
236
325
  var unprotected = _d.value;
237
326
  if (unprotected.sheetId !== sheetId) {
238
327
  kept.push(unprotected);
@@ -245,15 +334,371 @@ export var shiftProtectedRangesOnStructuralChange = function (draft, sheetId, ax
245
334
  kept.push(next);
246
335
  }
247
336
  }
248
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
337
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
249
338
  finally {
250
339
  try {
251
340
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
252
341
  }
253
- finally { if (e_4) throw e_4.error; }
342
+ finally { if (e_3) throw e_3.error; }
254
343
  }
255
344
  if (unprotectedChanged)
256
345
  protectedRange.unprotectedRanges = kept;
257
346
  }
258
347
  }
259
348
  };
349
+ /**
350
+ * Visit every `SheetRange` a chart spec holds — `dataRange`, per-series /
351
+ * per-domain `sources`, error-bar `plusRange` / `minusRange`, and any future
352
+ * range-valued key — replacing it with what `rewrite` returns. A range the
353
+ * rewrite returns `null` for is removed — spliced out of arrays (`sources`),
354
+ * nulled on properties (`dataRange`) — the chart's `#REF!`; a move never
355
+ * consumes a range, so its rewrites always return a range. Mutates in place;
356
+ * returns whether anything changed.
357
+ */
358
+ var rewriteChartSpecRanges = function (spec, rewrite) {
359
+ var changed = false;
360
+ var walk = function (node) {
361
+ var e_4, _a;
362
+ if (!node || typeof node !== "object")
363
+ return;
364
+ if (Array.isArray(node)) {
365
+ for (var i = node.length - 1; i >= 0; i--) {
366
+ var item = node[i];
367
+ if (isSheetRangeLike(item)) {
368
+ var next = rewrite(item);
369
+ if (next === null) {
370
+ node.splice(i, 1);
371
+ changed = true;
372
+ }
373
+ else if (next !== item) {
374
+ node[i] = next;
375
+ changed = true;
376
+ }
377
+ }
378
+ else {
379
+ walk(item);
380
+ }
381
+ }
382
+ return;
383
+ }
384
+ var obj = node;
385
+ try {
386
+ for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
387
+ var key = _c.value;
388
+ var value = obj[key];
389
+ if (isSheetRangeLike(value)) {
390
+ var next = rewrite(value);
391
+ if (next !== value) {
392
+ obj[key] = next;
393
+ changed = true;
394
+ }
395
+ }
396
+ else {
397
+ walk(value);
398
+ }
399
+ }
400
+ }
401
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
402
+ finally {
403
+ try {
404
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
405
+ }
406
+ finally { if (e_4) throw e_4.error; }
407
+ }
408
+ };
409
+ walk(spec);
410
+ return changed;
411
+ };
412
+ /**
413
+ * Deleting a sheet consumes every range on it: a chart elsewhere whose series
414
+ * / category / data range read the deleted sheet keeps the chart but loses
415
+ * that range (Excel's empty `#REF!` series).
416
+ */
417
+ export var removeChartSpecRangesOnSheet = function (spec, sheetId) {
418
+ return rewriteChartSpecRanges(spec, function (range) {
419
+ return range.sheetId === sheetId ? null : range;
420
+ });
421
+ };
422
+ /**
423
+ * Re-point every range on `fromSheetId` at `toSheetId` — a duplicated sheet's
424
+ * charts read the copy's own cells (Excel), while ranges on other sheets keep
425
+ * reading the original.
426
+ */
427
+ export var retargetChartSpecRanges = function (spec, fromSheetId, toSheetId) {
428
+ return rewriteChartSpecRanges(spec, function (range) {
429
+ return range.sheetId === fromSheetId ? __assign(__assign({}, range), { sheetId: toSheetId }) : range;
430
+ });
431
+ };
432
+ /**
433
+ * Relocate the ranges inside a chart spec when the block `from` on
434
+ * `fromSheetId` is moved (drag-move, cut → paste) to `to` on `toSheetId`, the
435
+ * way Excel re-points series like references: a range that lies ENTIRELY
436
+ * inside the moved block travels with it (shifted by the move delta and onto
437
+ * the destination sheet); a range the block covers only partially, and any
438
+ * range outside it, keeps referring to its original cells. Mirrors
439
+ * `move_spec_sheet_ranges` in `rnc-store`.
440
+ */
441
+ export var moveChartSpecRanges = function (spec, fromSheetId, from, toSheetId, to) {
442
+ var rowDelta = to.startRowIndex - from.startRowIndex;
443
+ var columnDelta = to.startColumnIndex - from.startColumnIndex;
444
+ if (rowDelta === 0 && columnDelta === 0 && fromSheetId === toSheetId) {
445
+ return false;
446
+ }
447
+ return rewriteChartSpecRanges(spec, function (range) {
448
+ if (range.sheetId !== fromSheetId ||
449
+ range.startRowIndex < from.startRowIndex ||
450
+ range.endRowIndex > from.endRowIndex ||
451
+ range.startColumnIndex < from.startColumnIndex ||
452
+ range.endColumnIndex > from.endColumnIndex) {
453
+ return range;
454
+ }
455
+ return __assign(__assign({}, range), { sheetId: toSheetId, startRowIndex: range.startRowIndex + rowDelta, endRowIndex: range.endRowIndex + rowDelta, startColumnIndex: range.startColumnIndex + columnDelta, endColumnIndex: range.endColumnIndex + columnDelta });
456
+ });
457
+ };
458
+ /** Re-point the ranges of every chart when a cell block is moved (see `moveChartSpecRanges`). */
459
+ export var moveChartsOnRangeMove = function (draft, fromSheetId, from, toSheetId, to) {
460
+ var e_5, _a;
461
+ try {
462
+ for (var draft_2 = __values(draft), draft_2_1 = draft_2.next(); !draft_2_1.done; draft_2_1 = draft_2.next()) {
463
+ var chart = draft_2_1.value;
464
+ moveChartSpecRanges(chart.spec, fromSheetId, from, toSheetId, to);
465
+ }
466
+ }
467
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
468
+ finally {
469
+ try {
470
+ if (draft_2_1 && !draft_2_1.done && (_a = draft_2.return)) _a.call(draft_2);
471
+ }
472
+ finally { if (e_5) throw e_5.error; }
473
+ }
474
+ };
475
+ /**
476
+ * Where line `index` (a row or column) ends up after the whole lines `lines`
477
+ * (sorted ascending) are moved so the block lands at `target` in the
478
+ * post-removal frame — the permutation a row/column move applies to every
479
+ * cell. A moved line lands at `target` + its rank in the block; a line outside
480
+ * closes the gap the block left and is pushed by the block landing at or
481
+ * before it. Mirrors `moved_line_index` in `rnc-store`.
482
+ */
483
+ export var movedLineIndex = function (lines, target, index) {
484
+ var e_6, _a;
485
+ var rank = lines.indexOf(index);
486
+ if (rank !== -1)
487
+ return target + rank;
488
+ var removedBefore = 0;
489
+ try {
490
+ for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
491
+ var line = lines_1_1.value;
492
+ if (line < index)
493
+ removedBefore++;
494
+ }
495
+ }
496
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
497
+ finally {
498
+ try {
499
+ if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
500
+ }
501
+ finally { if (e_6) throw e_6.error; }
502
+ }
503
+ var settled = index - removedBefore;
504
+ return settled < target ? settled : settled + lines.length;
505
+ };
506
+ /**
507
+ * Re-point the ranges inside a chart spec when whole rows / columns of
508
+ * `sheetId` are moved (`lines` land at `target`), with the rule the engines
509
+ * apply to formula references: both edges follow their line, and the range is
510
+ * rewritten only when that yields a range of the same size — so a range wholly
511
+ * inside the moved block relocates with it, one wholly inside the displaced
512
+ * band shifts by the block size, and one straddling the block and its
513
+ * neighbours keeps its text (it still covers the same cells). Mirrors
514
+ * `permute_spec_sheet_ranges` in `rnc-store` / `remap_formula_axis`.
515
+ */
516
+ export var reorderChartSpecRanges = function (spec, sheetId, axis, lines, target) {
517
+ if (!lines.length)
518
+ return false;
519
+ var _a = __read(axis === "row"
520
+ ? ["startRowIndex", "endRowIndex"]
521
+ : ["startColumnIndex", "endColumnIndex"], 2), startKey = _a[0], endKey = _a[1];
522
+ return rewriteChartSpecRanges(spec, function (range) {
523
+ var _a;
524
+ if (range.sheetId !== sheetId)
525
+ return range;
526
+ var start = range[startKey];
527
+ var end = range[endKey];
528
+ var nextStart = movedLineIndex(lines, target, start);
529
+ var nextEnd = movedLineIndex(lines, target, end);
530
+ if (nextEnd < nextStart ||
531
+ nextEnd - nextStart !== end - start ||
532
+ (nextStart === start && nextEnd === end)) {
533
+ return range;
534
+ }
535
+ return __assign(__assign({}, range), (_a = {}, _a[startKey] = nextStart, _a[endKey] = nextEnd, _a));
536
+ });
537
+ };
538
+ /** Re-point the ranges of every chart when whole rows / columns are moved (see `reorderChartSpecRanges`). */
539
+ export var reorderChartsOnLineMove = function (draft, sheetId, axis, lines, target) {
540
+ var e_7, _a;
541
+ try {
542
+ for (var draft_3 = __values(draft), draft_3_1 = draft_3.next(); !draft_3_1.done; draft_3_1 = draft_3.next()) {
543
+ var chart = draft_3_1.value;
544
+ reorderChartSpecRanges(chart.spec, sheetId, axis, lines, target);
545
+ }
546
+ }
547
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
548
+ finally {
549
+ try {
550
+ if (draft_3_1 && !draft_3_1.done && (_a = draft_3.return)) _a.call(draft_3);
551
+ }
552
+ finally { if (e_7) throw e_7.error; }
553
+ }
554
+ };
555
+ export var tableBinding = function (table) {
556
+ var range = table.range;
557
+ var bodyStartRowIndex = range.startRowIndex + (table.headerRow === false ? 0 : 1);
558
+ return {
559
+ range: range,
560
+ rowStarts: [range.startRowIndex, bodyStartRowIndex],
561
+ bodyEndRowIndex: range.endRowIndex - (table.totalRow ? 1 : 0),
562
+ };
563
+ };
564
+ /**
565
+ * A range bound to the table along `axis`: it covers the body rows (or header + body) of one or
566
+ * more table columns — for a column edit ALL of them, since a series is a column and only a range
567
+ * reading the whole table gains a column with it.
568
+ */
569
+ var isTableBoundRange = function (range, binding, axis) {
570
+ return binding.rowStarts.includes(range.startRowIndex) &&
571
+ range.endRowIndex === binding.bodyEndRowIndex &&
572
+ range.startColumnIndex >= binding.range.startColumnIndex &&
573
+ range.endColumnIndex <= binding.range.endColumnIndex &&
574
+ (axis === "row" ||
575
+ (range.startColumnIndex === binding.range.startColumnIndex &&
576
+ range.endColumnIndex === binding.range.endColumnIndex));
577
+ };
578
+ /** The table's extent across `axis` — the band a table-local edit moves cells in. */
579
+ var tableBand = function (binding, axis) {
580
+ return axis === "row"
581
+ ? {
582
+ startIndex: binding.range.startColumnIndex,
583
+ endIndex: binding.range.endColumnIndex,
584
+ }
585
+ : {
586
+ startIndex: binding.range.startRowIndex,
587
+ endIndex: binding.range.endRowIndex,
588
+ };
589
+ };
590
+ var growSpan = function (range, axis, delta) {
591
+ var _a;
592
+ var _b = __read(axis === "row"
593
+ ? ["startRowIndex", "endRowIndex"]
594
+ : ["startColumnIndex", "endColumnIndex"], 2), startKey = _b[0], endKey = _b[1];
595
+ var end = range[endKey] + delta;
596
+ return end < range[startKey] ? null : __assign(__assign({}, range), (_a = {}, _a[endKey] = end, _a));
597
+ };
598
+ /**
599
+ * Insert / delete table rows (or columns): the cells inside the table's columns (rows) at/after
600
+ * `index` move, so every chart range wholly inside that band follows the reference rule like
601
+ * insert/delete-cells — except a range bound to the table (`isTableBoundRange`), which grows /
602
+ * shrinks by `count` even when the rows are appended below the last body row (where the
603
+ * reference rule would leave it alone) or inserted above the first one (where it would shift):
604
+ * Excel keeps the series on the table column. A range that collapses is removed (`#REF!`).
605
+ * Mutates in place; returns whether anything changed. Mirrors
606
+ * `shift_spec_sheet_ranges_for_table_edit` in `rnc-store`.
607
+ */
608
+ export var shiftChartSpecRangesOnTableEdit = function (spec, sheetId, binding, axis, op, index, count) {
609
+ var band = tableBand(binding, axis);
610
+ var _a = __read(axis === "row"
611
+ ? ["startColumnIndex", "endColumnIndex"]
612
+ : ["startRowIndex", "endRowIndex"], 2), acrossStartKey = _a[0], acrossEndKey = _a[1];
613
+ return rewriteChartSpecRanges(spec, function (range) {
614
+ if (range.sheetId !== sheetId ||
615
+ range[acrossStartKey] < band.startIndex ||
616
+ range[acrossEndKey] > band.endIndex) {
617
+ return range;
618
+ }
619
+ if (isTableBoundRange(range, binding, axis)) {
620
+ return growSpan(range, axis, op === "insert" ? count : -count);
621
+ }
622
+ return shiftGridRangeLikeReference(range, axis, op, index, count);
623
+ });
624
+ };
625
+ /**
626
+ * Table growth without a cell shift — the resize handle, typing below / to the right of the
627
+ * table: a range bound to the table (`isTableBoundRange`) grows / shrinks with its body by
628
+ * `rowDelta` rows, then by `columnDelta` columns against the row-grown table. Mutates in place;
629
+ * returns whether anything changed. Mirrors `grow_table_bound_spec_ranges` in `rnc-store`.
630
+ */
631
+ export var growTableBoundChartSpecRanges = function (spec, sheetId, binding, rowDelta, columnDelta) {
632
+ if (rowDelta === 0 && columnDelta === 0)
633
+ return false;
634
+ var rowGrown = __assign(__assign({}, binding), { range: __assign(__assign({}, binding.range), { endRowIndex: binding.range.endRowIndex + rowDelta }), bodyEndRowIndex: binding.bodyEndRowIndex + rowDelta });
635
+ return rewriteChartSpecRanges(spec, function (range) {
636
+ if (range.sheetId !== sheetId)
637
+ return range;
638
+ var next = range;
639
+ if (rowDelta !== 0 && isTableBoundRange(next, binding, "row")) {
640
+ next = growSpan(next, "row", rowDelta);
641
+ }
642
+ if (next && columnDelta !== 0 && isTableBoundRange(next, rowGrown, "column")) {
643
+ next = growSpan(next, "column", columnDelta);
644
+ }
645
+ return next;
646
+ });
647
+ };
648
+ /** Every chart's ranges follow a table-local row / column insert or delete (see `shiftChartSpecRangesOnTableEdit`). */
649
+ export var shiftChartsOnTableEdit = function (draft, sheetId, binding, axis, op, index, count) {
650
+ var e_8, _a;
651
+ try {
652
+ for (var draft_4 = __values(draft), draft_4_1 = draft_4.next(); !draft_4_1.done; draft_4_1 = draft_4.next()) {
653
+ var chart = draft_4_1.value;
654
+ shiftChartSpecRangesOnTableEdit(chart.spec, sheetId, binding, axis, op, index, count);
655
+ }
656
+ }
657
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
658
+ finally {
659
+ try {
660
+ if (draft_4_1 && !draft_4_1.done && (_a = draft_4.return)) _a.call(draft_4);
661
+ }
662
+ finally { if (e_8) throw e_8.error; }
663
+ }
664
+ };
665
+ /** Every chart's table-bound ranges grow / shrink with a resized or auto-expanded table (see `growTableBoundChartSpecRanges`). */
666
+ export var growChartsWithTable = function (draft, sheetId, binding, rowDelta, columnDelta) {
667
+ var e_9, _a;
668
+ try {
669
+ for (var draft_5 = __values(draft), draft_5_1 = draft_5.next(); !draft_5_1.done; draft_5_1 = draft_5.next()) {
670
+ var chart = draft_5_1.value;
671
+ growTableBoundChartSpecRanges(chart.spec, sheetId, binding, rowDelta, columnDelta);
672
+ }
673
+ }
674
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
675
+ finally {
676
+ try {
677
+ if (draft_5_1 && !draft_5_1.done && (_a = draft_5.return)) _a.call(draft_5);
678
+ }
679
+ finally { if (e_9) throw e_9.error; }
680
+ }
681
+ };
682
+ /**
683
+ * Re-derive a citation's denormalized `destinationAnchor` from its `range`
684
+ * after a structural row / column / cell shift, so the anchor and the range
685
+ * travel together in the same history entry. A single cell becomes a
686
+ * `sheet_cell` anchor, anything larger a `sheet_range`; a citation without an
687
+ * anchor, or with an anchor of another type, is left alone.
688
+ */
689
+ export var refreshCitationAnchor = function (citation) {
690
+ var anchor = citation.destinationAnchor;
691
+ if (!anchor || (anchor.type !== "sheet_cell" && anchor.type !== "sheet_range")) {
692
+ return;
693
+ }
694
+ var _a = citation.range, sheetId = _a.sheetId, startRowIndex = _a.startRowIndex, endRowIndex = _a.endRowIndex, startColumnIndex = _a.startColumnIndex, endColumnIndex = _a.endColumnIndex;
695
+ var start = cellToAddress({ rowIndex: startRowIndex, columnIndex: startColumnIndex });
696
+ var end = cellToAddress({ rowIndex: endRowIndex, columnIndex: endColumnIndex });
697
+ if (!start || !end)
698
+ return;
699
+ if (startRowIndex === endRowIndex && startColumnIndex === endColumnIndex) {
700
+ citation.destinationAnchor = { type: "sheet_cell", sheetId: sheetId, cell: start };
701
+ return;
702
+ }
703
+ citation.destinationAnchor = { type: "sheet_range", sheetId: sheetId, range: "".concat(start, ":").concat(end) };
704
+ };
@@ -1,10 +1,9 @@
1
1
  import type { CellInterface, GridRange } from "@rowsncolumns/common-types";
2
2
  import type { CellData, EmbeddedObject, TableView } from "@rowsncolumns/spreadsheet";
3
- import type { GeneratedNames } from "../generated-names";
4
3
  import type { UseSpreadsheetProps } from "../hooks/use-spreadsheet-state";
5
4
  export type ClipBoardFormat = "text/html" | "text/csv" | "text/plain" | "application/json" | "image/apng" | "image/bmp" | "image/gif" | "image/jpeg" | "image/pjpeg" | "image/png" | "image/svg+xml" | "image/tiff" | "image/webp" | "image/x-icon";
6
5
  export declare const SUPPORTED_IMAGE_TYPES: string[];
7
- export declare const generateDataFromClipboard: <T extends CellData>(e: ClipboardEvent | undefined, activeCell: CellInterface, sheetId: number, activeSheetName: string, preserveFormatting?: boolean, locale?: string, idCreationStrategy?: UseSpreadsheetProps<T>["idCreationStrategy"], forcePlainText?: boolean, sanitizeHtml?: (html: string) => string, generatedNames?: GeneratedNames, options?: {
6
+ export declare const generateDataFromClipboard: <T extends CellData>(e: ClipboardEvent | undefined, activeCell: CellInterface, sheetId: number, activeSheetName: string, preserveFormatting?: boolean, locale?: string, idCreationStrategy?: UseSpreadsheetProps<T>["idCreationStrategy"], forcePlainText?: boolean, sanitizeHtml?: (html: string) => string, options?: {
8
7
  /**
9
8
  * Re-anchor each copied formula's relative refs from its `sourceCell` to the paste
10
9
  * destination (a COPY). `false` for a CUT: Excel keeps a moved formula's text verbatim and
@@ -1 +1 @@
1
- {"version":3,"file":"copy-paste.d.ts","sourceRoot":"","sources":["../../../api/copy-paste.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,SAAS,EACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,SAAS,EAEV,MAAM,2BAA2B,CAAC;AAanC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAW1E,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,UAAU,GACV,YAAY,GACZ,kBAAkB,GAClB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,YAAY,GACZ,aAAa,GACb,WAAW,GACX,eAAe,GACf,YAAY,GACZ,YAAY,GACZ,cAAc,CAAC;AAEnB,eAAO,MAAM,qBAAqB,UAWjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAU,CAAC,SAAS,QAAQ,EAChE,GAAG,cAAc,GAAG,SAAS,EAC7B,YAAY,aAAa,EACzB,SAAS,MAAM,EACf,iBAAiB,MAAM,EACvB,qBAAqB,OAAO,EAC5B,SAAS,MAAM,EACf,qBAAqB,mBAAmB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,EACjE,iBAAiB,OAAO,EACxB,eAAe,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EACvC,iBAAiB,cAAc,EAC/B,UAAU;IACR;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,KACA,OAAO,CACN;IACE,OAAO,CAAC,EAAE,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC;IAC5C,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,GACD,SAAS,CAyQZ,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,SAazC;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAC/C,MAAM,EAAE,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,yCAwB9C;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAC1C,MAAM,EAAE,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,EAC7C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,yCAkChB;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAC5C,MAAM,EAAE,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,EAC7C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,yCAwBhB;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7D,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,KACnD,MAAM,EAmBR,CAAC"}
1
+ {"version":3,"file":"copy-paste.d.ts","sourceRoot":"","sources":["../../../api/copy-paste.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,SAAS,EACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,SAAS,EAEV,MAAM,2BAA2B,CAAC;AAcnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAW1E,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,UAAU,GACV,YAAY,GACZ,kBAAkB,GAClB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,YAAY,GACZ,aAAa,GACb,WAAW,GACX,eAAe,GACf,YAAY,GACZ,YAAY,GACZ,cAAc,CAAC;AAEnB,eAAO,MAAM,qBAAqB,UAWjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAU,CAAC,SAAS,QAAQ,EAChE,GAAG,cAAc,GAAG,SAAS,EAC7B,YAAY,aAAa,EACzB,SAAS,MAAM,EACf,iBAAiB,MAAM,EACvB,qBAAqB,OAAO,EAC5B,SAAS,MAAM,EACf,qBAAqB,mBAAmB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,EACjE,iBAAiB,OAAO,EACxB,eAAe,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EACvC,UAAU;IACR;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,KACA,OAAO,CACN;IACE,OAAO,CAAC,EAAE,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC;IAC5C,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,GACD,SAAS,CAqQZ,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,SAazC;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAC/C,MAAM,EAAE,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,yCAwB9C;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAC1C,MAAM,EAAE,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,EAC7C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,yCAkChB;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAC5C,MAAM,EAAE,CAAC,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,EAC7C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,yCAwBhB;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAC7D,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,KACnD,MAAM,EAmBR,CAAC"}
@@ -2,7 +2,6 @@ import { __assign, __awaiter, __generator, __read, __rest, __spreadArray, __valu
2
2
  import { createCellDataArrayFromCSVString, readImageFileAsDataUri, } from "@rowsncolumns/toolkit";
3
3
  import { getCellEffectiveFormat, isAFormula, isNil, log, } from "@rowsncolumns/utils";
4
4
  import { uuid } from "@rowsncolumns/utils";
5
- import { getGeneratedTableCopyName } from "../generated-names";
6
5
  import { defaultCellCoords, defaultSheetId, isStyleReference, SheetCell, } from "../sheet-cell";
7
6
  import { isRichSharedString } from "../types";
8
7
  import { isBoolean, isValidURLorEmail } from "./datatype";
@@ -19,7 +18,7 @@ export var SUPPORTED_IMAGE_TYPES = [
19
18
  "image/webp",
20
19
  "image/x-icon",
21
20
  ];
22
- export var generateDataFromClipboard = function (e, activeCell, sheetId, activeSheetName, preserveFormatting, locale, idCreationStrategy, forcePlainText, sanitizeHtml, generatedNames, options) { return __awaiter(void 0, void 0, void 0, function () {
21
+ export var generateDataFromClipboard = function (e, activeCell, sheetId, activeSheetName, preserveFormatting, locale, idCreationStrategy, forcePlainText, sanitizeHtml, options) { return __awaiter(void 0, void 0, void 0, function () {
23
22
  var items, files, formatOrder, plainTextValue, isFormula, format, rows, filesArray, filesArray_1, filesArray_1_1, file, _a, imageUrl, e_1_1, clipboardValue, sheetCell, clipboard, isPlainTextOnly, _b, parsed, sheetData, tables, cellXfs, parsedSharedStrings, sharedStrings_1, tables_1, tables_1_1, table, rowDelta, colDelta, rowSpan, colSpan, merges_1, cellXfsMap_1, results, itemsArray, itemsArray_1, itemsArray_1_1, item, e_2_1, results, results;
24
23
  var e_1, _c, e_3, _d, e_2, _e;
25
24
  var _f, _g, _h, _j, _k, _l, _m;
@@ -118,7 +117,6 @@ export var generateDataFromClipboard = function (e, activeCell, sheetId, activeS
118
117
  rowSpan = table.range.endRowIndex - table.range.startRowIndex;
119
118
  colSpan = table.range.endColumnIndex - table.range.startColumnIndex;
120
119
  table.id = (_m = idCreationStrategy === null || idCreationStrategy === void 0 ? void 0 : idCreationStrategy("table")) !== null && _m !== void 0 ? _m : uuid();
121
- table.title = getGeneratedTableCopyName(table.title, generatedNames);
122
120
  // Update sheet id
123
121
  table.sheetId = sheetId;
124
122
  table.range.startRowIndex = activeCell.rowIndex + rowDelta;