@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/README.md
CHANGED
|
@@ -92,7 +92,7 @@ all wire up the moment you turn on the matching prop.
|
|
|
92
92
|
- **Selection** - cell-range click+drag and Shift+arrows, copy/paste as TSV, Excel-style fill handle, row selection.
|
|
93
93
|
- **Views** - row grouping with aggregation, tree data, master/detail, full-width detail rows, spreadsheet mode with formulas.
|
|
94
94
|
- **Layout** - row + column pinning, sticky header + first column, header drag-to-reorder, autosize, keyboard-accessible column sizing, zebra rows, responsive mode.
|
|
95
|
-
- **Data operations** - find in grid (Ctrl+F), undo / redo, transaction API, optimistic updates, server-side
|
|
95
|
+
- **Data operations** - find in grid (Ctrl+F), undo / redo, transaction API, optimistic updates, server-side data with sort / filter / paging / infinite-scroll pushdown (lazy grouping, tree, pivot and transactions on the server are in `@svgrid/enterprise`).
|
|
96
96
|
- **AI helpers, free** - natural-language filter, smart fill, summarize, classify, anomaly detection, and "chart this". Model-agnostic: register one provider, nothing is bundled.
|
|
97
97
|
- **UI components** - a Svelte 5 component suite ships in the package (inputs, selection, date/time, overlays, layout, feedback), standalone or as grid cell editors.
|
|
98
98
|
- **Accessibility** - WAI-ARIA grid roles, full keyboard navigation, RTL, high-contrast theme.
|
|
@@ -154,14 +154,14 @@ See [Use sv-grid docs as LLM context](https://svgrid.com/docs/help/llm-grounding
|
|
|
154
154
|
## Enterprise features
|
|
155
155
|
|
|
156
156
|
The MIT core is free for any use, including commercial, with **no feature gating**. Sorting, filtering,
|
|
157
|
-
editing, virtualization,
|
|
158
|
-
package. The optional [`@svgrid/enterprise`](https://www.npmjs.com/package/@svgrid/enterprise) pack layers
|
|
157
|
+
editing, virtualization, **server-side data** (paging, infinite block scroll, sort, filter, CRUD) and the
|
|
158
|
+
**AI helpers** all ship in the free package. The optional [`@svgrid/enterprise`](https://www.npmjs.com/package/@svgrid/enterprise) pack layers
|
|
159
159
|
on the export- and analytics-heavy features teams tend to need last:
|
|
160
160
|
|
|
161
161
|
- **Excel / PDF / CSV / TSV / HTML export** plus paginated print.
|
|
162
162
|
- **Excel / CSV / TSV / JSON import** with auto-mapping and per-row validation.
|
|
163
163
|
- **Pivot tables** with a drag-and-drop pivot Designer.
|
|
164
|
-
- **Kanban board
|
|
164
|
+
- **Kanban board, scheduler / calendar and Gantt renderers** for the `board`, `scheduler` and `gantt` props.
|
|
165
165
|
|
|
166
166
|
OSS projects receive an Enterprise key free. See [Pricing](https://svgrid.com/pricing/).
|
|
167
167
|
|
|
@@ -193,10 +193,11 @@ inside `@svgrid/grid`; the tools after it install separately and are entirely op
|
|
|
193
193
|
|---|---|---|---|
|
|
194
194
|
| **Svelte 5 runes native** | Yes | No, JS core + wrapper | Adapter only |
|
|
195
195
|
| **Ships a renderer** | Yes, plus headless | Yes | No, headless only |
|
|
196
|
-
| **Bundle (gzip)** |
|
|
196
|
+
| **Bundle (gzip)** | measured on [the comparison page](https://svgrid.com/compare/ag-grid/) | measured, same page | measured, [same method](https://svgrid.com/compare/tanstack-table/) |
|
|
197
197
|
| **Master/detail, tree, range selection** | Free | Enterprise only | Build it yourself |
|
|
198
198
|
|
|
199
199
|
Full detail: [SvGrid vs AG Grid vs TanStack Table](https://svgrid.com/docs/help/comparison/) ·
|
|
200
|
+
[All comparisons, with dated sources](https://svgrid.com/compare/) ·
|
|
200
201
|
[Migrating from AG Grid](https://svgrid.com/docs/help/migrating-from-ag-grid/)
|
|
201
202
|
|
|
202
203
|
## Documentation
|
package/dist/GridMenus.svelte
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import SvListBox from "./SvListBox.svelte";
|
|
15
15
|
import type {
|
|
16
16
|
FilterOperator,
|
|
17
|
+
MenuPosition,
|
|
17
18
|
} from "./SvGrid.types";
|
|
18
19
|
import {
|
|
19
20
|
getEditorInputType,
|
|
@@ -175,6 +176,29 @@
|
|
|
175
176
|
import("./SvDateRangeInput.svelte").then((m) => (MenuRangePicker = m.default));
|
|
176
177
|
});
|
|
177
178
|
|
|
179
|
+
/**
|
|
180
|
+
* The context menu is placed on a guessed height (280px, flipped above the
|
|
181
|
+
* click when that would not fit) before it exists. A consumer's menu can be
|
|
182
|
+
* far taller - the spreadsheet shell's has thirteen entries - and then the
|
|
183
|
+
* guess leaves its tail below the viewport. Once the menu is in the DOM its
|
|
184
|
+
* real box is measured and the position pulled back inside: up when it runs
|
|
185
|
+
* off the bottom, left when it runs off the right. The style reads
|
|
186
|
+
* `contextMenuPos`, so writing it moves the menu; the action's `update`
|
|
187
|
+
* runs on every position change and settles in one pass.
|
|
188
|
+
*/
|
|
189
|
+
function keepInViewport(node: HTMLElement, _pos: MenuPosition) {
|
|
190
|
+
const fit = () => {
|
|
191
|
+
const pos = ctrl.contextMenuPos;
|
|
192
|
+
const box = node.getBoundingClientRect();
|
|
193
|
+
if (!box.width && !box.height) return;
|
|
194
|
+
const x = Math.max(8, Math.min(pos.x, window.innerWidth - box.width - 8));
|
|
195
|
+
const y = Math.max(8, Math.min(pos.y, window.innerHeight - box.height - 8));
|
|
196
|
+
if (x !== pos.x || y !== pos.y) ctrl.contextMenuPos = { x, y };
|
|
197
|
+
};
|
|
198
|
+
fit();
|
|
199
|
+
return { update: fit };
|
|
200
|
+
}
|
|
201
|
+
|
|
178
202
|
/**
|
|
179
203
|
* Opening the filter popover used to leave focus on the funnel button
|
|
180
204
|
* outside it, so a keyboard user landed nowhere and had to tab in past the
|
|
@@ -832,6 +856,8 @@
|
|
|
832
856
|
{/if}
|
|
833
857
|
|
|
834
858
|
{#if contextMenuFor}
|
|
859
|
+
{@const items = contextMenuItems()}
|
|
860
|
+
{@const gutter = items.some((it) => it.icon)}
|
|
835
861
|
<div
|
|
836
862
|
class="sv-grid-menu-backdrop"
|
|
837
863
|
role="presentation"
|
|
@@ -843,8 +869,9 @@
|
|
|
843
869
|
data-svgrid-menu={ctrl.gridDomId}
|
|
844
870
|
role="menu"
|
|
845
871
|
style={`left: ${contextMenuPos.x}px; top: ${contextMenuPos.y}px;`}
|
|
872
|
+
use:keepInViewport={contextMenuPos}
|
|
846
873
|
>
|
|
847
|
-
{#each
|
|
874
|
+
{#each items as item (item.key)}
|
|
848
875
|
{#if item.separator}
|
|
849
876
|
<div class="sv-grid-menu-sep"></div>
|
|
850
877
|
{:else}
|
|
@@ -854,7 +881,22 @@
|
|
|
854
881
|
role="menuitem"
|
|
855
882
|
disabled={item.disabled}
|
|
856
883
|
onclick={() => { item.run?.(); closeContextMenu(); }}
|
|
857
|
-
>
|
|
884
|
+
>
|
|
885
|
+
<!-- Every item keeps the gutter once one has an icon, so the labels
|
|
886
|
+
line up. The label is its own span with no whitespace text
|
|
887
|
+
around it, so the button reads exactly its label. -->
|
|
888
|
+
{#if gutter}<span class="sv-grid-menu-icon" aria-hidden="true">
|
|
889
|
+
{#if typeof item.icon === "string"}
|
|
890
|
+
{@render icon(item.icon)}
|
|
891
|
+
{:else if item.icon}
|
|
892
|
+
<svg class="sv-grid-menu-icon-own" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" focusable="false">
|
|
893
|
+
{#each item.icon.paths as path, i (i)}
|
|
894
|
+
<path d={path.d} fill={path.fill ? "currentColor" : "none"} stroke-width={path.width} stroke-dasharray={path.dash} />
|
|
895
|
+
{/each}
|
|
896
|
+
</svg>
|
|
897
|
+
{/if}
|
|
898
|
+
</span>{/if}<span class="sv-grid-menu-label">{item.label}</span>
|
|
899
|
+
</button>
|
|
858
900
|
{/if}
|
|
859
901
|
{/each}
|
|
860
902
|
</div>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The chart's right-click menu: the same portalled, focus-trapped,
|
|
4
|
+
* dismissable panel `SvContextMenu` opens, without the zone `<div>` that
|
|
5
|
+
* component wraps its children in. The chart owns its own `contextmenu`
|
|
6
|
+
* handler (the SVG is the zone) and hands this the items and a position.
|
|
7
|
+
*
|
|
8
|
+
* Lazy-loaded by `SvGridChart` on the first right-click, so a chart that is
|
|
9
|
+
* never right-clicked never pays for the menu machinery.
|
|
10
|
+
*/
|
|
11
|
+
import { portalToBody, popIn } from './popover'
|
|
12
|
+
import { createDismissableLayer, onScrollOutside } from './a11y/dismissable'
|
|
13
|
+
import { createFocusTrap } from './a11y/focus-trap'
|
|
14
|
+
import SvMenuList, { type MenuItem } from './SvMenuList.svelte'
|
|
15
|
+
|
|
16
|
+
type Props = {
|
|
17
|
+
items: ReadonlyArray<MenuItem>
|
|
18
|
+
x: number
|
|
19
|
+
y: number
|
|
20
|
+
onClose: () => void
|
|
21
|
+
ariaLabel?: string
|
|
22
|
+
}
|
|
23
|
+
let { items, x, y, onClose, ariaLabel = 'Chart menu' }: Props = $props()
|
|
24
|
+
|
|
25
|
+
let panelEl = $state<HTMLDivElement | null>(null)
|
|
26
|
+
const MENU_W = 220
|
|
27
|
+
const pos = $derived.by(() => {
|
|
28
|
+
if (typeof window === 'undefined') return { x, y }
|
|
29
|
+
const estH = Math.min(items.length, 12) * 34 + 8
|
|
30
|
+
return {
|
|
31
|
+
x: Math.max(6, Math.min(x, window.innerWidth - MENU_W - 6)),
|
|
32
|
+
y: Math.max(6, Math.min(y, window.innerHeight - estH - 6)),
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (!panelEl) return
|
|
38
|
+
const trap = createFocusTrap(panelEl, {
|
|
39
|
+
initialFocus: () => panelEl?.querySelector<HTMLElement>('[role="menuitem"]:not([disabled])') ?? null,
|
|
40
|
+
})
|
|
41
|
+
trap.activate()
|
|
42
|
+
const layer = createDismissableLayer({ element: () => panelEl, onDismiss: onClose })
|
|
43
|
+
layer.activate()
|
|
44
|
+
const offScroll = onScrollOutside(() => panelEl, onClose)
|
|
45
|
+
return () => { layer.release(); trap.release(); offScroll() }
|
|
46
|
+
})
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
bind:this={panelEl}
|
|
51
|
+
class="sv-ctx sv-grid-chart-menu"
|
|
52
|
+
use:portalToBody
|
|
53
|
+
use:popIn={{}}
|
|
54
|
+
style:position="fixed"
|
|
55
|
+
style:top={`${pos.y}px`}
|
|
56
|
+
style:left={`${pos.x}px`}
|
|
57
|
+
aria-label={ariaLabel}
|
|
58
|
+
>
|
|
59
|
+
<SvMenuList {items} onclose={onClose} onselect={() => onClose()} />
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
:global(.sv-grid-chart-menu) {
|
|
64
|
+
z-index: 2147483646; min-width: 220px;
|
|
65
|
+
background: var(--sg-bg, #fff); color: var(--sg-fg, #0f172a);
|
|
66
|
+
border: 1px solid var(--sg-border, #e2e8f0); border-radius: 10px;
|
|
67
|
+
box-shadow: 0 16px 48px -12px rgba(15, 23, 42, 0.35); font-size: 13px;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type MenuItem } from './SvMenuList.svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
items: ReadonlyArray<MenuItem>;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const SvChartMenu: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type SvChartMenu = ReturnType<typeof SvChartMenu>;
|
|
11
|
+
export default SvChartMenu;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* SvChartPanes - a price chart with indicator panes stacked under it, the
|
|
4
|
+
* way a trading terminal lays them out: one shared x axis (labelled on the
|
|
5
|
+
* last pane only), one value-axis gutter width so the plots line up, and
|
|
6
|
+
* one crosshair / zoom window across all of them.
|
|
7
|
+
*
|
|
8
|
+
* Composition, not a new layout: every pane is a full `SvChart` in a sync
|
|
9
|
+
* group of its own, so tooltips, keyboard navigation, the screen-reader
|
|
10
|
+
* table, export and the context menu all come for free, and the geometry
|
|
11
|
+
* stays single-plot. The main chart takes every `SvChart` prop.
|
|
12
|
+
*/
|
|
13
|
+
import SvGridChart from './SvGridChart.svelte'
|
|
14
|
+
import { indicatorPane, type ChartIndicatorSpec } from './chart-indicators'
|
|
15
|
+
import type { ChartSpec, ChartZoomWindow } from './chart-types'
|
|
16
|
+
import type { SvChartProps } from './SvGridChart.types'
|
|
17
|
+
|
|
18
|
+
type Props = Omit<SvChartProps, 'spec' | 'syncGroup' | 'zoom'> & {
|
|
19
|
+
/** The price spec: a candlestick / OHLC / line chart with the series the
|
|
20
|
+
* indicators read (`ohlc` and `volumes` on it for the volume-based ones). */
|
|
21
|
+
spec: ChartSpec
|
|
22
|
+
/** The panes under the price, top to bottom. */
|
|
23
|
+
indicators?: ChartIndicatorSpec[]
|
|
24
|
+
/** A sync group to share with charts outside the stack. Default: private. */
|
|
25
|
+
syncGroup?: string
|
|
26
|
+
/** Width of the value-axis gutter every pane uses, so the plots line up.
|
|
27
|
+
* Default 56. */
|
|
28
|
+
axisWidth?: number
|
|
29
|
+
/** The shared zoom window, bindable. */
|
|
30
|
+
zoom?: ChartZoomWindow | null
|
|
31
|
+
}
|
|
32
|
+
let {
|
|
33
|
+
spec,
|
|
34
|
+
indicators = [],
|
|
35
|
+
syncGroup,
|
|
36
|
+
axisWidth = 56,
|
|
37
|
+
zoom = $bindable(null),
|
|
38
|
+
onZoom,
|
|
39
|
+
zoomable,
|
|
40
|
+
legend,
|
|
41
|
+
toolbar,
|
|
42
|
+
...rest
|
|
43
|
+
}: Props = $props()
|
|
44
|
+
|
|
45
|
+
const uid = `svcp-${Math.random().toString(36).slice(2, 8)}`
|
|
46
|
+
const group = $derived(syncGroup ?? uid)
|
|
47
|
+
// Every pane is laid out at the stack's pixel width, so the panes line up
|
|
48
|
+
// and none of them is a 520px viewBox stretched across a 900px column.
|
|
49
|
+
// Heights stay what the specs say; only the width follows the container.
|
|
50
|
+
let hostW = $state(0)
|
|
51
|
+
const widthOf = (s: ChartSpec) => (hostW > 0 && !s.width ? { width: Math.round(hostW) } : {})
|
|
52
|
+
/** The price chart hides its x labels when a pane below will show them. */
|
|
53
|
+
const mainSpec = $derived<ChartSpec>({
|
|
54
|
+
...spec,
|
|
55
|
+
...widthOf(spec),
|
|
56
|
+
xAxis: { ...spec.xAxis, ...(indicators.length ? { labels: false } : {}) },
|
|
57
|
+
yAxis: { ...spec.yAxis, width: axisWidth },
|
|
58
|
+
...(spec.y2Axis || spec.series.some((s) => s.axis === 'right') ? { y2Axis: { ...spec.y2Axis, width: axisWidth } } : {}),
|
|
59
|
+
})
|
|
60
|
+
// The pane's title is drawn by this component as a small corner label
|
|
61
|
+
// rather than by the chart frame, which would take a third of a 100px
|
|
62
|
+
// pane for it.
|
|
63
|
+
const panes = $derived(
|
|
64
|
+
indicators.map((ind, i) => {
|
|
65
|
+
const { title, ...pane } = indicatorPane(spec, ind)
|
|
66
|
+
return {
|
|
67
|
+
title: title ?? ind.kind,
|
|
68
|
+
spec: {
|
|
69
|
+
...pane,
|
|
70
|
+
...widthOf(pane),
|
|
71
|
+
xAxis: { ...pane.xAxis, labels: i === indicators.length - 1 },
|
|
72
|
+
yAxis: { ...pane.yAxis, width: axisWidth },
|
|
73
|
+
} satisfies ChartSpec,
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
)
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<div class="sv-chart-panes" bind:clientWidth={hostW}>
|
|
80
|
+
<div class="sv-chart-pane is-main">
|
|
81
|
+
<SvGridChart spec={mainSpec} syncGroup={group} bind:zoom {onZoom} {zoomable} {legend} {toolbar} {...rest} />
|
|
82
|
+
</div>
|
|
83
|
+
{#each panes as pane, i (`${indicators[i]?.kind}-${i}`)}
|
|
84
|
+
<div class="sv-chart-pane is-indicator" data-indicator={indicators[i]?.kind}>
|
|
85
|
+
<span class="sv-chart-pane-title" style:left={`${axisWidth + 6}px`}>{pane.title}</span>
|
|
86
|
+
<SvGridChart spec={pane.spec} syncGroup={group} zoomable={zoomable ? { drag: false, wheel: typeof zoomable === 'object' ? zoomable.wheel : false, pan: typeof zoomable === 'object' ? zoomable.pan : false } : false} legend={false} toolbar={false} interactive localeText={rest.localeText} />
|
|
87
|
+
</div>
|
|
88
|
+
{/each}
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<style>
|
|
92
|
+
.sv-chart-panes {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 2px;
|
|
96
|
+
min-width: 0;
|
|
97
|
+
}
|
|
98
|
+
.sv-chart-pane {
|
|
99
|
+
position: relative;
|
|
100
|
+
min-width: 0;
|
|
101
|
+
}
|
|
102
|
+
/* The title of a pane sits in its top-left corner, small, like a terminal. */
|
|
103
|
+
/* Placed just right of the value-axis gutter, clear of the tick labels. */
|
|
104
|
+
.sv-chart-pane-title {
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: 2px;
|
|
107
|
+
z-index: 1;
|
|
108
|
+
font-size: 10px;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
color: var(--sg-muted, #64748b);
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ChartIndicatorSpec } from './chart-indicators.js';
|
|
2
|
+
import type { ChartSpec, ChartZoomWindow } from './chart-types.js';
|
|
3
|
+
import type { SvChartProps } from './SvGridChart.types.js';
|
|
4
|
+
type Props = Omit<SvChartProps, 'spec' | 'syncGroup' | 'zoom'> & {
|
|
5
|
+
/** The price spec: a candlestick / OHLC / line chart with the series the
|
|
6
|
+
* indicators read (`ohlc` and `volumes` on it for the volume-based ones). */
|
|
7
|
+
spec: ChartSpec;
|
|
8
|
+
/** The panes under the price, top to bottom. */
|
|
9
|
+
indicators?: ChartIndicatorSpec[];
|
|
10
|
+
/** A sync group to share with charts outside the stack. Default: private. */
|
|
11
|
+
syncGroup?: string;
|
|
12
|
+
/** Width of the value-axis gutter every pane uses, so the plots line up.
|
|
13
|
+
* Default 56. */
|
|
14
|
+
axisWidth?: number;
|
|
15
|
+
/** The shared zoom window, bindable. */
|
|
16
|
+
zoom?: ChartZoomWindow | null;
|
|
17
|
+
};
|
|
18
|
+
declare const SvChartPanes: import("svelte").Component<Props, {}, "zoom">;
|
|
19
|
+
type SvChartPanes = ReturnType<typeof SvChartPanes>;
|
|
20
|
+
export default SvChartPanes;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type GridPredicateExpr, type CellEditorOption, type Column, type ColumnDef, type Row, type RowData, type TableFeatures, type ChartType, type ChartSpec, type ChartValueFormat } from "./index.js";
|
|
1
|
+
import { type GridPredicateExpr, type CellEditorOption, type Column, type ColumnDef, type Row, type RowData, type TableFeatures, type ChartType, type ChartSpec, type ChartReducer, type ChartTimeBucket, type ChartValueFormat, type ChartZoomWindow, type ChartPanelIndicator, type ChartFormatState, type OhlcColumns } from "./index.js";
|
|
2
2
|
import "./sv-grid-scrollbar.js";
|
|
3
3
|
import { type ColumnStat } from "./conditional-formatting.js";
|
|
4
4
|
import type { Props, SelectionRange, CellEditState, FilterOperator, MenuPosition, ContextMenuTarget, ChartingConfig } from "./SvGrid.types.js";
|
|
5
|
+
import { type HistoryStep as SharedHistoryStep } from "./history.js";
|
|
5
6
|
import { operatorOption, operatorsForColumn, defaultOperatorFor, operatorLabelFor } from "./filter-operators.js";
|
|
6
7
|
import { type FacetBucket, isBucketableColumn, buildBuckets, isInBucket } from "./facet-buckets.js";
|
|
7
8
|
import { getColumnBaseValue, isGroupRow, toolPanelHeaderLabel, formatSummaryNumeric, getColumnAlign, getPinnedCellValue, getColumnAccessorValue, columnDefMatchesId } from "./cell-values.js";
|
|
@@ -74,14 +75,9 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
74
75
|
} | null;
|
|
75
76
|
editedCellValues: Record<string, unknown>;
|
|
76
77
|
readonly UNDO_LIMIT: number;
|
|
77
|
-
history:
|
|
78
|
-
rowId: string;
|
|
79
|
-
columnId: string;
|
|
80
|
-
field: string;
|
|
81
|
-
before: unknown;
|
|
82
|
-
after: unknown;
|
|
83
|
-
}[];
|
|
78
|
+
history: SharedHistoryStep[];
|
|
84
79
|
historyPtr: number;
|
|
80
|
+
historyGroupId: string | undefined;
|
|
85
81
|
historyVersion: number;
|
|
86
82
|
tooltip: {
|
|
87
83
|
text: string;
|
|
@@ -104,6 +100,9 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
104
100
|
headerHeight: number;
|
|
105
101
|
editorSelectAll: boolean;
|
|
106
102
|
columnWidths: Record<string, number>;
|
|
103
|
+
readonly collapsedColumns: Record<string, boolean>;
|
|
104
|
+
readonly mergeIndex: import("./merges.js").MergeIndex | null;
|
|
105
|
+
readonly setColumnCollapsed: (columnId: string, collapsed: boolean) => void;
|
|
107
106
|
readonly MIN_COLUMN_WIDTH: number;
|
|
108
107
|
columnPinning: {
|
|
109
108
|
left: Array<string>;
|
|
@@ -159,8 +158,6 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
159
158
|
readonly scrollMetrics: {
|
|
160
159
|
scrollTop: number;
|
|
161
160
|
scrollLeft: number;
|
|
162
|
-
clientHeight: number;
|
|
163
|
-
clientWidth: number;
|
|
164
161
|
scrollHeight: number;
|
|
165
162
|
scrollWidth: number;
|
|
166
163
|
};
|
|
@@ -175,6 +172,7 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
175
172
|
readonly moveCellsEffective: boolean;
|
|
176
173
|
readonly flushScheduledScrollSync: () => void;
|
|
177
174
|
readonly scheduleScrollSync: (scrollTop: number, scrollLeft: number) => void;
|
|
175
|
+
readonly syncScrollNow: (scrollTop: number, scrollLeft: number) => void;
|
|
178
176
|
internalData: readonly TData[];
|
|
179
177
|
internalColumns: ColumnDef<TFeatures, TData>[];
|
|
180
178
|
hiddenColumns: Record<string, boolean>;
|
|
@@ -299,6 +297,8 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
299
297
|
rows: TData[];
|
|
300
298
|
ids: string[];
|
|
301
299
|
};
|
|
300
|
+
readonly selectionBarCount: number;
|
|
301
|
+
readonly selectionBarVisible: boolean;
|
|
302
302
|
lastSelectionSerialized: string;
|
|
303
303
|
lastCellRangeSerialized: string;
|
|
304
304
|
readonly statusBarEnabled: boolean;
|
|
@@ -318,7 +318,9 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
318
318
|
readonly toolPanelHeaderLabel: typeof toolPanelHeaderLabel;
|
|
319
319
|
readonly toggleColumnVisibleInPanel: (columnId: string) => void;
|
|
320
320
|
readonly moveColumnInPanel: (columnId: string, dir: -1 | 1) => void;
|
|
321
|
-
readonly messages: import("./grid-messages.js").
|
|
321
|
+
readonly messages: import("./grid-messages.js").GridChromeMessages;
|
|
322
|
+
/** The raw `localization.text` map, for the lazy chart panel's own strings. */
|
|
323
|
+
readonly localizationText: Partial<import("./grid-messages.js").GridMessages> | undefined;
|
|
322
324
|
readonly pivotConfig: import("./pivot-view.svelte.js").GridPivotConfig<TData> | null;
|
|
323
325
|
readonly pivotActive: boolean;
|
|
324
326
|
readonly pivotResult: {
|
|
@@ -341,7 +343,7 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
341
343
|
readonly chartIsCustom: boolean;
|
|
342
344
|
chartPanelOpen: boolean;
|
|
343
345
|
chartType: ChartType;
|
|
344
|
-
chartReduce:
|
|
346
|
+
chartReduce: ChartReducer;
|
|
345
347
|
chartDimensionId: string | null;
|
|
346
348
|
chartMeasureId: string | null;
|
|
347
349
|
chartSeriesId: string | null;
|
|
@@ -349,6 +351,21 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
349
351
|
chartDataLabels: boolean;
|
|
350
352
|
chartLogScale: boolean;
|
|
351
353
|
chartTimeAxis: boolean;
|
|
354
|
+
chartBucket: ChartTimeBucket | null;
|
|
355
|
+
chartBins: number | null;
|
|
356
|
+
chartFunnelShape: "trapezoid" | "pyramid" | "cone" | null;
|
|
357
|
+
chartCandleStyle: "classic" | "hollow" | "heikin-ashi" | null;
|
|
358
|
+
chartFormat: ChartFormatState | null;
|
|
359
|
+
readonly chartFrozen: {
|
|
360
|
+
spec: ChartSpec;
|
|
361
|
+
at: string;
|
|
362
|
+
} | null;
|
|
363
|
+
readonly chartIsOhlc: boolean;
|
|
364
|
+
chartOhlc: OhlcColumns;
|
|
365
|
+
readonly chartOhlcDateId: string | null;
|
|
366
|
+
chartIndicators: ChartPanelIndicator[];
|
|
367
|
+
readonly chartIndicatorPanes: import("./chart-indicators.js").ChartIndicatorSpec[];
|
|
368
|
+
chartZoom: ChartZoomWindow | null;
|
|
352
369
|
chartValueFormat: ChartValueFormat;
|
|
353
370
|
readonly chartDimensionIsDate: boolean;
|
|
354
371
|
chartSize: number | null;
|
|
@@ -386,27 +403,32 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
386
403
|
}[];
|
|
387
404
|
activeChartIndex: number;
|
|
388
405
|
addChart(): void;
|
|
406
|
+
/** Unlink the active chart from the grid: it keeps the spec it has now. */
|
|
407
|
+
freezeChart(): void;
|
|
408
|
+
/** Link the active chart back to the grid's rows. */
|
|
409
|
+
unfreezeChart(): void;
|
|
389
410
|
removeChart(index?: number): void;
|
|
390
411
|
renameChart(index: number, title: string): void;
|
|
391
|
-
getChartsState():
|
|
392
|
-
title: string;
|
|
393
|
-
type: ChartType;
|
|
394
|
-
dimension: string | null;
|
|
395
|
-
series: string | null;
|
|
396
|
-
measure: string | null;
|
|
397
|
-
measure2: string | null;
|
|
398
|
-
orientation: "horizontal" | "vertical" | null;
|
|
399
|
-
stacked100: boolean | null;
|
|
400
|
-
donut: boolean | null;
|
|
401
|
-
palette: string[] | null;
|
|
402
|
-
reduce: "sum" | "avg" | "count";
|
|
403
|
-
stacked: boolean | null;
|
|
404
|
-
dataLabels: boolean | null;
|
|
405
|
-
logScale: boolean | null;
|
|
406
|
-
timeAxis: boolean | null;
|
|
407
|
-
valueFormat: ChartValueFormat | null;
|
|
408
|
-
}[];
|
|
412
|
+
getChartsState(): Record<string, unknown>[];
|
|
409
413
|
applyChartsState(list: ReadonlyArray<Record<string, unknown>>, active?: number): void;
|
|
414
|
+
readonly savedCharts: {
|
|
415
|
+
name: string;
|
|
416
|
+
savedAt: string;
|
|
417
|
+
tab: Record<string, unknown>;
|
|
418
|
+
}[];
|
|
419
|
+
/** Keep the active tab's configuration under a name (replacing a same-named one). */
|
|
420
|
+
saveChart(name: string): void;
|
|
421
|
+
/** Apply a saved chart to the active tab; the tab keeps its id and title. */
|
|
422
|
+
applySavedChart(name: string): boolean;
|
|
423
|
+
removeSavedChart(name: string): void;
|
|
424
|
+
getSavedCharts(): {
|
|
425
|
+
tab: {
|
|
426
|
+
[x: string]: unknown;
|
|
427
|
+
};
|
|
428
|
+
name: string;
|
|
429
|
+
savedAt: string;
|
|
430
|
+
}[];
|
|
431
|
+
applySavedCharts(list: ReadonlyArray<Record<string, unknown>>): void;
|
|
410
432
|
readonly chartCrossFilterable: boolean;
|
|
411
433
|
chartOrientation: "horizontal" | "vertical";
|
|
412
434
|
chartStacked100: boolean;
|
|
@@ -415,18 +437,46 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
415
437
|
chartMeasure2Id: string | null;
|
|
416
438
|
readonly effectiveChartMeasure2Id: string | null;
|
|
417
439
|
chartAiHandler: ((prompt: string) => Promise<Record<string, unknown> | null>) | null;
|
|
440
|
+
chartExplainHandler: (() => Promise<{
|
|
441
|
+
summary: string;
|
|
442
|
+
insights: string[];
|
|
443
|
+
} | null>) | null;
|
|
418
444
|
applyChartConfig(config: {
|
|
419
445
|
open?: boolean;
|
|
420
446
|
type?: ChartType;
|
|
421
447
|
dimension?: string | null;
|
|
422
448
|
series?: string | null;
|
|
423
449
|
measure?: string | null;
|
|
424
|
-
reduce?:
|
|
450
|
+
reduce?: ChartReducer;
|
|
425
451
|
stacked?: boolean;
|
|
426
452
|
dataLabels?: boolean;
|
|
427
453
|
logScale?: boolean;
|
|
428
454
|
timeAxis?: boolean;
|
|
429
455
|
valueFormat?: ChartValueFormat;
|
|
456
|
+
bucket?: ChartTimeBucket | null;
|
|
457
|
+
bins?: number | null;
|
|
458
|
+
funnelShape?: "trapezoid" | "pyramid" | "cone" | null;
|
|
459
|
+
candleStyle?: "classic" | "hollow" | "heikin-ashi" | null;
|
|
460
|
+
/** Second measure: scatter Y, range high end, bullet target. */
|
|
461
|
+
measure2?: string | null;
|
|
462
|
+
/** Candlestick / OHLC price columns (ids or fields). */
|
|
463
|
+
ohlc?: {
|
|
464
|
+
open?: string | null;
|
|
465
|
+
high?: string | null;
|
|
466
|
+
low?: string | null;
|
|
467
|
+
close?: string | null;
|
|
468
|
+
volume?: string | null;
|
|
469
|
+
} | null;
|
|
470
|
+
/** Indicators: panes (volume, rsi, macd, stochastic, atr, obv) and
|
|
471
|
+
* overlays (sma, ema, bb, vwap). */
|
|
472
|
+
indicators?: ChartPanelIndicator[];
|
|
473
|
+
/** The builder's format (titles, axes, legend, series style); `null` resets it. */
|
|
474
|
+
format?: ChartFormatState | null;
|
|
475
|
+
/** Unlink the chart from the grid (true) or link it back (false). */
|
|
476
|
+
frozen?: boolean;
|
|
477
|
+
/** A saved chart's name: applied to the active tab first, then the
|
|
478
|
+
* other keys on top. */
|
|
479
|
+
saved?: string;
|
|
430
480
|
}): void;
|
|
431
481
|
readonly toggleGroupInPanel: (columnId: string) => void;
|
|
432
482
|
lastSortingSerialized: string;
|
|
@@ -471,8 +521,17 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
471
521
|
readonly measuredRowHeightPx: (index: number) => number | undefined;
|
|
472
522
|
/** True when the `rowResize` prop is on and nothing overrides it. */
|
|
473
523
|
readonly rowResizeOn: boolean;
|
|
524
|
+
readonly frozenRowCount: number;
|
|
525
|
+
readonly frozenRowList: Row<TData>[];
|
|
526
|
+
readonly frozenBandHeight: number;
|
|
527
|
+
readonly frozenRowTop: (i: number) => number;
|
|
474
528
|
/** Record the height the user dragged a row to. */
|
|
475
|
-
readonly setRowResizeHeight: (index: number, height: number) => void;
|
|
529
|
+
readonly setRowResizeHeight: (index: number, height: number | null) => void;
|
|
530
|
+
readonly isRowCollapsed: (index: number) => boolean;
|
|
531
|
+
readonly setRowCollapsed: (index: number, collapsed: boolean) => void;
|
|
532
|
+
readonly resizeRowByUser: (index: number, height: number | null) => void;
|
|
533
|
+
readonly resizeColumnByUser: (columnId: string, width: number, before: number) => void;
|
|
534
|
+
readonly autosizeColumnByUser: (columnId: string) => void;
|
|
476
535
|
/** A row's dragged height, or undefined when it has not been resized. */
|
|
477
536
|
readonly rowResizeHeightPx: (index: number) => number | undefined;
|
|
478
537
|
readonly virtualRowTotalSize: number;
|
|
@@ -541,11 +600,20 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
541
600
|
readonly getPinnedCellValue: typeof getPinnedCellValue;
|
|
542
601
|
readonly formatPinnedValue: (column: Column<TData>, value: unknown) => string;
|
|
543
602
|
readonly computePinnedCellClass: (rowData: TData, column: Column<TData>) => string;
|
|
544
|
-
readonly isRowSelected: (rowId: string) =>
|
|
603
|
+
readonly isRowSelected: (rowId: string) => any;
|
|
545
604
|
readonly toggleRowSelectionById: (rowId: string) => void;
|
|
546
|
-
readonly headerSelectionState: "
|
|
605
|
+
readonly headerSelectionState: "some" | "none" | "all";
|
|
606
|
+
readonly visibleRowRange: {
|
|
607
|
+
startIndex: number;
|
|
608
|
+
endIndex: number;
|
|
609
|
+
};
|
|
610
|
+
placeholderStateOf: (row: Row<TData>) => "loading" | "failed" | null;
|
|
611
|
+
/** Retry a failed placeholder row. No-op without `onRetryRow`. */
|
|
612
|
+
retryRow(row: Row<TData>): void;
|
|
547
613
|
readonly toggleSelectAllRows: () => void;
|
|
614
|
+
readonly setSelectAllRows: (select: boolean) => void;
|
|
548
615
|
userHasActivatedCell: boolean;
|
|
616
|
+
tabRunOrigin: number | null;
|
|
549
617
|
readonly setActiveCell: (rowIndex: number, colIndex: number) => void;
|
|
550
618
|
readonly scrollActiveCellIntoView: (rowIndex: number, colIndex: number) => void;
|
|
551
619
|
readonly getColumnBaseWidth: (columnId: string) => any;
|
|
@@ -560,6 +628,22 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
560
628
|
left: boolean;
|
|
561
629
|
right: boolean;
|
|
562
630
|
} | null;
|
|
631
|
+
readonly activeRangeRect: () => {
|
|
632
|
+
minRow: number;
|
|
633
|
+
maxRow: number;
|
|
634
|
+
minCol: number;
|
|
635
|
+
maxCol: number;
|
|
636
|
+
} | null;
|
|
637
|
+
readonly cellSelectionState: (rowIndex: number, colIndex: number) => {
|
|
638
|
+
active: boolean;
|
|
639
|
+
edges: {
|
|
640
|
+
top: boolean;
|
|
641
|
+
bottom: boolean;
|
|
642
|
+
left: boolean;
|
|
643
|
+
right: boolean;
|
|
644
|
+
} | null;
|
|
645
|
+
fillHandle: boolean;
|
|
646
|
+
} | null;
|
|
563
647
|
readonly getSelectionRects: () => {
|
|
564
648
|
minRow: number;
|
|
565
649
|
maxRow: number;
|
|
@@ -593,6 +677,7 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
593
677
|
readonly startFillDrag: (event: PointerEvent, rowIndex: number, colIndex: number) => void;
|
|
594
678
|
readonly onFillPointerMove: (event: PointerEvent) => void;
|
|
595
679
|
readonly onFillPointerUp: () => void;
|
|
680
|
+
readonly fillDownToNeighbour: () => void;
|
|
596
681
|
readonly isOnMoveGrabStrip: (cell: HTMLElement, rowIndex: number, colIndex: number, clientX: number, clientY: number) => boolean;
|
|
597
682
|
readonly startMoveDrag: (event: PointerEvent, rowIndex: number, colIndex: number) => boolean;
|
|
598
683
|
readonly onMovePointerMove: (event: PointerEvent) => void;
|
|
@@ -626,6 +711,7 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
626
711
|
readonly cutSelectionToClipboard: () => Promise<void>;
|
|
627
712
|
readonly pasteFromClipboard: () => Promise<void>;
|
|
628
713
|
readonly onGridPaste: (event: ClipboardEvent) => void;
|
|
714
|
+
readonly armPasteFallback: () => void;
|
|
629
715
|
readonly clearSelectedCells: () => boolean;
|
|
630
716
|
readonly onCellDoubleClick: (rowIndex: number, colIndex: number) => void;
|
|
631
717
|
readonly startEditingWithChar: (rowIndex: number, colIndex: number, char: string) => boolean;
|
|
@@ -636,13 +722,7 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
636
722
|
readonly commitFullRowEdit: () => void;
|
|
637
723
|
readonly cancelFullRowEdit: () => void;
|
|
638
724
|
readonly saveEditingCell: () => void;
|
|
639
|
-
readonly applyHistoryStep: (step:
|
|
640
|
-
rowId: string;
|
|
641
|
-
columnId: string;
|
|
642
|
-
field: string;
|
|
643
|
-
before: unknown;
|
|
644
|
-
after: unknown;
|
|
645
|
-
}, direction: "undo" | "redo") => void;
|
|
725
|
+
readonly applyHistoryStep: (step: SharedHistoryStep, direction: "undo" | "redo") => void;
|
|
646
726
|
readonly updateEditingCellValue: (value: unknown) => void;
|
|
647
727
|
readonly onEditorKeyDown: (event: KeyboardEvent) => void;
|
|
648
728
|
readonly commitAndMoveByTab: (shiftKey: boolean) => void;
|
|
@@ -657,6 +737,7 @@ export declare function createSvGridController<TFeatures extends TableFeatures =
|
|
|
657
737
|
readonly contextMenuItems: () => {
|
|
658
738
|
key: string;
|
|
659
739
|
label: string;
|
|
740
|
+
icon?: import("./grid-icons.js").GridIconName | import("./SvGrid.types.js").ContextMenuIcon;
|
|
660
741
|
separator?: boolean;
|
|
661
742
|
disabled?: boolean;
|
|
662
743
|
run?: (() => void) | undefined;
|