@svgrid/enterprise 3.0.1 → 3.0.3
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/LICENSE +94 -24
- package/README.md +36 -4
- package/dist/SvAdvancedFilter.svelte +1 -1
- package/dist/SvAlertsManager.svelte +2 -1
- package/dist/SvBoard.svelte +2 -1
- package/dist/SvExportMenu.svelte +4 -1
- package/dist/SvExportMenu.svelte.d.ts +0 -13
- package/dist/SvExpressionEditor.svelte +3 -3
- package/dist/SvFormulaBar.svelte +680 -0
- package/dist/SvFormulaBar.svelte.d.ts +69 -0
- package/dist/SvGridAlerts.svelte +49 -9
- package/dist/SvGridBoard.svelte +13 -8
- package/dist/SvGridBulkEditDrawer.svelte +26 -2
- package/dist/SvGridEditPanel.svelte +3 -0
- package/dist/SvGridScheduler.svelte +69 -40
- package/dist/SvGridSelectionBar.svelte +10 -3
- package/dist/SvPivotDesigner.svelte +263 -54
- package/dist/SvPivotDesigner.svelte.d.ts +27 -20
- package/dist/SvRibbonIcon.svelte +46 -0
- package/dist/SvRibbonIcon.svelte.d.ts +17 -0
- package/dist/SvSchemaChart.svelte +4 -2
- package/dist/SvSheet.svelte +7914 -0
- package/dist/SvSheet.svelte.d.ts +215 -0
- package/dist/SvSheetChartSetup.svelte +151 -0
- package/dist/SvSheetChartSetup.svelte.d.ts +18 -0
- package/dist/SvSheetComment.svelte +283 -0
- package/dist/SvSheetComment.svelte.d.ts +22 -0
- package/dist/SvSheetConditionalFormat.svelte +159 -0
- package/dist/SvSheetConditionalFormat.svelte.d.ts +14 -0
- package/dist/SvSheetDataValidation.svelte +273 -0
- package/dist/SvSheetDataValidation.svelte.d.ts +14 -0
- package/dist/SvSheetEditRanges.svelte +217 -0
- package/dist/SvSheetEditRanges.svelte.d.ts +15 -0
- package/dist/SvSheetErrors.svelte +125 -0
- package/dist/SvSheetErrors.svelte.d.ts +20 -0
- package/dist/SvSheetEvaluate.svelte +133 -0
- package/dist/SvSheetEvaluate.svelte.d.ts +15 -0
- package/dist/SvSheetFilterMenu.svelte +320 -0
- package/dist/SvSheetFilterMenu.svelte.d.ts +22 -0
- package/dist/SvSheetFindReplace.svelte +132 -0
- package/dist/SvSheetFindReplace.svelte.d.ts +10 -0
- package/dist/SvSheetFormatCells.svelte +465 -0
- package/dist/SvSheetFormatCells.svelte.d.ts +17 -0
- package/dist/SvSheetGoalSeek.svelte +145 -0
- package/dist/SvSheetGoalSeek.svelte.d.ts +12 -0
- package/dist/SvSheetInsertFunction.svelte +149 -0
- package/dist/SvSheetInsertFunction.svelte.d.ts +8 -0
- package/dist/SvSheetIteration.svelte +81 -0
- package/dist/SvSheetIteration.svelte.d.ts +10 -0
- package/dist/SvSheetLink.svelte +99 -0
- package/dist/SvSheetLink.svelte.d.ts +17 -0
- package/dist/SvSheetListPicker.svelte +91 -0
- package/dist/SvSheetListPicker.svelte.d.ts +10 -0
- package/dist/SvSheetManageRules.svelte +187 -0
- package/dist/SvSheetManageRules.svelte.d.ts +16 -0
- package/dist/SvSheetNameManager.svelte +227 -0
- package/dist/SvSheetNameManager.svelte.d.ts +11 -0
- package/dist/SvSheetPageSetup.svelte +159 -0
- package/dist/SvSheetPageSetup.svelte.d.ts +13 -0
- package/dist/SvSheetPasteSpecial.svelte +107 -0
- package/dist/SvSheetPasteSpecial.svelte.d.ts +12 -0
- package/dist/SvSheetPivot.svelte +220 -0
- package/dist/SvSheetPivot.svelte.d.ts +21 -0
- package/dist/SvSheetProtectSheet.svelte +81 -0
- package/dist/SvSheetProtectSheet.svelte.d.ts +11 -0
- package/dist/SvSheetRemoveDuplicates.svelte +152 -0
- package/dist/SvSheetRemoveDuplicates.svelte.d.ts +12 -0
- package/dist/SvSheetRibbon.svelte +1254 -0
- package/dist/SvSheetRibbon.svelte.d.ts +34 -0
- package/dist/SvSheetSizeDialog.svelte +60 -0
- package/dist/SvSheetSizeDialog.svelte.d.ts +11 -0
- package/dist/SvSheetSort.svelte +218 -0
- package/dist/SvSheetSort.svelte.d.ts +28 -0
- package/dist/SvSheetSparklines.svelte +135 -0
- package/dist/SvSheetSparklines.svelte.d.ts +14 -0
- package/dist/SvSheetTable.svelte +160 -0
- package/dist/SvSheetTable.svelte.d.ts +24 -0
- package/dist/SvSheetTabs.svelte +571 -0
- package/dist/SvSheetTabs.svelte.d.ts +50 -0
- package/dist/SvSheetTabs.test-harness.svelte.d.ts +17 -0
- package/dist/SvSheetTabs.test-harness.svelte.js +22 -0
- package/dist/SvSheetTextToColumns.svelte +172 -0
- package/dist/SvSheetTextToColumns.svelte.d.ts +13 -0
- package/dist/SvSheetValidationAlert.svelte +85 -0
- package/dist/SvSheetValidationAlert.svelte.d.ts +15 -0
- package/dist/advanced-filter-enable.js +1 -1
- package/dist/alerts/alert-engine.d.ts +6 -0
- package/dist/alerts/alert-engine.js +21 -4
- package/dist/alerts/alert-formats.js +2 -0
- package/dist/alerts/alert-types.d.ts +1 -1
- package/dist/alerts.d.ts +1 -1
- package/dist/alerts.js +2 -2
- package/dist/board.js +2 -2
- package/dist/bulk-edit.d.ts +3 -1
- package/dist/bulk-edit.js +1 -1
- package/dist/cdn/svgrid-enterprise.svelte-external.js +43538 -6539
- package/dist/designer/assets/GridMenus-8gTNssgV.js +8 -0
- package/dist/designer/assets/SvChartMenu-BDoeqGz6.js +1 -0
- package/dist/designer/assets/SvChartMenu-BYO9cYdy.css +1 -0
- package/dist/designer/assets/SvDateRangeInput-BBRzrQeg.js +1 -0
- package/dist/designer/assets/SvDateTimePicker-DCPg7WGN.js +1 -0
- package/dist/designer/assets/SvGridCellEditor-DMoWJjEI.js +4 -0
- package/dist/designer/assets/SvGridChart-BgLuPO7I.css +1 -0
- package/dist/designer/assets/SvGridChart-Cy1ATrWh.js +3 -0
- package/dist/designer/assets/SvGridChartBuilder-08YWWeqY.css +1 -0
- package/dist/designer/assets/SvGridChartBuilder-eQ3mn0L9.js +1 -0
- package/dist/designer/assets/SvGridChartPanel-4Pc8y5yO.css +1 -0
- package/dist/designer/assets/SvGridChartPanel-CATdVc9X.js +4 -0
- package/dist/designer/assets/{SvGridChartView-DUc-1RUf.css → SvGridChartView-7msfnWZT.css} +1 -1
- package/dist/designer/assets/SvGridChartView-CmsZtCED.js +1 -0
- package/dist/designer/assets/SvGridDropdown-Cjz0H-fI.js +1 -0
- package/dist/designer/assets/SvListBox-BDS66lmZ.js +110 -0
- package/dist/designer/assets/SvMenuList-DJ47ba1h.css +1 -0
- package/dist/designer/assets/SvMenuList-Dgq2D5VN.js +1 -0
- package/dist/designer/assets/SvTabs-2mHC6oaz.js +1 -0
- package/dist/designer/assets/SvTabs-DKmwb5p1.css +1 -0
- package/dist/designer/assets/cell-formatting-BbubJTVz.js +1 -0
- package/dist/designer/assets/chart-Cn7MnNqA.js +1 -0
- package/dist/designer/assets/chart-export-B6bkQ3X8.js +11 -0
- package/dist/designer/assets/chart-export-pdf-BbA28-gt.js +11 -0
- package/dist/designer/assets/chart-panel-messages-Dz7PTIqT.js +1 -0
- package/dist/designer/assets/chart-summary-BD1qYB2R.js +1 -0
- package/dist/designer/assets/chart-trend-B8xr5LuD.js +1 -0
- package/dist/designer/assets/chart-validate-BMqM-qkF.js +1 -0
- package/dist/designer/assets/column-resize-BYDzR1Ve.js +1 -0
- package/dist/designer/assets/date-format-B8JbEtIG.js +1 -0
- package/dist/designer/assets/date-format-DKS-z0xS.css +1 -0
- package/dist/designer/assets/{dismissable-BO547MH9.js → dismissable-ChWRPkoa.js} +1 -1
- package/dist/designer/assets/editor-contract-Bpoa7A5g.js +1 -0
- package/dist/designer/assets/{export-format-D-eP4b2l.js → export-format-DGckmgKr.js} +1 -1
- package/dist/designer/assets/focus-trap-V2-6Fy9I.js +1 -0
- package/dist/designer/assets/{index-C_a9Cj8Y.js → index-D5bVbuzI.js} +318 -315
- package/dist/designer/assets/index-_JVFxt02.css +1 -0
- package/dist/designer/assets/list-option-BP_dWS66.js +1 -0
- package/dist/designer/assets/row-resize-BInFWCpr.js +1 -0
- package/dist/designer/assets/server-block-cache-CXJKkJpy.js +1 -0
- package/dist/designer/assets/src-CITpcm6b.js +1 -0
- package/dist/designer/assets/src-DUQ4xE3x.js +58 -0
- package/dist/designer/assets/validate-C3B8QKsM.js +1 -0
- package/dist/designer/index.html +29 -19
- package/dist/export-pdf.d.ts +164 -0
- package/dist/export-pdf.js +346 -15
- package/dist/export.js +25 -10
- package/dist/gantt/SvGridGantt.svelte +2890 -0
- package/dist/gantt/SvGridGantt.svelte.d.ts +30 -0
- package/dist/gantt/gantt-config.d.ts +73 -0
- package/dist/gantt/gantt-config.js +1 -0
- package/dist/gantt/gantt-critical-path.d.ts +67 -0
- package/dist/gantt/gantt-critical-path.js +207 -0
- package/dist/gantt/gantt-model.d.ts +257 -0
- package/dist/gantt/gantt-model.js +651 -0
- package/dist/gantt/gantt-resources.d.ts +59 -0
- package/dist/gantt/gantt-resources.js +71 -0
- package/dist/gantt/gantt.d.ts +7 -0
- package/dist/gantt/gantt.js +36 -0
- package/dist/gantt/index.d.ts +15 -0
- package/dist/gantt/index.js +22 -0
- package/dist/gantt/timeline-arrows.d.ts +102 -0
- package/dist/gantt/timeline-arrows.js +181 -0
- package/dist/import.d.ts +2 -2
- package/dist/import.js +1 -1
- package/dist/index.d.ts +93 -3
- package/dist/index.js +107 -3
- package/dist/install.js +13 -1
- package/dist/license-core.d.ts +17 -1
- package/dist/license-core.js +16 -5
- package/dist/license.d.ts +18 -2
- package/dist/license.js +71 -6
- package/dist/node/studio.js +203 -9
- package/dist/pivot-chart.d.ts +25 -1
- package/dist/pivot-chart.js +25 -69
- package/dist/pivot-enable.js +2 -2
- package/dist/scheduler-dependencies.d.ts +35 -0
- package/dist/scheduler-dependencies.js +36 -1
- package/dist/scheduler.js +2 -2
- package/dist/selection-bar.js +2 -2
- package/dist/server/SvGroupCell.svelte +213 -0
- package/dist/server/SvGroupCell.svelte.d.ts +62 -0
- package/dist/server/SvRowGroupPanel.svelte +322 -0
- package/dist/server/SvRowGroupPanel.svelte.d.ts +37 -0
- package/dist/server/enable.d.ts +17 -0
- package/dist/server/enable.js +49 -0
- package/dist/server/index.d.ts +22 -0
- package/dist/server/index.js +24 -0
- package/dist/server/messages.d.ts +45 -0
- package/dist/server/messages.js +35 -0
- package/dist/server/server-group-model.d.ts +104 -0
- package/dist/server/server-group-model.js +272 -0
- package/dist/server/server-pivot.d.ts +46 -0
- package/dist/server/server-pivot.js +57 -0
- package/dist/server/server-row-model.d.ts +547 -0
- package/dist/server/server-row-model.js +1551 -0
- package/dist/server/server-selection.d.ts +99 -0
- package/dist/server/server-selection.js +215 -0
- package/dist/server/svgrid-adapter.d.ts +155 -0
- package/dist/server/svgrid-adapter.js +202 -0
- package/dist/sheet/address.d.ts +43 -0
- package/dist/sheet/address.js +81 -0
- package/dist/sheet/ast.d.ts +138 -0
- package/dist/sheet/ast.js +70 -0
- package/dist/sheet/auto-filter.d.ts +120 -0
- package/dist/sheet/auto-filter.js +295 -0
- package/dist/sheet/autocomplete.d.ts +51 -0
- package/dist/sheet/autocomplete.js +248 -0
- package/dist/sheet/cell-images.d.ts +39 -0
- package/dist/sheet/cell-images.js +90 -0
- package/dist/sheet/cell-types.d.ts +58 -0
- package/dist/sheet/cell-types.js +96 -0
- package/dist/sheet/coerce.d.ts +71 -0
- package/dist/sheet/coerce.js +289 -0
- package/dist/sheet/commands.d.ts +89 -0
- package/dist/sheet/commands.js +230 -0
- package/dist/sheet/comments.d.ts +63 -0
- package/dist/sheet/comments.js +131 -0
- package/dist/sheet/conditional-formats.d.ts +167 -0
- package/dist/sheet/conditional-formats.js +341 -0
- package/dist/sheet/csv.d.ts +32 -0
- package/dist/sheet/csv.js +158 -0
- package/dist/sheet/culture.d.ts +87 -0
- package/dist/sheet/culture.js +247 -0
- package/dist/sheet/delta.d.ts +102 -0
- package/dist/sheet/delta.js +203 -0
- package/dist/sheet/deps.d.ts +104 -0
- package/dist/sheet/deps.js +274 -0
- package/dist/sheet/document.d.ts +252 -0
- package/dist/sheet/document.js +465 -0
- package/dist/sheet/edit-keys.d.ts +14 -0
- package/dist/sheet/edit-keys.js +40 -0
- package/dist/sheet/engine.d.ts +67 -0
- package/dist/sheet/engine.js +19 -0
- package/dist/sheet/entry.d.ts +35 -0
- package/dist/sheet/entry.js +226 -0
- package/dist/sheet/error-check.d.ts +49 -0
- package/dist/sheet/error-check.js +83 -0
- package/dist/sheet/evaluate-steps.d.ts +48 -0
- package/dist/sheet/evaluate-steps.js +196 -0
- package/dist/sheet/evaluate.d.ts +128 -0
- package/dist/sheet/evaluate.js +1049 -0
- package/dist/sheet/filter-files.d.ts +37 -0
- package/dist/sheet/filter-files.js +465 -0
- package/dist/sheet/find-replace.d.ts +62 -0
- package/dist/sheet/find-replace.js +152 -0
- package/dist/sheet/format-store.d.ts +114 -0
- package/dist/sheet/format-store.js +243 -0
- package/dist/sheet/freeze.d.ts +54 -0
- package/dist/sheet/freeze.js +58 -0
- package/dist/sheet/from-rows.d.ts +14 -0
- package/dist/sheet/from-rows.js +50 -0
- package/dist/sheet/function-catalog.d.ts +10 -0
- package/dist/sheet/function-catalog.js +385 -0
- package/dist/sheet/functions.d.ts +28 -0
- package/dist/sheet/functions.js +634 -0
- package/dist/sheet/goal-seek.d.ts +73 -0
- package/dist/sheet/goal-seek.js +153 -0
- package/dist/sheet/index.d.ts +80 -0
- package/dist/sheet/index.js +80 -0
- package/dist/sheet/links.d.ts +57 -0
- package/dist/sheet/links.js +174 -0
- package/dist/sheet/merges.d.ts +71 -0
- package/dist/sheet/merges.js +137 -0
- package/dist/sheet/messages.d.ts +778 -0
- package/dist/sheet/messages.js +806 -0
- package/dist/sheet/names.d.ts +31 -0
- package/dist/sheet/names.js +87 -0
- package/dist/sheet/navigate.d.ts +52 -0
- package/dist/sheet/navigate.js +135 -0
- package/dist/sheet/number-format.d.ts +110 -0
- package/dist/sheet/number-format.js +905 -0
- package/dist/sheet/objects.d.ts +106 -0
- package/dist/sheet/objects.js +149 -0
- package/dist/sheet/ods-document.d.ts +44 -0
- package/dist/sheet/ods-document.js +1275 -0
- package/dist/sheet/open-file.d.ts +26 -0
- package/dist/sheet/open-file.js +56 -0
- package/dist/sheet/outline.d.ts +82 -0
- package/dist/sheet/outline.js +228 -0
- package/dist/sheet/packs/array.d.ts +16 -0
- package/dist/sheet/packs/array.js +172 -0
- package/dist/sheet/packs/database.d.ts +42 -0
- package/dist/sheet/packs/database.js +142 -0
- package/dist/sheet/packs/engineering.d.ts +2 -0
- package/dist/sheet/packs/engineering.js +296 -0
- package/dist/sheet/packs/financial.d.ts +5 -0
- package/dist/sheet/packs/financial.js +220 -0
- package/dist/sheet/packs/math-stats.d.ts +2 -0
- package/dist/sheet/packs/math-stats.js +372 -0
- package/dist/sheet/packs/special.d.ts +44 -0
- package/dist/sheet/packs/special.js +187 -0
- package/dist/sheet/packs/stats-dist.d.ts +2 -0
- package/dist/sheet/packs/stats-dist.js +785 -0
- package/dist/sheet/packs/text-date.d.ts +2 -0
- package/dist/sheet/packs/text-date.js +332 -0
- package/dist/sheet/packs/trig.d.ts +2 -0
- package/dist/sheet/packs/trig.js +73 -0
- package/dist/sheet/page-setup.d.ts +73 -0
- package/dist/sheet/page-setup.js +73 -0
- package/dist/sheet/palette.d.ts +19 -0
- package/dist/sheet/palette.js +84 -0
- package/dist/sheet/parse.d.ts +13 -0
- package/dist/sheet/parse.js +140 -0
- package/dist/sheet/paste-special.d.ts +186 -0
- package/dist/sheet/paste-special.js +601 -0
- package/dist/sheet/pivot-range.d.ts +160 -0
- package/dist/sheet/pivot-range.js +333 -0
- package/dist/sheet/presence.d.ts +73 -0
- package/dist/sheet/presence.js +79 -0
- package/dist/sheet/print.d.ts +104 -0
- package/dist/sheet/print.js +169 -0
- package/dist/sheet/protection.d.ts +75 -0
- package/dist/sheet/protection.js +101 -0
- package/dist/sheet/rects.d.ts +45 -0
- package/dist/sheet/rects.js +112 -0
- package/dist/sheet/refs.d.ts +130 -0
- package/dist/sheet/refs.js +413 -0
- package/dist/sheet/ribbon-icons.d.ts +31 -0
- package/dist/sheet/ribbon-icons.js +536 -0
- package/dist/sheet/ribbon.d.ts +173 -0
- package/dist/sheet/ribbon.js +1054 -0
- package/dist/sheet/sheet-kinds.d.ts +74 -0
- package/dist/sheet/sheet-kinds.js +91 -0
- package/dist/sheet/shortcuts.d.ts +174 -0
- package/dist/sheet/shortcuts.js +674 -0
- package/dist/sheet/sort.d.ts +51 -0
- package/dist/sheet/sort.js +107 -0
- package/dist/sheet/sparklines.d.ts +111 -0
- package/dist/sheet/sparklines.js +204 -0
- package/dist/sheet/structure.d.ts +87 -0
- package/dist/sheet/structure.js +166 -0
- package/dist/sheet/table-styles.d.ts +74 -0
- package/dist/sheet/table-styles.js +152 -0
- package/dist/sheet/tables.d.ts +89 -0
- package/dist/sheet/tables.js +178 -0
- package/dist/sheet/tokenize.d.ts +71 -0
- package/dist/sheet/tokenize.js +355 -0
- package/dist/sheet/transforms.d.ts +76 -0
- package/dist/sheet/transforms.js +154 -0
- package/dist/sheet/validation.d.ts +108 -0
- package/dist/sheet/validation.js +278 -0
- package/dist/sheet/workbook.d.ts +217 -0
- package/dist/sheet/workbook.js +1120 -0
- package/dist/sheet/xls-cfb.d.ts +32 -0
- package/dist/sheet/xls-cfb.js +290 -0
- package/dist/sheet/xls-document.d.ts +10 -0
- package/dist/sheet/xls-document.js +1243 -0
- package/dist/sheet/xls-formula.d.ts +40 -0
- package/dist/sheet/xls-formula.js +569 -0
- package/dist/sheet/xlsx-document.d.ts +108 -0
- package/dist/sheet/xlsx-document.js +1849 -0
- package/dist/sheet/xlsx-drawing.d.ts +99 -0
- package/dist/sheet/xlsx-drawing.js +420 -0
- package/dist/sheet-enable.d.ts +6 -0
- package/dist/sheet-enable.js +45 -0
- package/dist/sheet-text.d.ts +7 -0
- package/dist/sheet-text.js +29 -0
- package/dist/sources/auth-supabase.js +2 -2
- package/dist/sources/realtime-supabase.js +2 -2
- package/dist/sources/rest.d.ts +6 -2
- package/dist/sources/rest.js +42 -7
- package/dist/sources/supabase.d.ts +10 -1
- package/dist/sources/supabase.js +73 -40
- package/dist/studio/emit-project.js +14 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio/project.d.ts +11 -2
- package/dist/studio/project.js +5 -2
- package/dist/studio/ui-components.generated.js +170 -3
- package/dist/sveltekit/in-memory.d.ts +2 -2
- package/dist/sveltekit/in-memory.js +125 -4
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/index.js +1 -1
- package/dist/sveltekit/query-plan.d.ts +50 -4
- package/dist/sveltekit/query-plan.js +25 -3
- package/dist/sveltekit/sql-source.d.ts +6 -0
- package/dist/sveltekit/sql-source.js +34 -6
- package/dist/sveltekit/sql.d.ts +31 -0
- package/dist/sveltekit/sql.js +135 -25
- package/dist/sveltekit/transport.d.ts +10 -2
- package/dist/sveltekit/transport.js +30 -6
- package/dist/upgrade-prompt.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/watermark.js +35 -2
- package/dist/wc/GridMenus-By9vPuq0.js +1088 -0
- package/dist/wc/SvChartMenu-CQNrQGT2.js +308 -0
- package/dist/wc/SvDateRangeInput-DR6m7bSM.js +199 -0
- package/dist/wc/SvDateTimePicker-D-vRnaMo.js +771 -0
- package/dist/wc/SvField-B_kurx_P.js +149 -0
- package/dist/wc/SvGrid.helpers-BdVDtjUm.js +135 -0
- package/dist/wc/SvGridCellEditor-Bnf1Kr5C.js +560 -0
- package/dist/wc/SvGridChart-BqUJh2pG.js +3572 -0
- package/dist/wc/SvGridChartBuilder-CGycC5cn.js +988 -0
- package/dist/wc/SvGridChartPanel-CRnizsHD.js +1746 -0
- package/dist/wc/SvGridChartView-D1pa_xMy.js +47 -0
- package/dist/wc/SvGridDropdown-45WsObLL.js +259 -0
- package/dist/wc/SvModal-DrfOYYyX.js +189 -0
- package/dist/wc/cell-formatting-CBfgahv1.js +86 -0
- package/dist/wc/chart-6OXlybVT.js +4341 -0
- package/dist/wc/chart-export-CeSADGfi.js +135 -0
- package/dist/wc/chart-export-pdf-BGko7MER.js +104 -0
- package/dist/wc/chart-summary-2m3ia1-n.js +137 -0
- package/dist/wc/chart-trend-CQOQtTMl.js +50 -0
- package/dist/wc/chart-validate-CD6ptiwg.js +180 -0
- package/dist/wc/client-DQIzjDBG.js +3064 -0
- package/dist/wc/column-resize-DUPgynvc.js +101 -0
- package/dist/wc/date-format-DS-z_h9v.js +1130 -0
- package/dist/wc/dismissable-CQ6XFXsk.js +45 -0
- package/dist/wc/editor-contract-peBDxir_.js +22 -0
- package/dist/wc/editor-registry-DxGKqcvx.js +24 -0
- package/dist/wc/focus-trap-Dbb2tJxb.js +65 -0
- package/dist/wc/list-option-DrRyivWp.js +82 -0
- package/dist/wc/popover-WsGlvtQv.js +69 -0
- package/dist/wc/positioning-BiKLfu1E.js +112 -0
- package/dist/wc/react.d.ts +41 -0
- package/dist/wc/react.js +90 -0
- package/dist/wc/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/wc/row-drag-touch-CycRR65n.js +93 -0
- package/dist/wc/row-resize-limG_N1z.js +111 -0
- package/dist/wc/sv-sheet-element.d.ts +97 -0
- package/dist/wc/sv-sheet-element.js +44213 -0
- package/dist/wc/svelte-virtualizer.svelte-CXtQy2TQ.js +530 -0
- package/dist/wc/validate-BqDthkNr.js +88 -0
- package/dist/wc/vue.d.ts +31 -0
- package/dist/wc/vue.js +75 -0
- package/package.json +36 -6
- package/dist/designer/assets/GridMenus-B1JtIN21.js +0 -8
- package/dist/designer/assets/SvDateRangeInput-CjO7nn_x.js +0 -1
- package/dist/designer/assets/SvDateTimePicker-ByBD_ov6.js +0 -1
- package/dist/designer/assets/SvField-YDLipR6O.css +0 -1
- package/dist/designer/assets/SvField-cj1PFNgZ.js +0 -1
- package/dist/designer/assets/SvGridCellEditor-0W1L2hJ1.js +0 -2
- package/dist/designer/assets/SvGridChart-DBOR4xcz.js +0 -2
- package/dist/designer/assets/SvGridChart-fkMWeh1J.css +0 -1
- package/dist/designer/assets/SvGridChartPanel-symrhNnR.js +0 -11
- package/dist/designer/assets/SvGridChartView-BmRxq6mU.js +0 -1
- package/dist/designer/assets/SvGridDropdown-Bb3HH2Aj.js +0 -1
- package/dist/designer/assets/SvListBox-1oUF6Iav.js +0 -110
- package/dist/designer/assets/cell-formatting-wr5wm7US.js +0 -1
- package/dist/designer/assets/chart-DXFganU8.js +0 -1
- package/dist/designer/assets/column-resize-C_inr5zT.js +0 -1
- package/dist/designer/assets/date-format-DGagAqRc.css +0 -1
- package/dist/designer/assets/date-format-onlYDsrY.js +0 -1
- package/dist/designer/assets/easing-zaypKrr0.js +0 -3
- package/dist/designer/assets/index-k2stW6L8.css +0 -1
- package/dist/designer/assets/row-resize-B0FWHcNr.js +0 -1
- package/dist/designer/assets/src-D9p27OGC.js +0 -58
- package/dist/designer/assets/validate-h-aslRV9.js +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's sort order over a block of rows, by one key or several.
|
|
3
|
+
*
|
|
4
|
+
* The rules that make a sheet's sort read as Excel's: numbers before text
|
|
5
|
+
* before booleans and errors, blanks last whichever way the sort runs,
|
|
6
|
+
* text without regard to case, a stable order so a tie keeps the rows as
|
|
7
|
+
* they were, and each key only consulted when the ones before it tie.
|
|
8
|
+
*/
|
|
9
|
+
import { type CellValue } from './ast.js';
|
|
10
|
+
export type SortDirection = 'asc' | 'desc';
|
|
11
|
+
/**
|
|
12
|
+
* What a key sorts on. Excel's "Sort On" list: the cell's value, or one of
|
|
13
|
+
* its colours.
|
|
14
|
+
*/
|
|
15
|
+
export type SortOn = 'value' | 'fill' | 'color';
|
|
16
|
+
export type SortKey = {
|
|
17
|
+
/** The column the key reads, as a sheet column index. */
|
|
18
|
+
col: number;
|
|
19
|
+
direction: SortDirection;
|
|
20
|
+
/** What the key reads in that column. Absent means the value. */
|
|
21
|
+
on?: SortOn;
|
|
22
|
+
/**
|
|
23
|
+
* The colour this key puts first, for a colour key: Excel sorts ONE
|
|
24
|
+
* colour to the top (ascending) or the bottom (descending) and leaves
|
|
25
|
+
* every other row where it was. Absent leaves the key doing nothing.
|
|
26
|
+
*/
|
|
27
|
+
colour?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The rows in sorted order. `rows` are the row indexes of the block's data
|
|
31
|
+
* rows (the header left out), `valueAt` reads a computed cell.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sortOrder(rows: ReadonlyArray<number>, keys: ReadonlyArray<SortKey>, valueAt: (row: number, col: number) => CellValue,
|
|
34
|
+
/**
|
|
35
|
+
* The colours a cell carries, for a key that sorts on one: its fill and
|
|
36
|
+
* its font colour, each as it is written, or null. Only a colour key
|
|
37
|
+
* calls it.
|
|
38
|
+
*/
|
|
39
|
+
colourAt?: (row: number, col: number, on: 'fill' | 'color') => string | null): number[];
|
|
40
|
+
/**
|
|
41
|
+
* Excel's guess at "my data has headers": the first row of the key column
|
|
42
|
+
* holds text and the row under it holds something that is not text. Given
|
|
43
|
+
* the block's columns it looks across them, as Excel does: a Name column
|
|
44
|
+
* over names says nothing, and the Pay column beside it, text over a
|
|
45
|
+
* number, is what says the first row is a header, so a sort by name does
|
|
46
|
+
* not carry "Name" down into the names.
|
|
47
|
+
*/
|
|
48
|
+
export declare function guessHeaderRow(valueAt: (row: number, col: number) => CellValue, top: number, col: number, columns?: {
|
|
49
|
+
left: number;
|
|
50
|
+
right: number;
|
|
51
|
+
}): boolean;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's sort order over a block of rows, by one key or several.
|
|
3
|
+
*
|
|
4
|
+
* The rules that make a sheet's sort read as Excel's: numbers before text
|
|
5
|
+
* before booleans and errors, blanks last whichever way the sort runs,
|
|
6
|
+
* text without regard to case, a stable order so a tie keeps the rows as
|
|
7
|
+
* they were, and each key only consulted when the ones before it tie.
|
|
8
|
+
*/
|
|
9
|
+
import { isError } from './ast.js';
|
|
10
|
+
import { isBlankValue } from './navigate.js';
|
|
11
|
+
/** Excel's type order: numbers, then text, then booleans and errors. */
|
|
12
|
+
function rank(v) {
|
|
13
|
+
if (isBlankValue(v))
|
|
14
|
+
return [3, ''];
|
|
15
|
+
if (typeof v === 'number')
|
|
16
|
+
return [0, v];
|
|
17
|
+
if (typeof v === 'boolean')
|
|
18
|
+
return [2, v ? 1 : 0];
|
|
19
|
+
if (isError(v))
|
|
20
|
+
return [2, 0];
|
|
21
|
+
return [1, String(v).toLowerCase()];
|
|
22
|
+
}
|
|
23
|
+
function compareValues(a, b, direction) {
|
|
24
|
+
const [ka, va] = rank(a);
|
|
25
|
+
const [kb, vb] = rank(b);
|
|
26
|
+
// A blank sorts last both ways, as in Excel.
|
|
27
|
+
if (ka === 3 || kb === 3)
|
|
28
|
+
return ka === kb ? 0 : ka === 3 ? 1 : -1;
|
|
29
|
+
if (ka !== kb)
|
|
30
|
+
return direction === 'asc' ? ka - kb : kb - ka;
|
|
31
|
+
const cmp = typeof va === 'number' && typeof vb === 'number' ? va - vb : String(va).localeCompare(String(vb));
|
|
32
|
+
return direction === 'asc' ? cmp : -cmp;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The rows in sorted order. `rows` are the row indexes of the block's data
|
|
36
|
+
* rows (the header left out), `valueAt` reads a computed cell.
|
|
37
|
+
*/
|
|
38
|
+
export function sortOrder(rows, keys, valueAt,
|
|
39
|
+
/**
|
|
40
|
+
* The colours a cell carries, for a key that sorts on one: its fill and
|
|
41
|
+
* its font colour, each as it is written, or null. Only a colour key
|
|
42
|
+
* calls it.
|
|
43
|
+
*/
|
|
44
|
+
colourAt) {
|
|
45
|
+
if (!keys.length)
|
|
46
|
+
return [...rows];
|
|
47
|
+
return rows
|
|
48
|
+
.map((row, index) => ({ row, index }))
|
|
49
|
+
.sort((a, b) => {
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
const cmp = key.on === 'fill' || key.on === 'color'
|
|
52
|
+
? compareColours(a.row, b.row, key, colourAt)
|
|
53
|
+
: compareValues(valueAt(a.row, key.col), valueAt(b.row, key.col), key.direction);
|
|
54
|
+
if (cmp !== 0)
|
|
55
|
+
return cmp;
|
|
56
|
+
}
|
|
57
|
+
return a.index - b.index;
|
|
58
|
+
})
|
|
59
|
+
.map((entry) => entry.row);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A colour key: the rows wearing the chosen colour move to the top, or to
|
|
63
|
+
* the bottom when the key runs the other way, and everything else keeps the
|
|
64
|
+
* order it had.
|
|
65
|
+
*
|
|
66
|
+
* That is Excel's model and it is worth stating, because the obvious
|
|
67
|
+
* alternative, ordering colours among themselves, has no order to use: two
|
|
68
|
+
* colours are not greater or lesser than one another.
|
|
69
|
+
*/
|
|
70
|
+
function compareColours(rowA, rowB, key, colourAt) {
|
|
71
|
+
if (!key.colour || !colourAt || (key.on !== 'fill' && key.on !== 'color'))
|
|
72
|
+
return 0;
|
|
73
|
+
const wanted = key.colour.trim().toLowerCase();
|
|
74
|
+
const has = (row) => (colourAt(row, key.col, key.on) ?? '').trim().toLowerCase() === wanted;
|
|
75
|
+
const a = has(rowA);
|
|
76
|
+
const b = has(rowB);
|
|
77
|
+
if (a === b)
|
|
78
|
+
return 0;
|
|
79
|
+
return key.direction === 'asc' ? (a ? -1 : 1) : (a ? 1 : -1);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Excel's guess at "my data has headers": the first row of the key column
|
|
83
|
+
* holds text and the row under it holds something that is not text. Given
|
|
84
|
+
* the block's columns it looks across them, as Excel does: a Name column
|
|
85
|
+
* over names says nothing, and the Pay column beside it, text over a
|
|
86
|
+
* number, is what says the first row is a header, so a sort by name does
|
|
87
|
+
* not carry "Name" down into the names.
|
|
88
|
+
*/
|
|
89
|
+
export function guessHeaderRow(valueAt, top, col, columns) {
|
|
90
|
+
const isText = (v) => typeof v === 'string' && v !== '';
|
|
91
|
+
const headerOver = (c) => {
|
|
92
|
+
const below = valueAt(top + 1, c);
|
|
93
|
+
return isText(valueAt(top, c)) && !isText(below) && !isBlankValue(below);
|
|
94
|
+
};
|
|
95
|
+
if (!columns)
|
|
96
|
+
return headerOver(col);
|
|
97
|
+
let someHeader = false;
|
|
98
|
+
for (let c = columns.left; c <= columns.right; c += 1) {
|
|
99
|
+
const head = valueAt(top, c);
|
|
100
|
+
// A number or a blank in the first row is data, whatever is beside it.
|
|
101
|
+
if (!isBlankValue(head) && !isText(head))
|
|
102
|
+
return false;
|
|
103
|
+
if (headerOver(c))
|
|
104
|
+
someHeader = true;
|
|
105
|
+
}
|
|
106
|
+
return someHeader;
|
|
107
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparklines: Excel's tiny chart drawn INSIDE a cell, one per row (or per
|
|
3
|
+
* column) of a block of numbers.
|
|
4
|
+
*
|
|
5
|
+
* Excel keeps them as a group rather than as one chart per cell: a data
|
|
6
|
+
* range, a location range of the same shape, and the settings the whole
|
|
7
|
+
* group shares (the kind, the colours, whether every line is drawn on one
|
|
8
|
+
* scale). That is what this keeps, because it is also what the user edits:
|
|
9
|
+
* changing the kind changes the group, and clearing one clears the group.
|
|
10
|
+
*
|
|
11
|
+
* A sparkline is not an object (`objects.ts`): it has no anchor and no size
|
|
12
|
+
* of its own, it IS the cell, so it moves and dies with the cells the way a
|
|
13
|
+
* conditional format does. Its data is read live from the range, so editing
|
|
14
|
+
* a number redraws it.
|
|
15
|
+
*/
|
|
16
|
+
import type { Rect } from './format-store.js';
|
|
17
|
+
import type { StructuralEdit } from './refs.js';
|
|
18
|
+
import type { CellValue } from './ast.js';
|
|
19
|
+
/** The three Excel offers: Line, Column and Win/Loss. */
|
|
20
|
+
export declare const SPARKLINE_TYPES: readonly ["line", "column", "winloss"];
|
|
21
|
+
export type SheetSparklineType = (typeof SPARKLINE_TYPES)[number];
|
|
22
|
+
export type SparklineGroup = {
|
|
23
|
+
id: string;
|
|
24
|
+
/** The cells the sparklines are drawn in: one row, or one column. */
|
|
25
|
+
location: Rect;
|
|
26
|
+
/** The numbers they read, one line of it per location cell. */
|
|
27
|
+
data: Rect;
|
|
28
|
+
type: SheetSparklineType;
|
|
29
|
+
/** The line or the positive bars. Defaults to the theme's accent. */
|
|
30
|
+
color?: string;
|
|
31
|
+
/** The negative bars of a Column or Win/Loss group. */
|
|
32
|
+
negativeColor?: string;
|
|
33
|
+
/** One value scale across the whole group, as Excel's "Same for All". */
|
|
34
|
+
sameScale?: boolean;
|
|
35
|
+
/** A dot on the last point of a Line group. */
|
|
36
|
+
markers?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** An id no other group of this session carries. */
|
|
39
|
+
export declare const sparklineId: () => string;
|
|
40
|
+
/** A copy safe to hand out or save. */
|
|
41
|
+
export declare function copySparkline(group: SparklineGroup): SparklineGroup;
|
|
42
|
+
/**
|
|
43
|
+
* The group after an insert or delete: both rectangles move with their
|
|
44
|
+
* cells. Null when the edit took every cell the group was drawn in, or
|
|
45
|
+
* every cell it read.
|
|
46
|
+
*/
|
|
47
|
+
export declare function shiftSparkline(group: SparklineGroup, edit: StructuralEdit): SparklineGroup | null;
|
|
48
|
+
/** The groups of a sheet after an insert or delete, the gone ones dropped. */
|
|
49
|
+
export declare function shiftSparklines(groups: ReadonlyArray<SparklineGroup>, edit: StructuralEdit): SparklineGroup[];
|
|
50
|
+
/** True when the group draws down a column of cells rather than along a row. */
|
|
51
|
+
export declare function isColumnLocation(group: SparklineGroup): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The numbers one location cell draws, read through `valueAt`. The nth cell
|
|
54
|
+
* of the location reads the nth line of the data: the nth row when the
|
|
55
|
+
* sparklines run down a column, the nth column when they run along a row.
|
|
56
|
+
* A blank or a text cell inside the line is a gap, which Excel draws as a
|
|
57
|
+
* zero rather than breaking the line.
|
|
58
|
+
*/
|
|
59
|
+
export declare function sparklineSeries(group: SparklineGroup, row: number, col: number, valueAt: (row: number, col: number) => CellValue): number[] | null;
|
|
60
|
+
/** The group drawn in a cell, or null: the last one wins, as Excel's does. */
|
|
61
|
+
/**
|
|
62
|
+
* One line per cell of the group: the cell the sparkline is drawn in and
|
|
63
|
+
* the block of numbers it reads.
|
|
64
|
+
*
|
|
65
|
+
* The drawing works this out cell by cell as it paints; a writer needs the
|
|
66
|
+
* whole list, because Excel stores a sparkline group as one entry per cell
|
|
67
|
+
* with its own reference.
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* A sparkline as standalone SVG markup, for a page the component cannot
|
|
71
|
+
* draw on: the printed sheet.
|
|
72
|
+
*
|
|
73
|
+
* The geometry is the grid's own `buildSparkline`, so the printed line is
|
|
74
|
+
* the line on screen rather than a second drawing that can disagree with
|
|
75
|
+
* it. The markup carries its colours inline, since the print document has
|
|
76
|
+
* no stylesheet of ours.
|
|
77
|
+
*/
|
|
78
|
+
export declare function sparklineSvg(values: ReadonlyArray<number>, options: {
|
|
79
|
+
type?: SheetSparklineType;
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
color?: string;
|
|
83
|
+
negativeColor?: string;
|
|
84
|
+
min?: number;
|
|
85
|
+
max?: number;
|
|
86
|
+
markers?: boolean;
|
|
87
|
+
}): string;
|
|
88
|
+
export declare function sparklineLines(group: SparklineGroup): Array<{
|
|
89
|
+
row: number;
|
|
90
|
+
col: number;
|
|
91
|
+
data: Rect;
|
|
92
|
+
}>;
|
|
93
|
+
export declare function sparklineAt(groups: ReadonlyArray<SparklineGroup>, row: number, col: number): SparklineGroup | null;
|
|
94
|
+
/**
|
|
95
|
+
* The scale a group is drawn on when every sparkline in it shares one, which
|
|
96
|
+
* is Excel's "Same for All": the smallest and largest number anywhere in the
|
|
97
|
+
* data range. Null when the group scales each sparkline on its own.
|
|
98
|
+
*/
|
|
99
|
+
export declare function sparklineScale(group: SparklineGroup, valueAt: (row: number, col: number) => CellValue): {
|
|
100
|
+
min: number;
|
|
101
|
+
max: number;
|
|
102
|
+
} | null;
|
|
103
|
+
/**
|
|
104
|
+
* Where Excel's Create Sparklines dialog opens: the data is the selected
|
|
105
|
+
* block, and the location the column just past it (or the row just under it
|
|
106
|
+
* when the block is a single row). A block one cell tall gets a location of
|
|
107
|
+
* one cell, which is the common "a row of months, a sparkline beside it".
|
|
108
|
+
*/
|
|
109
|
+
export declare function sparklinesFromRange(data: Rect, type?: SheetSparklineType): SparklineGroup;
|
|
110
|
+
/** The groups left after clearing every one the rectangles touch. */
|
|
111
|
+
export declare function clearSparklines(groups: ReadonlyArray<SparklineGroup>, rects: ReadonlyArray<Rect>): SparklineGroup[];
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { shiftRect, rectContains } from './rects.js';
|
|
2
|
+
// The geometry only, through the grid's own subpath: this module is read by
|
|
3
|
+
// the xlsx writer and by tests that run without a DOM, and the package root
|
|
4
|
+
// would drag every component in with it.
|
|
5
|
+
import { buildSparkline } from '@svgrid/grid/sparkline';
|
|
6
|
+
/** The three Excel offers: Line, Column and Win/Loss. */
|
|
7
|
+
export const SPARKLINE_TYPES = ['line', 'column', 'winloss'];
|
|
8
|
+
let nextSparklineId = 1;
|
|
9
|
+
/** An id no other group of this session carries. */
|
|
10
|
+
export const sparklineId = () => `spark-${Date.now().toString(36)}-${(nextSparklineId += 1).toString(36)}`;
|
|
11
|
+
/** A copy safe to hand out or save. */
|
|
12
|
+
export function copySparkline(group) {
|
|
13
|
+
return { ...group, location: [...group.location], data: [...group.data] };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The group after an insert or delete: both rectangles move with their
|
|
17
|
+
* cells. Null when the edit took every cell the group was drawn in, or
|
|
18
|
+
* every cell it read.
|
|
19
|
+
*/
|
|
20
|
+
export function shiftSparkline(group, edit) {
|
|
21
|
+
const location = shiftRect(group.location, edit);
|
|
22
|
+
if (!location)
|
|
23
|
+
return null;
|
|
24
|
+
const data = shiftRect(group.data, edit);
|
|
25
|
+
if (!data)
|
|
26
|
+
return null;
|
|
27
|
+
return { ...copySparkline(group), location: location, data: data };
|
|
28
|
+
}
|
|
29
|
+
/** The groups of a sheet after an insert or delete, the gone ones dropped. */
|
|
30
|
+
export function shiftSparklines(groups, edit) {
|
|
31
|
+
return groups.map((g) => shiftSparkline(g, edit)).filter((g) => g !== null);
|
|
32
|
+
}
|
|
33
|
+
/** True when the group draws down a column of cells rather than along a row. */
|
|
34
|
+
export function isColumnLocation(group) {
|
|
35
|
+
const [r1, c1, r2, c2] = group.location;
|
|
36
|
+
// A single cell counts as a column: its data is read as one line either way.
|
|
37
|
+
return r2 - r1 >= c2 - c1;
|
|
38
|
+
}
|
|
39
|
+
/** A cell's value as a number, or null when it is not one. */
|
|
40
|
+
function numberOf(value) {
|
|
41
|
+
if (typeof value === 'number')
|
|
42
|
+
return Number.isFinite(value) ? value : null;
|
|
43
|
+
if (typeof value === 'boolean')
|
|
44
|
+
return value ? 1 : 0;
|
|
45
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
46
|
+
const n = Number(value);
|
|
47
|
+
return Number.isFinite(n) ? n : null;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The numbers one location cell draws, read through `valueAt`. The nth cell
|
|
53
|
+
* of the location reads the nth line of the data: the nth row when the
|
|
54
|
+
* sparklines run down a column, the nth column when they run along a row.
|
|
55
|
+
* A blank or a text cell inside the line is a gap, which Excel draws as a
|
|
56
|
+
* zero rather than breaking the line.
|
|
57
|
+
*/
|
|
58
|
+
export function sparklineSeries(group, row, col, valueAt) {
|
|
59
|
+
if (!rectContains(group.location, row, col))
|
|
60
|
+
return null;
|
|
61
|
+
const [lr1, lc1] = group.location;
|
|
62
|
+
const [dr1, dc1, dr2, dc2] = group.data;
|
|
63
|
+
const down = isColumnLocation(group);
|
|
64
|
+
const index = down ? row - lr1 : col - lc1;
|
|
65
|
+
const values = [];
|
|
66
|
+
if (down) {
|
|
67
|
+
const r = dr1 + index;
|
|
68
|
+
if (r > dr2)
|
|
69
|
+
return null;
|
|
70
|
+
for (let c = dc1; c <= dc2; c += 1)
|
|
71
|
+
values.push(numberOf(valueAt(r, c)) ?? 0);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const c = dc1 + index;
|
|
75
|
+
if (c > dc2)
|
|
76
|
+
return null;
|
|
77
|
+
for (let r = dr1; r <= dr2; r += 1)
|
|
78
|
+
values.push(numberOf(valueAt(r, c)) ?? 0);
|
|
79
|
+
}
|
|
80
|
+
return values.length ? values : null;
|
|
81
|
+
}
|
|
82
|
+
/** The group drawn in a cell, or null: the last one wins, as Excel's does. */
|
|
83
|
+
/**
|
|
84
|
+
* One line per cell of the group: the cell the sparkline is drawn in and
|
|
85
|
+
* the block of numbers it reads.
|
|
86
|
+
*
|
|
87
|
+
* The drawing works this out cell by cell as it paints; a writer needs the
|
|
88
|
+
* whole list, because Excel stores a sparkline group as one entry per cell
|
|
89
|
+
* with its own reference.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* A sparkline as standalone SVG markup, for a page the component cannot
|
|
93
|
+
* draw on: the printed sheet.
|
|
94
|
+
*
|
|
95
|
+
* The geometry is the grid's own `buildSparkline`, so the printed line is
|
|
96
|
+
* the line on screen rather than a second drawing that can disagree with
|
|
97
|
+
* it. The markup carries its colours inline, since the print document has
|
|
98
|
+
* no stylesheet of ours.
|
|
99
|
+
*/
|
|
100
|
+
export function sparklineSvg(values, options) {
|
|
101
|
+
const geo = buildSparkline([...values], {
|
|
102
|
+
type: options.type === 'column' ? 'bar' : options.type === 'winloss' ? 'winloss' : 'line',
|
|
103
|
+
width: options.width,
|
|
104
|
+
height: options.height,
|
|
105
|
+
...(options.color ? { color: options.color } : {}),
|
|
106
|
+
...(options.negativeColor ? { negativeColor: options.negativeColor } : {}),
|
|
107
|
+
...(options.min !== undefined ? { min: options.min } : {}),
|
|
108
|
+
...(options.max !== undefined ? { max: options.max } : {}),
|
|
109
|
+
lastPoint: Boolean(options.markers),
|
|
110
|
+
});
|
|
111
|
+
if (!geo)
|
|
112
|
+
return '';
|
|
113
|
+
const parts = [];
|
|
114
|
+
if (geo.bars.length) {
|
|
115
|
+
for (const bar of geo.bars) {
|
|
116
|
+
const fill = bar.negative ? geo.negativeColor : geo.color;
|
|
117
|
+
parts.push(`<rect x="${round(bar.x)}" y="${round(bar.y)}" width="${round(bar.w)}" height="${round(bar.h)}" fill="${fill}"/>`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (geo.linePath) {
|
|
121
|
+
parts.push(`<path d="${geo.linePath}" fill="none" stroke="${geo.color}" stroke-width="${geo.lineWidth}" stroke-linejoin="round" stroke-linecap="round"/>`);
|
|
122
|
+
}
|
|
123
|
+
if (geo.lastPoint && options.markers) {
|
|
124
|
+
parts.push(`<circle cx="${round(geo.lastPoint.x)}" cy="${round(geo.lastPoint.y)}" r="${geo.lineWidth + 0.5}" fill="${geo.color}"/>`);
|
|
125
|
+
}
|
|
126
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${geo.width}" height="${geo.height}" viewBox="0 0 ${geo.width} ${geo.height}" role="img" aria-hidden="true">${parts.join('')}</svg>`;
|
|
127
|
+
}
|
|
128
|
+
const round = (n) => Math.round(n * 100) / 100;
|
|
129
|
+
export function sparklineLines(group) {
|
|
130
|
+
const [lr1, lc1, lr2, lc2] = group.location;
|
|
131
|
+
const [dr1, dc1, dr2, dc2] = group.data;
|
|
132
|
+
const down = isColumnLocation(group);
|
|
133
|
+
const out = [];
|
|
134
|
+
const count = down ? lr2 - lr1 + 1 : lc2 - lc1 + 1;
|
|
135
|
+
for (let i = 0; i < count; i += 1) {
|
|
136
|
+
if (down) {
|
|
137
|
+
const r = dr1 + i;
|
|
138
|
+
if (r > dr2)
|
|
139
|
+
break;
|
|
140
|
+
out.push({ row: lr1 + i, col: lc1, data: [r, dc1, r, dc2] });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const c = dc1 + i;
|
|
144
|
+
if (c > dc2)
|
|
145
|
+
break;
|
|
146
|
+
out.push({ row: lr1, col: lc1 + i, data: [dr1, c, dr2, c] });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
export function sparklineAt(groups, row, col) {
|
|
152
|
+
for (let i = groups.length - 1; i >= 0; i -= 1) {
|
|
153
|
+
if (rectContains(groups[i].location, row, col))
|
|
154
|
+
return groups[i];
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The scale a group is drawn on when every sparkline in it shares one, which
|
|
160
|
+
* is Excel's "Same for All": the smallest and largest number anywhere in the
|
|
161
|
+
* data range. Null when the group scales each sparkline on its own.
|
|
162
|
+
*/
|
|
163
|
+
export function sparklineScale(group, valueAt) {
|
|
164
|
+
if (!group.sameScale)
|
|
165
|
+
return null;
|
|
166
|
+
const [r1, c1, r2, c2] = group.data;
|
|
167
|
+
let min = Infinity;
|
|
168
|
+
let max = -Infinity;
|
|
169
|
+
for (let r = r1; r <= r2; r += 1) {
|
|
170
|
+
for (let c = c1; c <= c2; c += 1) {
|
|
171
|
+
const n = numberOf(valueAt(r, c));
|
|
172
|
+
if (n === null)
|
|
173
|
+
continue;
|
|
174
|
+
if (n < min)
|
|
175
|
+
min = n;
|
|
176
|
+
if (n > max)
|
|
177
|
+
max = n;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (min === Infinity)
|
|
181
|
+
return null;
|
|
182
|
+
return min === max ? { min: min - 1, max: max + 1 } : { min, max };
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Where Excel's Create Sparklines dialog opens: the data is the selected
|
|
186
|
+
* block, and the location the column just past it (or the row just under it
|
|
187
|
+
* when the block is a single row). A block one cell tall gets a location of
|
|
188
|
+
* one cell, which is the common "a row of months, a sparkline beside it".
|
|
189
|
+
*/
|
|
190
|
+
export function sparklinesFromRange(data, type = 'line') {
|
|
191
|
+
const [r1, c1, r2, c2] = data;
|
|
192
|
+
const alongARow = r2 === r1 && c2 > c1;
|
|
193
|
+
const location = alongARow
|
|
194
|
+
? [r1, c2 + 1, r1, c2 + 1]
|
|
195
|
+
: [r1, c2 + 1, r2, c2 + 1];
|
|
196
|
+
return { id: sparklineId(), location, data: [r1, c1, r2, c2], type, markers: type === 'line' };
|
|
197
|
+
}
|
|
198
|
+
/** The groups left after clearing every one the rectangles touch. */
|
|
199
|
+
export function clearSparklines(groups, rects) {
|
|
200
|
+
return groups.filter((g) => !rects.some((rect) => overlaps(g.location, rect)));
|
|
201
|
+
}
|
|
202
|
+
function overlaps(a, b) {
|
|
203
|
+
return !(a[2] < b[0] || b[2] < a[0] || a[3] < b[1] || b[3] < a[1]);
|
|
204
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insert and delete rows and columns, with every formula on the sheet
|
|
3
|
+
* rewritten to follow.
|
|
4
|
+
*
|
|
5
|
+
* The api half already existed (`addRow`, `removeRow`, `addColumn`,
|
|
6
|
+
* `removeColumn`). What was missing is the fixup pass: inserting a row above
|
|
7
|
+
* `=SUM(D2:D11)` without widening the range silently produces the wrong total,
|
|
8
|
+
* and deleting a referenced row leaves a formula pointing at whatever moved
|
|
9
|
+
* into its place. Neither shows an error. That is why this waited for the
|
|
10
|
+
* engine rather than shipping with the other shortcuts.
|
|
11
|
+
*
|
|
12
|
+
* A structural edit is three things in order:
|
|
13
|
+
* 1. rewrite every formula in the sheet, and every defined name
|
|
14
|
+
* 2. drop format entries for whatever the edit deletes
|
|
15
|
+
* 3. apply the structural change itself
|
|
16
|
+
*
|
|
17
|
+
* Order matters: the first two read the OLD geometry.
|
|
18
|
+
*/
|
|
19
|
+
import type { GridCommandContext } from '@svgrid/grid/shortcuts';
|
|
20
|
+
import { type StructuralEdit } from './refs.js';
|
|
21
|
+
import type { SheetNames } from './names.js';
|
|
22
|
+
import type { SheetFormatStore, CellAddressLookup } from './format-store.js';
|
|
23
|
+
/** What a structural command needs beyond the command context. */
|
|
24
|
+
export type StructureTarget = {
|
|
25
|
+
/** Rewrite one cell's raw text. Called only for cells that changed. */
|
|
26
|
+
setRaw(rowIndex: number, colIndex: number, text: string): void;
|
|
27
|
+
/** Read one cell's raw text, formula included. */
|
|
28
|
+
getRaw(rowIndex: number, colIndex: number): string;
|
|
29
|
+
/** Apply the structural change to the data itself. */
|
|
30
|
+
apply(edit: StructuralEdit): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set when `apply` rewrites the references itself. A Workbook does, across
|
|
33
|
+
* every sheet, which is the whole reason a shell routes the edit through
|
|
34
|
+
* it; rewriting here as well then moved every reference twice, so one
|
|
35
|
+
* inserted row turned =SUM(A1:A3) into =SUM(A1:A5) and a cycle.
|
|
36
|
+
*/
|
|
37
|
+
rewritesReferences?: boolean;
|
|
38
|
+
names?: SheetNames;
|
|
39
|
+
format?: {
|
|
40
|
+
store: SheetFormatStore;
|
|
41
|
+
lookup: CellAddressLookup;
|
|
42
|
+
};
|
|
43
|
+
onChange?(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Everything a structural edit can touch, as one value, and the way to
|
|
46
|
+
* put it back. Supplying both makes insert and delete ONE Ctrl+Z: the
|
|
47
|
+
* command records the state before and after and hands the grid a step
|
|
48
|
+
* that restores either. Without them the formula rewrites inside the
|
|
49
|
+
* edit would sit in the history on their own, and undoing those while
|
|
50
|
+
* the rows stayed inserted would leave the sheet inconsistent.
|
|
51
|
+
*/
|
|
52
|
+
snapshot?(): unknown;
|
|
53
|
+
restore?(state: unknown): void;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the edit may happen at all. A protected sheet says no to every
|
|
56
|
+
* insert and delete, as Excel's does; the ribbon greys Insert and Delete
|
|
57
|
+
* on the same answer, so it must be cheap and must not talk to the user.
|
|
58
|
+
*/
|
|
59
|
+
canApply?(edit: StructuralEdit): boolean;
|
|
60
|
+
/** Called when `canApply` refused an edit: the place to say why. */
|
|
61
|
+
refused?(): void;
|
|
62
|
+
};
|
|
63
|
+
/** Attach what the insert / delete commands operate on. */
|
|
64
|
+
export declare function setStructureTarget(next: StructureTarget | null): void;
|
|
65
|
+
export declare function getStructureTarget(): StructureTarget | null;
|
|
66
|
+
/**
|
|
67
|
+
* Rewrite every formula on the sheet for one structural edit.
|
|
68
|
+
*
|
|
69
|
+
* Walks the whole grid rather than consulting the dependency graph, because
|
|
70
|
+
* the graph indexes what a formula READS and this needs every formula that
|
|
71
|
+
* MENTIONS a moved coordinate, including ones whose precedents were never
|
|
72
|
+
* resolved (a `#REF!` today may become valid after an insert).
|
|
73
|
+
*/
|
|
74
|
+
export declare function rewriteFormulas(cmd: GridCommandContext, t: StructureTarget, edit: StructuralEdit): number;
|
|
75
|
+
export declare function insertRows(cmd: GridCommandContext, at?: number, count?: number): boolean;
|
|
76
|
+
export declare function deleteRows(cmd: GridCommandContext, at?: number, count?: number): boolean;
|
|
77
|
+
export declare function insertColumns(cmd: GridCommandContext, at?: number, count?: number): boolean;
|
|
78
|
+
export declare function deleteColumns(cmd: GridCommandContext, at?: number, count?: number): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Which axis a bare Ctrl+Plus / Ctrl+Minus acts on.
|
|
81
|
+
*
|
|
82
|
+
* Excel opens a dialog when the selection is not a whole row or column. That
|
|
83
|
+
* dialog is a design decision, so this reports what it would ask about and
|
|
84
|
+
* lets the consumer decide: a selection spanning every column is a row
|
|
85
|
+
* operation, every row is a column operation, anything else is ambiguous.
|
|
86
|
+
*/
|
|
87
|
+
export declare function axisForSelection(cmd: GridCommandContext): 'rows' | 'cols' | 'ambiguous';
|