@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,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data validation, Excel's: a rule over some cells says what may be typed
|
|
3
|
+
* into them, and an entry that breaks it is stopped (or warned about)
|
|
4
|
+
* before it lands. Only typed entries are checked, as in Excel: paste, fill
|
|
5
|
+
* and the commands write what they are given.
|
|
6
|
+
*
|
|
7
|
+
* Rules keep their rectangles by position and move with an insert or
|
|
8
|
+
* delete; the last rule that covers a cell is the one that applies, which
|
|
9
|
+
* is what lets a later rule over a smaller block override an earlier one.
|
|
10
|
+
* Bounds and custom rules are text (a literal or a formula) evaluated in
|
|
11
|
+
* the sheet through the context the shell supplies, so `=$B$1` as a
|
|
12
|
+
* maximum follows B1.
|
|
13
|
+
*/
|
|
14
|
+
import { type CellValue } from './ast.js';
|
|
15
|
+
import type { StructuralEdit } from './refs.js';
|
|
16
|
+
import { type Rect } from './rects.js';
|
|
17
|
+
export type ValidationAllow = 'any' | 'whole' | 'decimal' | 'list' | 'date' | 'textLength' | 'custom';
|
|
18
|
+
export type ValidationOperator = 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greater' | 'less' | 'greaterOrEqual' | 'lessOrEqual';
|
|
19
|
+
/** Everything a rule is but where it applies: what the dialog hands back. */
|
|
20
|
+
export type ValidationSpec = Omit<ValidationRule, 'id' | 'rects'>;
|
|
21
|
+
export type ValidationRule = {
|
|
22
|
+
id: string;
|
|
23
|
+
rects: ReadonlyArray<Rect>;
|
|
24
|
+
allow: ValidationAllow;
|
|
25
|
+
/** For whole, decimal, date and textLength. Default between. */
|
|
26
|
+
operator?: ValidationOperator;
|
|
27
|
+
/** The bound, the value, the list source or the custom formula: a
|
|
28
|
+
* literal, a comma list, or a formula starting with '='. */
|
|
29
|
+
value1?: string;
|
|
30
|
+
/** The upper bound of between / notBetween. */
|
|
31
|
+
value2?: string;
|
|
32
|
+
ignoreBlank: boolean;
|
|
33
|
+
/** List rules: show the arrow and the picker on the cell. */
|
|
34
|
+
inCellDropdown: boolean;
|
|
35
|
+
alert: {
|
|
36
|
+
style: 'stop' | 'warning';
|
|
37
|
+
title?: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
};
|
|
40
|
+
/** Excel's Input Message: shown under the cell while it is selected.
|
|
41
|
+
* Absent when the rule has none. */
|
|
42
|
+
input?: {
|
|
43
|
+
title?: string;
|
|
44
|
+
message?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/** How a rule reads the sheet: the shell wires the workbook in. */
|
|
48
|
+
export type ValidationContext = {
|
|
49
|
+
/**
|
|
50
|
+
* A formula or a literal, evaluated in the sheet. With `entry`, the
|
|
51
|
+
* cell being checked reads as that text: Excel's custom rules refer to
|
|
52
|
+
* the cell they guard (`=A1>B1` on A1), and the entry is not written yet.
|
|
53
|
+
*/
|
|
54
|
+
evaluate(text: string, entry?: {
|
|
55
|
+
row: number;
|
|
56
|
+
col: number;
|
|
57
|
+
text: string;
|
|
58
|
+
}): CellValue;
|
|
59
|
+
/** The values of a range reference or a name for one; null otherwise. */
|
|
60
|
+
range(text: string): CellValue[][] | null;
|
|
61
|
+
};
|
|
62
|
+
export type ValidationVerdict = {
|
|
63
|
+
ok: true;
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
style: 'stop' | 'warning';
|
|
67
|
+
title: string;
|
|
68
|
+
message: string;
|
|
69
|
+
};
|
|
70
|
+
/** Excel's own words when a rule has no message of its own. */
|
|
71
|
+
export declare const DEFAULT_ALERT_MESSAGE = "This value doesn't match the data validation restrictions defined for this cell.";
|
|
72
|
+
export declare const OPERATOR_LABELS: Record<ValidationOperator, string>;
|
|
73
|
+
export declare function validationId(): string;
|
|
74
|
+
/** The rule that applies to (r, c): the last one covering it. */
|
|
75
|
+
export declare function ruleAt(rules: ReadonlyArray<ValidationRule>, r: number, c: number): ValidationRule | undefined;
|
|
76
|
+
/** The rules touching any of the rectangles. */
|
|
77
|
+
export declare function rulesIn(rules: ReadonlyArray<ValidationRule>, rects: ReadonlyArray<Rect>): ValidationRule[];
|
|
78
|
+
/** A date as milliseconds: an ISO text, or an Excel serial. Null otherwise. */
|
|
79
|
+
export declare function dateValue(v: CellValue): number | null;
|
|
80
|
+
/**
|
|
81
|
+
* The choices a list rule offers: a comma list as written, or the cells of
|
|
82
|
+
* a range (or a name for one), blanks left out, as text.
|
|
83
|
+
*/
|
|
84
|
+
export declare function listChoices(rule: ValidationRule, ctx: ValidationContext): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Whether `text`, typed into (row, col), passes the rule. The verdict
|
|
87
|
+
* carries the alert to show when it does not.
|
|
88
|
+
*/
|
|
89
|
+
export declare function checkEntry(rule: ValidationRule, text: string, at: {
|
|
90
|
+
row: number;
|
|
91
|
+
col: number;
|
|
92
|
+
}, ctx: ValidationContext): ValidationVerdict;
|
|
93
|
+
/** The rules after an insert or delete. */
|
|
94
|
+
export declare function shiftValidation(rules: ReadonlyArray<ValidationRule>, edit: StructuralEdit): ValidationRule[];
|
|
95
|
+
/** The rules with the rectangles cut out of them: Excel's Clear All. */
|
|
96
|
+
export declare function removeValidation(rules: ReadonlyArray<ValidationRule>, rects: ReadonlyArray<Rect>): ValidationRule[];
|
|
97
|
+
/** A short description for a rule, the way Excel's dialog title reads it. */
|
|
98
|
+
export declare function describeRule(rule: ValidationRule): string;
|
|
99
|
+
/**
|
|
100
|
+
* Excel's Circle Invalid Data: every cell under a rule whose current text
|
|
101
|
+
* breaks it. Blank cells count when the rule says they do. The rectangles
|
|
102
|
+
* are clipped to `rows` by `cols`, the sheet's used extent, so a rule over
|
|
103
|
+
* a whole column costs the cells that hold something.
|
|
104
|
+
*/
|
|
105
|
+
export declare function invalidCells(rules: ReadonlyArray<ValidationRule>, ctx: ValidationContext, rawAt: (row: number, col: number) => string, rows: number, cols: number): Array<{
|
|
106
|
+
row: number;
|
|
107
|
+
col: number;
|
|
108
|
+
}>;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data validation, Excel's: a rule over some cells says what may be typed
|
|
3
|
+
* into them, and an entry that breaks it is stopped (or warned about)
|
|
4
|
+
* before it lands. Only typed entries are checked, as in Excel: paste, fill
|
|
5
|
+
* and the commands write what they are given.
|
|
6
|
+
*
|
|
7
|
+
* Rules keep their rectangles by position and move with an insert or
|
|
8
|
+
* delete; the last rule that covers a cell is the one that applies, which
|
|
9
|
+
* is what lets a later rule over a smaller block override an earlier one.
|
|
10
|
+
* Bounds and custom rules are text (a literal or a formula) evaluated in
|
|
11
|
+
* the sheet through the context the shell supplies, so `=$B$1` as a
|
|
12
|
+
* maximum follows B1.
|
|
13
|
+
*/
|
|
14
|
+
import { isError } from './ast.js';
|
|
15
|
+
import { toText } from './coerce.js';
|
|
16
|
+
import { parseEntry } from './entry.js';
|
|
17
|
+
import { translateFormula } from './refs.js';
|
|
18
|
+
import { rectContains, shiftRects, subtractRect, rectsIntersect } from './rects.js';
|
|
19
|
+
/** Excel's own words when a rule has no message of its own. */
|
|
20
|
+
export const DEFAULT_ALERT_MESSAGE = "This value doesn't match the data validation restrictions defined for this cell.";
|
|
21
|
+
export const OPERATOR_LABELS = {
|
|
22
|
+
between: 'between',
|
|
23
|
+
notBetween: 'not between',
|
|
24
|
+
equal: 'equal to',
|
|
25
|
+
notEqual: 'not equal to',
|
|
26
|
+
greater: 'greater than',
|
|
27
|
+
less: 'less than',
|
|
28
|
+
greaterOrEqual: 'greater than or equal to',
|
|
29
|
+
lessOrEqual: 'less than or equal to',
|
|
30
|
+
};
|
|
31
|
+
let nextId = 1;
|
|
32
|
+
export function validationId() {
|
|
33
|
+
nextId += 1;
|
|
34
|
+
return `v${Date.now().toString(36)}${nextId}`;
|
|
35
|
+
}
|
|
36
|
+
/** The rule that applies to (r, c): the last one covering it. */
|
|
37
|
+
export function ruleAt(rules, r, c) {
|
|
38
|
+
for (let i = rules.length - 1; i >= 0; i -= 1) {
|
|
39
|
+
const rule = rules[i];
|
|
40
|
+
if (rule.rects.some((rect) => rectContains(rect, r, c)))
|
|
41
|
+
return rule;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The rules touching any of the rectangles. */
|
|
46
|
+
export function rulesIn(rules, rects) {
|
|
47
|
+
return rules.filter((rule) => rule.rects.some((a) => rects.some((b) => rectsIntersect(a, b))));
|
|
48
|
+
}
|
|
49
|
+
/** What the typed text is worth: a formula's result, or the literal coerced. */
|
|
50
|
+
function entered(text, ctx) {
|
|
51
|
+
const t = text.trim();
|
|
52
|
+
if (t.startsWith('='))
|
|
53
|
+
return ctx.evaluate(t);
|
|
54
|
+
const parsed = parseEntry(t);
|
|
55
|
+
const plain = parsed ? parsed.value : t;
|
|
56
|
+
const n = Number(plain);
|
|
57
|
+
if (plain !== '' && Number.isFinite(n))
|
|
58
|
+
return n;
|
|
59
|
+
const upper = plain.toUpperCase();
|
|
60
|
+
if (upper === 'TRUE')
|
|
61
|
+
return true;
|
|
62
|
+
if (upper === 'FALSE')
|
|
63
|
+
return false;
|
|
64
|
+
return plain;
|
|
65
|
+
}
|
|
66
|
+
/** A date as milliseconds: an ISO text, or an Excel serial. Null otherwise. */
|
|
67
|
+
export function dateValue(v) {
|
|
68
|
+
if (typeof v === 'number')
|
|
69
|
+
return Date.UTC(1899, 11, 30) + v * 86400000;
|
|
70
|
+
if (typeof v !== 'string' || !v.trim())
|
|
71
|
+
return null;
|
|
72
|
+
if (!/^\d{4}-\d{2}-\d{2}/.test(v.trim()))
|
|
73
|
+
return null;
|
|
74
|
+
const ms = Date.parse(v.trim().length === 10 ? `${v.trim()}T00:00:00Z` : v.trim());
|
|
75
|
+
return Number.isNaN(ms) ? null : ms;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A bound or a source, moved from the rule's top-left cell to the cell being
|
|
79
|
+
* checked, as Excel moves a relative reference in a rule: `=A2` as the
|
|
80
|
+
* minimum of G2:G17 reads A5 on G5, while `=$B$1` stays put.
|
|
81
|
+
*/
|
|
82
|
+
function relative(text, rule, at) {
|
|
83
|
+
if (text === undefined || !text.trim().startsWith('='))
|
|
84
|
+
return text;
|
|
85
|
+
const origin = rule.rects[0];
|
|
86
|
+
if (!origin)
|
|
87
|
+
return text;
|
|
88
|
+
return String(translateFormula(text.trim(), at.row - origin[0], at.col - origin[1]));
|
|
89
|
+
}
|
|
90
|
+
function bound(text, ctx, as) {
|
|
91
|
+
if (text === undefined || text.trim() === '')
|
|
92
|
+
return null;
|
|
93
|
+
const v = ctx.evaluate(text);
|
|
94
|
+
if (isError(v))
|
|
95
|
+
return null;
|
|
96
|
+
if (as === 'date')
|
|
97
|
+
return dateValue(v);
|
|
98
|
+
if (typeof v === 'boolean')
|
|
99
|
+
return null;
|
|
100
|
+
const n = typeof v === 'number' ? v : Number(v);
|
|
101
|
+
return Number.isFinite(n) ? n : null;
|
|
102
|
+
}
|
|
103
|
+
function compareTo(x, op, a, b) {
|
|
104
|
+
if (a === null)
|
|
105
|
+
return false;
|
|
106
|
+
switch (op) {
|
|
107
|
+
case 'between': return b !== null && x >= Math.min(a, b) && x <= Math.max(a, b);
|
|
108
|
+
case 'notBetween': return b !== null && (x < Math.min(a, b) || x > Math.max(a, b));
|
|
109
|
+
case 'equal': return x === a;
|
|
110
|
+
case 'notEqual': return x !== a;
|
|
111
|
+
case 'greater': return x > a;
|
|
112
|
+
case 'less': return x < a;
|
|
113
|
+
case 'greaterOrEqual': return x >= a;
|
|
114
|
+
case 'lessOrEqual': return x <= a;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The choices a list rule offers: a comma list as written, or the cells of
|
|
119
|
+
* a range (or a name for one), blanks left out, as text.
|
|
120
|
+
*/
|
|
121
|
+
export function listChoices(rule, ctx) {
|
|
122
|
+
const source = (rule.value1 ?? '').trim();
|
|
123
|
+
if (!source)
|
|
124
|
+
return [];
|
|
125
|
+
if (source.startsWith('=')) {
|
|
126
|
+
const grid = ctx.range(source);
|
|
127
|
+
if (grid) {
|
|
128
|
+
const out = [];
|
|
129
|
+
for (const row of grid)
|
|
130
|
+
for (const v of row) {
|
|
131
|
+
if (v === '' || v == null)
|
|
132
|
+
continue;
|
|
133
|
+
out.push(isError(v) ? v.error : toText(v));
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
const v = ctx.evaluate(source);
|
|
138
|
+
return isError(v) ? [] : [toText(v)];
|
|
139
|
+
}
|
|
140
|
+
return source.split(',').map((s) => s.trim()).filter((s) => s !== '');
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Whether `text`, typed into (row, col), passes the rule. The verdict
|
|
144
|
+
* carries the alert to show when it does not.
|
|
145
|
+
*/
|
|
146
|
+
export function checkEntry(rule, text, at, ctx) {
|
|
147
|
+
const fail = () => ({
|
|
148
|
+
ok: false,
|
|
149
|
+
style: rule.alert.style,
|
|
150
|
+
title: rule.alert.title?.trim() || 'Data validation',
|
|
151
|
+
message: rule.alert.message?.trim() || DEFAULT_ALERT_MESSAGE,
|
|
152
|
+
});
|
|
153
|
+
if (rule.allow === 'any')
|
|
154
|
+
return { ok: true };
|
|
155
|
+
const trimmed = text.trim();
|
|
156
|
+
if (trimmed === '')
|
|
157
|
+
return rule.ignoreBlank ? { ok: true } : fail();
|
|
158
|
+
const op = rule.operator ?? 'between';
|
|
159
|
+
switch (rule.allow) {
|
|
160
|
+
case 'whole':
|
|
161
|
+
case 'decimal': {
|
|
162
|
+
const v = entered(text, ctx);
|
|
163
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
164
|
+
return fail();
|
|
165
|
+
if (rule.allow === 'whole' && !Number.isInteger(v))
|
|
166
|
+
return fail();
|
|
167
|
+
return compareTo(v, op, bound(relative(rule.value1, rule, at), ctx, 'number'), bound(relative(rule.value2, rule, at), ctx, 'number')) ? { ok: true } : fail();
|
|
168
|
+
}
|
|
169
|
+
case 'date': {
|
|
170
|
+
const ms = dateValue(entered(text, ctx));
|
|
171
|
+
if (ms === null)
|
|
172
|
+
return fail();
|
|
173
|
+
return compareTo(ms, op, bound(relative(rule.value1, rule, at), ctx, 'date'), bound(relative(rule.value2, rule, at), ctx, 'date')) ? { ok: true } : fail();
|
|
174
|
+
}
|
|
175
|
+
case 'textLength': {
|
|
176
|
+
const v = entered(text, ctx);
|
|
177
|
+
const length = isError(v) ? 0 : toText(v).length;
|
|
178
|
+
return compareTo(length, op, bound(relative(rule.value1, rule, at), ctx, 'number'), bound(relative(rule.value2, rule, at), ctx, 'number')) ? { ok: true } : fail();
|
|
179
|
+
}
|
|
180
|
+
case 'list': {
|
|
181
|
+
// Excel matches a list entry without regard to case.
|
|
182
|
+
const v = entered(text, ctx);
|
|
183
|
+
const shown = isError(v) ? v.error : toText(v);
|
|
184
|
+
const needle = shown.toLowerCase();
|
|
185
|
+
return listChoices(rule, ctx).some((choice) => choice.toLowerCase() === needle) ? { ok: true } : fail();
|
|
186
|
+
}
|
|
187
|
+
case 'custom': {
|
|
188
|
+
const formula = (rule.value1 ?? '').trim();
|
|
189
|
+
if (!formula)
|
|
190
|
+
return fail();
|
|
191
|
+
// The formula is written for the rule's top-left cell and moves with
|
|
192
|
+
// the cell it checks, as a copied formula would.
|
|
193
|
+
const origin = rule.rects[0];
|
|
194
|
+
const source = formula.startsWith('=') ? formula : `=${formula}`;
|
|
195
|
+
const moved = origin
|
|
196
|
+
? String(translateFormula(source, at.row - origin[0], at.col - origin[1]))
|
|
197
|
+
: source;
|
|
198
|
+
const v = ctx.evaluate(moved, { row: at.row, col: at.col, text });
|
|
199
|
+
if (isError(v))
|
|
200
|
+
return fail();
|
|
201
|
+
const truthy = typeof v === 'boolean' ? v : typeof v === 'number' ? v !== 0 : false;
|
|
202
|
+
return truthy ? { ok: true } : fail();
|
|
203
|
+
}
|
|
204
|
+
default:
|
|
205
|
+
return { ok: true };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** The rules after an insert or delete. */
|
|
209
|
+
export function shiftValidation(rules, edit) {
|
|
210
|
+
return shiftRects(rules, edit);
|
|
211
|
+
}
|
|
212
|
+
/** The rules with the rectangles cut out of them: Excel's Clear All. */
|
|
213
|
+
export function removeValidation(rules, rects) {
|
|
214
|
+
const out = [];
|
|
215
|
+
for (const rule of rules) {
|
|
216
|
+
let kept = [...rule.rects];
|
|
217
|
+
for (const hole of rects)
|
|
218
|
+
kept = kept.flatMap((rect) => subtractRect(rect, hole));
|
|
219
|
+
if (kept.length)
|
|
220
|
+
out.push({ ...rule, rects: kept });
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
/** A short description for a rule, the way Excel's dialog title reads it. */
|
|
225
|
+
export function describeRule(rule) {
|
|
226
|
+
const op = OPERATOR_LABELS[rule.operator ?? 'between'];
|
|
227
|
+
const v1 = rule.value1 ?? '';
|
|
228
|
+
const v2 = rule.value2 ?? '';
|
|
229
|
+
const range = (rule.operator ?? 'between') === 'between' || rule.operator === 'notBetween'
|
|
230
|
+
? `${v1} and ${v2}`
|
|
231
|
+
: v1;
|
|
232
|
+
switch (rule.allow) {
|
|
233
|
+
case 'any': return 'Any value';
|
|
234
|
+
case 'whole': return `Whole number ${op} ${range}`;
|
|
235
|
+
case 'decimal': return `Decimal ${op} ${range}`;
|
|
236
|
+
case 'date': return `Date ${op} ${range}`;
|
|
237
|
+
case 'textLength': return `Text length ${op} ${range}`;
|
|
238
|
+
case 'list': return `List: ${v1}`;
|
|
239
|
+
case 'custom': return `Custom: ${v1}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Excel's Circle Invalid Data: every cell under a rule whose current text
|
|
244
|
+
* breaks it. Blank cells count when the rule says they do. The rectangles
|
|
245
|
+
* are clipped to `rows` by `cols`, the sheet's used extent, so a rule over
|
|
246
|
+
* a whole column costs the cells that hold something.
|
|
247
|
+
*/
|
|
248
|
+
export function invalidCells(rules, ctx, rawAt, rows, cols) {
|
|
249
|
+
const out = [];
|
|
250
|
+
const seen = new Set();
|
|
251
|
+
for (const rule of rules) {
|
|
252
|
+
if (rule.allow === 'any')
|
|
253
|
+
continue;
|
|
254
|
+
for (const [r1, c1, r2, c2] of rule.rects) {
|
|
255
|
+
const rowEnd = Math.min(r2, rows - 1);
|
|
256
|
+
const colEnd = Math.min(c2, cols - 1);
|
|
257
|
+
for (let r = Math.max(0, r1); r <= rowEnd; r += 1) {
|
|
258
|
+
for (let c = Math.max(0, c1); c <= colEnd; c += 1) {
|
|
259
|
+
const key = r * 1048576 + c;
|
|
260
|
+
if (seen.has(key))
|
|
261
|
+
continue;
|
|
262
|
+
seen.add(key);
|
|
263
|
+
// The rule that applies is the last one covering the cell, which
|
|
264
|
+
// may not be this one.
|
|
265
|
+
const applies = ruleAt(rules, r, c);
|
|
266
|
+
if (!applies || applies.allow === 'any')
|
|
267
|
+
continue;
|
|
268
|
+
const text = rawAt(r, c);
|
|
269
|
+
if (text.trim() === '' && applies.ignoreBlank)
|
|
270
|
+
continue;
|
|
271
|
+
if (!checkEntry(applies, text, { row: r, col: c }, ctx).ok)
|
|
272
|
+
out.push({ row: r, col: c });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return out;
|
|
278
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { type SheetFunction } from './functions.js';
|
|
2
|
+
import { isError, type CellValue } from './ast.js';
|
|
3
|
+
import { type TableRegion, type TableRegistry } from './tables.js';
|
|
4
|
+
import { type SheetNames } from './names.js';
|
|
5
|
+
import { type CellMove, type StructuralEdit } from './refs.js';
|
|
6
|
+
import { type SheetEngine } from './engine.js';
|
|
7
|
+
export type SheetData = {
|
|
8
|
+
name: string;
|
|
9
|
+
/** Row-major raw text. Ragged is fine; a missing cell reads as empty. */
|
|
10
|
+
cells: string[][];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Excel's Enable iterative calculation, under File > Options > Formulas.
|
|
14
|
+
*
|
|
15
|
+
* A circular reference is normally an error: every cell in the loop shows
|
|
16
|
+
* #CYCLE!. Some models are written as one on purpose, though, because the
|
|
17
|
+
* answer is a fixed point rather than a mistake: a bonus that is a share of
|
|
18
|
+
* the profit the bonus is subtracted from, an interest charge on a balance
|
|
19
|
+
* the charge is added to. Excel solves those by running the loop over and
|
|
20
|
+
* over from the values it last had, and stopping when either the answer
|
|
21
|
+
* stops moving or the passes run out.
|
|
22
|
+
*/
|
|
23
|
+
export type IterationSettings = {
|
|
24
|
+
/** Off by default, which is Excel's default and keeps a cycle an error. */
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
/** Passes before the answer is taken as it stands. Excel's default is 100. */
|
|
27
|
+
maxIterations: number;
|
|
28
|
+
/** The largest move that still counts as settled. Excel's default is 0.001. */
|
|
29
|
+
maxChange: number;
|
|
30
|
+
};
|
|
31
|
+
export declare const DEFAULT_ITERATION: IterationSettings;
|
|
32
|
+
/** Excel's text prefix. A cell typed as `'007` holds the text `007`: the
|
|
33
|
+
* apostrophe says "what follows is text", and it is not part of the value,
|
|
34
|
+
* so it is never displayed, printed, exported or compared. */
|
|
35
|
+
export declare const TEXT_PREFIX = "'";
|
|
36
|
+
/** The value a typed text stands for once the prefix is taken off. */
|
|
37
|
+
export declare const withoutTextPrefix: (text: string) => string;
|
|
38
|
+
export type WorkbookOptions = {
|
|
39
|
+
/** Extra functions merged over the built-ins. */
|
|
40
|
+
functions?: Record<string, SheetFunction>;
|
|
41
|
+
/** Fires after a recalculation, with the cells whose value changed. */
|
|
42
|
+
onRecalc?(changed: ReadonlyArray<{
|
|
43
|
+
sheet: string;
|
|
44
|
+
row: number;
|
|
45
|
+
col: number;
|
|
46
|
+
value: CellValue;
|
|
47
|
+
}>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Fires for every RAW WRITE, with the text as typed rather than the value
|
|
50
|
+
* it computes: one call per `setRaw` that changed something, and one per
|
|
51
|
+
* cell a structural edit rewrote. This is the seam a delta stream reads
|
|
52
|
+
* (`sheet/delta.ts`), since a collaborator has to receive `=SUM(A1:A9)`
|
|
53
|
+
* rather than 42.
|
|
54
|
+
*/
|
|
55
|
+
onWrite?(change: {
|
|
56
|
+
sheet: string;
|
|
57
|
+
row: number;
|
|
58
|
+
col: number;
|
|
59
|
+
text: string;
|
|
60
|
+
}): void;
|
|
61
|
+
/**
|
|
62
|
+
* What works a formula out. The built-in parser and evaluator unless an
|
|
63
|
+
* application hands over an evaluator of its own. The workbook keeps the
|
|
64
|
+
* dependency graph, the cache, the cycles and the spills whichever engine
|
|
65
|
+
* answers.
|
|
66
|
+
*/
|
|
67
|
+
engine?: SheetEngine;
|
|
68
|
+
/** Tables the workbook starts with, for a document being restored. */
|
|
69
|
+
tables?: ReadonlyArray<TableRegion>;
|
|
70
|
+
/** Iterative calculation, off unless a model needs it. */
|
|
71
|
+
iteration?: Partial<IterationSettings>;
|
|
72
|
+
};
|
|
73
|
+
/** One cell read as text that has not been written: what a validation rule checks. */
|
|
74
|
+
export type CellOverride = {
|
|
75
|
+
row: number;
|
|
76
|
+
col: number;
|
|
77
|
+
text: string;
|
|
78
|
+
};
|
|
79
|
+
export type Workbook = {
|
|
80
|
+
readonly sheets: ReadonlyArray<string>;
|
|
81
|
+
readonly active: string;
|
|
82
|
+
readonly names: SheetNames;
|
|
83
|
+
/**
|
|
84
|
+
* Excel's tables, which is what a structured reference resolves through.
|
|
85
|
+
* Defining one here is what makes `=SUM(Orders[Amount])` mean anything;
|
|
86
|
+
* the shell's Insert > Table does it, and a document restores it.
|
|
87
|
+
*/
|
|
88
|
+
readonly tables: TableRegistry;
|
|
89
|
+
setActive(name: string): void;
|
|
90
|
+
addSheet(name?: string, at?: number): string;
|
|
91
|
+
removeSheet(name: string): boolean;
|
|
92
|
+
renameSheet(from: string, to: string): boolean;
|
|
93
|
+
moveSheet(name: string, to: number): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Copy a sheet's cells into a new sheet placed right after it, named
|
|
96
|
+
* `to` or Excel's "Name (2)", and make it active. The new sheet's
|
|
97
|
+
* formulas read their own sheet where the old ones read theirs, because
|
|
98
|
+
* an unqualified reference is relative to the sheet it sits on. Returns
|
|
99
|
+
* the new name, or null when `from` is unknown or `to` is taken.
|
|
100
|
+
*/
|
|
101
|
+
copySheet(from: string, to?: string): string | null;
|
|
102
|
+
/** The raw text of a cell: the formula as typed, or the literal. */
|
|
103
|
+
getRaw(sheet: string, row: number, col: number): string;
|
|
104
|
+
/** Write raw text and recalculate whatever depends on it. */
|
|
105
|
+
setRaw(sheet: string, row: number, col: number, text: string): void;
|
|
106
|
+
/** The computed value. */
|
|
107
|
+
getValue(sheet: string, row: number, col: number): CellValue;
|
|
108
|
+
/** Every cell of a sheet, computed. */
|
|
109
|
+
snapshot(sheet: string): CellValue[][];
|
|
110
|
+
/**
|
|
111
|
+
* What `text` would be worth in a cell of `sheet`, without putting it in
|
|
112
|
+
* one: a formula is evaluated there (names and other sheets included), a
|
|
113
|
+
* literal is coerced the way a typed one is. Data validation checks its
|
|
114
|
+
* bounds and custom rules through this, and conditional formatting its
|
|
115
|
+
* formula rules, with `at` naming the cell the text is read for.
|
|
116
|
+
*/
|
|
117
|
+
evaluateText(sheet: string, text: string, override?: CellOverride, at?: {
|
|
118
|
+
row: number;
|
|
119
|
+
col: number;
|
|
120
|
+
}): CellValue;
|
|
121
|
+
/**
|
|
122
|
+
* The values of a range reference, or of a name that refers to one, as a
|
|
123
|
+
* grid; null when `text` is not a reference. A list source.
|
|
124
|
+
*/
|
|
125
|
+
evaluateRange(sheet: string, text: string): CellValue[][] | null;
|
|
126
|
+
/**
|
|
127
|
+
* Tell the workbook which rows are folded away, and by what: `'filter'`
|
|
128
|
+
* for an AutoFilter, `'hand'` for Hide Rows, null for a row on the
|
|
129
|
+
* screen. Only `SUBTOTAL` reads it, which is how a total under a filtered
|
|
130
|
+
* list follows the filter. Pass null to forget the source again.
|
|
131
|
+
*/
|
|
132
|
+
setHiddenRows(source: ((sheet: string, row: number) => 'filter' | 'hand' | null) | null): void;
|
|
133
|
+
/** Apply a structural edit to one sheet, rewriting every formula in the
|
|
134
|
+
* WORKBOOK that pointed into it. */
|
|
135
|
+
applyStructuralEdit(sheet: string, edit: StructuralEdit): void;
|
|
136
|
+
/**
|
|
137
|
+
* A block of cells has been MOVED (cut and pasted, or dragged): point
|
|
138
|
+
* every reference to those cells at where they now are, across the whole
|
|
139
|
+
* workbook and the defined names, as Excel does. The cells themselves are
|
|
140
|
+
* moved by whoever did the moving; this is only the repointing.
|
|
141
|
+
*/
|
|
142
|
+
repointAfterMove(move: CellMove): void;
|
|
143
|
+
/**
|
|
144
|
+
* Excel's Trace Precedents: the cells a formula reads directly, on any
|
|
145
|
+
* sheet. Empty for a literal. A whole-column reference contributes its
|
|
146
|
+
* used rows.
|
|
147
|
+
*/
|
|
148
|
+
precedents(sheet: string, row: number, col: number): Array<{
|
|
149
|
+
sheet: string;
|
|
150
|
+
row: number;
|
|
151
|
+
col: number;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* Excel's Trace Dependents: the formulas that read a cell directly. Every
|
|
155
|
+
* formula in the workbook is evaluated first, so a dependent that was
|
|
156
|
+
* never on screen is found too.
|
|
157
|
+
*/
|
|
158
|
+
dependents(sheet: string, row: number, col: number): Array<{
|
|
159
|
+
sheet: string;
|
|
160
|
+
row: number;
|
|
161
|
+
col: number;
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* Hear about every raw write, with the text as typed. Returns the
|
|
165
|
+
* unsubscribe. The delta stream reads this; a mirror of the cells in
|
|
166
|
+
* another store can too.
|
|
167
|
+
*/
|
|
168
|
+
subscribeWrites(listener: (change: {
|
|
169
|
+
sheet: string;
|
|
170
|
+
row: number;
|
|
171
|
+
col: number;
|
|
172
|
+
text: string;
|
|
173
|
+
}) => void): () => void;
|
|
174
|
+
/** Recompute everything. Rarely needed; `setRaw` keeps itself current. */
|
|
175
|
+
recalculate(): void;
|
|
176
|
+
/** How circular references are treated, as the Formulas tab sets it. */
|
|
177
|
+
readonly iteration: IterationSettings;
|
|
178
|
+
/**
|
|
179
|
+
* Turn iterative calculation on or off, or change its limits, and
|
|
180
|
+
* recalculate: the cells in a cycle go from #CYCLE! to their fixed point,
|
|
181
|
+
* or back.
|
|
182
|
+
*/
|
|
183
|
+
setIteration(next: Partial<IterationSettings>): void;
|
|
184
|
+
/**
|
|
185
|
+
* The spill a cell belongs to: the anchor holding the array formula and
|
|
186
|
+
* the rectangle its answer covers, for the anchor itself and every cell
|
|
187
|
+
* it spills into; null for a cell that is neither.
|
|
188
|
+
*/
|
|
189
|
+
spillOf(sheet: string, row: number, col: number): {
|
|
190
|
+
anchor: {
|
|
191
|
+
row: number;
|
|
192
|
+
col: number;
|
|
193
|
+
};
|
|
194
|
+
rect: readonly [number, number, number, number];
|
|
195
|
+
} | null;
|
|
196
|
+
/** Every spill on a sheet, anchors computed, for a writer that saves the ranges. */
|
|
197
|
+
spills(sheet: string): Array<{
|
|
198
|
+
row: number;
|
|
199
|
+
col: number;
|
|
200
|
+
rect: readonly [number, number, number, number];
|
|
201
|
+
}>;
|
|
202
|
+
rowCount(sheet: string): number;
|
|
203
|
+
colCount(sheet: string): number;
|
|
204
|
+
serialize(): {
|
|
205
|
+
sheets: SheetData[];
|
|
206
|
+
active: string;
|
|
207
|
+
names: Record<string, string>;
|
|
208
|
+
tables?: TableRegion[];
|
|
209
|
+
iteration?: IterationSettings;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
/** A name Excel would accept for a sheet. */
|
|
213
|
+
export declare function isValidSheetName(name: string): boolean;
|
|
214
|
+
/** Iteration settings with the defaults filled in and the numbers sane. */
|
|
215
|
+
export declare function cleanIteration(next?: Partial<IterationSettings> | null): IterationSettings;
|
|
216
|
+
export declare function createWorkbook(initial?: ReadonlyArray<SheetData>, options?: WorkbookOptions): Workbook;
|
|
217
|
+
export { isError };
|