@svgrid/grid 3.0.3 → 3.0.5
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 +6 -5
- 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 +122 -41
- package/dist/SvGrid.controller.svelte.js +846 -207
- package/dist/SvGrid.css +178 -2
- package/dist/SvGrid.svelte +717 -720
- package/dist/SvGrid.types.d.ts +566 -12
- 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 +119 -28
- package/dist/cdn/GridMenus-CID62rlI.js +636 -0
- package/dist/cdn/GridMenus-DLL-qZeu.js +635 -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/server-block-cache-CGoWz-87.js +237 -0
- package/dist/cdn/{src-D6XvA1Ij.js → src-Bklofsad.js} +10615 -10155
- package/dist/cdn/{src-Bugf5XlI.js → src-jcFMkBnN.js} +7111 -6651
- package/dist/cdn/svgrid.js +27 -15
- package/dist/cdn/svgrid.svelte-external.js +27 -15
- package/dist/cdn/validate-C7Rn_Bns.js +76 -0
- 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/core.js +36 -13
- package/dist/createPopoverSelect.svelte.d.ts +2 -2
- package/dist/editing.d.ts +2 -8
- package/dist/editing.js +272 -33
- package/dist/fill-patterns.d.ts +0 -5
- package/dist/fill-patterns.js +56 -2
- package/dist/gantt-view.svelte.d.ts +24 -0
- package/dist/gantt-view.svelte.js +13 -0
- package/dist/grid-icons.d.ts +2 -2
- package/dist/grid-icons.js +2 -2
- package/dist/grid-messages.d.ts +16 -3
- package/dist/grid-messages.js +10 -0
- package/dist/history.d.ts +83 -0
- package/dist/history.js +133 -0
- package/dist/index.d.ts +29 -10
- package/dist/index.js +23 -5
- 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-model.d.ts +133 -0
- package/dist/row-model.js +16 -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 +18 -1
- package/dist/selection.js +138 -18
- package/dist/server-block-cache.d.ts +214 -0
- package/dist/server-block-cache.js +531 -0
- package/dist/server-data-source.d.ts +240 -6
- package/dist/server-data-source.js +220 -20
- package/dist/server.d.ts +13 -0
- package/dist/server.js +13 -0
- 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/validate.d.ts +4 -0
- package/dist/validate.js +21 -3
- package/dist/virtualization/virtualizer.js +38 -17
- package/package.json +11 -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 +819 -179
- package/src/SvGrid.css +178 -2
- package/src/SvGrid.svelte +717 -720
- package/src/SvGrid.types.ts +564 -11
- 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 +118 -22
- 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.rowmodel-cache.test.ts +51 -0
- package/src/core.ts +40 -12
- package/src/editing.test.ts +281 -3
- package/src/editing.ts +264 -38
- package/src/fill-patterns.test.ts +35 -0
- package/src/fill-patterns.ts +56 -2
- package/src/gantt-stub.test.svelte +38 -0
- package/src/gantt-view.svelte.ts +35 -0
- package/src/grid-icons.ts +2 -2
- package/src/grid-messages.ts +28 -3
- package/src/history.test.ts +196 -0
- package/src/history.ts +162 -0
- package/src/icon-seam.test.ts +5 -6
- package/src/index.ts +186 -12
- 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-model.ts +146 -0
- 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 +33 -2
- package/src/selection.ts +143 -21
- package/src/server-block-cache.test.ts +645 -0
- package/src/server-block-cache.ts +677 -0
- package/src/server-data-source.infinite.test.ts +343 -0
- package/src/server-data-source.ts +450 -27
- package/src/server.ts +47 -0
- 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.gantt-seam.test.ts +199 -0
- package/src/svgrid.new-features.wrapper.test.ts +10 -3
- package/src/svgrid.row-model-prop.svelte.test.ts +352 -0
- package/src/svgrid.row-model-seam.svelte.test.ts +289 -0
- package/src/svgrid.upsell-license.test.ts +7 -4
- package/src/validate.test.ts +29 -0
- package/src/validate.ts +28 -3
- package/src/virtualization/virtualizer.ts +39 -17
- package/dist/SvGroupCell.svelte +0 -141
- package/dist/SvGroupCell.svelte.d.ts +0 -49
- package/dist/SvRowGroupPanel.svelte +0 -186
- package/dist/SvRowGroupPanel.svelte.d.ts +0 -25
- package/dist/cdn/GridMenus-CHOMnW-c.js +0 -602
- package/dist/cdn/GridMenus-DhdPF700.js +0 -603
- package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +0 -816
- package/dist/cdn/SvGridChart-1PMSp2LZ.js +0 -1481
- package/dist/cdn/SvGridChart-D02avhyr.js +0 -1480
- package/dist/cdn/SvGridChartPanel-DJnViOv4.js +0 -834
- package/dist/cdn/SvGridChartPanel-vPTNerFZ.js +0 -810
- package/dist/cdn/SvGridChartView-C--HhdUo.js +0 -56
- package/dist/cdn/SvGridChartView-KyyFG-wY.js +0 -55
- package/dist/cdn/chart-DLg3_zTQ.js +0 -1652
- package/dist/cdn/validate-_CDJzgIo.js +0 -75
- package/dist/server-group-model.d.ts +0 -98
- package/dist/server-group-model.js +0 -263
- package/src/SvGroupCell.svelte +0 -141
- package/src/SvRowGroupPanel.svelte +0 -186
- package/src/server-group-model.test.ts +0 -294
- package/src/server-group-model.ts +0 -370
package/src/SvGrid.types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Type definitions extracted from SvGrid.svelte. These are compile-time
|
|
2
2
|
// only - moving them out keeps the component's <script> focused on logic.
|
|
3
3
|
import type { Snippet } from "svelte";
|
|
4
|
+
import type { GridRowModel } from "./row-model";
|
|
4
5
|
import type {
|
|
5
6
|
CellEditorType,
|
|
6
7
|
ColumnDef,
|
|
@@ -11,6 +12,7 @@ import type {
|
|
|
11
12
|
import type { ConditionalFormat } from "./conditional-formatting";
|
|
12
13
|
import type { GroupDisplayType } from "./group-display";
|
|
13
14
|
import type { GridMessages } from "./grid-messages";
|
|
15
|
+
import type { ChartMessages } from "./chart-messages";
|
|
14
16
|
import type { GridIconName, GridIcons } from "./grid-icons";
|
|
15
17
|
import type { GridPivotConfig } from "./pivot-view.svelte";
|
|
16
18
|
import type { GridPredicateExpr } from "./filtering/predicate-expr";
|
|
@@ -68,9 +70,22 @@ import type {
|
|
|
68
70
|
ChartType,
|
|
69
71
|
ChartSpec,
|
|
70
72
|
ChartAnnotation,
|
|
73
|
+
ChartReducer,
|
|
71
74
|
ChartReferenceLine,
|
|
72
75
|
ChartValueFormat,
|
|
73
76
|
} from "./chart";
|
|
77
|
+
import type { ChartRangePreset } from "./chart-zoom";
|
|
78
|
+
import type { ChartAnimateConfig, ChartContextTarget, ChartZoomConfig } from "./SvGridChart.types";
|
|
79
|
+
|
|
80
|
+
/** What the chart panel's lifecycle events carry. */
|
|
81
|
+
export type ChartPanelInfo = {
|
|
82
|
+
/** Tab index in the panel's strip. */
|
|
83
|
+
index: number;
|
|
84
|
+
title: string;
|
|
85
|
+
type: ChartType;
|
|
86
|
+
/** The spec the panel is rendering, or null while it cannot build one. */
|
|
87
|
+
spec: ChartSpec | null;
|
|
88
|
+
};
|
|
74
89
|
|
|
75
90
|
/** One aggregated bucket returned by a server-side `getAggregate`. */
|
|
76
91
|
export type ChartAggregateBucket = { category: string; series?: string; value: number };
|
|
@@ -79,7 +94,7 @@ export type ChartAggregateRequest = {
|
|
|
79
94
|
dimension: string | undefined;
|
|
80
95
|
measure: string | null;
|
|
81
96
|
series?: string;
|
|
82
|
-
reduce:
|
|
97
|
+
reduce: ChartReducer;
|
|
83
98
|
filterModel: Record<string, unknown>;
|
|
84
99
|
};
|
|
85
100
|
|
|
@@ -107,7 +122,7 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
107
122
|
series?: string;
|
|
108
123
|
/** Measure column, or several for a multi-series chart. */
|
|
109
124
|
measures?: string | string[];
|
|
110
|
-
reduce?:
|
|
125
|
+
reduce?: ChartReducer;
|
|
111
126
|
stacked?: boolean;
|
|
112
127
|
stacked100?: boolean;
|
|
113
128
|
/** Per-series-label type override (combo). */
|
|
@@ -116,7 +131,10 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
116
131
|
seriesAxes?: Record<string, "left" | "right">;
|
|
117
132
|
referenceLines?: ChartReferenceLine[];
|
|
118
133
|
averageLine?: boolean;
|
|
119
|
-
|
|
134
|
+
/** An overlay on every series: a 7-point moving average, or a regression
|
|
135
|
+
* (`linear`, `poly` for a quadratic, `exp`, `log`, `power`) whose
|
|
136
|
+
* R-squared the tooltip reads. */
|
|
137
|
+
trend?: "sma" | "ema" | "linear" | "poly" | "exp" | "log" | "power";
|
|
120
138
|
annotations?: ChartAnnotation[];
|
|
121
139
|
yScale?: "linear" | "log";
|
|
122
140
|
timeAxis?: boolean;
|
|
@@ -137,10 +155,37 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
137
155
|
otherLabel?: string;
|
|
138
156
|
sort?: "value-desc" | "value-asc" | "category" | "none";
|
|
139
157
|
dataLabels?: boolean;
|
|
140
|
-
zoom
|
|
158
|
+
/** Zooming: `true` for drag-to-zoom, or an object choosing wheel, pinch,
|
|
159
|
+
* pan and the axes (see `ChartZoomConfig`). The window survives tab
|
|
160
|
+
* switches and round-trips through `getChartsState`. */
|
|
161
|
+
zoom?: boolean | ChartZoomConfig;
|
|
141
162
|
brush?: boolean;
|
|
163
|
+
/** Range buttons (1W / 1M / 3M / 6M / YTD / 1Y / All, or your own) when the
|
|
164
|
+
* dimension is a date. */
|
|
165
|
+
rangePresets?: boolean | ChartRangePreset[];
|
|
166
|
+
/** Share crosshair and zoom with other charts on the page (any `SvChart`
|
|
167
|
+
* with the same `syncGroup`). */
|
|
168
|
+
syncGroup?: string;
|
|
169
|
+
/** All chart tabs of this grid share one zoom window: zoom in one tab and
|
|
170
|
+
* the others open at the same range. */
|
|
171
|
+
syncTabs?: boolean;
|
|
172
|
+
/** Right-click menu on the chart: `true` for the built-in items, your own
|
|
173
|
+
* `MenuItem`s appended after them, or a function of the clicked point. */
|
|
174
|
+
contextMenu?: boolean | MenuItem[] | ((target: ChartContextTarget) => MenuItem[]);
|
|
175
|
+
/** Motion: `true` for the default data-update tween, or an object choosing
|
|
176
|
+
* the enter effect and duration. */
|
|
177
|
+
animate?: boolean | ChartAnimateConfig;
|
|
178
|
+
/** Translations for the chart's own strings (toolbar, menu, legend hints,
|
|
179
|
+
* what it says to assistive technology); the panel passes them to every
|
|
180
|
+
* chart it draws. See `ChartMessages`. */
|
|
181
|
+
localeText?: Partial<ChartMessages>;
|
|
142
182
|
/** Show the chart's PNG/SVG export toolbar. */
|
|
143
183
|
export?: boolean;
|
|
184
|
+
/** A chart tab was added (the first one counts, once the panel opens). */
|
|
185
|
+
onChartCreated?: (info: ChartPanelInfo) => void;
|
|
186
|
+
/** The active chart's spec changed: a picker, the builder, a filter, an
|
|
187
|
+
* edit, new rows. Debounced to one call per burst of changes. */
|
|
188
|
+
onChartChanged?: (info: ChartPanelInfo) => void;
|
|
144
189
|
/** Escape hatch: build a fully custom ChartSpec from the (scoped) rows. */
|
|
145
190
|
buildSpec?: (rows: TData[]) => ChartSpec | null;
|
|
146
191
|
/** Server-side aggregation: chart the whole dataset, not just loaded rows. */
|
|
@@ -212,17 +257,42 @@ export type ContextMenuTarget<TData extends RowData = RowData> = {
|
|
|
212
257
|
* "chart"`. The `"chart"` item (chart the selected range) is only shown when
|
|
213
258
|
* `charting` is enabled; it is appended to the default menu automatically.
|
|
214
259
|
*/
|
|
260
|
+
/**
|
|
261
|
+
* An icon of your own for a context-menu item: path data on a 16 x 16 grid,
|
|
262
|
+
* drawn in the text colour with a 1.4px round stroke (`fill` for a solid
|
|
263
|
+
* part, `width` and `dash` to vary the stroke). The same shape a
|
|
264
|
+
* spreadsheet ribbon's icon set uses, so one set serves both.
|
|
265
|
+
*/
|
|
266
|
+
export type ContextMenuIcon = {
|
|
267
|
+
paths: ReadonlyArray<{ d: string; fill?: boolean; width?: number; dash?: string }>;
|
|
268
|
+
};
|
|
269
|
+
|
|
215
270
|
export type ContextMenuItem<TData extends RowData = RowData> =
|
|
216
271
|
| string
|
|
217
272
|
| {
|
|
218
273
|
key: string;
|
|
219
|
-
|
|
274
|
+
/**
|
|
275
|
+
* The text. An object whose `key` names a built-in (`copy`, `cut`,
|
|
276
|
+
* `paste`, `clear`, `row_above`, `row_below`, `remove_row`,
|
|
277
|
+
* `remove_col`, `comment`, `chart`) keeps the built-in's own label
|
|
278
|
+
* when this is omitted.
|
|
279
|
+
*/
|
|
280
|
+
label?: string;
|
|
281
|
+
/**
|
|
282
|
+
* A glyph before the label: one of the grid's icons by name, or path
|
|
283
|
+
* data of your own. Items without one keep the gutter, so the labels
|
|
284
|
+
* line up.
|
|
285
|
+
*/
|
|
286
|
+
icon?: GridIconName | ContextMenuIcon;
|
|
220
287
|
/** Hide the item entirely for this target. */
|
|
221
288
|
hidden?: (target: ContextMenuTarget<TData>) => boolean;
|
|
222
289
|
/** Render the item greyed-out and non-clickable for this target. */
|
|
223
290
|
disabled?: (target: ContextMenuTarget<TData>) => boolean;
|
|
224
|
-
/**
|
|
225
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Invoked on click. The menu closes afterwards. Omit it on a built-in
|
|
293
|
+
* key to keep what the built-in does and only give it an icon.
|
|
294
|
+
*/
|
|
295
|
+
action?: (target: ContextMenuTarget<TData>) => void;
|
|
226
296
|
};
|
|
227
297
|
|
|
228
298
|
/** What a {@link SelectionBarAction} is handed when it runs. */
|
|
@@ -416,7 +486,7 @@ export type ChartViewConfig<
|
|
|
416
486
|
/** Pivot dimension: one series per distinct value of this field. */
|
|
417
487
|
series?: keyof TData & string;
|
|
418
488
|
/** Aggregation when several rows share a category. Default `'sum'`. */
|
|
419
|
-
reduce?:
|
|
489
|
+
reduce?: ChartReducer;
|
|
420
490
|
/** Stack bar / area series instead of grouping them. */
|
|
421
491
|
stacked?: boolean;
|
|
422
492
|
/** Stack to 100% (implies `stacked`). */
|
|
@@ -1043,8 +1113,276 @@ export type SchedulerConfig<
|
|
|
1043
1113
|
searchPlaceholder?: string;
|
|
1044
1114
|
};
|
|
1045
1115
|
|
|
1116
|
+
/**
|
|
1117
|
+
* The Gantt axis presets: which unit is a tick and which is the coarser row
|
|
1118
|
+
* grouping them. `week` (day ticks under month majors) is the default.
|
|
1119
|
+
*/
|
|
1120
|
+
export type GanttZoom = "day" | "week" | "month" | "quarter" | "year";
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* The four classic dependency kinds. `FS` (finish-to-start) is the default:
|
|
1124
|
+
* the successor may not start before the predecessor finishes.
|
|
1125
|
+
*/
|
|
1126
|
+
export type GanttDependencyType = "FS" | "SS" | "FF" | "SF";
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* A link from a predecessor task (`from`) to a successor (`to`). Both are row
|
|
1130
|
+
* ids (the grid's `getRowId`). `lag` is in DAYS - negative for a lead, so
|
|
1131
|
+
* `{ type: 'FS', lag: -1 }` lets the successor start a day before the
|
|
1132
|
+
* predecessor finishes.
|
|
1133
|
+
*/
|
|
1134
|
+
export type GanttDependency = {
|
|
1135
|
+
id: string;
|
|
1136
|
+
from: string;
|
|
1137
|
+
to: string;
|
|
1138
|
+
type?: GanttDependencyType;
|
|
1139
|
+
lag?: number;
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
/** Fired when a task bar is dragged to new dates. {@link GanttConfig.onTaskMove}. */
|
|
1143
|
+
export type GanttTaskMoveEvent<TData extends RowData = RowData> = {
|
|
1144
|
+
row: TData;
|
|
1145
|
+
start: Date;
|
|
1146
|
+
end: Date;
|
|
1147
|
+
/**
|
|
1148
|
+
* The moved row's descendants, shifted by the same delta - present only when
|
|
1149
|
+
* a summary (parent) bar was dragged. Cascaded successors are NOT here; they
|
|
1150
|
+
* arrive through {@link GanttConfig.onDependenciesChange}.
|
|
1151
|
+
*/
|
|
1152
|
+
subtree?: Array<{ row: TData; start: Date; end: Date }>;
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
/** Fired when a task bar's edge is dragged. {@link GanttConfig.onTaskResize}. */
|
|
1156
|
+
export type GanttTaskResizeEvent<TData extends RowData = RowData> = {
|
|
1157
|
+
row: TData;
|
|
1158
|
+
start: Date;
|
|
1159
|
+
end: Date;
|
|
1160
|
+
/** Which edge the user dragged. */
|
|
1161
|
+
edge: "start" | "end";
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
/** Fired when a bar's progress grip is dragged. {@link GanttConfig.onProgressChange}. */
|
|
1165
|
+
export type GanttProgressChangeEvent<TData extends RowData = RowData> = {
|
|
1166
|
+
row: TData;
|
|
1167
|
+
/** 0-100, in whole percent. */
|
|
1168
|
+
progress: number;
|
|
1169
|
+
};
|
|
1170
|
+
|
|
1171
|
+
/** Fired when the Gantt's detail drawer is saved. {@link GanttConfig.onTaskCommit}. */
|
|
1172
|
+
export type GanttTaskCommitEvent<TData extends RowData = RowData> = {
|
|
1173
|
+
row: TData;
|
|
1174
|
+
values: Partial<TData>;
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* The Gantt's built-in task drawer. Same shape as the scheduler's - a field
|
|
1179
|
+
* list, a title and a width - so one drawer config type covers both views.
|
|
1180
|
+
*/
|
|
1181
|
+
export type GanttDrawerConfig<TData extends RowData = RowData> =
|
|
1182
|
+
SchedulerDrawerConfig<TData>;
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Turns the grid into a Gantt chart. Set `gantt` and the grid renders its rows
|
|
1186
|
+
* as a task table beside a time chart: one bar per row positioned by start /
|
|
1187
|
+
* end, nested into a work-breakdown tree by `parentField`, with dependency
|
|
1188
|
+
* arrows between linked tasks.
|
|
1189
|
+
*
|
|
1190
|
+
* Like the Kanban board and the scheduler it is a pure *view of the grid*: it
|
|
1191
|
+
* renders the grid's filtered + sorted rows and writes back only through
|
|
1192
|
+
* callbacks, never mutating your data. Dragging a bar fires
|
|
1193
|
+
* {@link GanttConfig.onTaskMove} where you reassign the dates on your own rows.
|
|
1194
|
+
*
|
|
1195
|
+
* Dates are local calendar days and `end` is EXCLUSIVE, except that a date-only
|
|
1196
|
+
* string (`'2026-09-14'`, no time part) is read as the end OF that day - the
|
|
1197
|
+
* inclusive convention planning tools use. So
|
|
1198
|
+
* `{ start: '2026-09-14', end: '2026-09-16' }` draws a three-day bar.
|
|
1199
|
+
*/
|
|
1200
|
+
export type GanttConfig<
|
|
1201
|
+
TFeatures extends TableFeatures = TableFeatures,
|
|
1202
|
+
TData extends RowData = RowData,
|
|
1203
|
+
> = {
|
|
1204
|
+
/** Field holding each task's start (`Date` | epoch-ms | ISO string). Required. */
|
|
1205
|
+
startField: keyof TData & string;
|
|
1206
|
+
/** Field holding the end. Omit to use `durationField`, else the task is a milestone. */
|
|
1207
|
+
endField?: keyof TData & string;
|
|
1208
|
+
/** Field holding the length in WORKING days, used when `endField` is absent. */
|
|
1209
|
+
durationField?: keyof TData & string;
|
|
1210
|
+
/** Field for the task name. Defaults to the first column's field. */
|
|
1211
|
+
titleField?: keyof TData & string;
|
|
1212
|
+
/** Field holding percent complete (0-100). Drives the bar's inner fill. */
|
|
1213
|
+
progressField?: keyof TData & string;
|
|
1214
|
+
/**
|
|
1215
|
+
* Field holding each row's PARENT task id, nesting the flat rows into a
|
|
1216
|
+
* work-breakdown tree. Parents render a rolled-up summary bar and a collapse
|
|
1217
|
+
* chevron. Rows whose parent is missing become roots rather than vanishing.
|
|
1218
|
+
*
|
|
1219
|
+
* This is the Gantt's own tree - do NOT also set the grid's `treeData` prop.
|
|
1220
|
+
* `treeData` hides collapsed children from the view entirely, which would
|
|
1221
|
+
* drop them out of their phase's summary bar.
|
|
1222
|
+
*/
|
|
1223
|
+
parentField?: keyof TData & string;
|
|
1224
|
+
/**
|
|
1225
|
+
* Boolean field marking a task as a milestone (a diamond, no length). A task
|
|
1226
|
+
* whose end equals its start renders as one regardless.
|
|
1227
|
+
*/
|
|
1228
|
+
milestoneField?: keyof TData & string;
|
|
1229
|
+
/** Field holding a per-task accent color (any CSS color). Else `color`. */
|
|
1230
|
+
colorField?: keyof TData & string;
|
|
1231
|
+
/** Fallback accent color for every bar. */
|
|
1232
|
+
color?: string;
|
|
1233
|
+
|
|
1234
|
+
// --- dependencies ---------------------------------------------------------
|
|
1235
|
+
/**
|
|
1236
|
+
* Predecessor -> successor links, drawn as arrows between bars. `from` / `to`
|
|
1237
|
+
* are row ids (your `getRowId`). See {@link GanttDependency}.
|
|
1238
|
+
*/
|
|
1239
|
+
dependencies?: ReadonlyArray<GanttDependency>;
|
|
1240
|
+
/**
|
|
1241
|
+
* Per-row field holding that row's links (as `GanttDependency[]` or a plain
|
|
1242
|
+
* list of successor ids). An alternative to the flat `dependencies` array.
|
|
1243
|
+
*/
|
|
1244
|
+
dependencyField?: keyof TData & string;
|
|
1245
|
+
/**
|
|
1246
|
+
* Cascade successors forward on move / resize so every link stays legal,
|
|
1247
|
+
* preserving each task's duration. Defaults to `true` when any dependency is
|
|
1248
|
+
* present. Cascading never pulls a task earlier.
|
|
1249
|
+
*/
|
|
1250
|
+
autoReschedule?: boolean;
|
|
1251
|
+
/**
|
|
1252
|
+
* Schedule in working time (see `nonWorkingDays` / `holidays`): a moved
|
|
1253
|
+
* or cascaded task lands on a working day and keeps its WORKING length, so
|
|
1254
|
+
* a five-day task dragged over a weekend stays five days of work, and the
|
|
1255
|
+
* critical path measures slack in working days. `false` schedules in
|
|
1256
|
+
* calendar time. Default `true`.
|
|
1257
|
+
*/
|
|
1258
|
+
respectWorkingTime?: boolean;
|
|
1259
|
+
/** Fired with the cascaded shifts after a move / resize (never mutates rows). */
|
|
1260
|
+
onDependenciesChange?: (
|
|
1261
|
+
moves: Array<{ id: string; start: Date; end: Date }>,
|
|
1262
|
+
) => void;
|
|
1263
|
+
/** Fired when the user draws a new link (drag from one bar's edge to another). */
|
|
1264
|
+
onDependencyAdd?: (dep: GanttDependency) => void;
|
|
1265
|
+
/** Fired when the user removes a link (arrow context menu). */
|
|
1266
|
+
onDependencyRemove?: (id: string) => void;
|
|
1267
|
+
|
|
1268
|
+
// --- axis -----------------------------------------------------------------
|
|
1269
|
+
/** The axis preset the chart opens on. Default `'week'`. */
|
|
1270
|
+
zoom?: GanttZoom;
|
|
1271
|
+
/**
|
|
1272
|
+
* The presets the toolbar's zoom stepper offers. Default all five; a single
|
|
1273
|
+
* entry hides the stepper.
|
|
1274
|
+
*/
|
|
1275
|
+
zoomLevels?: ReadonlyArray<GanttZoom>;
|
|
1276
|
+
/** Fired when the zoom preset changes (stepper or Ctrl+wheel). */
|
|
1277
|
+
onZoomChange?: (zoom: GanttZoom) => void;
|
|
1278
|
+
/** First day of the week, 0-6 (0 = Sunday). Default 0. */
|
|
1279
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1280
|
+
/**
|
|
1281
|
+
* Weekday numbers (0 = Sun ... 6 = Sat) that are non-working: shaded in the
|
|
1282
|
+
* chart and skipped by duration + cascade arithmetic. Default `[0, 6]`.
|
|
1283
|
+
*/
|
|
1284
|
+
nonWorkingDays?: ReadonlyArray<number>;
|
|
1285
|
+
/** Specific dates that are non-working (holidays, closures). */
|
|
1286
|
+
holidays?: ReadonlyArray<Date | number | string>;
|
|
1287
|
+
/** Shade the non-working columns. Default `true`. */
|
|
1288
|
+
showNonWorking?: boolean;
|
|
1289
|
+
/** Draw the dashed "today" line across the chart. Default `true`. */
|
|
1290
|
+
todayLine?: boolean;
|
|
1291
|
+
/** Earliest date the axis shows and a drag may reach. */
|
|
1292
|
+
minDate?: Date | number | string;
|
|
1293
|
+
/** Latest date the axis shows and a drag may reach. */
|
|
1294
|
+
maxDate?: Date | number | string;
|
|
1295
|
+
/** Calendar days of slack around the first start / last end. Default 7. */
|
|
1296
|
+
rangePaddingDays?: number;
|
|
1297
|
+
|
|
1298
|
+
// --- layout ---------------------------------------------------------------
|
|
1299
|
+
/**
|
|
1300
|
+
* Column ids shown in the task table, in order. Defaults to every leaf
|
|
1301
|
+
* column. Two built-ins need no column definition: `'__duration'` (working
|
|
1302
|
+
* days) and `'__progress'` (a small bar).
|
|
1303
|
+
*/
|
|
1304
|
+
tableColumns?: ReadonlyArray<string>;
|
|
1305
|
+
/** Width (px) of the task table pane. Default 360; a splitter resizes it. */
|
|
1306
|
+
tableWidth?: number;
|
|
1307
|
+
/** Height (px) of one task row. Default 32. */
|
|
1308
|
+
rowHeight?: number;
|
|
1309
|
+
/** Parents draw a rolled-up summary bar spanning their children. Default `true`. */
|
|
1310
|
+
summaryBars?: boolean;
|
|
1311
|
+
/**
|
|
1312
|
+
* Where a bar's label sits: `'inside'` (default, falling back to the right
|
|
1313
|
+
* when the bar is too narrow), always `'right'`, or `'none'`.
|
|
1314
|
+
*/
|
|
1315
|
+
labelPosition?: "inside" | "right" | "none";
|
|
1316
|
+
|
|
1317
|
+
// --- work-breakdown collapse ------------------------------------------------
|
|
1318
|
+
/**
|
|
1319
|
+
* Controlled collapse: the ids of the parent rows whose children are hidden.
|
|
1320
|
+
* Omit to let the Gantt own its own collapse state.
|
|
1321
|
+
*/
|
|
1322
|
+
collapsed?: ReadonlyArray<string>;
|
|
1323
|
+
/** Fired when a chevron (or Expand / Collapse all) changes the collapsed set. */
|
|
1324
|
+
onCollapseChange?: (collapsed: string[]) => void;
|
|
1325
|
+
|
|
1326
|
+
// --- editing ----------------------------------------------------------------
|
|
1327
|
+
/**
|
|
1328
|
+
* Enable drag-to-move, edge resize, the progress grip and link drawing.
|
|
1329
|
+
* Without it the chart is read-only.
|
|
1330
|
+
*/
|
|
1331
|
+
editable?: boolean;
|
|
1332
|
+
/**
|
|
1333
|
+
* Enable undo / redo of move, resize and progress edits with `Ctrl/Cmd+Z` and
|
|
1334
|
+
* `Ctrl/Cmd+Shift+Z` (or `Ctrl+Y`). The callbacks re-fire with the reversed
|
|
1335
|
+
* values, so your data follows.
|
|
1336
|
+
*/
|
|
1337
|
+
history?: boolean;
|
|
1338
|
+
/** Fired when a bar is dragged to new dates. */
|
|
1339
|
+
onTaskMove?: (event: GanttTaskMoveEvent<TData>) => void;
|
|
1340
|
+
/** Fired when a bar's edge is dragged. */
|
|
1341
|
+
onTaskResize?: (event: GanttTaskResizeEvent<TData>) => void;
|
|
1342
|
+
/** Fired when the progress grip is dragged. */
|
|
1343
|
+
onProgressChange?: (event: GanttProgressChangeEvent<TData>) => void;
|
|
1344
|
+
/** Fired when empty chart space is double-clicked - create a task there. */
|
|
1345
|
+
onTaskAdd?: (start: Date, end: Date, parentId?: string) => void;
|
|
1346
|
+
/**
|
|
1347
|
+
* Fired from the bar's Delete action. Setting this shows Delete in the
|
|
1348
|
+
* drawer and the context menu. Remove the row from your data in the handler.
|
|
1349
|
+
*/
|
|
1350
|
+
onTaskDelete?: (row: TData) => void;
|
|
1351
|
+
|
|
1352
|
+
// --- chrome -----------------------------------------------------------------
|
|
1353
|
+
/**
|
|
1354
|
+
* Custom body for a TASK bar. Receives the row. Omit for the built-in label.
|
|
1355
|
+
* A phase's summary bar is a thin spine with no room for a body, so it keeps
|
|
1356
|
+
* its plain label; a milestone has no body at all.
|
|
1357
|
+
*/
|
|
1358
|
+
task?: Snippet<[TData]>;
|
|
1359
|
+
/**
|
|
1360
|
+
* Hover tooltip for a bar. A `Snippet<[TData]>` for custom content, or `true`
|
|
1361
|
+
* for the built-in one (title, dates, duration, percent). Omit to disable.
|
|
1362
|
+
*/
|
|
1363
|
+
tooltip?: boolean | Snippet<[TData]>;
|
|
1364
|
+
/** Delay (ms) before the hover tooltip opens. Default 400. */
|
|
1365
|
+
tooltipDelay?: number;
|
|
1366
|
+
/** Built-in task drawer: `true` for all fields, or a config object. */
|
|
1367
|
+
drawer?: boolean | GanttDrawerConfig<TData>;
|
|
1368
|
+
/** Fired when the drawer is saved. */
|
|
1369
|
+
onTaskCommit?: (event: GanttTaskCommitEvent<TData>) => void;
|
|
1370
|
+
/** Right-click menu for a bar. Return items or `undefined` to suppress. */
|
|
1371
|
+
taskMenu?: (row: TData) => MenuItem[] | undefined;
|
|
1372
|
+
|
|
1373
|
+
/** Show the search box (binds to the grid's global filter). Default `true`. */
|
|
1374
|
+
searchable?: boolean;
|
|
1375
|
+
searchPlaceholder?: string;
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1046
1378
|
export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData> = {
|
|
1047
|
-
|
|
1379
|
+
/**
|
|
1380
|
+
* The rows to render.
|
|
1381
|
+
*
|
|
1382
|
+
* Optional only because `rowModel` can supply them instead; a grid with
|
|
1383
|
+
* neither renders empty. When both are present `data` wins.
|
|
1384
|
+
*/
|
|
1385
|
+
data?: ReadonlyArray<TData>;
|
|
1048
1386
|
columns: Array<ColumnDef<TFeatures, TData>>;
|
|
1049
1387
|
/**
|
|
1050
1388
|
* Kanban board mode. When set, the grid renders its rows as cards in
|
|
@@ -1058,6 +1396,15 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1058
1396
|
* {@link SchedulerConfig}.
|
|
1059
1397
|
*/
|
|
1060
1398
|
scheduler?: SchedulerConfig<TFeatures, TData>;
|
|
1399
|
+
/**
|
|
1400
|
+
* Gantt mode. When set, the grid renders its rows as a task table beside a
|
|
1401
|
+
* time chart: one bar per row by start / end, a work-breakdown tree from
|
|
1402
|
+
* `parentField`, and dependency arrows. See {@link GanttConfig}.
|
|
1403
|
+
*
|
|
1404
|
+
* A view of the grid like the board and scheduler; the renderer ships in
|
|
1405
|
+
* `@svgrid/enterprise` (call `enableGanttView()`).
|
|
1406
|
+
*/
|
|
1407
|
+
gantt?: GanttConfig<TFeatures, TData>;
|
|
1061
1408
|
/**
|
|
1062
1409
|
* Chart view. When set, the grid renders its FILTERED + SORTED rows as a chart
|
|
1063
1410
|
* instead of a table (search / filters / sort flow through). Unlike board and
|
|
@@ -1556,6 +1903,17 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1556
1903
|
* that leaves this off never fetches that code.
|
|
1557
1904
|
*/
|
|
1558
1905
|
columnResize?: boolean;
|
|
1906
|
+
/**
|
|
1907
|
+
* The user dragged a column's edge (or double-clicked it to autosize).
|
|
1908
|
+
* Programmatic `api.setColumnWidth` does not fire it.
|
|
1909
|
+
*/
|
|
1910
|
+
onColumnResize?: (event: { columnId: string; width: number }) => void;
|
|
1911
|
+
/**
|
|
1912
|
+
* The user dragged a row's edge, or double-clicked it: `height` is then
|
|
1913
|
+
* `null`, the row back at its declared height. Programmatic
|
|
1914
|
+
* `api.setRowHeight` does not fire it.
|
|
1915
|
+
*/
|
|
1916
|
+
onRowResize?: (event: { rowIndex: number; height: number | null }) => void;
|
|
1559
1917
|
/**
|
|
1560
1918
|
* Make the grid usable on narrow screens. When the grid's own width drops
|
|
1561
1919
|
* below the breakpoint (default `640`px), pinned columns are un-pinned so the
|
|
@@ -1618,6 +1976,22 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1618
1976
|
* currency symbols, expand codes to labels, or redact. Receives the display
|
|
1619
1977
|
* value plus the row/column context; return the string (or value) to copy.
|
|
1620
1978
|
*/
|
|
1979
|
+
/**
|
|
1980
|
+
* Decide what the fill handle writes into one cell, ahead of the grid's
|
|
1981
|
+
* own pattern rules (series, weekdays, "Item 1"). Receives the source
|
|
1982
|
+
* cell's value and how far the target sits from it; return the value to
|
|
1983
|
+
* write, or `undefined` to let the pattern decide. A spreadsheet uses it
|
|
1984
|
+
* to move a formula's references by the distance filled, which the
|
|
1985
|
+
* pattern rules would otherwise mangle ("=A1+B1" reads as "Item 1").
|
|
1986
|
+
*/
|
|
1987
|
+
processCellForFill?: (params: {
|
|
1988
|
+
/** The source cell's value the target cycles back to. */
|
|
1989
|
+
value: unknown;
|
|
1990
|
+
/** Rows and columns from that source cell to the target. */
|
|
1991
|
+
delta: { rows: number; cols: number };
|
|
1992
|
+
rowIndex: number;
|
|
1993
|
+
columnId: string;
|
|
1994
|
+
}) => unknown;
|
|
1621
1995
|
processCellForClipboard?: (params: {
|
|
1622
1996
|
value: unknown;
|
|
1623
1997
|
column: unknown;
|
|
@@ -1625,6 +1999,60 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1625
1999
|
rowIndex: number;
|
|
1626
2000
|
columnId: string;
|
|
1627
2001
|
}) => unknown;
|
|
2002
|
+
/**
|
|
2003
|
+
* An HTML rendering of what Ctrl+C copies, written to the clipboard as
|
|
2004
|
+
* `text/html` beside the TSV. Excel and Google Sheets read the HTML
|
|
2005
|
+
* first, so a table with inline styles pastes into them with its formats,
|
|
2006
|
+
* and the same markup can carry what the text cannot (a formula in a
|
|
2007
|
+
* `data-` attribute) for a round trip back into a grid that reads it.
|
|
2008
|
+
* Called after every cell has been through `processCellForClipboard`,
|
|
2009
|
+
* with the rectangles copied and the text about to be written. Return
|
|
2010
|
+
* nothing to write text alone. Runs synchronously inside the key press,
|
|
2011
|
+
* which is what the clipboard needs.
|
|
2012
|
+
*/
|
|
2013
|
+
clipboardHtml?: (params: {
|
|
2014
|
+
rects: ReadonlyArray<{ minRow: number; maxRow: number; minCol: number; maxCol: number }>;
|
|
2015
|
+
text: string;
|
|
2016
|
+
}) => string | null | undefined;
|
|
2017
|
+
/**
|
|
2018
|
+
* Take over a paste. Receives the clipboard's `text/plain` and, when the
|
|
2019
|
+
* source put one there, its `text/html` (Excel's carries formats and
|
|
2020
|
+
* formulas; a grid's own `clipboardHtml` carries whatever it chose to).
|
|
2021
|
+
* Return `true` to say the paste was applied; anything else lets the grid
|
|
2022
|
+
* paste the text as it always has. Runs inside one history group, so
|
|
2023
|
+
* every `setCellValue` and `recordUndo` the handler makes is one Ctrl+Z.
|
|
2024
|
+
*
|
|
2025
|
+
* With this set, Ctrl+V lets the browser's own `paste` event through
|
|
2026
|
+
* (that is where the unsanitised HTML is), and the async Clipboard API is
|
|
2027
|
+
* the fallback for a browser that does not deliver it. `source` says
|
|
2028
|
+
* which path the payload came by.
|
|
2029
|
+
*/
|
|
2030
|
+
onPasteClipboard?: (payload: {
|
|
2031
|
+
text: string;
|
|
2032
|
+
html: string | null;
|
|
2033
|
+
source: "event" | "async";
|
|
2034
|
+
}) => boolean | void;
|
|
2035
|
+
/**
|
|
2036
|
+
* Transform each cell on its way IN from the clipboard, before the grid
|
|
2037
|
+
* coerces it for the column's editor. Symmetric with
|
|
2038
|
+
* `processCellForClipboard`: the pair is what lets a round trip survive.
|
|
2039
|
+
*
|
|
2040
|
+
* Receives the raw clipboard text for the cell plus where it is landing.
|
|
2041
|
+
* Return the value to write, or `undefined` to leave the cell untouched.
|
|
2042
|
+
*
|
|
2043
|
+
* This is also the seam a feature pack uses to take over a paste entirely:
|
|
2044
|
+
* `@svgrid/enterprise`'s paste-special reads the clipboard's `text/html`
|
|
2045
|
+
* for formats and formulas and writes through here.
|
|
2046
|
+
*/
|
|
2047
|
+
processCellFromClipboard?: (params: {
|
|
2048
|
+
/** The raw text from the clipboard for this cell. */
|
|
2049
|
+
text: string;
|
|
2050
|
+
/** What the grid would have written after its own coercion. */
|
|
2051
|
+
parsedValue: unknown;
|
|
2052
|
+
row: TData;
|
|
2053
|
+
rowIndex: number;
|
|
2054
|
+
columnId: string;
|
|
2055
|
+
}) => unknown;
|
|
1628
2056
|
/**
|
|
1629
2057
|
* Inline cell editing: F2 or double-click opens an editor in the active cell,
|
|
1630
2058
|
* Enter commits, Esc cancels. Off by default.
|
|
@@ -1634,6 +2062,14 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1634
2062
|
* `editable` is the shortcut alias and wins over this.
|
|
1635
2063
|
*/
|
|
1636
2064
|
enableInlineEditing?: boolean;
|
|
2065
|
+
/**
|
|
2066
|
+
* A click on the cell that is already active opens its editor, the way a
|
|
2067
|
+
* second click on a selected file name starts renaming it. On by default.
|
|
2068
|
+
* A spreadsheet turns it off: Excel edits on double-click or F2 only, and
|
|
2069
|
+
* a user clicking the cell they are on to get back to it after a dialog
|
|
2070
|
+
* would otherwise find the next shortcut typed into an editor.
|
|
2071
|
+
*/
|
|
2072
|
+
editOnSecondClick?: boolean;
|
|
1637
2073
|
/**
|
|
1638
2074
|
* Full-row editing. When `true`, starting an edit puts the WHOLE row into
|
|
1639
2075
|
* edit mode - every editable cell shows an inline editor at once - and a
|
|
@@ -1941,6 +2377,99 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1941
2377
|
scrollHeight: number;
|
|
1942
2378
|
clientHeight: number;
|
|
1943
2379
|
}) => void;
|
|
2380
|
+
/**
|
|
2381
|
+
* Fires when the range of rows on screen changes, with the first and last
|
|
2382
|
+
* row INDEX (not pixels). Coalesced to one call per frame, so it is cheap
|
|
2383
|
+
* to wire to something that fetches.
|
|
2384
|
+
*
|
|
2385
|
+
* This is the hook a block-loading data source needs and
|
|
2386
|
+
* `onScrollBottomReached` cannot give it: "the user is looking at rows
|
|
2387
|
+
* 4,000-4,020" answers which block to fetch and which to keep, while
|
|
2388
|
+
* "they hit the bottom" only ever means "append more". Both are free; use
|
|
2389
|
+
* this one with `createServerDataSource({ mode: 'infinite' })`, or let
|
|
2390
|
+
* `rowModel` wire it for you.
|
|
2391
|
+
*
|
|
2392
|
+
* Reports `0, data.length - 1` when virtualization is off, since every row
|
|
2393
|
+
* really is rendered.
|
|
2394
|
+
*/
|
|
2395
|
+
onVisibleRangeChange?: (range: {
|
|
2396
|
+
startIndex: number;
|
|
2397
|
+
endIndex: number;
|
|
2398
|
+
}) => void;
|
|
2399
|
+
/**
|
|
2400
|
+
* Marks a row as one whose data has not arrived: `"loading"` draws a
|
|
2401
|
+
* shimmer in every cell, `"failed"` draws a full-width "could not load"
|
|
2402
|
+
* row with a Retry button, and `null` (the default for every row) renders
|
|
2403
|
+
* normally.
|
|
2404
|
+
*
|
|
2405
|
+
* Placeholder rows are inert - not selectable, not editable, and skipped
|
|
2406
|
+
* by cell navigation - because there is nothing there to act on yet.
|
|
2407
|
+
*
|
|
2408
|
+
* `createServerDataSource` in `infinite` mode fills the gaps with rows this
|
|
2409
|
+
* recognises, so the usual wiring is `rowPlaceholder={rowPlaceholderState}`
|
|
2410
|
+
* (or nothing at all, via `rowModel`).
|
|
2411
|
+
*/
|
|
2412
|
+
rowPlaceholder?: (row: TData, rowIndex: number) => "loading" | "failed" | null;
|
|
2413
|
+
/** Called by the Retry button on a `"failed"` placeholder row. */
|
|
2414
|
+
onRetryRow?: (row: TData, rowIndex: number) => void;
|
|
2415
|
+
/**
|
|
2416
|
+
* Hand selection over to an external model.
|
|
2417
|
+
*
|
|
2418
|
+
* The grid normally tracks selection as a record of the row ids it has
|
|
2419
|
+
* seen, which is right until the rows it has seen are a window onto a
|
|
2420
|
+
* million on a server: "select all" then means 20 ticked checkboxes rather
|
|
2421
|
+
* than a million, and the header checkbox cannot honestly say `all`. A
|
|
2422
|
+
* model that stores the RULE ("everything except these three") can answer
|
|
2423
|
+
* both, so when this is set the header checkbox, the row checkboxes and
|
|
2424
|
+
* `api.selectAllRows()` all route through it instead.
|
|
2425
|
+
*
|
|
2426
|
+
* `@svgrid/enterprise` ships one for the server-side row model; this is the
|
|
2427
|
+
* seam it plugs into.
|
|
2428
|
+
*/
|
|
2429
|
+
/**
|
|
2430
|
+
* Drive the grid from a row model instead of wiring a dozen props.
|
|
2431
|
+
*
|
|
2432
|
+
* `createServerDataSource` returns one, and so does the Enterprise
|
|
2433
|
+
* server-side row model, so server-backed grids become:
|
|
2434
|
+
*
|
|
2435
|
+
* ```svelte
|
|
2436
|
+
* <SvGrid rowModel={ctl} {columns} />
|
|
2437
|
+
* ```
|
|
2438
|
+
*
|
|
2439
|
+
* The model supplies `data`, `loading`, `getRowId`, the external sort
|
|
2440
|
+
* and filter wiring, the visible range, placeholder rows, group
|
|
2441
|
+
* accessors, selection and paging - each one only if it implements that
|
|
2442
|
+
* part. A prop written explicitly on the grid always wins, so you can
|
|
2443
|
+
* adopt it and still override one piece.
|
|
2444
|
+
*/
|
|
2445
|
+
rowModel?: GridRowModel<TData>;
|
|
2446
|
+
/**
|
|
2447
|
+
* Columns that REPLACE `columns` while set. The server-side row model
|
|
2448
|
+
* supplies them in pivot mode - one column per pivoted value, grouped
|
|
2449
|
+
* under a header per pivot key - and clears them when pivot mode ends,
|
|
2450
|
+
* so `columns` stays the app's own list. Rarely set by hand.
|
|
2451
|
+
*/
|
|
2452
|
+
pivotResultColumns?: Array<ColumnDef<TFeatures, TData>> | null;
|
|
2453
|
+
rowSelectionModel?: {
|
|
2454
|
+
isSelected: (rowId: string, row: TData) => boolean;
|
|
2455
|
+
/** Whether the header checkbox shows empty, indeterminate, or ticked. */
|
|
2456
|
+
headerState: () => "none" | "some" | "all";
|
|
2457
|
+
toggle: (rowId: string, row: TData, next: boolean) => void;
|
|
2458
|
+
/** The header checkbox: select or clear everything, loaded or not. */
|
|
2459
|
+
toggleAll: (next: boolean) => void;
|
|
2460
|
+
/**
|
|
2461
|
+
* How many rows the rule selects, counting the ones the grid never
|
|
2462
|
+
* loaded; `null` when it cannot say. The selection bar shows this
|
|
2463
|
+
* instead of counting ticked rows on screen.
|
|
2464
|
+
*/
|
|
2465
|
+
selectedCount?: () => number | null;
|
|
2466
|
+
/**
|
|
2467
|
+
* Apply one patch to every selected row, loaded or not. When present,
|
|
2468
|
+
* the bulk-edit drawer sends its edits here instead of writing the
|
|
2469
|
+
* loaded cells. Resolves with how many rows changed.
|
|
2470
|
+
*/
|
|
2471
|
+
bulkUpdate?: (patch: Record<string, unknown>) => Promise<number>;
|
|
2472
|
+
};
|
|
1944
2473
|
/**
|
|
1945
2474
|
* Marks a row as an expandable "detail row". When this returns true the
|
|
1946
2475
|
* grid renders that row as a SINGLE full-width cell (colspan across every
|
|
@@ -1961,8 +2490,10 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1961
2490
|
* Server-side group / tree keyboard + accessibility, built into the grid. When
|
|
1962
2491
|
* set, the grid uses the treegrid role and marks matching rows with
|
|
1963
2492
|
* `aria-level` / `aria-expanded`, and ArrowRight / ArrowLeft expand / collapse
|
|
1964
|
-
* the focused group row (no app-level key handling). Pair with
|
|
1965
|
-
* + `SvGroupCell` for the visual
|
|
2493
|
+
* the focused group row (no app-level key handling). Pair with
|
|
2494
|
+
* `serverGroupRows` + `SvGroupCell` from `@svgrid/enterprise` for the visual
|
|
2495
|
+
* expander, or drive it from your own tree state. Every accessor receives the
|
|
2496
|
+
* row data.
|
|
1966
2497
|
*/
|
|
1967
2498
|
serverGroup?: {
|
|
1968
2499
|
/** Whether a row is an expandable group / branch. */
|
|
@@ -1991,6 +2522,28 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1991
2522
|
* main grid; field/format/cell/cellClass all apply.
|
|
1992
2523
|
*/
|
|
1993
2524
|
pinnedTopRows?: ReadonlyArray<TData>;
|
|
2525
|
+
/**
|
|
2526
|
+
* Freeze the first N rows: they stay under the header while the body
|
|
2527
|
+
* scrolls, and unlike `pinnedTopRows` they are the grid's own rows,
|
|
2528
|
+
* still editable, selectable and numbered as rows 1..N. Excel's Freeze
|
|
2529
|
+
* Panes, for the row half; the column half is `columnPinning`. Under
|
|
2530
|
+
* `virtualization` the frozen rows are always rendered and the window
|
|
2531
|
+
* skips them.
|
|
2532
|
+
*/
|
|
2533
|
+
frozenRows?: number;
|
|
2534
|
+
/**
|
|
2535
|
+
* Merged cells: rectangles drawn as one cell, a spreadsheet's Merge &
|
|
2536
|
+
* Center. Each entry is the top-left cell (display indices) and how many
|
|
2537
|
+
* rows and columns it covers. The origin's td takes the span and shows
|
|
2538
|
+
* the origin's value; the covered cells are not drawn, a selection grows
|
|
2539
|
+
* to whole merges, the active cell inside a merge is its origin, and the
|
|
2540
|
+
* arrow keys step over a merge as one cell. A merge that crosses the
|
|
2541
|
+
* frozen boundary or the rendered window is drawn in parts, one per
|
|
2542
|
+
* band. The grid does not write into covered cells on its own; a
|
|
2543
|
+
* consumer that merges cells keeps them empty or marks them read-only
|
|
2544
|
+
* through the column's `editable`.
|
|
2545
|
+
*/
|
|
2546
|
+
mergedCells?: ReadonlyArray<{ rowIndex: number; colIndex: number; rowSpan: number; colSpan: number }>;
|
|
1994
2547
|
/**
|
|
1995
2548
|
* Rows to pin to the BOTTOM of the grid - rendered below the regular
|
|
1996
2549
|
* rows and sticky-positioned (sticks to the bottom of the viewport
|