@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.
- package/README.md +2 -1
- package/dist/GridMenus.svelte +44 -2
- package/dist/SvChartMenu.svelte +69 -0
- package/dist/SvChartMenu.svelte.d.ts +11 -0
- package/dist/SvChartPanes.svelte +113 -0
- package/dist/SvChartPanes.svelte.d.ts +20 -0
- package/dist/SvGrid.controller.svelte.d.ts +110 -39
- package/dist/SvGrid.controller.svelte.js +655 -200
- package/dist/SvGrid.css +105 -2
- package/dist/SvGrid.svelte +386 -514
- package/dist/SvGrid.types.d.ts +210 -9
- package/dist/SvGridCellEditor.svelte +17 -0
- package/dist/SvGridChart.svelte +2257 -329
- package/dist/SvGridChart.svelte.d.ts +6 -106
- package/dist/SvGridChart.types.d.ts +338 -0
- package/dist/SvGridChart.types.js +1 -0
- package/dist/SvGridChartBuilder.svelte +323 -0
- package/dist/SvGridChartBuilder.svelte.d.ts +34 -0
- package/dist/SvGridChartPanel.svelte +221 -275
- package/dist/SvGridChartPickers.svelte +417 -0
- package/dist/SvGridChartPickers.svelte.d.ts +70 -0
- package/dist/SvGridChartView.svelte +13 -14
- package/dist/SvModal.svelte +7 -1
- package/dist/SvModal.svelte.d.ts +5 -0
- package/dist/ai.d.ts +40 -8
- package/dist/ai.js +135 -24
- package/dist/aria.d.ts +11 -0
- package/dist/build-api.js +108 -22
- package/dist/cdn/GridMenus-7kbpnnBW.js +635 -0
- package/dist/cdn/GridMenus-BL7ZgQvU.js +636 -0
- package/dist/cdn/SvChartMenu-Bl6PBbkT.js +58 -0
- package/dist/cdn/SvChartMenu-FBSMINA6.js +59 -0
- package/dist/cdn/{SvDateRangeInput-DMLKmGEc.js → SvDateRangeInput-BeU_TkbQ.js} +15 -14
- package/dist/cdn/{SvDateRangeInput-CaOuMs8O.js → SvDateRangeInput-yX8vzleW.js} +38 -37
- package/dist/cdn/{SvDateTimePicker-sonaH0oh.js → SvDateTimePicker-DQwt4UAs.js} +139 -180
- package/dist/cdn/SvDateTimePicker-vNU6bZ-q.js +775 -0
- package/dist/cdn/{SvGridCellEditor-CjEJMJKc.js → SvGridCellEditor-B1p-vCK5.js} +188 -178
- package/dist/cdn/{SvGridCellEditor-BWnTi2N7.js → SvGridCellEditor-D_0q4xAu.js} +98 -88
- package/dist/cdn/SvGridChart-C3EWAZaM.js +3574 -0
- package/dist/cdn/SvGridChart-DzLkSwCH.js +3572 -0
- package/dist/cdn/SvGridChartBuilder-BE2T1ykB.js +783 -0
- package/dist/cdn/SvGridChartBuilder-CfII62sZ.js +784 -0
- package/dist/cdn/SvGridChartPanel-CCX5_Wgd.js +675 -0
- package/dist/cdn/SvGridChartPanel-xf4sWVTo.js +699 -0
- package/dist/cdn/SvGridChartView-CfuXmY5I.js +48 -0
- package/dist/cdn/SvGridChartView-DYwabQWj.js +47 -0
- package/dist/cdn/SvMenuList-CLN8OuIK.js +452 -0
- package/dist/cdn/SvMenuList-DkGhNKjf.js +451 -0
- package/dist/cdn/SvModal-BAE-pjZX.js +396 -0
- package/dist/cdn/SvModal-CIZWCcad.js +397 -0
- package/dist/cdn/chart-Dz7SqMXH.js +4341 -0
- package/dist/cdn/chart-export-BXqueeWJ.js +135 -0
- package/dist/cdn/chart-export-pdf-DONFUnNY.js +110 -0
- package/dist/cdn/chart-panel-messages-CUbf2R4i.js +1052 -0
- package/dist/cdn/chart-panel-messages-CmNrMdsr.js +1053 -0
- package/dist/cdn/chart-summary-BJW_tg_X.js +138 -0
- package/dist/cdn/chart-trend-CaN9mDEV.js +50 -0
- package/dist/cdn/chart-validate-HcOVFAfJ.js +188 -0
- package/dist/cdn/{column-resize-DsfNXMom.js → column-resize-DpmOLfRp.js} +3 -3
- package/dist/cdn/{date-format-BnnHlqGw.js → date-format-CtquV-p3.js} +583 -603
- package/dist/cdn/{date-format-BNii4zeD.js → date-format-D6KFzU_W.js} +347 -367
- package/dist/cdn/dismissable-DAHetSNk.js +44 -0
- package/dist/cdn/editor-contract-LXgQJAgd.js +22 -0
- package/dist/cdn/focus-trap-BBOQYBma.js +65 -0
- package/dist/cdn/{row-resize-BRcimkUT.js → row-resize-niQCp040.js} +44 -36
- package/dist/cdn/{src-DNbz94Ct.js → src-BKhZ6eXd.js} +10227 -9787
- package/dist/cdn/{src-BJ2opd0j.js → src-V1uu8iE9.js} +6568 -6128
- package/dist/cdn/svgrid.js +26 -15
- package/dist/cdn/svgrid.svelte-external.js +26 -15
- package/dist/chart-axes.d.ts +53 -0
- package/dist/chart-axes.js +351 -0
- package/dist/chart-cartesian.d.ts +88 -0
- package/dist/chart-cartesian.js +1862 -0
- package/dist/chart-decimate.d.ts +51 -0
- package/dist/chart-decimate.js +199 -0
- package/dist/chart-export-pdf.d.ts +47 -0
- package/dist/chart-export-pdf.js +187 -0
- package/dist/chart-export.d.ts +2 -1
- package/dist/chart-export.js +18 -3
- package/dist/chart-financial.d.ts +91 -0
- package/dist/chart-financial.js +175 -0
- package/dist/chart-flow.d.ts +10 -0
- package/dist/chart-flow.js +298 -0
- package/dist/chart-format.d.ts +18 -0
- package/dist/chart-format.js +65 -0
- package/dist/chart-grid.d.ts +8 -0
- package/dist/chart-grid.js +190 -0
- package/dist/chart-hierarchy.d.ts +17 -0
- package/dist/chart-hierarchy.js +146 -0
- package/dist/chart-indicators.d.ts +115 -0
- package/dist/chart-indicators.js +389 -0
- package/dist/chart-messages.d.ts +95 -0
- package/dist/chart-messages.js +92 -0
- package/dist/chart-motion.d.ts +16 -0
- package/dist/chart-motion.js +141 -0
- package/dist/chart-panel-messages.d.ts +265 -0
- package/dist/chart-panel-messages.js +285 -0
- package/dist/chart-pivot.d.ts +87 -0
- package/dist/chart-pivot.js +156 -0
- package/dist/chart-polar.d.ts +25 -0
- package/dist/chart-polar.js +700 -0
- package/dist/chart-samples.d.ts +16 -0
- package/dist/chart-samples.js +153 -0
- package/dist/chart-scale.d.ts +113 -0
- package/dist/chart-scale.js +405 -0
- package/dist/chart-stats.d.ts +111 -0
- package/dist/chart-stats.js +419 -0
- package/dist/chart-stream.d.ts +45 -0
- package/dist/chart-stream.js +91 -0
- package/dist/chart-summary.d.ts +27 -0
- package/dist/chart-summary.js +205 -0
- package/dist/chart-sync.svelte.d.ts +32 -0
- package/dist/chart-sync.svelte.js +23 -0
- package/dist/chart-table.d.ts +35 -0
- package/dist/chart-table.js +165 -0
- package/dist/chart-trend.d.ts +19 -0
- package/dist/chart-trend.js +61 -0
- package/dist/chart-types.d.ts +1456 -0
- package/dist/chart-types.js +6 -0
- package/dist/chart-validate.d.ts +43 -0
- package/dist/chart-validate.js +272 -0
- package/dist/chart-zoom.d.ts +40 -0
- package/dist/chart-zoom.js +145 -0
- package/dist/chart.d.ts +186 -865
- package/dist/chart.js +460 -2204
- package/dist/clipboard.d.ts +1 -0
- package/dist/clipboard.js +137 -18
- package/dist/column-resize.d.ts +3 -0
- package/dist/column-resize.js +4 -1
- package/dist/columns.js +3 -0
- package/dist/command-context.d.ts +19 -0
- package/dist/command-context.js +116 -0
- package/dist/core.d.ts +7 -0
- package/dist/createPopoverSelect.svelte.d.ts +2 -2
- package/dist/editing.d.ts +2 -8
- package/dist/editing.js +262 -33
- package/dist/fill-patterns.d.ts +0 -5
- package/dist/fill-patterns.js +56 -2
- package/dist/grid-messages.d.ts +10 -3
- package/dist/grid-messages.js +5 -0
- package/dist/history.d.ts +83 -0
- package/dist/history.js +133 -0
- package/dist/index.d.ts +24 -6
- package/dist/index.js +20 -2
- package/dist/keyboard-handlers.js +88 -31
- package/dist/keyboard.d.ts +55 -0
- package/dist/keyboard.js +132 -0
- package/dist/menus.d.ts +3 -1
- package/dist/menus.js +7 -2
- package/dist/merges.d.ts +97 -0
- package/dist/merges.js +147 -0
- package/dist/row-resize.d.ts +3 -0
- package/dist/row-resize.js +14 -0
- package/dist/scroll-sync.d.ts +1 -0
- package/dist/scroll-sync.js +24 -0
- package/dist/selection.d.ts +16 -0
- package/dist/selection.js +108 -16
- package/dist/shortcut-registry.d.ts +145 -0
- package/dist/shortcut-registry.js +44 -0
- package/dist/svgrid-wrapper.types.d.ts +213 -22
- package/dist/virtualization/virtualizer.js +38 -17
- package/package.json +6 -1
- package/src/GridMenus.svelte +44 -2
- package/src/SvChartMenu.svelte +69 -0
- package/src/SvChartPanes.svelte +113 -0
- package/src/SvChartPanes.test.ts +66 -0
- package/src/SvGrid.controller.svelte.ts +629 -172
- package/src/SvGrid.css +105 -2
- package/src/SvGrid.svelte +386 -514
- package/src/SvGrid.types.ts +188 -8
- package/src/SvGridCellEditor.svelte +17 -0
- package/src/SvGridChart.svelte +2257 -329
- package/src/SvGridChart.test.ts +1419 -1
- package/src/SvGridChart.types.ts +336 -0
- package/src/SvGridChartBuilder.svelte +323 -0
- package/src/SvGridChartPanel.svelte +221 -275
- package/src/SvGridChartPickers.svelte +417 -0
- package/src/SvGridChartView.svelte +13 -14
- package/src/SvModal.svelte +7 -1
- package/src/SvModal.test.ts +9 -0
- package/src/ai.test.ts +57 -2
- package/src/ai.ts +166 -22
- package/src/aria.d.ts +11 -0
- package/src/build-api.coverage.test.ts +184 -0
- package/src/build-api.ts +107 -18
- package/src/chart-axes.test.ts +573 -0
- package/src/chart-axes.ts +342 -0
- package/src/chart-cartesian.ts +1863 -0
- package/src/chart-decimate.test.ts +249 -0
- package/src/chart-decimate.ts +186 -0
- package/src/chart-export-pdf.test.ts +91 -0
- package/src/chart-export-pdf.ts +207 -0
- package/src/chart-export.test.ts +14 -0
- package/src/chart-export.ts +13 -3
- package/src/chart-financial.ts +208 -0
- package/src/chart-flow.ts +286 -0
- package/src/chart-format.ts +67 -0
- package/src/chart-grid.ts +179 -0
- package/src/chart-hierarchy.ts +135 -0
- package/src/chart-indicators.test.ts +443 -0
- package/src/chart-indicators.ts +384 -0
- package/src/chart-messages.test.ts +21 -0
- package/src/chart-messages.ts +184 -0
- package/src/chart-motion.test.ts +71 -0
- package/src/chart-motion.ts +148 -0
- package/src/chart-panel-messages.test.ts +29 -0
- package/src/chart-panel-messages.ts +550 -0
- package/src/chart-pivot.test.ts +54 -0
- package/src/chart-pivot.ts +225 -0
- package/src/chart-polar.ts +674 -0
- package/src/chart-samples.ts +106 -0
- package/src/chart-scale.ts +394 -0
- package/src/chart-series-types.test.ts +714 -0
- package/src/chart-stats.ts +409 -0
- package/src/chart-stream.test.ts +75 -0
- package/src/chart-stream.ts +114 -0
- package/src/chart-summary.test.ts +90 -0
- package/src/chart-summary.ts +197 -0
- package/src/chart-sync.svelte.ts +41 -0
- package/src/chart-table.test.ts +76 -0
- package/src/chart-table.ts +178 -0
- package/src/chart-trend.ts +47 -0
- package/src/chart-types.ts +1309 -0
- package/src/chart-validate.test.ts +100 -0
- package/src/chart-validate.ts +247 -0
- package/src/chart-zoom.test.ts +137 -0
- package/src/chart-zoom.ts +124 -0
- package/src/chart.coverage.test.ts +81 -0
- package/src/chart.test.ts +56 -3
- package/src/chart.ts +557 -2784
- package/src/clipboard.test.ts +151 -0
- package/src/clipboard.ts +145 -16
- package/src/column-resize.ts +7 -1
- package/src/columns.ts +2 -0
- package/src/command-context.test.ts +200 -0
- package/src/command-context.ts +137 -0
- package/src/core.ts +7 -0
- package/src/editing.test.ts +281 -3
- package/src/editing.ts +256 -38
- package/src/fill-patterns.test.ts +35 -0
- package/src/fill-patterns.ts +56 -2
- package/src/grid-messages.ts +16 -3
- package/src/history.test.ts +196 -0
- package/src/history.ts +162 -0
- package/src/icon-seam.test.ts +3 -2
- package/src/index.ts +150 -2
- package/src/keyboard-handlers.coverage.test.ts +126 -6
- package/src/keyboard-handlers.ts +91 -30
- package/src/keyboard-shortcuts.seam.test.ts +200 -0
- package/src/keyboard.test.ts +124 -1
- package/src/keyboard.ts +142 -0
- package/src/menus.test.ts +26 -0
- package/src/menus.ts +10 -3
- package/src/merges.test.ts +112 -0
- package/src/merges.ts +168 -0
- package/src/pivot.grid.test.ts +40 -5
- package/src/row-resize.test.ts +44 -0
- package/src/row-resize.ts +17 -0
- package/src/scroll-sync.test.ts +42 -1
- package/src/scroll-sync.ts +25 -0
- package/src/selection.multi-range.test.ts +34 -0
- package/src/selection.test.ts +30 -2
- package/src/selection.ts +111 -19
- package/src/shortcut-registry.test.ts +97 -0
- package/src/shortcut-registry.ts +181 -0
- package/src/svgrid-wrapper.types.ts +184 -13
- package/src/svgrid.behavior.test.ts +135 -0
- package/src/svgrid.charting.test.ts +513 -3
- package/src/svgrid.context-menu.test.ts +31 -0
- package/src/svgrid.new-features.wrapper.test.ts +10 -3
- package/src/virtualization/virtualizer.ts +39 -17
- package/dist/cdn/GridMenus-DyFA-QxA.js +0 -602
- package/dist/cdn/GridMenus-M2XP9t0_.js +0 -603
- package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +0 -816
- package/dist/cdn/SvGridChart-DAb9RbRs.js +0 -1480
- package/dist/cdn/SvGridChart-Yl-IXZFO.js +0 -1481
- package/dist/cdn/SvGridChartPanel-DayQpDsR.js +0 -834
- package/dist/cdn/SvGridChartPanel-aqf8n-vJ.js +0 -810
- package/dist/cdn/SvGridChartView-CxfakxR0.js +0 -56
- package/dist/cdn/SvGridChartView-Dm_YEx9L.js +0 -55
- package/dist/cdn/chart-CKJRCPOk.js +0 -1652
package/src/SvGrid.types.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import type { ConditionalFormat } from "./conditional-formatting";
|
|
12
12
|
import type { GroupDisplayType } from "./group-display";
|
|
13
13
|
import type { GridMessages } from "./grid-messages";
|
|
14
|
+
import type { ChartMessages } from "./chart-messages";
|
|
14
15
|
import type { GridIconName, GridIcons } from "./grid-icons";
|
|
15
16
|
import type { GridPivotConfig } from "./pivot-view.svelte";
|
|
16
17
|
import type { GridPredicateExpr } from "./filtering/predicate-expr";
|
|
@@ -68,9 +69,22 @@ import type {
|
|
|
68
69
|
ChartType,
|
|
69
70
|
ChartSpec,
|
|
70
71
|
ChartAnnotation,
|
|
72
|
+
ChartReducer,
|
|
71
73
|
ChartReferenceLine,
|
|
72
74
|
ChartValueFormat,
|
|
73
75
|
} from "./chart";
|
|
76
|
+
import type { ChartRangePreset } from "./chart-zoom";
|
|
77
|
+
import type { ChartAnimateConfig, ChartContextTarget, ChartZoomConfig } from "./SvGridChart.types";
|
|
78
|
+
|
|
79
|
+
/** What the chart panel's lifecycle events carry. */
|
|
80
|
+
export type ChartPanelInfo = {
|
|
81
|
+
/** Tab index in the panel's strip. */
|
|
82
|
+
index: number;
|
|
83
|
+
title: string;
|
|
84
|
+
type: ChartType;
|
|
85
|
+
/** The spec the panel is rendering, or null while it cannot build one. */
|
|
86
|
+
spec: ChartSpec | null;
|
|
87
|
+
};
|
|
74
88
|
|
|
75
89
|
/** One aggregated bucket returned by a server-side `getAggregate`. */
|
|
76
90
|
export type ChartAggregateBucket = { category: string; series?: string; value: number };
|
|
@@ -79,7 +93,7 @@ export type ChartAggregateRequest = {
|
|
|
79
93
|
dimension: string | undefined;
|
|
80
94
|
measure: string | null;
|
|
81
95
|
series?: string;
|
|
82
|
-
reduce:
|
|
96
|
+
reduce: ChartReducer;
|
|
83
97
|
filterModel: Record<string, unknown>;
|
|
84
98
|
};
|
|
85
99
|
|
|
@@ -107,7 +121,7 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
107
121
|
series?: string;
|
|
108
122
|
/** Measure column, or several for a multi-series chart. */
|
|
109
123
|
measures?: string | string[];
|
|
110
|
-
reduce?:
|
|
124
|
+
reduce?: ChartReducer;
|
|
111
125
|
stacked?: boolean;
|
|
112
126
|
stacked100?: boolean;
|
|
113
127
|
/** Per-series-label type override (combo). */
|
|
@@ -116,7 +130,10 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
116
130
|
seriesAxes?: Record<string, "left" | "right">;
|
|
117
131
|
referenceLines?: ChartReferenceLine[];
|
|
118
132
|
averageLine?: boolean;
|
|
119
|
-
|
|
133
|
+
/** An overlay on every series: a 7-point moving average, or a regression
|
|
134
|
+
* (`linear`, `poly` for a quadratic, `exp`, `log`, `power`) whose
|
|
135
|
+
* R-squared the tooltip reads. */
|
|
136
|
+
trend?: "sma" | "ema" | "linear" | "poly" | "exp" | "log" | "power";
|
|
120
137
|
annotations?: ChartAnnotation[];
|
|
121
138
|
yScale?: "linear" | "log";
|
|
122
139
|
timeAxis?: boolean;
|
|
@@ -137,10 +154,37 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
137
154
|
otherLabel?: string;
|
|
138
155
|
sort?: "value-desc" | "value-asc" | "category" | "none";
|
|
139
156
|
dataLabels?: boolean;
|
|
140
|
-
zoom
|
|
157
|
+
/** Zooming: `true` for drag-to-zoom, or an object choosing wheel, pinch,
|
|
158
|
+
* pan and the axes (see `ChartZoomConfig`). The window survives tab
|
|
159
|
+
* switches and round-trips through `getChartsState`. */
|
|
160
|
+
zoom?: boolean | ChartZoomConfig;
|
|
141
161
|
brush?: boolean;
|
|
162
|
+
/** Range buttons (1W / 1M / 3M / 6M / YTD / 1Y / All, or your own) when the
|
|
163
|
+
* dimension is a date. */
|
|
164
|
+
rangePresets?: boolean | ChartRangePreset[];
|
|
165
|
+
/** Share crosshair and zoom with other charts on the page (any `SvChart`
|
|
166
|
+
* with the same `syncGroup`). */
|
|
167
|
+
syncGroup?: string;
|
|
168
|
+
/** All chart tabs of this grid share one zoom window: zoom in one tab and
|
|
169
|
+
* the others open at the same range. */
|
|
170
|
+
syncTabs?: boolean;
|
|
171
|
+
/** Right-click menu on the chart: `true` for the built-in items, your own
|
|
172
|
+
* `MenuItem`s appended after them, or a function of the clicked point. */
|
|
173
|
+
contextMenu?: boolean | MenuItem[] | ((target: ChartContextTarget) => MenuItem[]);
|
|
174
|
+
/** Motion: `true` for the default data-update tween, or an object choosing
|
|
175
|
+
* the enter effect and duration. */
|
|
176
|
+
animate?: boolean | ChartAnimateConfig;
|
|
177
|
+
/** Translations for the chart's own strings (toolbar, menu, legend hints,
|
|
178
|
+
* what it says to assistive technology); the panel passes them to every
|
|
179
|
+
* chart it draws. See `ChartMessages`. */
|
|
180
|
+
localeText?: Partial<ChartMessages>;
|
|
142
181
|
/** Show the chart's PNG/SVG export toolbar. */
|
|
143
182
|
export?: boolean;
|
|
183
|
+
/** A chart tab was added (the first one counts, once the panel opens). */
|
|
184
|
+
onChartCreated?: (info: ChartPanelInfo) => void;
|
|
185
|
+
/** The active chart's spec changed: a picker, the builder, a filter, an
|
|
186
|
+
* edit, new rows. Debounced to one call per burst of changes. */
|
|
187
|
+
onChartChanged?: (info: ChartPanelInfo) => void;
|
|
144
188
|
/** Escape hatch: build a fully custom ChartSpec from the (scoped) rows. */
|
|
145
189
|
buildSpec?: (rows: TData[]) => ChartSpec | null;
|
|
146
190
|
/** Server-side aggregation: chart the whole dataset, not just loaded rows. */
|
|
@@ -212,17 +256,42 @@ export type ContextMenuTarget<TData extends RowData = RowData> = {
|
|
|
212
256
|
* "chart"`. The `"chart"` item (chart the selected range) is only shown when
|
|
213
257
|
* `charting` is enabled; it is appended to the default menu automatically.
|
|
214
258
|
*/
|
|
259
|
+
/**
|
|
260
|
+
* An icon of your own for a context-menu item: path data on a 16 x 16 grid,
|
|
261
|
+
* drawn in the text colour with a 1.4px round stroke (`fill` for a solid
|
|
262
|
+
* part, `width` and `dash` to vary the stroke). The same shape a
|
|
263
|
+
* spreadsheet ribbon's icon set uses, so one set serves both.
|
|
264
|
+
*/
|
|
265
|
+
export type ContextMenuIcon = {
|
|
266
|
+
paths: ReadonlyArray<{ d: string; fill?: boolean; width?: number; dash?: string }>;
|
|
267
|
+
};
|
|
268
|
+
|
|
215
269
|
export type ContextMenuItem<TData extends RowData = RowData> =
|
|
216
270
|
| string
|
|
217
271
|
| {
|
|
218
272
|
key: string;
|
|
219
|
-
|
|
273
|
+
/**
|
|
274
|
+
* The text. An object whose `key` names a built-in (`copy`, `cut`,
|
|
275
|
+
* `paste`, `clear`, `row_above`, `row_below`, `remove_row`,
|
|
276
|
+
* `remove_col`, `comment`, `chart`) keeps the built-in's own label
|
|
277
|
+
* when this is omitted.
|
|
278
|
+
*/
|
|
279
|
+
label?: string;
|
|
280
|
+
/**
|
|
281
|
+
* A glyph before the label: one of the grid's icons by name, or path
|
|
282
|
+
* data of your own. Items without one keep the gutter, so the labels
|
|
283
|
+
* line up.
|
|
284
|
+
*/
|
|
285
|
+
icon?: GridIconName | ContextMenuIcon;
|
|
220
286
|
/** Hide the item entirely for this target. */
|
|
221
287
|
hidden?: (target: ContextMenuTarget<TData>) => boolean;
|
|
222
288
|
/** Render the item greyed-out and non-clickable for this target. */
|
|
223
289
|
disabled?: (target: ContextMenuTarget<TData>) => boolean;
|
|
224
|
-
/**
|
|
225
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Invoked on click. The menu closes afterwards. Omit it on a built-in
|
|
292
|
+
* key to keep what the built-in does and only give it an icon.
|
|
293
|
+
*/
|
|
294
|
+
action?: (target: ContextMenuTarget<TData>) => void;
|
|
226
295
|
};
|
|
227
296
|
|
|
228
297
|
/** What a {@link SelectionBarAction} is handed when it runs. */
|
|
@@ -416,7 +485,7 @@ export type ChartViewConfig<
|
|
|
416
485
|
/** Pivot dimension: one series per distinct value of this field. */
|
|
417
486
|
series?: keyof TData & string;
|
|
418
487
|
/** Aggregation when several rows share a category. Default `'sum'`. */
|
|
419
|
-
reduce?:
|
|
488
|
+
reduce?: ChartReducer;
|
|
420
489
|
/** Stack bar / area series instead of grouping them. */
|
|
421
490
|
stacked?: boolean;
|
|
422
491
|
/** Stack to 100% (implies `stacked`). */
|
|
@@ -1556,6 +1625,17 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1556
1625
|
* that leaves this off never fetches that code.
|
|
1557
1626
|
*/
|
|
1558
1627
|
columnResize?: boolean;
|
|
1628
|
+
/**
|
|
1629
|
+
* The user dragged a column's edge (or double-clicked it to autosize).
|
|
1630
|
+
* Programmatic `api.setColumnWidth` does not fire it.
|
|
1631
|
+
*/
|
|
1632
|
+
onColumnResize?: (event: { columnId: string; width: number }) => void;
|
|
1633
|
+
/**
|
|
1634
|
+
* The user dragged a row's edge, or double-clicked it: `height` is then
|
|
1635
|
+
* `null`, the row back at its declared height. Programmatic
|
|
1636
|
+
* `api.setRowHeight` does not fire it.
|
|
1637
|
+
*/
|
|
1638
|
+
onRowResize?: (event: { rowIndex: number; height: number | null }) => void;
|
|
1559
1639
|
/**
|
|
1560
1640
|
* Make the grid usable on narrow screens. When the grid's own width drops
|
|
1561
1641
|
* below the breakpoint (default `640`px), pinned columns are un-pinned so the
|
|
@@ -1618,6 +1698,22 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1618
1698
|
* currency symbols, expand codes to labels, or redact. Receives the display
|
|
1619
1699
|
* value plus the row/column context; return the string (or value) to copy.
|
|
1620
1700
|
*/
|
|
1701
|
+
/**
|
|
1702
|
+
* Decide what the fill handle writes into one cell, ahead of the grid's
|
|
1703
|
+
* own pattern rules (series, weekdays, "Item 1"). Receives the source
|
|
1704
|
+
* cell's value and how far the target sits from it; return the value to
|
|
1705
|
+
* write, or `undefined` to let the pattern decide. A spreadsheet uses it
|
|
1706
|
+
* to move a formula's references by the distance filled, which the
|
|
1707
|
+
* pattern rules would otherwise mangle ("=A1+B1" reads as "Item 1").
|
|
1708
|
+
*/
|
|
1709
|
+
processCellForFill?: (params: {
|
|
1710
|
+
/** The source cell's value the target cycles back to. */
|
|
1711
|
+
value: unknown;
|
|
1712
|
+
/** Rows and columns from that source cell to the target. */
|
|
1713
|
+
delta: { rows: number; cols: number };
|
|
1714
|
+
rowIndex: number;
|
|
1715
|
+
columnId: string;
|
|
1716
|
+
}) => unknown;
|
|
1621
1717
|
processCellForClipboard?: (params: {
|
|
1622
1718
|
value: unknown;
|
|
1623
1719
|
column: unknown;
|
|
@@ -1625,6 +1721,60 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1625
1721
|
rowIndex: number;
|
|
1626
1722
|
columnId: string;
|
|
1627
1723
|
}) => unknown;
|
|
1724
|
+
/**
|
|
1725
|
+
* An HTML rendering of what Ctrl+C copies, written to the clipboard as
|
|
1726
|
+
* `text/html` beside the TSV. Excel and Google Sheets read the HTML
|
|
1727
|
+
* first, so a table with inline styles pastes into them with its formats,
|
|
1728
|
+
* and the same markup can carry what the text cannot (a formula in a
|
|
1729
|
+
* `data-` attribute) for a round trip back into a grid that reads it.
|
|
1730
|
+
* Called after every cell has been through `processCellForClipboard`,
|
|
1731
|
+
* with the rectangles copied and the text about to be written. Return
|
|
1732
|
+
* nothing to write text alone. Runs synchronously inside the key press,
|
|
1733
|
+
* which is what the clipboard needs.
|
|
1734
|
+
*/
|
|
1735
|
+
clipboardHtml?: (params: {
|
|
1736
|
+
rects: ReadonlyArray<{ minRow: number; maxRow: number; minCol: number; maxCol: number }>;
|
|
1737
|
+
text: string;
|
|
1738
|
+
}) => string | null | undefined;
|
|
1739
|
+
/**
|
|
1740
|
+
* Take over a paste. Receives the clipboard's `text/plain` and, when the
|
|
1741
|
+
* source put one there, its `text/html` (Excel's carries formats and
|
|
1742
|
+
* formulas; a grid's own `clipboardHtml` carries whatever it chose to).
|
|
1743
|
+
* Return `true` to say the paste was applied; anything else lets the grid
|
|
1744
|
+
* paste the text as it always has. Runs inside one history group, so
|
|
1745
|
+
* every `setCellValue` and `recordUndo` the handler makes is one Ctrl+Z.
|
|
1746
|
+
*
|
|
1747
|
+
* With this set, Ctrl+V lets the browser's own `paste` event through
|
|
1748
|
+
* (that is where the unsanitised HTML is), and the async Clipboard API is
|
|
1749
|
+
* the fallback for a browser that does not deliver it. `source` says
|
|
1750
|
+
* which path the payload came by.
|
|
1751
|
+
*/
|
|
1752
|
+
onPasteClipboard?: (payload: {
|
|
1753
|
+
text: string;
|
|
1754
|
+
html: string | null;
|
|
1755
|
+
source: "event" | "async";
|
|
1756
|
+
}) => boolean | void;
|
|
1757
|
+
/**
|
|
1758
|
+
* Transform each cell on its way IN from the clipboard, before the grid
|
|
1759
|
+
* coerces it for the column's editor. Symmetric with
|
|
1760
|
+
* `processCellForClipboard`: the pair is what lets a round trip survive.
|
|
1761
|
+
*
|
|
1762
|
+
* Receives the raw clipboard text for the cell plus where it is landing.
|
|
1763
|
+
* Return the value to write, or `undefined` to leave the cell untouched.
|
|
1764
|
+
*
|
|
1765
|
+
* This is also the seam a feature pack uses to take over a paste entirely:
|
|
1766
|
+
* `@svgrid/enterprise`'s paste-special reads the clipboard's `text/html`
|
|
1767
|
+
* for formats and formulas and writes through here.
|
|
1768
|
+
*/
|
|
1769
|
+
processCellFromClipboard?: (params: {
|
|
1770
|
+
/** The raw text from the clipboard for this cell. */
|
|
1771
|
+
text: string;
|
|
1772
|
+
/** What the grid would have written after its own coercion. */
|
|
1773
|
+
parsedValue: unknown;
|
|
1774
|
+
row: TData;
|
|
1775
|
+
rowIndex: number;
|
|
1776
|
+
columnId: string;
|
|
1777
|
+
}) => unknown;
|
|
1628
1778
|
/**
|
|
1629
1779
|
* Inline cell editing: F2 or double-click opens an editor in the active cell,
|
|
1630
1780
|
* Enter commits, Esc cancels. Off by default.
|
|
@@ -1634,6 +1784,14 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1634
1784
|
* `editable` is the shortcut alias and wins over this.
|
|
1635
1785
|
*/
|
|
1636
1786
|
enableInlineEditing?: boolean;
|
|
1787
|
+
/**
|
|
1788
|
+
* A click on the cell that is already active opens its editor, the way a
|
|
1789
|
+
* second click on a selected file name starts renaming it. On by default.
|
|
1790
|
+
* A spreadsheet turns it off: Excel edits on double-click or F2 only, and
|
|
1791
|
+
* a user clicking the cell they are on to get back to it after a dialog
|
|
1792
|
+
* would otherwise find the next shortcut typed into an editor.
|
|
1793
|
+
*/
|
|
1794
|
+
editOnSecondClick?: boolean;
|
|
1637
1795
|
/**
|
|
1638
1796
|
* Full-row editing. When `true`, starting an edit puts the WHOLE row into
|
|
1639
1797
|
* edit mode - every editable cell shows an inline editor at once - and a
|
|
@@ -1991,6 +2149,28 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1991
2149
|
* main grid; field/format/cell/cellClass all apply.
|
|
1992
2150
|
*/
|
|
1993
2151
|
pinnedTopRows?: ReadonlyArray<TData>;
|
|
2152
|
+
/**
|
|
2153
|
+
* Freeze the first N rows: they stay under the header while the body
|
|
2154
|
+
* scrolls, and unlike `pinnedTopRows` they are the grid's own rows,
|
|
2155
|
+
* still editable, selectable and numbered as rows 1..N. Excel's Freeze
|
|
2156
|
+
* Panes, for the row half; the column half is `columnPinning`. Under
|
|
2157
|
+
* `virtualization` the frozen rows are always rendered and the window
|
|
2158
|
+
* skips them.
|
|
2159
|
+
*/
|
|
2160
|
+
frozenRows?: number;
|
|
2161
|
+
/**
|
|
2162
|
+
* Merged cells: rectangles drawn as one cell, a spreadsheet's Merge &
|
|
2163
|
+
* Center. Each entry is the top-left cell (display indices) and how many
|
|
2164
|
+
* rows and columns it covers. The origin's td takes the span and shows
|
|
2165
|
+
* the origin's value; the covered cells are not drawn, a selection grows
|
|
2166
|
+
* to whole merges, the active cell inside a merge is its origin, and the
|
|
2167
|
+
* arrow keys step over a merge as one cell. A merge that crosses the
|
|
2168
|
+
* frozen boundary or the rendered window is drawn in parts, one per
|
|
2169
|
+
* band. The grid does not write into covered cells on its own; a
|
|
2170
|
+
* consumer that merges cells keeps them empty or marks them read-only
|
|
2171
|
+
* through the column's `editable`.
|
|
2172
|
+
*/
|
|
2173
|
+
mergedCells?: ReadonlyArray<{ rowIndex: number; colIndex: number; rowSpan: number; colSpan: number }>;
|
|
1994
2174
|
/**
|
|
1995
2175
|
* Rows to pin to the BOTTOM of the grid - rendered below the regular
|
|
1996
2176
|
* 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" &&
|