@svgrid/grid 3.0.2 → 3.0.4

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 (281) hide show
  1. package/README.md +2 -1
  2. package/dist/GridMenus.svelte +44 -2
  3. package/dist/SvChartMenu.svelte +69 -0
  4. package/dist/SvChartMenu.svelte.d.ts +11 -0
  5. package/dist/SvChartPanes.svelte +113 -0
  6. package/dist/SvChartPanes.svelte.d.ts +20 -0
  7. package/dist/SvGrid.controller.svelte.d.ts +110 -39
  8. package/dist/SvGrid.controller.svelte.js +655 -200
  9. package/dist/SvGrid.css +105 -2
  10. package/dist/SvGrid.svelte +386 -514
  11. package/dist/SvGrid.types.d.ts +210 -9
  12. package/dist/SvGridCellEditor.svelte +17 -0
  13. package/dist/SvGridChart.svelte +2257 -329
  14. package/dist/SvGridChart.svelte.d.ts +6 -106
  15. package/dist/SvGridChart.types.d.ts +338 -0
  16. package/dist/SvGridChart.types.js +1 -0
  17. package/dist/SvGridChartBuilder.svelte +323 -0
  18. package/dist/SvGridChartBuilder.svelte.d.ts +34 -0
  19. package/dist/SvGridChartPanel.svelte +221 -275
  20. package/dist/SvGridChartPickers.svelte +417 -0
  21. package/dist/SvGridChartPickers.svelte.d.ts +70 -0
  22. package/dist/SvGridChartView.svelte +13 -14
  23. package/dist/SvModal.svelte +7 -1
  24. package/dist/SvModal.svelte.d.ts +5 -0
  25. package/dist/ai.d.ts +40 -8
  26. package/dist/ai.js +135 -24
  27. package/dist/aria.d.ts +11 -0
  28. package/dist/build-api.js +108 -22
  29. package/dist/cdn/GridMenus-7kbpnnBW.js +635 -0
  30. package/dist/cdn/GridMenus-BL7ZgQvU.js +636 -0
  31. package/dist/cdn/SvChartMenu-Bl6PBbkT.js +58 -0
  32. package/dist/cdn/SvChartMenu-FBSMINA6.js +59 -0
  33. package/dist/cdn/{SvDateRangeInput-DMLKmGEc.js → SvDateRangeInput-BeU_TkbQ.js} +15 -14
  34. package/dist/cdn/{SvDateRangeInput-CaOuMs8O.js → SvDateRangeInput-yX8vzleW.js} +38 -37
  35. package/dist/cdn/{SvDateTimePicker-sonaH0oh.js → SvDateTimePicker-DQwt4UAs.js} +139 -180
  36. package/dist/cdn/SvDateTimePicker-vNU6bZ-q.js +775 -0
  37. package/dist/cdn/{SvGridCellEditor-CjEJMJKc.js → SvGridCellEditor-B1p-vCK5.js} +188 -178
  38. package/dist/cdn/{SvGridCellEditor-BWnTi2N7.js → SvGridCellEditor-D_0q4xAu.js} +98 -88
  39. package/dist/cdn/SvGridChart-C3EWAZaM.js +3574 -0
  40. package/dist/cdn/SvGridChart-DzLkSwCH.js +3572 -0
  41. package/dist/cdn/SvGridChartBuilder-BE2T1ykB.js +783 -0
  42. package/dist/cdn/SvGridChartBuilder-CfII62sZ.js +784 -0
  43. package/dist/cdn/SvGridChartPanel-CCX5_Wgd.js +675 -0
  44. package/dist/cdn/SvGridChartPanel-xf4sWVTo.js +699 -0
  45. package/dist/cdn/SvGridChartView-CfuXmY5I.js +48 -0
  46. package/dist/cdn/SvGridChartView-DYwabQWj.js +47 -0
  47. package/dist/cdn/SvMenuList-CLN8OuIK.js +452 -0
  48. package/dist/cdn/SvMenuList-DkGhNKjf.js +451 -0
  49. package/dist/cdn/SvModal-BAE-pjZX.js +396 -0
  50. package/dist/cdn/SvModal-CIZWCcad.js +397 -0
  51. package/dist/cdn/chart-Dz7SqMXH.js +4341 -0
  52. package/dist/cdn/chart-export-BXqueeWJ.js +135 -0
  53. package/dist/cdn/chart-export-pdf-DONFUnNY.js +110 -0
  54. package/dist/cdn/chart-panel-messages-CUbf2R4i.js +1052 -0
  55. package/dist/cdn/chart-panel-messages-CmNrMdsr.js +1053 -0
  56. package/dist/cdn/chart-summary-BJW_tg_X.js +138 -0
  57. package/dist/cdn/chart-trend-CaN9mDEV.js +50 -0
  58. package/dist/cdn/chart-validate-HcOVFAfJ.js +188 -0
  59. package/dist/cdn/{column-resize-DsfNXMom.js → column-resize-DpmOLfRp.js} +3 -3
  60. package/dist/cdn/{date-format-BnnHlqGw.js → date-format-CtquV-p3.js} +583 -603
  61. package/dist/cdn/{date-format-BNii4zeD.js → date-format-D6KFzU_W.js} +347 -367
  62. package/dist/cdn/dismissable-DAHetSNk.js +44 -0
  63. package/dist/cdn/editor-contract-LXgQJAgd.js +22 -0
  64. package/dist/cdn/focus-trap-BBOQYBma.js +65 -0
  65. package/dist/cdn/{row-resize-BRcimkUT.js → row-resize-niQCp040.js} +44 -36
  66. package/dist/cdn/{src-DNbz94Ct.js → src-BKhZ6eXd.js} +10227 -9787
  67. package/dist/cdn/{src-BJ2opd0j.js → src-V1uu8iE9.js} +6568 -6128
  68. package/dist/cdn/svgrid.js +26 -15
  69. package/dist/cdn/svgrid.svelte-external.js +26 -15
  70. package/dist/chart-axes.d.ts +53 -0
  71. package/dist/chart-axes.js +351 -0
  72. package/dist/chart-cartesian.d.ts +88 -0
  73. package/dist/chart-cartesian.js +1862 -0
  74. package/dist/chart-decimate.d.ts +51 -0
  75. package/dist/chart-decimate.js +199 -0
  76. package/dist/chart-export-pdf.d.ts +47 -0
  77. package/dist/chart-export-pdf.js +187 -0
  78. package/dist/chart-export.d.ts +2 -1
  79. package/dist/chart-export.js +18 -3
  80. package/dist/chart-financial.d.ts +91 -0
  81. package/dist/chart-financial.js +175 -0
  82. package/dist/chart-flow.d.ts +10 -0
  83. package/dist/chart-flow.js +298 -0
  84. package/dist/chart-format.d.ts +18 -0
  85. package/dist/chart-format.js +65 -0
  86. package/dist/chart-grid.d.ts +8 -0
  87. package/dist/chart-grid.js +190 -0
  88. package/dist/chart-hierarchy.d.ts +17 -0
  89. package/dist/chart-hierarchy.js +146 -0
  90. package/dist/chart-indicators.d.ts +115 -0
  91. package/dist/chart-indicators.js +389 -0
  92. package/dist/chart-messages.d.ts +95 -0
  93. package/dist/chart-messages.js +92 -0
  94. package/dist/chart-motion.d.ts +16 -0
  95. package/dist/chart-motion.js +141 -0
  96. package/dist/chart-panel-messages.d.ts +265 -0
  97. package/dist/chart-panel-messages.js +285 -0
  98. package/dist/chart-pivot.d.ts +87 -0
  99. package/dist/chart-pivot.js +156 -0
  100. package/dist/chart-polar.d.ts +25 -0
  101. package/dist/chart-polar.js +700 -0
  102. package/dist/chart-samples.d.ts +16 -0
  103. package/dist/chart-samples.js +153 -0
  104. package/dist/chart-scale.d.ts +113 -0
  105. package/dist/chart-scale.js +405 -0
  106. package/dist/chart-stats.d.ts +111 -0
  107. package/dist/chart-stats.js +419 -0
  108. package/dist/chart-stream.d.ts +45 -0
  109. package/dist/chart-stream.js +91 -0
  110. package/dist/chart-summary.d.ts +27 -0
  111. package/dist/chart-summary.js +205 -0
  112. package/dist/chart-sync.svelte.d.ts +32 -0
  113. package/dist/chart-sync.svelte.js +23 -0
  114. package/dist/chart-table.d.ts +35 -0
  115. package/dist/chart-table.js +165 -0
  116. package/dist/chart-trend.d.ts +19 -0
  117. package/dist/chart-trend.js +61 -0
  118. package/dist/chart-types.d.ts +1456 -0
  119. package/dist/chart-types.js +6 -0
  120. package/dist/chart-validate.d.ts +43 -0
  121. package/dist/chart-validate.js +272 -0
  122. package/dist/chart-zoom.d.ts +40 -0
  123. package/dist/chart-zoom.js +145 -0
  124. package/dist/chart.d.ts +186 -865
  125. package/dist/chart.js +460 -2204
  126. package/dist/clipboard.d.ts +1 -0
  127. package/dist/clipboard.js +137 -18
  128. package/dist/column-resize.d.ts +3 -0
  129. package/dist/column-resize.js +4 -1
  130. package/dist/columns.js +3 -0
  131. package/dist/command-context.d.ts +19 -0
  132. package/dist/command-context.js +116 -0
  133. package/dist/core.d.ts +7 -0
  134. package/dist/createPopoverSelect.svelte.d.ts +2 -2
  135. package/dist/editing.d.ts +2 -8
  136. package/dist/editing.js +262 -33
  137. package/dist/fill-patterns.d.ts +0 -5
  138. package/dist/fill-patterns.js +56 -2
  139. package/dist/grid-messages.d.ts +10 -3
  140. package/dist/grid-messages.js +5 -0
  141. package/dist/history.d.ts +83 -0
  142. package/dist/history.js +133 -0
  143. package/dist/index.d.ts +24 -6
  144. package/dist/index.js +20 -2
  145. package/dist/keyboard-handlers.js +88 -31
  146. package/dist/keyboard.d.ts +55 -0
  147. package/dist/keyboard.js +132 -0
  148. package/dist/menus.d.ts +3 -1
  149. package/dist/menus.js +7 -2
  150. package/dist/merges.d.ts +97 -0
  151. package/dist/merges.js +147 -0
  152. package/dist/row-resize.d.ts +3 -0
  153. package/dist/row-resize.js +14 -0
  154. package/dist/scroll-sync.d.ts +1 -0
  155. package/dist/scroll-sync.js +24 -0
  156. package/dist/selection.d.ts +16 -0
  157. package/dist/selection.js +108 -16
  158. package/dist/shortcut-registry.d.ts +145 -0
  159. package/dist/shortcut-registry.js +44 -0
  160. package/dist/svgrid-wrapper.types.d.ts +213 -22
  161. package/dist/virtualization/virtualizer.js +38 -17
  162. package/package.json +6 -1
  163. package/src/GridMenus.svelte +44 -2
  164. package/src/SvChartMenu.svelte +69 -0
  165. package/src/SvChartPanes.svelte +113 -0
  166. package/src/SvChartPanes.test.ts +66 -0
  167. package/src/SvGrid.controller.svelte.ts +629 -172
  168. package/src/SvGrid.css +105 -2
  169. package/src/SvGrid.svelte +386 -514
  170. package/src/SvGrid.types.ts +188 -8
  171. package/src/SvGridCellEditor.svelte +17 -0
  172. package/src/SvGridChart.svelte +2257 -329
  173. package/src/SvGridChart.test.ts +1419 -1
  174. package/src/SvGridChart.types.ts +336 -0
  175. package/src/SvGridChartBuilder.svelte +323 -0
  176. package/src/SvGridChartPanel.svelte +221 -275
  177. package/src/SvGridChartPickers.svelte +417 -0
  178. package/src/SvGridChartView.svelte +13 -14
  179. package/src/SvModal.svelte +7 -1
  180. package/src/SvModal.test.ts +9 -0
  181. package/src/ai.test.ts +57 -2
  182. package/src/ai.ts +166 -22
  183. package/src/aria.d.ts +11 -0
  184. package/src/build-api.coverage.test.ts +184 -0
  185. package/src/build-api.ts +107 -18
  186. package/src/chart-axes.test.ts +573 -0
  187. package/src/chart-axes.ts +342 -0
  188. package/src/chart-cartesian.ts +1863 -0
  189. package/src/chart-decimate.test.ts +249 -0
  190. package/src/chart-decimate.ts +186 -0
  191. package/src/chart-export-pdf.test.ts +91 -0
  192. package/src/chart-export-pdf.ts +207 -0
  193. package/src/chart-export.test.ts +14 -0
  194. package/src/chart-export.ts +13 -3
  195. package/src/chart-financial.ts +208 -0
  196. package/src/chart-flow.ts +286 -0
  197. package/src/chart-format.ts +67 -0
  198. package/src/chart-grid.ts +179 -0
  199. package/src/chart-hierarchy.ts +135 -0
  200. package/src/chart-indicators.test.ts +443 -0
  201. package/src/chart-indicators.ts +384 -0
  202. package/src/chart-messages.test.ts +21 -0
  203. package/src/chart-messages.ts +184 -0
  204. package/src/chart-motion.test.ts +71 -0
  205. package/src/chart-motion.ts +148 -0
  206. package/src/chart-panel-messages.test.ts +29 -0
  207. package/src/chart-panel-messages.ts +550 -0
  208. package/src/chart-pivot.test.ts +54 -0
  209. package/src/chart-pivot.ts +225 -0
  210. package/src/chart-polar.ts +674 -0
  211. package/src/chart-samples.ts +106 -0
  212. package/src/chart-scale.ts +394 -0
  213. package/src/chart-series-types.test.ts +714 -0
  214. package/src/chart-stats.ts +409 -0
  215. package/src/chart-stream.test.ts +75 -0
  216. package/src/chart-stream.ts +114 -0
  217. package/src/chart-summary.test.ts +90 -0
  218. package/src/chart-summary.ts +197 -0
  219. package/src/chart-sync.svelte.ts +41 -0
  220. package/src/chart-table.test.ts +76 -0
  221. package/src/chart-table.ts +178 -0
  222. package/src/chart-trend.ts +47 -0
  223. package/src/chart-types.ts +1309 -0
  224. package/src/chart-validate.test.ts +100 -0
  225. package/src/chart-validate.ts +247 -0
  226. package/src/chart-zoom.test.ts +137 -0
  227. package/src/chart-zoom.ts +124 -0
  228. package/src/chart.coverage.test.ts +81 -0
  229. package/src/chart.test.ts +56 -3
  230. package/src/chart.ts +557 -2784
  231. package/src/clipboard.test.ts +151 -0
  232. package/src/clipboard.ts +145 -16
  233. package/src/column-resize.ts +7 -1
  234. package/src/columns.ts +2 -0
  235. package/src/command-context.test.ts +200 -0
  236. package/src/command-context.ts +137 -0
  237. package/src/core.ts +7 -0
  238. package/src/editing.test.ts +281 -3
  239. package/src/editing.ts +256 -38
  240. package/src/fill-patterns.test.ts +35 -0
  241. package/src/fill-patterns.ts +56 -2
  242. package/src/grid-messages.ts +16 -3
  243. package/src/history.test.ts +196 -0
  244. package/src/history.ts +162 -0
  245. package/src/icon-seam.test.ts +3 -2
  246. package/src/index.ts +150 -2
  247. package/src/keyboard-handlers.coverage.test.ts +126 -6
  248. package/src/keyboard-handlers.ts +91 -30
  249. package/src/keyboard-shortcuts.seam.test.ts +200 -0
  250. package/src/keyboard.test.ts +124 -1
  251. package/src/keyboard.ts +142 -0
  252. package/src/menus.test.ts +26 -0
  253. package/src/menus.ts +10 -3
  254. package/src/merges.test.ts +112 -0
  255. package/src/merges.ts +168 -0
  256. package/src/pivot.grid.test.ts +40 -5
  257. package/src/row-resize.test.ts +44 -0
  258. package/src/row-resize.ts +17 -0
  259. package/src/scroll-sync.test.ts +42 -1
  260. package/src/scroll-sync.ts +25 -0
  261. package/src/selection.multi-range.test.ts +34 -0
  262. package/src/selection.test.ts +30 -2
  263. package/src/selection.ts +111 -19
  264. package/src/shortcut-registry.test.ts +97 -0
  265. package/src/shortcut-registry.ts +181 -0
  266. package/src/svgrid-wrapper.types.ts +184 -13
  267. package/src/svgrid.behavior.test.ts +135 -0
  268. package/src/svgrid.charting.test.ts +513 -3
  269. package/src/svgrid.context-menu.test.ts +31 -0
  270. package/src/svgrid.new-features.wrapper.test.ts +10 -3
  271. package/src/virtualization/virtualizer.ts +39 -17
  272. package/dist/cdn/GridMenus-DyFA-QxA.js +0 -602
  273. package/dist/cdn/GridMenus-M2XP9t0_.js +0 -603
  274. package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +0 -816
  275. package/dist/cdn/SvGridChart-DAb9RbRs.js +0 -1480
  276. package/dist/cdn/SvGridChart-Yl-IXZFO.js +0 -1481
  277. package/dist/cdn/SvGridChartPanel-DayQpDsR.js +0 -834
  278. package/dist/cdn/SvGridChartPanel-aqf8n-vJ.js +0 -810
  279. package/dist/cdn/SvGridChartView-CxfakxR0.js +0 -56
  280. package/dist/cdn/SvGridChartView-Dm_YEx9L.js +0 -55
  281. package/dist/cdn/chart-CKJRCPOk.js +0 -1652
