@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/dist/SvGrid.types.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
+
import type { GridRowModel } from "./row-model.js";
|
|
2
3
|
import type { CellEditorType, ColumnDef, RowData, SvGridApi, TableFeatures } from "./index.js";
|
|
3
4
|
import type { ConditionalFormat } from "./conditional-formatting.js";
|
|
4
5
|
import type { GroupDisplayType } from "./group-display.js";
|
|
5
6
|
import type { GridMessages } from "./grid-messages.js";
|
|
7
|
+
import type { ChartMessages } from "./chart-messages.js";
|
|
6
8
|
import type { GridIconName, GridIcons } from "./grid-icons.js";
|
|
7
9
|
import type { GridPivotConfig } from "./pivot-view.svelte.js";
|
|
8
10
|
import type { GridPredicateExpr } from "./filtering/predicate-expr.js";
|
|
@@ -52,7 +54,18 @@ export type SchedulerResource = {
|
|
|
52
54
|
}>;
|
|
53
55
|
}>;
|
|
54
56
|
};
|
|
55
|
-
import type { ChartType, ChartSpec, ChartAnnotation, ChartReferenceLine, ChartValueFormat } from "./chart.js";
|
|
57
|
+
import type { ChartType, ChartSpec, ChartAnnotation, ChartReducer, ChartReferenceLine, ChartValueFormat } from "./chart.js";
|
|
58
|
+
import type { ChartRangePreset } from "./chart-zoom.js";
|
|
59
|
+
import type { ChartAnimateConfig, ChartContextTarget, ChartZoomConfig } from "./SvGridChart.types.js";
|
|
60
|
+
/** What the chart panel's lifecycle events carry. */
|
|
61
|
+
export type ChartPanelInfo = {
|
|
62
|
+
/** Tab index in the panel's strip. */
|
|
63
|
+
index: number;
|
|
64
|
+
title: string;
|
|
65
|
+
type: ChartType;
|
|
66
|
+
/** The spec the panel is rendering, or null while it cannot build one. */
|
|
67
|
+
spec: ChartSpec | null;
|
|
68
|
+
};
|
|
56
69
|
/** One aggregated bucket returned by a server-side `getAggregate`. */
|
|
57
70
|
export type ChartAggregateBucket = {
|
|
58
71
|
category: string;
|
|
@@ -64,7 +77,7 @@ export type ChartAggregateRequest = {
|
|
|
64
77
|
dimension: string | undefined;
|
|
65
78
|
measure: string | null;
|
|
66
79
|
series?: string;
|
|
67
|
-
reduce:
|
|
80
|
+
reduce: ChartReducer;
|
|
68
81
|
filterModel: Record<string, unknown>;
|
|
69
82
|
};
|
|
70
83
|
/**
|
|
@@ -91,7 +104,7 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
91
104
|
series?: string;
|
|
92
105
|
/** Measure column, or several for a multi-series chart. */
|
|
93
106
|
measures?: string | string[];
|
|
94
|
-
reduce?:
|
|
107
|
+
reduce?: ChartReducer;
|
|
95
108
|
stacked?: boolean;
|
|
96
109
|
stacked100?: boolean;
|
|
97
110
|
/** Per-series-label type override (combo). */
|
|
@@ -100,7 +113,10 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
100
113
|
seriesAxes?: Record<string, "left" | "right">;
|
|
101
114
|
referenceLines?: ChartReferenceLine[];
|
|
102
115
|
averageLine?: boolean;
|
|
103
|
-
|
|
116
|
+
/** An overlay on every series: a 7-point moving average, or a regression
|
|
117
|
+
* (`linear`, `poly` for a quadratic, `exp`, `log`, `power`) whose
|
|
118
|
+
* R-squared the tooltip reads. */
|
|
119
|
+
trend?: "sma" | "ema" | "linear" | "poly" | "exp" | "log" | "power";
|
|
104
120
|
annotations?: ChartAnnotation[];
|
|
105
121
|
yScale?: "linear" | "log";
|
|
106
122
|
timeAxis?: boolean;
|
|
@@ -121,10 +137,37 @@ export type ChartingConfig<TData extends RowData = RowData> = {
|
|
|
121
137
|
otherLabel?: string;
|
|
122
138
|
sort?: "value-desc" | "value-asc" | "category" | "none";
|
|
123
139
|
dataLabels?: boolean;
|
|
124
|
-
zoom
|
|
140
|
+
/** Zooming: `true` for drag-to-zoom, or an object choosing wheel, pinch,
|
|
141
|
+
* pan and the axes (see `ChartZoomConfig`). The window survives tab
|
|
142
|
+
* switches and round-trips through `getChartsState`. */
|
|
143
|
+
zoom?: boolean | ChartZoomConfig;
|
|
125
144
|
brush?: boolean;
|
|
145
|
+
/** Range buttons (1W / 1M / 3M / 6M / YTD / 1Y / All, or your own) when the
|
|
146
|
+
* dimension is a date. */
|
|
147
|
+
rangePresets?: boolean | ChartRangePreset[];
|
|
148
|
+
/** Share crosshair and zoom with other charts on the page (any `SvChart`
|
|
149
|
+
* with the same `syncGroup`). */
|
|
150
|
+
syncGroup?: string;
|
|
151
|
+
/** All chart tabs of this grid share one zoom window: zoom in one tab and
|
|
152
|
+
* the others open at the same range. */
|
|
153
|
+
syncTabs?: boolean;
|
|
154
|
+
/** Right-click menu on the chart: `true` for the built-in items, your own
|
|
155
|
+
* `MenuItem`s appended after them, or a function of the clicked point. */
|
|
156
|
+
contextMenu?: boolean | MenuItem[] | ((target: ChartContextTarget) => MenuItem[]);
|
|
157
|
+
/** Motion: `true` for the default data-update tween, or an object choosing
|
|
158
|
+
* the enter effect and duration. */
|
|
159
|
+
animate?: boolean | ChartAnimateConfig;
|
|
160
|
+
/** Translations for the chart's own strings (toolbar, menu, legend hints,
|
|
161
|
+
* what it says to assistive technology); the panel passes them to every
|
|
162
|
+
* chart it draws. See `ChartMessages`. */
|
|
163
|
+
localeText?: Partial<ChartMessages>;
|
|
126
164
|
/** Show the chart's PNG/SVG export toolbar. */
|
|
127
165
|
export?: boolean;
|
|
166
|
+
/** A chart tab was added (the first one counts, once the panel opens). */
|
|
167
|
+
onChartCreated?: (info: ChartPanelInfo) => void;
|
|
168
|
+
/** The active chart's spec changed: a picker, the builder, a filter, an
|
|
169
|
+
* edit, new rows. Debounced to one call per burst of changes. */
|
|
170
|
+
onChartChanged?: (info: ChartPanelInfo) => void;
|
|
128
171
|
/** Escape hatch: build a fully custom ChartSpec from the (scoped) rows. */
|
|
129
172
|
buildSpec?: (rows: TData[]) => ChartSpec | null;
|
|
130
173
|
/** Server-side aggregation: chart the whole dataset, not just loaded rows. */
|
|
@@ -189,15 +232,44 @@ export type ContextMenuTarget<TData extends RowData = RowData> = {
|
|
|
189
232
|
* "chart"`. The `"chart"` item (chart the selected range) is only shown when
|
|
190
233
|
* `charting` is enabled; it is appended to the default menu automatically.
|
|
191
234
|
*/
|
|
235
|
+
/**
|
|
236
|
+
* An icon of your own for a context-menu item: path data on a 16 x 16 grid,
|
|
237
|
+
* drawn in the text colour with a 1.4px round stroke (`fill` for a solid
|
|
238
|
+
* part, `width` and `dash` to vary the stroke). The same shape a
|
|
239
|
+
* spreadsheet ribbon's icon set uses, so one set serves both.
|
|
240
|
+
*/
|
|
241
|
+
export type ContextMenuIcon = {
|
|
242
|
+
paths: ReadonlyArray<{
|
|
243
|
+
d: string;
|
|
244
|
+
fill?: boolean;
|
|
245
|
+
width?: number;
|
|
246
|
+
dash?: string;
|
|
247
|
+
}>;
|
|
248
|
+
};
|
|
192
249
|
export type ContextMenuItem<TData extends RowData = RowData> = string | {
|
|
193
250
|
key: string;
|
|
194
|
-
|
|
251
|
+
/**
|
|
252
|
+
* The text. An object whose `key` names a built-in (`copy`, `cut`,
|
|
253
|
+
* `paste`, `clear`, `row_above`, `row_below`, `remove_row`,
|
|
254
|
+
* `remove_col`, `comment`, `chart`) keeps the built-in's own label
|
|
255
|
+
* when this is omitted.
|
|
256
|
+
*/
|
|
257
|
+
label?: string;
|
|
258
|
+
/**
|
|
259
|
+
* A glyph before the label: one of the grid's icons by name, or path
|
|
260
|
+
* data of your own. Items without one keep the gutter, so the labels
|
|
261
|
+
* line up.
|
|
262
|
+
*/
|
|
263
|
+
icon?: GridIconName | ContextMenuIcon;
|
|
195
264
|
/** Hide the item entirely for this target. */
|
|
196
265
|
hidden?: (target: ContextMenuTarget<TData>) => boolean;
|
|
197
266
|
/** Render the item greyed-out and non-clickable for this target. */
|
|
198
267
|
disabled?: (target: ContextMenuTarget<TData>) => boolean;
|
|
199
|
-
/**
|
|
200
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Invoked on click. The menu closes afterwards. Omit it on a built-in
|
|
270
|
+
* key to keep what the built-in does and only give it an icon.
|
|
271
|
+
*/
|
|
272
|
+
action?: (target: ContextMenuTarget<TData>) => void;
|
|
201
273
|
};
|
|
202
274
|
/** What a {@link SelectionBarAction} is handed when it runs. */
|
|
203
275
|
export type SelectionBarTarget<TData extends RowData = RowData> = {
|
|
@@ -377,7 +449,7 @@ export type ChartViewConfig<TFeatures extends TableFeatures = TableFeatures, TDa
|
|
|
377
449
|
/** Pivot dimension: one series per distinct value of this field. */
|
|
378
450
|
series?: keyof TData & string;
|
|
379
451
|
/** Aggregation when several rows share a category. Default `'sum'`. */
|
|
380
|
-
reduce?:
|
|
452
|
+
reduce?: ChartReducer;
|
|
381
453
|
/** Stack bar / area series instead of grouping them. */
|
|
382
454
|
stacked?: boolean;
|
|
383
455
|
/** Stack to 100% (implies `stacked`). */
|
|
@@ -1003,8 +1075,256 @@ export type SchedulerConfig<TFeatures extends TableFeatures = TableFeatures, TDa
|
|
|
1003
1075
|
searchable?: boolean;
|
|
1004
1076
|
searchPlaceholder?: string;
|
|
1005
1077
|
};
|
|
1078
|
+
/**
|
|
1079
|
+
* The Gantt axis presets: which unit is a tick and which is the coarser row
|
|
1080
|
+
* grouping them. `week` (day ticks under month majors) is the default.
|
|
1081
|
+
*/
|
|
1082
|
+
export type GanttZoom = "day" | "week" | "month" | "quarter" | "year";
|
|
1083
|
+
/**
|
|
1084
|
+
* The four classic dependency kinds. `FS` (finish-to-start) is the default:
|
|
1085
|
+
* the successor may not start before the predecessor finishes.
|
|
1086
|
+
*/
|
|
1087
|
+
export type GanttDependencyType = "FS" | "SS" | "FF" | "SF";
|
|
1088
|
+
/**
|
|
1089
|
+
* A link from a predecessor task (`from`) to a successor (`to`). Both are row
|
|
1090
|
+
* ids (the grid's `getRowId`). `lag` is in DAYS - negative for a lead, so
|
|
1091
|
+
* `{ type: 'FS', lag: -1 }` lets the successor start a day before the
|
|
1092
|
+
* predecessor finishes.
|
|
1093
|
+
*/
|
|
1094
|
+
export type GanttDependency = {
|
|
1095
|
+
id: string;
|
|
1096
|
+
from: string;
|
|
1097
|
+
to: string;
|
|
1098
|
+
type?: GanttDependencyType;
|
|
1099
|
+
lag?: number;
|
|
1100
|
+
};
|
|
1101
|
+
/** Fired when a task bar is dragged to new dates. {@link GanttConfig.onTaskMove}. */
|
|
1102
|
+
export type GanttTaskMoveEvent<TData extends RowData = RowData> = {
|
|
1103
|
+
row: TData;
|
|
1104
|
+
start: Date;
|
|
1105
|
+
end: Date;
|
|
1106
|
+
/**
|
|
1107
|
+
* The moved row's descendants, shifted by the same delta - present only when
|
|
1108
|
+
* a summary (parent) bar was dragged. Cascaded successors are NOT here; they
|
|
1109
|
+
* arrive through {@link GanttConfig.onDependenciesChange}.
|
|
1110
|
+
*/
|
|
1111
|
+
subtree?: Array<{
|
|
1112
|
+
row: TData;
|
|
1113
|
+
start: Date;
|
|
1114
|
+
end: Date;
|
|
1115
|
+
}>;
|
|
1116
|
+
};
|
|
1117
|
+
/** Fired when a task bar's edge is dragged. {@link GanttConfig.onTaskResize}. */
|
|
1118
|
+
export type GanttTaskResizeEvent<TData extends RowData = RowData> = {
|
|
1119
|
+
row: TData;
|
|
1120
|
+
start: Date;
|
|
1121
|
+
end: Date;
|
|
1122
|
+
/** Which edge the user dragged. */
|
|
1123
|
+
edge: "start" | "end";
|
|
1124
|
+
};
|
|
1125
|
+
/** Fired when a bar's progress grip is dragged. {@link GanttConfig.onProgressChange}. */
|
|
1126
|
+
export type GanttProgressChangeEvent<TData extends RowData = RowData> = {
|
|
1127
|
+
row: TData;
|
|
1128
|
+
/** 0-100, in whole percent. */
|
|
1129
|
+
progress: number;
|
|
1130
|
+
};
|
|
1131
|
+
/** Fired when the Gantt's detail drawer is saved. {@link GanttConfig.onTaskCommit}. */
|
|
1132
|
+
export type GanttTaskCommitEvent<TData extends RowData = RowData> = {
|
|
1133
|
+
row: TData;
|
|
1134
|
+
values: Partial<TData>;
|
|
1135
|
+
};
|
|
1136
|
+
/**
|
|
1137
|
+
* The Gantt's built-in task drawer. Same shape as the scheduler's - a field
|
|
1138
|
+
* list, a title and a width - so one drawer config type covers both views.
|
|
1139
|
+
*/
|
|
1140
|
+
export type GanttDrawerConfig<TData extends RowData = RowData> = SchedulerDrawerConfig<TData>;
|
|
1141
|
+
/**
|
|
1142
|
+
* Turns the grid into a Gantt chart. Set `gantt` and the grid renders its rows
|
|
1143
|
+
* as a task table beside a time chart: one bar per row positioned by start /
|
|
1144
|
+
* end, nested into a work-breakdown tree by `parentField`, with dependency
|
|
1145
|
+
* arrows between linked tasks.
|
|
1146
|
+
*
|
|
1147
|
+
* Like the Kanban board and the scheduler it is a pure *view of the grid*: it
|
|
1148
|
+
* renders the grid's filtered + sorted rows and writes back only through
|
|
1149
|
+
* callbacks, never mutating your data. Dragging a bar fires
|
|
1150
|
+
* {@link GanttConfig.onTaskMove} where you reassign the dates on your own rows.
|
|
1151
|
+
*
|
|
1152
|
+
* Dates are local calendar days and `end` is EXCLUSIVE, except that a date-only
|
|
1153
|
+
* string (`'2026-09-14'`, no time part) is read as the end OF that day - the
|
|
1154
|
+
* inclusive convention planning tools use. So
|
|
1155
|
+
* `{ start: '2026-09-14', end: '2026-09-16' }` draws a three-day bar.
|
|
1156
|
+
*/
|
|
1157
|
+
export type GanttConfig<TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData> = {
|
|
1158
|
+
/** Field holding each task's start (`Date` | epoch-ms | ISO string). Required. */
|
|
1159
|
+
startField: keyof TData & string;
|
|
1160
|
+
/** Field holding the end. Omit to use `durationField`, else the task is a milestone. */
|
|
1161
|
+
endField?: keyof TData & string;
|
|
1162
|
+
/** Field holding the length in WORKING days, used when `endField` is absent. */
|
|
1163
|
+
durationField?: keyof TData & string;
|
|
1164
|
+
/** Field for the task name. Defaults to the first column's field. */
|
|
1165
|
+
titleField?: keyof TData & string;
|
|
1166
|
+
/** Field holding percent complete (0-100). Drives the bar's inner fill. */
|
|
1167
|
+
progressField?: keyof TData & string;
|
|
1168
|
+
/**
|
|
1169
|
+
* Field holding each row's PARENT task id, nesting the flat rows into a
|
|
1170
|
+
* work-breakdown tree. Parents render a rolled-up summary bar and a collapse
|
|
1171
|
+
* chevron. Rows whose parent is missing become roots rather than vanishing.
|
|
1172
|
+
*
|
|
1173
|
+
* This is the Gantt's own tree - do NOT also set the grid's `treeData` prop.
|
|
1174
|
+
* `treeData` hides collapsed children from the view entirely, which would
|
|
1175
|
+
* drop them out of their phase's summary bar.
|
|
1176
|
+
*/
|
|
1177
|
+
parentField?: keyof TData & string;
|
|
1178
|
+
/**
|
|
1179
|
+
* Boolean field marking a task as a milestone (a diamond, no length). A task
|
|
1180
|
+
* whose end equals its start renders as one regardless.
|
|
1181
|
+
*/
|
|
1182
|
+
milestoneField?: keyof TData & string;
|
|
1183
|
+
/** Field holding a per-task accent color (any CSS color). Else `color`. */
|
|
1184
|
+
colorField?: keyof TData & string;
|
|
1185
|
+
/** Fallback accent color for every bar. */
|
|
1186
|
+
color?: string;
|
|
1187
|
+
/**
|
|
1188
|
+
* Predecessor -> successor links, drawn as arrows between bars. `from` / `to`
|
|
1189
|
+
* are row ids (your `getRowId`). See {@link GanttDependency}.
|
|
1190
|
+
*/
|
|
1191
|
+
dependencies?: ReadonlyArray<GanttDependency>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Per-row field holding that row's links (as `GanttDependency[]` or a plain
|
|
1194
|
+
* list of successor ids). An alternative to the flat `dependencies` array.
|
|
1195
|
+
*/
|
|
1196
|
+
dependencyField?: keyof TData & string;
|
|
1197
|
+
/**
|
|
1198
|
+
* Cascade successors forward on move / resize so every link stays legal,
|
|
1199
|
+
* preserving each task's duration. Defaults to `true` when any dependency is
|
|
1200
|
+
* present. Cascading never pulls a task earlier.
|
|
1201
|
+
*/
|
|
1202
|
+
autoReschedule?: boolean;
|
|
1203
|
+
/**
|
|
1204
|
+
* Schedule in working time (see `nonWorkingDays` / `holidays`): a moved
|
|
1205
|
+
* or cascaded task lands on a working day and keeps its WORKING length, so
|
|
1206
|
+
* a five-day task dragged over a weekend stays five days of work, and the
|
|
1207
|
+
* critical path measures slack in working days. `false` schedules in
|
|
1208
|
+
* calendar time. Default `true`.
|
|
1209
|
+
*/
|
|
1210
|
+
respectWorkingTime?: boolean;
|
|
1211
|
+
/** Fired with the cascaded shifts after a move / resize (never mutates rows). */
|
|
1212
|
+
onDependenciesChange?: (moves: Array<{
|
|
1213
|
+
id: string;
|
|
1214
|
+
start: Date;
|
|
1215
|
+
end: Date;
|
|
1216
|
+
}>) => void;
|
|
1217
|
+
/** Fired when the user draws a new link (drag from one bar's edge to another). */
|
|
1218
|
+
onDependencyAdd?: (dep: GanttDependency) => void;
|
|
1219
|
+
/** Fired when the user removes a link (arrow context menu). */
|
|
1220
|
+
onDependencyRemove?: (id: string) => void;
|
|
1221
|
+
/** The axis preset the chart opens on. Default `'week'`. */
|
|
1222
|
+
zoom?: GanttZoom;
|
|
1223
|
+
/**
|
|
1224
|
+
* The presets the toolbar's zoom stepper offers. Default all five; a single
|
|
1225
|
+
* entry hides the stepper.
|
|
1226
|
+
*/
|
|
1227
|
+
zoomLevels?: ReadonlyArray<GanttZoom>;
|
|
1228
|
+
/** Fired when the zoom preset changes (stepper or Ctrl+wheel). */
|
|
1229
|
+
onZoomChange?: (zoom: GanttZoom) => void;
|
|
1230
|
+
/** First day of the week, 0-6 (0 = Sunday). Default 0. */
|
|
1231
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1232
|
+
/**
|
|
1233
|
+
* Weekday numbers (0 = Sun ... 6 = Sat) that are non-working: shaded in the
|
|
1234
|
+
* chart and skipped by duration + cascade arithmetic. Default `[0, 6]`.
|
|
1235
|
+
*/
|
|
1236
|
+
nonWorkingDays?: ReadonlyArray<number>;
|
|
1237
|
+
/** Specific dates that are non-working (holidays, closures). */
|
|
1238
|
+
holidays?: ReadonlyArray<Date | number | string>;
|
|
1239
|
+
/** Shade the non-working columns. Default `true`. */
|
|
1240
|
+
showNonWorking?: boolean;
|
|
1241
|
+
/** Draw the dashed "today" line across the chart. Default `true`. */
|
|
1242
|
+
todayLine?: boolean;
|
|
1243
|
+
/** Earliest date the axis shows and a drag may reach. */
|
|
1244
|
+
minDate?: Date | number | string;
|
|
1245
|
+
/** Latest date the axis shows and a drag may reach. */
|
|
1246
|
+
maxDate?: Date | number | string;
|
|
1247
|
+
/** Calendar days of slack around the first start / last end. Default 7. */
|
|
1248
|
+
rangePaddingDays?: number;
|
|
1249
|
+
/**
|
|
1250
|
+
* Column ids shown in the task table, in order. Defaults to every leaf
|
|
1251
|
+
* column. Two built-ins need no column definition: `'__duration'` (working
|
|
1252
|
+
* days) and `'__progress'` (a small bar).
|
|
1253
|
+
*/
|
|
1254
|
+
tableColumns?: ReadonlyArray<string>;
|
|
1255
|
+
/** Width (px) of the task table pane. Default 360; a splitter resizes it. */
|
|
1256
|
+
tableWidth?: number;
|
|
1257
|
+
/** Height (px) of one task row. Default 32. */
|
|
1258
|
+
rowHeight?: number;
|
|
1259
|
+
/** Parents draw a rolled-up summary bar spanning their children. Default `true`. */
|
|
1260
|
+
summaryBars?: boolean;
|
|
1261
|
+
/**
|
|
1262
|
+
* Where a bar's label sits: `'inside'` (default, falling back to the right
|
|
1263
|
+
* when the bar is too narrow), always `'right'`, or `'none'`.
|
|
1264
|
+
*/
|
|
1265
|
+
labelPosition?: "inside" | "right" | "none";
|
|
1266
|
+
/**
|
|
1267
|
+
* Controlled collapse: the ids of the parent rows whose children are hidden.
|
|
1268
|
+
* Omit to let the Gantt own its own collapse state.
|
|
1269
|
+
*/
|
|
1270
|
+
collapsed?: ReadonlyArray<string>;
|
|
1271
|
+
/** Fired when a chevron (or Expand / Collapse all) changes the collapsed set. */
|
|
1272
|
+
onCollapseChange?: (collapsed: string[]) => void;
|
|
1273
|
+
/**
|
|
1274
|
+
* Enable drag-to-move, edge resize, the progress grip and link drawing.
|
|
1275
|
+
* Without it the chart is read-only.
|
|
1276
|
+
*/
|
|
1277
|
+
editable?: boolean;
|
|
1278
|
+
/**
|
|
1279
|
+
* Enable undo / redo of move, resize and progress edits with `Ctrl/Cmd+Z` and
|
|
1280
|
+
* `Ctrl/Cmd+Shift+Z` (or `Ctrl+Y`). The callbacks re-fire with the reversed
|
|
1281
|
+
* values, so your data follows.
|
|
1282
|
+
*/
|
|
1283
|
+
history?: boolean;
|
|
1284
|
+
/** Fired when a bar is dragged to new dates. */
|
|
1285
|
+
onTaskMove?: (event: GanttTaskMoveEvent<TData>) => void;
|
|
1286
|
+
/** Fired when a bar's edge is dragged. */
|
|
1287
|
+
onTaskResize?: (event: GanttTaskResizeEvent<TData>) => void;
|
|
1288
|
+
/** Fired when the progress grip is dragged. */
|
|
1289
|
+
onProgressChange?: (event: GanttProgressChangeEvent<TData>) => void;
|
|
1290
|
+
/** Fired when empty chart space is double-clicked - create a task there. */
|
|
1291
|
+
onTaskAdd?: (start: Date, end: Date, parentId?: string) => void;
|
|
1292
|
+
/**
|
|
1293
|
+
* Fired from the bar's Delete action. Setting this shows Delete in the
|
|
1294
|
+
* drawer and the context menu. Remove the row from your data in the handler.
|
|
1295
|
+
*/
|
|
1296
|
+
onTaskDelete?: (row: TData) => void;
|
|
1297
|
+
/**
|
|
1298
|
+
* Custom body for a TASK bar. Receives the row. Omit for the built-in label.
|
|
1299
|
+
* A phase's summary bar is a thin spine with no room for a body, so it keeps
|
|
1300
|
+
* its plain label; a milestone has no body at all.
|
|
1301
|
+
*/
|
|
1302
|
+
task?: Snippet<[TData]>;
|
|
1303
|
+
/**
|
|
1304
|
+
* Hover tooltip for a bar. A `Snippet<[TData]>` for custom content, or `true`
|
|
1305
|
+
* for the built-in one (title, dates, duration, percent). Omit to disable.
|
|
1306
|
+
*/
|
|
1307
|
+
tooltip?: boolean | Snippet<[TData]>;
|
|
1308
|
+
/** Delay (ms) before the hover tooltip opens. Default 400. */
|
|
1309
|
+
tooltipDelay?: number;
|
|
1310
|
+
/** Built-in task drawer: `true` for all fields, or a config object. */
|
|
1311
|
+
drawer?: boolean | GanttDrawerConfig<TData>;
|
|
1312
|
+
/** Fired when the drawer is saved. */
|
|
1313
|
+
onTaskCommit?: (event: GanttTaskCommitEvent<TData>) => void;
|
|
1314
|
+
/** Right-click menu for a bar. Return items or `undefined` to suppress. */
|
|
1315
|
+
taskMenu?: (row: TData) => MenuItem[] | undefined;
|
|
1316
|
+
/** Show the search box (binds to the grid's global filter). Default `true`. */
|
|
1317
|
+
searchable?: boolean;
|
|
1318
|
+
searchPlaceholder?: string;
|
|
1319
|
+
};
|
|
1006
1320
|
export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData> = {
|
|
1007
|
-
|
|
1321
|
+
/**
|
|
1322
|
+
* The rows to render.
|
|
1323
|
+
*
|
|
1324
|
+
* Optional only because `rowModel` can supply them instead; a grid with
|
|
1325
|
+
* neither renders empty. When both are present `data` wins.
|
|
1326
|
+
*/
|
|
1327
|
+
data?: ReadonlyArray<TData>;
|
|
1008
1328
|
columns: Array<ColumnDef<TFeatures, TData>>;
|
|
1009
1329
|
/**
|
|
1010
1330
|
* Kanban board mode. When set, the grid renders its rows as cards in
|
|
@@ -1018,6 +1338,15 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1018
1338
|
* {@link SchedulerConfig}.
|
|
1019
1339
|
*/
|
|
1020
1340
|
scheduler?: SchedulerConfig<TFeatures, TData>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Gantt mode. When set, the grid renders its rows as a task table beside a
|
|
1343
|
+
* time chart: one bar per row by start / end, a work-breakdown tree from
|
|
1344
|
+
* `parentField`, and dependency arrows. See {@link GanttConfig}.
|
|
1345
|
+
*
|
|
1346
|
+
* A view of the grid like the board and scheduler; the renderer ships in
|
|
1347
|
+
* `@svgrid/enterprise` (call `enableGanttView()`).
|
|
1348
|
+
*/
|
|
1349
|
+
gantt?: GanttConfig<TFeatures, TData>;
|
|
1021
1350
|
/**
|
|
1022
1351
|
* Chart view. When set, the grid renders its FILTERED + SORTED rows as a chart
|
|
1023
1352
|
* instead of a table (search / filters / sort flow through). Unlike board and
|
|
@@ -1516,6 +1845,23 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1516
1845
|
* that leaves this off never fetches that code.
|
|
1517
1846
|
*/
|
|
1518
1847
|
columnResize?: boolean;
|
|
1848
|
+
/**
|
|
1849
|
+
* The user dragged a column's edge (or double-clicked it to autosize).
|
|
1850
|
+
* Programmatic `api.setColumnWidth` does not fire it.
|
|
1851
|
+
*/
|
|
1852
|
+
onColumnResize?: (event: {
|
|
1853
|
+
columnId: string;
|
|
1854
|
+
width: number;
|
|
1855
|
+
}) => void;
|
|
1856
|
+
/**
|
|
1857
|
+
* The user dragged a row's edge, or double-clicked it: `height` is then
|
|
1858
|
+
* `null`, the row back at its declared height. Programmatic
|
|
1859
|
+
* `api.setRowHeight` does not fire it.
|
|
1860
|
+
*/
|
|
1861
|
+
onRowResize?: (event: {
|
|
1862
|
+
rowIndex: number;
|
|
1863
|
+
height: number | null;
|
|
1864
|
+
}) => void;
|
|
1519
1865
|
/**
|
|
1520
1866
|
* Make the grid usable on narrow screens. When the grid's own width drops
|
|
1521
1867
|
* below the breakpoint (default `640`px), pinned columns are un-pinned so the
|
|
@@ -1580,6 +1926,25 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1580
1926
|
* currency symbols, expand codes to labels, or redact. Receives the display
|
|
1581
1927
|
* value plus the row/column context; return the string (or value) to copy.
|
|
1582
1928
|
*/
|
|
1929
|
+
/**
|
|
1930
|
+
* Decide what the fill handle writes into one cell, ahead of the grid's
|
|
1931
|
+
* own pattern rules (series, weekdays, "Item 1"). Receives the source
|
|
1932
|
+
* cell's value and how far the target sits from it; return the value to
|
|
1933
|
+
* write, or `undefined` to let the pattern decide. A spreadsheet uses it
|
|
1934
|
+
* to move a formula's references by the distance filled, which the
|
|
1935
|
+
* pattern rules would otherwise mangle ("=A1+B1" reads as "Item 1").
|
|
1936
|
+
*/
|
|
1937
|
+
processCellForFill?: (params: {
|
|
1938
|
+
/** The source cell's value the target cycles back to. */
|
|
1939
|
+
value: unknown;
|
|
1940
|
+
/** Rows and columns from that source cell to the target. */
|
|
1941
|
+
delta: {
|
|
1942
|
+
rows: number;
|
|
1943
|
+
cols: number;
|
|
1944
|
+
};
|
|
1945
|
+
rowIndex: number;
|
|
1946
|
+
columnId: string;
|
|
1947
|
+
}) => unknown;
|
|
1583
1948
|
processCellForClipboard?: (params: {
|
|
1584
1949
|
value: unknown;
|
|
1585
1950
|
column: unknown;
|
|
@@ -1587,6 +1952,65 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1587
1952
|
rowIndex: number;
|
|
1588
1953
|
columnId: string;
|
|
1589
1954
|
}) => unknown;
|
|
1955
|
+
/**
|
|
1956
|
+
* An HTML rendering of what Ctrl+C copies, written to the clipboard as
|
|
1957
|
+
* `text/html` beside the TSV. Excel and Google Sheets read the HTML
|
|
1958
|
+
* first, so a table with inline styles pastes into them with its formats,
|
|
1959
|
+
* and the same markup can carry what the text cannot (a formula in a
|
|
1960
|
+
* `data-` attribute) for a round trip back into a grid that reads it.
|
|
1961
|
+
* Called after every cell has been through `processCellForClipboard`,
|
|
1962
|
+
* with the rectangles copied and the text about to be written. Return
|
|
1963
|
+
* nothing to write text alone. Runs synchronously inside the key press,
|
|
1964
|
+
* which is what the clipboard needs.
|
|
1965
|
+
*/
|
|
1966
|
+
clipboardHtml?: (params: {
|
|
1967
|
+
rects: ReadonlyArray<{
|
|
1968
|
+
minRow: number;
|
|
1969
|
+
maxRow: number;
|
|
1970
|
+
minCol: number;
|
|
1971
|
+
maxCol: number;
|
|
1972
|
+
}>;
|
|
1973
|
+
text: string;
|
|
1974
|
+
}) => string | null | undefined;
|
|
1975
|
+
/**
|
|
1976
|
+
* Take over a paste. Receives the clipboard's `text/plain` and, when the
|
|
1977
|
+
* source put one there, its `text/html` (Excel's carries formats and
|
|
1978
|
+
* formulas; a grid's own `clipboardHtml` carries whatever it chose to).
|
|
1979
|
+
* Return `true` to say the paste was applied; anything else lets the grid
|
|
1980
|
+
* paste the text as it always has. Runs inside one history group, so
|
|
1981
|
+
* every `setCellValue` and `recordUndo` the handler makes is one Ctrl+Z.
|
|
1982
|
+
*
|
|
1983
|
+
* With this set, Ctrl+V lets the browser's own `paste` event through
|
|
1984
|
+
* (that is where the unsanitised HTML is), and the async Clipboard API is
|
|
1985
|
+
* the fallback for a browser that does not deliver it. `source` says
|
|
1986
|
+
* which path the payload came by.
|
|
1987
|
+
*/
|
|
1988
|
+
onPasteClipboard?: (payload: {
|
|
1989
|
+
text: string;
|
|
1990
|
+
html: string | null;
|
|
1991
|
+
source: "event" | "async";
|
|
1992
|
+
}) => boolean | void;
|
|
1993
|
+
/**
|
|
1994
|
+
* Transform each cell on its way IN from the clipboard, before the grid
|
|
1995
|
+
* coerces it for the column's editor. Symmetric with
|
|
1996
|
+
* `processCellForClipboard`: the pair is what lets a round trip survive.
|
|
1997
|
+
*
|
|
1998
|
+
* Receives the raw clipboard text for the cell plus where it is landing.
|
|
1999
|
+
* Return the value to write, or `undefined` to leave the cell untouched.
|
|
2000
|
+
*
|
|
2001
|
+
* This is also the seam a feature pack uses to take over a paste entirely:
|
|
2002
|
+
* `@svgrid/enterprise`'s paste-special reads the clipboard's `text/html`
|
|
2003
|
+
* for formats and formulas and writes through here.
|
|
2004
|
+
*/
|
|
2005
|
+
processCellFromClipboard?: (params: {
|
|
2006
|
+
/** The raw text from the clipboard for this cell. */
|
|
2007
|
+
text: string;
|
|
2008
|
+
/** What the grid would have written after its own coercion. */
|
|
2009
|
+
parsedValue: unknown;
|
|
2010
|
+
row: TData;
|
|
2011
|
+
rowIndex: number;
|
|
2012
|
+
columnId: string;
|
|
2013
|
+
}) => unknown;
|
|
1590
2014
|
/**
|
|
1591
2015
|
* Inline cell editing: F2 or double-click opens an editor in the active cell,
|
|
1592
2016
|
* Enter commits, Esc cancels. Off by default.
|
|
@@ -1596,6 +2020,14 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1596
2020
|
* `editable` is the shortcut alias and wins over this.
|
|
1597
2021
|
*/
|
|
1598
2022
|
enableInlineEditing?: boolean;
|
|
2023
|
+
/**
|
|
2024
|
+
* A click on the cell that is already active opens its editor, the way a
|
|
2025
|
+
* second click on a selected file name starts renaming it. On by default.
|
|
2026
|
+
* A spreadsheet turns it off: Excel edits on double-click or F2 only, and
|
|
2027
|
+
* a user clicking the cell they are on to get back to it after a dialog
|
|
2028
|
+
* would otherwise find the next shortcut typed into an editor.
|
|
2029
|
+
*/
|
|
2030
|
+
editOnSecondClick?: boolean;
|
|
1599
2031
|
/**
|
|
1600
2032
|
* Full-row editing. When `true`, starting an edit puts the WHOLE row into
|
|
1601
2033
|
* edit mode - every editable cell shows an inline editor at once - and a
|
|
@@ -1904,6 +2336,99 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1904
2336
|
scrollHeight: number;
|
|
1905
2337
|
clientHeight: number;
|
|
1906
2338
|
}) => void;
|
|
2339
|
+
/**
|
|
2340
|
+
* Fires when the range of rows on screen changes, with the first and last
|
|
2341
|
+
* row INDEX (not pixels). Coalesced to one call per frame, so it is cheap
|
|
2342
|
+
* to wire to something that fetches.
|
|
2343
|
+
*
|
|
2344
|
+
* This is the hook a block-loading data source needs and
|
|
2345
|
+
* `onScrollBottomReached` cannot give it: "the user is looking at rows
|
|
2346
|
+
* 4,000-4,020" answers which block to fetch and which to keep, while
|
|
2347
|
+
* "they hit the bottom" only ever means "append more". Both are free; use
|
|
2348
|
+
* this one with `createServerDataSource({ mode: 'infinite' })`, or let
|
|
2349
|
+
* `rowModel` wire it for you.
|
|
2350
|
+
*
|
|
2351
|
+
* Reports `0, data.length - 1` when virtualization is off, since every row
|
|
2352
|
+
* really is rendered.
|
|
2353
|
+
*/
|
|
2354
|
+
onVisibleRangeChange?: (range: {
|
|
2355
|
+
startIndex: number;
|
|
2356
|
+
endIndex: number;
|
|
2357
|
+
}) => void;
|
|
2358
|
+
/**
|
|
2359
|
+
* Marks a row as one whose data has not arrived: `"loading"` draws a
|
|
2360
|
+
* shimmer in every cell, `"failed"` draws a full-width "could not load"
|
|
2361
|
+
* row with a Retry button, and `null` (the default for every row) renders
|
|
2362
|
+
* normally.
|
|
2363
|
+
*
|
|
2364
|
+
* Placeholder rows are inert - not selectable, not editable, and skipped
|
|
2365
|
+
* by cell navigation - because there is nothing there to act on yet.
|
|
2366
|
+
*
|
|
2367
|
+
* `createServerDataSource` in `infinite` mode fills the gaps with rows this
|
|
2368
|
+
* recognises, so the usual wiring is `rowPlaceholder={rowPlaceholderState}`
|
|
2369
|
+
* (or nothing at all, via `rowModel`).
|
|
2370
|
+
*/
|
|
2371
|
+
rowPlaceholder?: (row: TData, rowIndex: number) => "loading" | "failed" | null;
|
|
2372
|
+
/** Called by the Retry button on a `"failed"` placeholder row. */
|
|
2373
|
+
onRetryRow?: (row: TData, rowIndex: number) => void;
|
|
2374
|
+
/**
|
|
2375
|
+
* Hand selection over to an external model.
|
|
2376
|
+
*
|
|
2377
|
+
* The grid normally tracks selection as a record of the row ids it has
|
|
2378
|
+
* seen, which is right until the rows it has seen are a window onto a
|
|
2379
|
+
* million on a server: "select all" then means 20 ticked checkboxes rather
|
|
2380
|
+
* than a million, and the header checkbox cannot honestly say `all`. A
|
|
2381
|
+
* model that stores the RULE ("everything except these three") can answer
|
|
2382
|
+
* both, so when this is set the header checkbox, the row checkboxes and
|
|
2383
|
+
* `api.selectAllRows()` all route through it instead.
|
|
2384
|
+
*
|
|
2385
|
+
* `@svgrid/enterprise` ships one for the server-side row model; this is the
|
|
2386
|
+
* seam it plugs into.
|
|
2387
|
+
*/
|
|
2388
|
+
/**
|
|
2389
|
+
* Drive the grid from a row model instead of wiring a dozen props.
|
|
2390
|
+
*
|
|
2391
|
+
* `createServerDataSource` returns one, and so does the Enterprise
|
|
2392
|
+
* server-side row model, so server-backed grids become:
|
|
2393
|
+
*
|
|
2394
|
+
* ```svelte
|
|
2395
|
+
* <SvGrid rowModel={ctl} {columns} />
|
|
2396
|
+
* ```
|
|
2397
|
+
*
|
|
2398
|
+
* The model supplies `data`, `loading`, `getRowId`, the external sort
|
|
2399
|
+
* and filter wiring, the visible range, placeholder rows, group
|
|
2400
|
+
* accessors, selection and paging - each one only if it implements that
|
|
2401
|
+
* part. A prop written explicitly on the grid always wins, so you can
|
|
2402
|
+
* adopt it and still override one piece.
|
|
2403
|
+
*/
|
|
2404
|
+
rowModel?: GridRowModel<TData>;
|
|
2405
|
+
/**
|
|
2406
|
+
* Columns that REPLACE `columns` while set. The server-side row model
|
|
2407
|
+
* supplies them in pivot mode - one column per pivoted value, grouped
|
|
2408
|
+
* under a header per pivot key - and clears them when pivot mode ends,
|
|
2409
|
+
* so `columns` stays the app's own list. Rarely set by hand.
|
|
2410
|
+
*/
|
|
2411
|
+
pivotResultColumns?: Array<ColumnDef<TFeatures, TData>> | null;
|
|
2412
|
+
rowSelectionModel?: {
|
|
2413
|
+
isSelected: (rowId: string, row: TData) => boolean;
|
|
2414
|
+
/** Whether the header checkbox shows empty, indeterminate, or ticked. */
|
|
2415
|
+
headerState: () => "none" | "some" | "all";
|
|
2416
|
+
toggle: (rowId: string, row: TData, next: boolean) => void;
|
|
2417
|
+
/** The header checkbox: select or clear everything, loaded or not. */
|
|
2418
|
+
toggleAll: (next: boolean) => void;
|
|
2419
|
+
/**
|
|
2420
|
+
* How many rows the rule selects, counting the ones the grid never
|
|
2421
|
+
* loaded; `null` when it cannot say. The selection bar shows this
|
|
2422
|
+
* instead of counting ticked rows on screen.
|
|
2423
|
+
*/
|
|
2424
|
+
selectedCount?: () => number | null;
|
|
2425
|
+
/**
|
|
2426
|
+
* Apply one patch to every selected row, loaded or not. When present,
|
|
2427
|
+
* the bulk-edit drawer sends its edits here instead of writing the
|
|
2428
|
+
* loaded cells. Resolves with how many rows changed.
|
|
2429
|
+
*/
|
|
2430
|
+
bulkUpdate?: (patch: Record<string, unknown>) => Promise<number>;
|
|
2431
|
+
};
|
|
1907
2432
|
/**
|
|
1908
2433
|
* Marks a row as an expandable "detail row". When this returns true the
|
|
1909
2434
|
* grid renders that row as a SINGLE full-width cell (colspan across every
|
|
@@ -1927,8 +2452,10 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1927
2452
|
* Server-side group / tree keyboard + accessibility, built into the grid. When
|
|
1928
2453
|
* set, the grid uses the treegrid role and marks matching rows with
|
|
1929
2454
|
* `aria-level` / `aria-expanded`, and ArrowRight / ArrowLeft expand / collapse
|
|
1930
|
-
* the focused group row (no app-level key handling). Pair with
|
|
1931
|
-
* + `SvGroupCell` for the visual
|
|
2455
|
+
* the focused group row (no app-level key handling). Pair with
|
|
2456
|
+
* `serverGroupRows` + `SvGroupCell` from `@svgrid/enterprise` for the visual
|
|
2457
|
+
* expander, or drive it from your own tree state. Every accessor receives the
|
|
2458
|
+
* row data.
|
|
1932
2459
|
*/
|
|
1933
2460
|
serverGroup?: {
|
|
1934
2461
|
/** Whether a row is an expandable group / branch. */
|
|
@@ -1957,6 +2484,33 @@ export type Props<TFeatures extends TableFeatures = TableFeatures, TData extends
|
|
|
1957
2484
|
* main grid; field/format/cell/cellClass all apply.
|
|
1958
2485
|
*/
|
|
1959
2486
|
pinnedTopRows?: ReadonlyArray<TData>;
|
|
2487
|
+
/**
|
|
2488
|
+
* Freeze the first N rows: they stay under the header while the body
|
|
2489
|
+
* scrolls, and unlike `pinnedTopRows` they are the grid's own rows,
|
|
2490
|
+
* still editable, selectable and numbered as rows 1..N. Excel's Freeze
|
|
2491
|
+
* Panes, for the row half; the column half is `columnPinning`. Under
|
|
2492
|
+
* `virtualization` the frozen rows are always rendered and the window
|
|
2493
|
+
* skips them.
|
|
2494
|
+
*/
|
|
2495
|
+
frozenRows?: number;
|
|
2496
|
+
/**
|
|
2497
|
+
* Merged cells: rectangles drawn as one cell, a spreadsheet's Merge &
|
|
2498
|
+
* Center. Each entry is the top-left cell (display indices) and how many
|
|
2499
|
+
* rows and columns it covers. The origin's td takes the span and shows
|
|
2500
|
+
* the origin's value; the covered cells are not drawn, a selection grows
|
|
2501
|
+
* to whole merges, the active cell inside a merge is its origin, and the
|
|
2502
|
+
* arrow keys step over a merge as one cell. A merge that crosses the
|
|
2503
|
+
* frozen boundary or the rendered window is drawn in parts, one per
|
|
2504
|
+
* band. The grid does not write into covered cells on its own; a
|
|
2505
|
+
* consumer that merges cells keeps them empty or marks them read-only
|
|
2506
|
+
* through the column's `editable`.
|
|
2507
|
+
*/
|
|
2508
|
+
mergedCells?: ReadonlyArray<{
|
|
2509
|
+
rowIndex: number;
|
|
2510
|
+
colIndex: number;
|
|
2511
|
+
rowSpan: number;
|
|
2512
|
+
colSpan: number;
|
|
2513
|
+
}>;
|
|
1960
2514
|
/**
|
|
1961
2515
|
* Rows to pin to the BOTTOM of the grid - rendered below the regular
|
|
1962
2516
|
* rows and sticky-positioned (sticks to the bottom of the viewport
|