@@ -3,6 +3,7 @@ import type { CellEditorType, ColumnDef, RowData, SvGridApi, TableFeatures } fro
3
3
  import type { ConditionalFormat } from "./conditional-formatting.js";
4
4
  import type { GroupDisplayType } from "./group-display.js";
5
5
  import type { GridMessages } from "./grid-messages.js";
6
+ import type { ChartMessages } from "./chart-messages.js";
6
7
  import type { GridIconName, GridIcons } from "./grid-icons.js";
7
8
  import type { GridPivotConfig } from "./pivot-view.svelte.js";
8
9
  import type { GridPredicateExpr } from "./filtering/predicate-expr.js";
@@ -52,7 +53,18 @@ export type SchedulerResource = {
52
53
  }>;
53
54
  }>;
54
55
  };
55
- import type { ChartType, ChartSpec, ChartAnnotation, ChartReferenceLine, ChartValueFormat } from "./chart.js";
56
+ import type { ChartType, ChartSpec, ChartAnnotation, ChartReducer, ChartReferenceLine, ChartValueFormat } from "./chart.js";
57
+ import type { ChartRangePreset } from "./chart-zoom.js";
58
+ import type { ChartAnimateConfig, ChartContextTarget, ChartZoomConfig } from "./SvGridChart.types.js";
59
+ /** What the chart panel's lifecycle events carry. */
60
+ export type ChartPanelInfo = {
61
+ /** Tab index in the panel's strip. */
62
+ index: number;
63
+ title: string;
64
+ type: ChartType;
65
+ /** The spec the panel is rendering, or null while it cannot build one. */
66
+ spec: ChartSpec | null;
67
+ };
56
68
  /** One aggregated bucket returned by a server-side `getAggregate`. */
57
69
  export type ChartAggregateBucket = {
58
70
  category: string;
@@ -64,7 +76,7 @@ export type ChartAggregateRequest = {
64
76
  dimension: string | undefined;
65
77
  measure: string | null;
66
78
  series?: string;
67
- reduce: "sum" | "avg" | "count";
79
+ reduce: ChartReducer;
68
80
  filterModel: Record<string, unknown>;
69
81
  };
70
82
  /**
@@ -91,7 +103,7 @@ export type ChartingConfig<TData extends RowData = RowData> = {
91
103
  series?: string;
92
104
  /** Measure column, or several for a multi-series chart. */
93
105
  measures?: string | string[];
94
- reduce?: "sum" | "avg" | "count";
106
+ reduce?: ChartReducer;
95
107
  stacked?: boolean;
96
108
  stacked100?: boolean;
97
109
  /** Per-series-label type override (combo). */
@@ -100,7 +112,10 @@ export type ChartingConfig<TData extends RowData = RowData> = {
100
112
  seriesAxes?: Record<string, "left" | "right">;
101
113
  referenceLines?: ChartReferenceLine[];
102
114
  averageLine?: boolean;
103
- trend?: "sma" | "ema" | "linear";
115
+ /** An overlay on every series: a 7-point moving average, or a regression
116
+ * (`linear`, `poly` for a quadratic, `exp`, `log`, `power`) whose
117
+ * R-squared the tooltip reads. */
118
+ trend?: "sma" | "ema" | "linear" | "poly" | "exp" | "log" | "power";
104
119
  annotations?: ChartAnnotation[];
105
120
  yScale?: "linear" | "log";
106
121
  timeAxis?: boolean;
@@ -121,10 +136,37 @@ export type ChartingConfig<TData extends RowData = RowData> = {
121
136
  otherLabel?: string;
122
137
  sort?: "value-desc" | "value-asc" | "category" | "none";
123
138
  dataLabels?: boolean;
124
- zoom?: boolean;
139
+ /** Zooming: `true` for drag-to-zoom, or an object choosing wheel, pinch,
140
+ * pan and the axes (see `ChartZoomConfig`). The window survives tab
141
+ * switches and round-trips through `getChartsState`. */
142
+ zoom?: boolean | ChartZoomConfig;
125
143
  brush?: boolean;
144
+ /** Range buttons (1W / 1M / 3M / 6M / YTD / 1Y / All, or your own) when the
145
+ * dimension is a date. */
146
+ rangePresets?: boolean | ChartRangePreset[];
147
+ /** Share crosshair and zoom with other charts on the page (any `SvChart`
148
+ * with the same `syncGroup`). */
149
+ syncGroup?: string;
150
+ /** All chart tabs of this grid share one zoom window: zoom in one tab and
151
+ * the others open at the same range. */
152
+ syncTabs?: boolean;
153
+ /** Right-click menu on the chart: `true` for the built-in items, your own
154
+ * `MenuItem`s appended after them, or a function of the clicked point. */
155
+ contextMenu?: boolean | MenuItem[] | ((target: ChartContextTarget) => MenuItem[]);
156
+ /** Motion: `true` for the default data-update tween, or an object choosing
157
+ * the enter effect and duration. */
158
+ animate?: boolean | ChartAnimateConfig;
159
+ /** Translations for the chart's own strings (toolbar, menu, legend hints,
160
+ * what it says to assistive technology); the panel passes them to every
161
+ * chart it draws. See `ChartMessages`. */
162
+ localeText?: Partial<ChartMessages>;
126
163
  /** Show the chart's PNG/SVG export toolbar. */
127
164
  export?: boolean;
165
+ /** A chart tab was added (the first one counts, once the panel opens). */
166
+ onChartCreated?: (info: ChartPanelInfo) => void;
167
+ /** The active chart's spec changed: a picker, the builder, a filter, an
168
+ * edit, new rows. Debounced to one call per burst of changes. */
169
+ onChartChanged?: (info: ChartPanelInfo) => void;
128
170
  /** Escape hatch: build a fully custom ChartSpec from the (scoped) rows. */
129
171
  buildSpec?: (rows: TData[]) => ChartSpec | null;
130
172
  /** Server-side aggregation: chart the whole dataset, not just loaded rows. */
@@ -189,15 +231,44 @@ export type ContextMenuTarget<TData extends RowData = RowData> = {
189
231
  * "chart"`. The `"chart"` item (chart the selected range) is only shown when
190
232
  * `charting` is enabled; it is appended to the default menu automatically.
191
233
  */
234
+ /**
235
+ * An icon of your own for a context-menu item: path data on a 16 x 16 grid,
236
+ * drawn in the text colour with a 1.4px round stroke (`fill` for a solid
237
+ * part, `width` and `dash` to vary the stroke). The same shape a
238
+ * spreadsheet ribbon's icon set uses, so one set serves both.
239
+ */
240
+ export type ContextMenuIcon = {
241
+ paths: ReadonlyArray<{
242
+ d: string;
243
+ fill?: boolean;
244
+ width?: number;
245
+ dash?: string;
246
+ }>;
247
+ };
192
248
  export type ContextMenuItem<TData extends RowData = RowData> = string | {
193
249
  key: string;
194
- label: string;
250
+ /**
251
+ * The text. An object whose `key` names a built-in (`copy`, `cut`,
252
+ * `paste`, `clear`, `row_above`, `row_below`, `remove_row`,
253
+ * `remove_col`, `comment`, `chart`) keeps the built-in's own label
254
+ * when this is omitted.
255
+ */
256
+ label?: string;
257
+ /**
258
+ * A glyph before the label: one of the grid's icons by name, or path
259
+ * data of your own. Items without one keep the gutter, so the labels
260
+ * line up.
261
+ */
262
+ icon?: GridIconName | ContextMenuIcon;
195
263
  /** Hide the item entirely for this target. */
196
264
  hidden?: (target: ContextMenuTarget<TData>) => boolean;
197
265
  /** Render the item greyed-out and non-clickable for this target. */
198
266
  disabled?: (target: ContextMenuTarget<TData>) => boolean;
199
- /** Invoked on click. The menu closes afterwards. */
200
- action: (target: ContextMenuTarget<TData>) => void;
267
+ /**
268
+ * Invoked on click. The menu closes afterwards. Omit it on a built-in
269
+ * key to keep what the built-in does and only give it an icon.
270
+ */
271
+ action?: (target: ContextMenuTarget<TData>) => void;
201
272
  };
202
273
  /** What a {@link SelectionBarAction} is handed when it runs. */
203
274
  export type SelectionBarTarget<TData extends RowData = RowData> = {
@@ -377,7 +448,7 @@ export type ChartViewConfig<TFeatures extends TableFeatures = TableFeatures, TDa
377
448
  /** Pivot dimension: one series per distinct value of this field. */
378
449
  series?: keyof TData & string;
379
450
  /** Aggregation when several rows share a category. Default `'sum'`. */
380
- reduce?: "sum" | "avg" | "count";
451
+ reduce?: ChartReducer;
381
452
  /** Stack bar / area series instead of grouping them. */
382
453
  stacked?: boolean;
383
454
  /** Stack to 100% (implies `stacked`). */
@@ -1516,6 +1587,23 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
1516
1587
  * that leaves this off never fetches that code.
1517
1588
  */
1518
1589
  columnResize?: boolean;
1590
+ /**
1591
+ * The user dragged a column's edge (or double-clicked it to autosize).
1592
+ * Programmatic `api.setColumnWidth` does not fire it.
1593
+ */
1594
+ onColumnResize?: (event: {
1595
+ columnId: string;
1596
+ width: number;
1597
+ }) => void;
1598
+ /**
1599
+ * The user dragged a row's edge, or double-clicked it: `height` is then
1600
+ * `null`, the row back at its declared height. Programmatic
1601
+ * `api.setRowHeight` does not fire it.
1602
+ */
1603
+ onRowResize?: (event: {
1604
+ rowIndex: number;
1605
+ height: number | null;
1606
+ }) => void;
1519
1607
  /**
1520
1608
  * Make the grid usable on narrow screens. When the grid's own width drops
1521
1609
  * below the breakpoint (default `640`px), pinned columns are un-pinned so the
@@ -1580,6 +1668,25 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
1580
1668
  * currency symbols, expand codes to labels, or redact. Receives the display
1581
1669
  * value plus the row/column context; return the string (or value) to copy.
1582
1670
  */
1671
+ /**
1672
+ * Decide what the fill handle writes into one cell, ahead of the grid's
1673
+ * own pattern rules (series, weekdays, "Item 1"). Receives the source
1674
+ * cell's value and how far the target sits from it; return the value to
1675
+ * write, or `undefined` to let the pattern decide. A spreadsheet uses it
1676
+ * to move a formula's references by the distance filled, which the
1677
+ * pattern rules would otherwise mangle ("=A1+B1" reads as "Item 1").
1678
+ */
1679
+ processCellForFill?: (params: {
1680
+ /** The source cell's value the target cycles back to. */
1681
+ value: unknown;
1682
+ /** Rows and columns from that source cell to the target. */
1683
+ delta: {
1684
+ rows: number;
1685
+ cols: number;
1686
+ };
1687
+ rowIndex: number;
1688
+ columnId: string;
1689
+ }) => unknown;
1583
1690
  processCellForClipboard?: (params: {
1584
1691
  value: unknown;
1585
1692
  column: unknown;
@@ -1587,6 +1694,65 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
1587
1694
  rowIndex: number;
1588
1695
  columnId: string;
1589
1696
  }) => unknown;
1697
+ /**
1698
+ * An HTML rendering of what Ctrl+C copies, written to the clipboard as
1699
+ * `text/html` beside the TSV. Excel and Google Sheets read the HTML
1700
+ * first, so a table with inline styles pastes into them with its formats,
1701
+ * and the same markup can carry what the text cannot (a formula in a
1702
+ * `data-` attribute) for a round trip back into a grid that reads it.
1703
+ * Called after every cell has been through `processCellForClipboard`,
1704
+ * with the rectangles copied and the text about to be written. Return
1705
+ * nothing to write text alone. Runs synchronously inside the key press,
1706
+ * which is what the clipboard needs.
1707
+ */
1708
+ clipboardHtml?: (params: {
1709
+ rects: ReadonlyArray<{
1710
+ minRow: number;
1711
+ maxRow: number;
1712
+ minCol: number;
1713
+ maxCol: number;
1714
+ }>;
1715
+ text: string;
1716
+ }) => string | null | undefined;
1717
+ /**
1718
+ * Take over a paste. Receives the clipboard's `text/plain` and, when the
1719
+ * source put one there, its `text/html` (Excel's carries formats and
1720
+ * formulas; a grid's own `clipboardHtml` carries whatever it chose to).
1721
+ * Return `true` to say the paste was applied; anything else lets the grid
1722
+ * paste the text as it always has. Runs inside one history group, so
1723
+ * every `setCellValue` and `recordUndo` the handler makes is one Ctrl+Z.
1724
+ *
1725
+ * With this set, Ctrl+V lets the browser's own `paste` event through
1726
+ * (that is where the unsanitised HTML is), and the async Clipboard API is
1727
+ * the fallback for a browser that does not deliver it. `source` says
1728
+ * which path the payload came by.
1729
+ */
1730
+ onPasteClipboard?: (payload: {
1731
+ text: string;
1732
+ html: string | null;
1733
+ source: "event" | "async";
1734
+ }) => boolean | void;
1735
+ /**
1736
+ * Transform each cell on its way IN from the clipboard, before the grid
1737
+ * coerces it for the column's editor. Symmetric with
1738
+ * `processCellForClipboard`: the pair is what lets a round trip survive.
1739
+ *
1740
+ * Receives the raw clipboard text for the cell plus where it is landing.
1741
+ * Return the value to write, or `undefined` to leave the cell untouched.
1742
+ *
1743
+ * This is also the seam a feature pack uses to take over a paste entirely:
1744
+ * `@svgrid/enterprise`'s paste-special reads the clipboard's `text/html`
1745
+ * for formats and formulas and writes through here.
1746
+ */
1747
+ processCellFromClipboard?: (params: {
1748
+ /** The raw text from the clipboard for this cell. */
1749
+ text: string;
1750
+ /** What the grid would have written after its own coercion. */
1751
+ parsedValue: unknown;
1752
+ row: TData;
1753
+ rowIndex: number;
1754
+ columnId: string;
1755
+ }) => unknown;
1590
1756
  /**
1591
1757
  * Inline cell editing: F2 or double-click opens an editor in the active cell,
1592
1758
  * Enter commits, Esc cancels. Off by default.
@@ -1596,6 +1762,14 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
1596
1762
  * `editable` is the shortcut alias and wins over this.
1597
1763
  */
1598
1764
  enableInlineEditing?: boolean;
1765
+ /**
1766
+ * A click on the cell that is already active opens its editor, the way a
1767
+ * second click on a selected file name starts renaming it. On by default.
1768
+ * A spreadsheet turns it off: Excel edits on double-click or F2 only, and
1769
+ * a user clicking the cell they are on to get back to it after a dialog
1770
+ * would otherwise find the next shortcut typed into an editor.
1771
+ */
1772
+ editOnSecondClick?: boolean;
1599
1773
  /**
1600
1774
  * Full-row editing. When `true`, starting an edit puts the WHOLE row into
1601
1775
  * edit mode - every editable cell shows an inline editor at once - and a
@@ -1957,6 +2131,33 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
1957
2131
  * main grid; field/format/cell/cellClass all apply.
1958
2132
  */
1959
2133
  pinnedTopRows?: ReadonlyArray<TData>;
2134
+ /**
2135
+ * Freeze the first N rows: they stay under the header while the body
2136
+ * scrolls, and unlike `pinnedTopRows` they are the grid's own rows,
2137
+ * still editable, selectable and numbered as rows 1..N. Excel's Freeze
2138
+ * Panes, for the row half; the column half is `columnPinning`. Under
2139
+ * `virtualization` the frozen rows are always rendered and the window
2140
+ * skips them.
2141
+ */
2142
+ frozenRows?: number;
2143
+ /**
2144
+ * Merged cells: rectangles drawn as one cell, a spreadsheet's Merge &
2145
+ * Center. Each entry is the top-left cell (display indices) and how many
2146
+ * rows and columns it covers. The origin's td takes the span and shows
2147
+ * the origin's value; the covered cells are not drawn, a selection grows
2148
+ * to whole merges, the active cell inside a merge is its origin, and the
2149
+ * arrow keys step over a merge as one cell. A merge that crosses the
2150
+ * frozen boundary or the rendered window is drawn in parts, one per
2151
+ * band. The grid does not write into covered cells on its own; a
2152
+ * consumer that merges cells keeps them empty or marks them read-only
2153
+ * through the column's `editable`.
2154
+ */
2155
+ mergedCells?: ReadonlyArray<{
2156
+ rowIndex: number;
2157
+ colIndex: number;
2158
+ rowSpan: number;
2159
+ colSpan: number;
2160
+ }>;
1960
2161
  /**
1961
2162
  * Rows to pin to the BOTTOM of the grid - rendered below the regular
1962
2163
  * rows and sticky-positioned (sticks to the bottom of the viewport
@@ -715,6 +715,23 @@
715
715
  {@const _reg = getCellEditor(String(ctrl.editingCell?.editorType))!}
716
716
  {@const CustomCellEditor = _reg.component}
717
717
  <CustomCellEditor {...resolveEditorProps(_reg, buildRegisteredEditorContext())} />
718
+ {:else if (ctrl.editingCell?.editorType ?? "text") === "text" && column?.columnDef.editorMultiline}
719
+ <!-- The text editor with room for line breaks: Alt+Enter inserts one
720
+ (handled in onEditorKeyDown), Enter commits like the input's, and
721
+ the height follows the lines. -->
722
+ <textarea
723
+ use:focusOnMount
724
+ class="sv-grid-cell-editor sv-grid-cell-editor-text sv-grid-cell-editor-multiline"
725
+ rows={Math.max(1, String(ctrl.editingCell?.value ?? "").split("\n").length)}
726
+ value={String(ctrl.editingCell?.value ?? "")}
727
+ oninput={(event) => {
728
+ const area = event.currentTarget as HTMLTextAreaElement;
729
+ area.rows = Math.max(1, area.value.split("\n").length);
730
+ updateEditingCellValue(area.value);
731
+ }}
732
+ onblur={() => saveEditingCell()}
733
+ onkeydown={onEditorKeyDown}
734
+ ></textarea>
718
735
  {:else}
719
736
  {@const editorType = ctrl.editingCell?.editorType ?? "text"}
720
737
  {@const isNumberEditor = getCellEditorInputType(editorType) === "text" &&