@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,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection across rows that were never loaded.
|
|
3
|
+
*
|
|
4
|
+
* A grid that keeps a list of selected ids is right until the rows it has
|
|
5
|
+
* seen are a window onto a million on a server. Then "select all" has to mean
|
|
6
|
+
* a million, the header checkbox has to say so, and a bulk edit has to reach
|
|
7
|
+
* rows that never came down the wire. None of that fits a list of ids. It
|
|
8
|
+
* fits a RULE: "everything, except these" - which is what this model stores.
|
|
9
|
+
*
|
|
10
|
+
* Two shapes, chosen by `groupSelects`:
|
|
11
|
+
*
|
|
12
|
+
* - `self`: one flat rule. `{ selectAll, toggled }` - toggled ids are the
|
|
13
|
+
* exceptions to `selectAll`, whatever level they sit on. A group row is a
|
|
14
|
+
* row like any other.
|
|
15
|
+
* - `descendants`: a tree of rules. Ticking a group selects everything under
|
|
16
|
+
* it, and an exception inside that group is recorded under that group, so
|
|
17
|
+
* the state reads like the tree it describes:
|
|
18
|
+
* `{ selectAllChildren: true, toggled: { EMEA: { selectAllChildren: false, toggled: { DE: { selectAllChildren: true } } } } }`
|
|
19
|
+
* means "everything, except EMEA, except DE within it".
|
|
20
|
+
*
|
|
21
|
+
* The shapes are plain data (`getState()` / `setState()`), so a selection
|
|
22
|
+
* survives a page reload or travels to a bulk-edit endpoint as "apply to
|
|
23
|
+
* these rules". Headless and framework-free; the row model wires it to the
|
|
24
|
+
* grid's `rowSelectionModel` seam and re-renders on `onChange`.
|
|
25
|
+
*/
|
|
26
|
+
/** How ticking a group row behaves: itself, or everything beneath it. */
|
|
27
|
+
export type ServerSelectionGroupMode = 'self' | 'descendants' | 'filteredDescendants';
|
|
28
|
+
/** The flat rule, for `groupSelects: 'self'`. */
|
|
29
|
+
export type ServerSelectionState = {
|
|
30
|
+
selectAll: boolean;
|
|
31
|
+
/** Exceptions to `selectAll`: selected ids when it is false, deselected ones when true. */
|
|
32
|
+
toggled: string[];
|
|
33
|
+
};
|
|
34
|
+
/** One node of the hierarchical rule, for `groupSelects: 'descendants'`. */
|
|
35
|
+
export type ServerGroupSelectionNode = {
|
|
36
|
+
/** Whether everything under this node is selected, before exceptions. */
|
|
37
|
+
selectAllChildren: boolean;
|
|
38
|
+
/** Exceptions, keyed by child id (a group key or a leaf id) under this node. */
|
|
39
|
+
toggled: Record<string, ServerGroupSelectionNode>;
|
|
40
|
+
/**
|
|
41
|
+
* True when this node is a group. A flipped group is an exception of
|
|
42
|
+
* unknown size (its rows were never counted here); a flipped leaf is
|
|
43
|
+
* exactly one row. Absent on the root and on leaves.
|
|
44
|
+
*/
|
|
45
|
+
group?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** What `createServerSelectionModel` takes: the group mode and a change callback. */
|
|
48
|
+
export type ServerSelectionModelOptions = {
|
|
49
|
+
/**
|
|
50
|
+
* How ticking a group row behaves. `self` selects that one row;
|
|
51
|
+
* `descendants` selects everything beneath it. `filteredDescendants` is
|
|
52
|
+
* `descendants` under a filter, which on a server is the same rule - the
|
|
53
|
+
* server applies the filter - so it is accepted as an alias.
|
|
54
|
+
*/
|
|
55
|
+
groupSelects?: ServerSelectionGroupMode;
|
|
56
|
+
/** Called after any change. The row model re-renders from here. */
|
|
57
|
+
onChange?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* How many leaves sit under a group, by its route, or `null` when that is
|
|
60
|
+
* not known. `selectedCount` needs it once a rule flips a whole group
|
|
61
|
+
* (a plan ticked under an unticked root): without it the count of such a
|
|
62
|
+
* rule is unknown. The row model answers from the group row's `count`
|
|
63
|
+
* aggregate.
|
|
64
|
+
*/
|
|
65
|
+
leafCount?: (route: ReadonlyArray<string>) => number | null;
|
|
66
|
+
};
|
|
67
|
+
/** A selection kept as a rule - "everything, except these" - flat or per group, that the row model exposes to the grid. */
|
|
68
|
+
export type ServerSelectionModel = {
|
|
69
|
+
readonly groupSelects: ServerSelectionGroupMode;
|
|
70
|
+
/** Whether the row `id` at `route` is selected. Leaves and groups alike. */
|
|
71
|
+
isSelected(route: ReadonlyArray<string>, id: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Set one row's selection. Under `descendants` a group takes its subtree
|
|
74
|
+
* along, and `isGroup` says which kind of row this is - the model cannot
|
|
75
|
+
* tell, and the difference decides whether a count is still exact.
|
|
76
|
+
*/
|
|
77
|
+
toggle(route: ReadonlyArray<string>, id: string, next: boolean, isGroup?: boolean): void;
|
|
78
|
+
/** The header checkbox: select or clear everything. */
|
|
79
|
+
setAll(next: boolean): void;
|
|
80
|
+
clear(): void;
|
|
81
|
+
/** `all`, `none`, or `some` - what the header checkbox should draw. */
|
|
82
|
+
headerState(): 'none' | 'some' | 'all';
|
|
83
|
+
/**
|
|
84
|
+
* How many rows are selected, given the total. Exact for the flat rule.
|
|
85
|
+
* Under `descendants` it is exact only while no group is an exception (a
|
|
86
|
+
* group's size is not known here); then it is `null`, and a UI should say
|
|
87
|
+
* "some" rather than invent a number.
|
|
88
|
+
*/
|
|
89
|
+
selectedCount(rowCount: number | null): number | null;
|
|
90
|
+
/** True when the rule is "everything" with no exceptions - a bulk edit can go by filter alone. */
|
|
91
|
+
isSelectAllWithoutExceptions(): boolean;
|
|
92
|
+
getState(): ServerSelectionState | ServerGroupSelectionNode;
|
|
93
|
+
setState(state: ServerSelectionState | ServerGroupSelectionNode): void;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Build a rule-based selection model. `createServerRowModel` makes one when
|
|
97
|
+
* its `selection` option is set; it is exported for a model of your own.
|
|
98
|
+
*/
|
|
99
|
+
export declare function createServerSelectionModel(options?: ServerSelectionModelOptions): ServerSelectionModel;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection across rows that were never loaded.
|
|
3
|
+
*
|
|
4
|
+
* A grid that keeps a list of selected ids is right until the rows it has
|
|
5
|
+
* seen are a window onto a million on a server. Then "select all" has to mean
|
|
6
|
+
* a million, the header checkbox has to say so, and a bulk edit has to reach
|
|
7
|
+
* rows that never came down the wire. None of that fits a list of ids. It
|
|
8
|
+
* fits a RULE: "everything, except these" - which is what this model stores.
|
|
9
|
+
*
|
|
10
|
+
* Two shapes, chosen by `groupSelects`:
|
|
11
|
+
*
|
|
12
|
+
* - `self`: one flat rule. `{ selectAll, toggled }` - toggled ids are the
|
|
13
|
+
* exceptions to `selectAll`, whatever level they sit on. A group row is a
|
|
14
|
+
* row like any other.
|
|
15
|
+
* - `descendants`: a tree of rules. Ticking a group selects everything under
|
|
16
|
+
* it, and an exception inside that group is recorded under that group, so
|
|
17
|
+
* the state reads like the tree it describes:
|
|
18
|
+
* `{ selectAllChildren: true, toggled: { EMEA: { selectAllChildren: false, toggled: { DE: { selectAllChildren: true } } } } }`
|
|
19
|
+
* means "everything, except EMEA, except DE within it".
|
|
20
|
+
*
|
|
21
|
+
* The shapes are plain data (`getState()` / `setState()`), so a selection
|
|
22
|
+
* survives a page reload or travels to a bulk-edit endpoint as "apply to
|
|
23
|
+
* these rules". Headless and framework-free; the row model wires it to the
|
|
24
|
+
* grid's `rowSelectionModel` seam and re-renders on `onChange`.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Build a rule-based selection model. `createServerRowModel` makes one when
|
|
28
|
+
* its `selection` option is set; it is exported for a model of your own.
|
|
29
|
+
*/
|
|
30
|
+
export function createServerSelectionModel(options = {}) {
|
|
31
|
+
const groupSelects = options.groupSelects ?? 'self';
|
|
32
|
+
const hierarchical = groupSelects !== 'self';
|
|
33
|
+
const notify = () => options.onChange?.();
|
|
34
|
+
// ------------------------------------------------------------- flat
|
|
35
|
+
let selectAll = false;
|
|
36
|
+
const toggled = new Set();
|
|
37
|
+
let root = { selectAllChildren: false, toggled: new Map(), group: true };
|
|
38
|
+
/** Walk the rule tree along `route`, returning the deepest node reached and the state it implies. */
|
|
39
|
+
function resolve(route) {
|
|
40
|
+
let node = root;
|
|
41
|
+
let state = root.selectAllChildren;
|
|
42
|
+
for (const key of route) {
|
|
43
|
+
const next = node.toggled.get(key);
|
|
44
|
+
if (!next)
|
|
45
|
+
return { node, state, exact: false };
|
|
46
|
+
node = next;
|
|
47
|
+
state = next.selectAllChildren;
|
|
48
|
+
}
|
|
49
|
+
return { node, state, exact: true };
|
|
50
|
+
}
|
|
51
|
+
/** Walk-or-create the rule tree along `route`, so an exception can be recorded beneath it. */
|
|
52
|
+
function ensurePath(route) {
|
|
53
|
+
let node = root;
|
|
54
|
+
for (const key of route) {
|
|
55
|
+
let next = node.toggled.get(key);
|
|
56
|
+
if (!next) {
|
|
57
|
+
// A group we descend into without an explicit rule inherits its
|
|
58
|
+
// parent's state, and records it so the exception below has a base.
|
|
59
|
+
next = { selectAllChildren: node.selectAllChildren, toggled: new Map(), group: true };
|
|
60
|
+
node.toggled.set(key, next);
|
|
61
|
+
}
|
|
62
|
+
node = next;
|
|
63
|
+
}
|
|
64
|
+
return node;
|
|
65
|
+
}
|
|
66
|
+
/** Drop nodes that no longer differ from their parent, so state stays minimal. */
|
|
67
|
+
function prune(node) {
|
|
68
|
+
for (const [key, child] of [...node.toggled]) {
|
|
69
|
+
prune(child);
|
|
70
|
+
if (child.toggled.size === 0 && child.selectAllChildren === node.selectAllChildren) {
|
|
71
|
+
node.toggled.delete(key);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const toPlain = (node) => ({
|
|
76
|
+
selectAllChildren: node.selectAllChildren,
|
|
77
|
+
toggled: Object.fromEntries([...node.toggled].map(([k, v]) => [k, toPlain(v)])),
|
|
78
|
+
...(node.group ? { group: true } : {}),
|
|
79
|
+
});
|
|
80
|
+
const fromPlain = (plain, group = true) => ({
|
|
81
|
+
selectAllChildren: !!plain.selectAllChildren,
|
|
82
|
+
toggled: new Map(Object.entries(plain.toggled ?? {}).map(([k, v]) => [k, fromPlain(v, !!v.group)])),
|
|
83
|
+
group,
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* The number of rows the exceptions under `node` amount to, or null when
|
|
87
|
+
* one of them is a flipped GROUP - its size was never counted here. A
|
|
88
|
+
* group whose own state matches its parent is a pass-through; only what
|
|
89
|
+
* sits beneath it counts.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Leaves selected under `node`, whose own subtree holds `size` leaves
|
|
93
|
+
* (`null` when unknown). A selected node is its size minus the exceptions
|
|
94
|
+
* among its toggled children; an unselected one is the sum of what its
|
|
95
|
+
* toggled children select. A flipped group needs its size, which comes
|
|
96
|
+
* from `leafCount`; without it the answer is unknown.
|
|
97
|
+
*/
|
|
98
|
+
function selectedUnder(node, route, size) {
|
|
99
|
+
if (node.selectAllChildren) {
|
|
100
|
+
if (size == null)
|
|
101
|
+
return null;
|
|
102
|
+
let minus = 0;
|
|
103
|
+
for (const [key, child] of node.toggled) {
|
|
104
|
+
if (child.group) {
|
|
105
|
+
const childRoute = [...route, key];
|
|
106
|
+
const childSize = options.leafCount?.(childRoute) ?? null;
|
|
107
|
+
const selected = selectedUnder(child, childRoute, childSize);
|
|
108
|
+
if (childSize == null || selected == null)
|
|
109
|
+
return null;
|
|
110
|
+
minus += childSize - selected;
|
|
111
|
+
}
|
|
112
|
+
else if (!child.selectAllChildren) {
|
|
113
|
+
minus += 1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return Math.max(0, size - minus);
|
|
117
|
+
}
|
|
118
|
+
let n = 0;
|
|
119
|
+
for (const [key, child] of node.toggled) {
|
|
120
|
+
if (child.group) {
|
|
121
|
+
const childRoute = [...route, key];
|
|
122
|
+
const selected = selectedUnder(child, childRoute, options.leafCount?.(childRoute) ?? null);
|
|
123
|
+
if (selected == null)
|
|
124
|
+
return null;
|
|
125
|
+
n += selected;
|
|
126
|
+
}
|
|
127
|
+
else if (child.selectAllChildren) {
|
|
128
|
+
n += 1;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return n;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
groupSelects,
|
|
135
|
+
isSelected(route, id) {
|
|
136
|
+
if (!hierarchical)
|
|
137
|
+
return selectAll !== toggled.has(id);
|
|
138
|
+
const { node, state } = resolve(route);
|
|
139
|
+
const own = node.toggled.get(id);
|
|
140
|
+
return own ? own.selectAllChildren : state;
|
|
141
|
+
},
|
|
142
|
+
toggle(route, id, next, isGroup = false) {
|
|
143
|
+
if (!hierarchical) {
|
|
144
|
+
// The row differs from the rule when `next` disagrees with selectAll.
|
|
145
|
+
if (next !== selectAll)
|
|
146
|
+
toggled.add(id);
|
|
147
|
+
else
|
|
148
|
+
toggled.delete(id);
|
|
149
|
+
notify();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const parent = ensurePath(route);
|
|
153
|
+
// A toggled row - group or leaf - becomes a node with no exceptions of
|
|
154
|
+
// its own: ticking a group throws away whatever was recorded beneath it.
|
|
155
|
+
if (next === parent.selectAllChildren)
|
|
156
|
+
parent.toggled.delete(id);
|
|
157
|
+
else
|
|
158
|
+
parent.toggled.set(id, { selectAllChildren: next, toggled: new Map(), group: isGroup });
|
|
159
|
+
prune(root);
|
|
160
|
+
notify();
|
|
161
|
+
},
|
|
162
|
+
setAll(next) {
|
|
163
|
+
if (!hierarchical) {
|
|
164
|
+
selectAll = next;
|
|
165
|
+
toggled.clear();
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
root = { selectAllChildren: next, toggled: new Map(), group: true };
|
|
169
|
+
}
|
|
170
|
+
notify();
|
|
171
|
+
},
|
|
172
|
+
clear() {
|
|
173
|
+
this.setAll(false);
|
|
174
|
+
},
|
|
175
|
+
headerState() {
|
|
176
|
+
if (!hierarchical) {
|
|
177
|
+
if (selectAll)
|
|
178
|
+
return toggled.size === 0 ? 'all' : 'some';
|
|
179
|
+
return toggled.size === 0 ? 'none' : 'some';
|
|
180
|
+
}
|
|
181
|
+
if (root.selectAllChildren)
|
|
182
|
+
return root.toggled.size === 0 ? 'all' : 'some';
|
|
183
|
+
return root.toggled.size === 0 ? 'none' : 'some';
|
|
184
|
+
},
|
|
185
|
+
selectedCount(rowCount) {
|
|
186
|
+
if (!hierarchical) {
|
|
187
|
+
if (!selectAll)
|
|
188
|
+
return toggled.size;
|
|
189
|
+
return rowCount == null ? null : Math.max(0, rowCount - toggled.size);
|
|
190
|
+
}
|
|
191
|
+
return selectedUnder(root, [], rowCount);
|
|
192
|
+
},
|
|
193
|
+
isSelectAllWithoutExceptions() {
|
|
194
|
+
return hierarchical ? root.selectAllChildren && root.toggled.size === 0 : selectAll && toggled.size === 0;
|
|
195
|
+
},
|
|
196
|
+
getState() {
|
|
197
|
+
if (!hierarchical)
|
|
198
|
+
return { selectAll, toggled: [...toggled] };
|
|
199
|
+
return toPlain(root);
|
|
200
|
+
},
|
|
201
|
+
setState(state) {
|
|
202
|
+
if (!hierarchical) {
|
|
203
|
+
const flat = state;
|
|
204
|
+
selectAll = !!flat.selectAll;
|
|
205
|
+
toggled.clear();
|
|
206
|
+
for (const id of flat.toggled ?? [])
|
|
207
|
+
toggled.add(id);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
root = fromPlain(state);
|
|
211
|
+
}
|
|
212
|
+
notify();
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters between the `ServerDataSource` contract and the callback-style
|
|
3
|
+
* datasource shape other server-side row models use: `getRows(params)` with
|
|
4
|
+
* `params.request` describing the block and `params.success` / `params.fail`
|
|
5
|
+
* answering it. A backend written for that shape keeps working behind
|
|
6
|
+
* `createServerRowModel` through `adaptCallbackDatasource`, so a migration is
|
|
7
|
+
* one line; `toCallbackDatasource` goes the other way, for a bench that runs
|
|
8
|
+
* two grids over one backend.
|
|
9
|
+
*
|
|
10
|
+
* The request fields map one for one:
|
|
11
|
+
*
|
|
12
|
+
* | Callback request | ServerRequest |
|
|
13
|
+
* |-------------------------------|----------------------------------------|
|
|
14
|
+
* | `startRow` / `endRow` | the same |
|
|
15
|
+
* | `rowGroupCols[].id` | `groupBy` |
|
|
16
|
+
* | `groupKeys` | `groupKeys` |
|
|
17
|
+
* | `valueCols[].{id,aggFunc}` | `aggregations[].{col,fn}` |
|
|
18
|
+
* | `pivotCols[].id`, `pivotMode` | `pivotBy`, `pivotMode` |
|
|
19
|
+
* | `sortModel[].{colId,sort}` | `sortModel[].{id,desc}` |
|
|
20
|
+
* | `filterModel[col].{type,filter,filterTo}` | `filterModel.columns[col].{operator,value,valueTo}` |
|
|
21
|
+
*
|
|
22
|
+
* and the answer: `success({ rowData, rowCount, pivotResultFields })` becomes
|
|
23
|
+
* `{ rows, rowCount, pivotResultFields }` (a `rowCount` of `-1` or absent
|
|
24
|
+
* stays unknown), `fail()` rejects.
|
|
25
|
+
*
|
|
26
|
+
* A backend that keeps parsing the callback-style request JSON needs no
|
|
27
|
+
* datasource object at all: `getRows(request)` posts
|
|
28
|
+
* `toCallbackRequest(request)` and reads the answer as usual.
|
|
29
|
+
*
|
|
30
|
+
* The selection rule has a counterpart there too, `{ selectAll,
|
|
31
|
+
* toggledNodes }` flat and `{ nodeId, selectAllChildren, toggledNodes }`
|
|
32
|
+
* per group; `toCallbackSelectionState` / `fromCallbackSelectionState` map
|
|
33
|
+
* it for a saved selection or a bulk endpoint written against that shape.
|
|
34
|
+
*/
|
|
35
|
+
import type { ServerDataSource, ServerFilterModel, ServerRequest } from '@svgrid/grid';
|
|
36
|
+
import type { ServerGroupSelectionNode, ServerSelectionState } from './server-selection.js';
|
|
37
|
+
/** The request a callback-style datasource receives; the subset the adapter reads. */
|
|
38
|
+
export type CallbackServerRequest = {
|
|
39
|
+
startRow?: number;
|
|
40
|
+
endRow?: number;
|
|
41
|
+
rowGroupCols: Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
displayName?: string;
|
|
44
|
+
field?: string;
|
|
45
|
+
aggFunc?: string | null;
|
|
46
|
+
}>;
|
|
47
|
+
groupKeys: string[];
|
|
48
|
+
valueCols: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
displayName?: string;
|
|
51
|
+
field?: string;
|
|
52
|
+
aggFunc?: string | null;
|
|
53
|
+
}>;
|
|
54
|
+
pivotCols: Array<{
|
|
55
|
+
id: string;
|
|
56
|
+
displayName?: string;
|
|
57
|
+
field?: string;
|
|
58
|
+
}>;
|
|
59
|
+
pivotMode: boolean;
|
|
60
|
+
sortModel: Array<{
|
|
61
|
+
colId: string;
|
|
62
|
+
sort: 'asc' | 'desc';
|
|
63
|
+
}>;
|
|
64
|
+
filterModel: Record<string, CallbackColumnFilter> | null;
|
|
65
|
+
};
|
|
66
|
+
/** One column of the callback-style filter model (text, number or set). */
|
|
67
|
+
export type CallbackColumnFilter = {
|
|
68
|
+
filterType?: string;
|
|
69
|
+
type?: string;
|
|
70
|
+
filter?: unknown;
|
|
71
|
+
filterTo?: unknown;
|
|
72
|
+
values?: string[];
|
|
73
|
+
};
|
|
74
|
+
/** What a callback-style datasource's `getRows` receives, and how it answers. */
|
|
75
|
+
export type CallbackGetRowsParams<TData = unknown> = {
|
|
76
|
+
request: CallbackServerRequest;
|
|
77
|
+
success: (result: {
|
|
78
|
+
rowData: TData[];
|
|
79
|
+
rowCount?: number;
|
|
80
|
+
pivotResultFields?: string[];
|
|
81
|
+
}) => void;
|
|
82
|
+
fail: () => void;
|
|
83
|
+
context?: unknown;
|
|
84
|
+
parentNode?: {
|
|
85
|
+
data?: TData;
|
|
86
|
+
} | null;
|
|
87
|
+
};
|
|
88
|
+
/** A datasource in the callback shape: `getRows(params)` answering through `params.success` / `params.fail`. */
|
|
89
|
+
export type CallbackDatasource<TData = unknown> = {
|
|
90
|
+
getRows(params: CallbackGetRowsParams<TData>): void;
|
|
91
|
+
destroy?(): void;
|
|
92
|
+
};
|
|
93
|
+
/** The callback-style per-column filter model -> `ServerFilterModel`. */
|
|
94
|
+
export declare function fromCallbackFilterModel(model: Record<string, CallbackColumnFilter> | null | undefined): ServerFilterModel;
|
|
95
|
+
/** `ServerFilterModel` -> the callback-style per-column filter model. The global search has no form there and is dropped. */
|
|
96
|
+
export declare function toCallbackFilterModel(model: ServerFilterModel): Record<string, CallbackColumnFilter>;
|
|
97
|
+
/** `ServerRequest` -> the callback-style request shape. */
|
|
98
|
+
export declare function toCallbackRequest(req: ServerRequest): CallbackServerRequest;
|
|
99
|
+
/** The callback-style request shape -> `ServerRequest`. */
|
|
100
|
+
export declare function fromCallbackRequest(req: CallbackServerRequest, extra?: Partial<ServerRequest>): ServerRequest;
|
|
101
|
+
/**
|
|
102
|
+
* Wrap a callback-style datasource so `createServerRowModel` (or
|
|
103
|
+
* `createServerDataSource`) can drive it.
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* const ctl = createServerRowModel(adaptCallbackDatasource(myDatasource), { groupBy: ['country'] })
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function adaptCallbackDatasource<TData>(ds: CallbackDatasource<TData>): ServerDataSource<TData>;
|
|
110
|
+
/**
|
|
111
|
+
* The other direction: a `ServerDataSource` as a callback-style datasource,
|
|
112
|
+
* so one backend can serve two grids side by side.
|
|
113
|
+
*/
|
|
114
|
+
export declare function toCallbackDatasource<TData>(source: ServerDataSource<TData>): CallbackDatasource<TData>;
|
|
115
|
+
/** The flat selection rule in the callback-style shape. */
|
|
116
|
+
export type CallbackSelectionState = {
|
|
117
|
+
selectAll: boolean;
|
|
118
|
+
/** Exceptions to `selectAll`, as row ids. */
|
|
119
|
+
toggledNodes: string[];
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* One node of the callback-style hierarchical rule. The root carries no
|
|
123
|
+
* `nodeId`; a child is a group row or a leaf, told apart by whether it has
|
|
124
|
+
* exceptions of its own (see `SelectionStateMapping.isGroup`).
|
|
125
|
+
*/
|
|
126
|
+
export type CallbackGroupSelectionState = {
|
|
127
|
+
nodeId?: string;
|
|
128
|
+
selectAllChildren?: boolean;
|
|
129
|
+
toggledNodes?: CallbackGroupSelectionState[];
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* How group rows are named across the two shapes. This model keys a group
|
|
133
|
+
* by its route segment (`['EMEA', 'DE']` is the DE group under EMEA); the
|
|
134
|
+
* callback shape keys it by a row node id that the app chose. When the two
|
|
135
|
+
* are the same string - the default - nothing needs to be passed.
|
|
136
|
+
*/
|
|
137
|
+
export type SelectionStateMapping = {
|
|
138
|
+
/** The node id of the group at `route`. Default: the last key of the route. */
|
|
139
|
+
groupId?: (route: string[]) => string;
|
|
140
|
+
/** The group key for a node id under `parentRoute`. Default: the id itself. */
|
|
141
|
+
groupKey?: (nodeId: string, parentRoute: string[]) => string;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the node `nodeId` under `parentRoute` is a group row. Default:
|
|
144
|
+
* it is when it carries exceptions of its own, a leaf otherwise. A flipped
|
|
145
|
+
* group read as a leaf still selects the same rows; only `selectedCount`
|
|
146
|
+
* is off, since a group exception has no size of its own.
|
|
147
|
+
*/
|
|
148
|
+
isGroup?: (nodeId: string, parentRoute: string[]) => boolean;
|
|
149
|
+
};
|
|
150
|
+
/** Whether a selection state is in the callback-style shape (either level). */
|
|
151
|
+
export declare function isCallbackSelectionState(state: unknown): state is CallbackSelectionState | CallbackGroupSelectionState;
|
|
152
|
+
/** The selection rule -> the callback-style shape, flat or per group. */
|
|
153
|
+
export declare function toCallbackSelectionState(state: ServerSelectionState | ServerGroupSelectionNode, mapping?: SelectionStateMapping): CallbackSelectionState | CallbackGroupSelectionState;
|
|
154
|
+
/** The callback-style shape -> the selection rule this model keeps. */
|
|
155
|
+
export declare function fromCallbackSelectionState(state: CallbackSelectionState | CallbackGroupSelectionState, mapping?: SelectionStateMapping): ServerSelectionState | ServerGroupSelectionNode;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const CALLBACK_TO_GRID_OPERATOR = {
|
|
2
|
+
contains: 'contains',
|
|
3
|
+
notContains: 'notContains',
|
|
4
|
+
equals: 'equals',
|
|
5
|
+
notEqual: 'notEquals',
|
|
6
|
+
startsWith: 'startsWith',
|
|
7
|
+
endsWith: 'endsWith',
|
|
8
|
+
lessThan: 'lessThan',
|
|
9
|
+
lessThanOrEqual: 'lessThanOrEqual',
|
|
10
|
+
greaterThan: 'greaterThan',
|
|
11
|
+
greaterThanOrEqual: 'greaterThanOrEqual',
|
|
12
|
+
inRange: 'between',
|
|
13
|
+
blank: 'isBlank',
|
|
14
|
+
notBlank: 'isNotBlank',
|
|
15
|
+
};
|
|
16
|
+
const GRID_TO_CALLBACK_OPERATOR = Object.fromEntries(Object.entries(CALLBACK_TO_GRID_OPERATOR).map(([theirs, ours]) => [ours, theirs]));
|
|
17
|
+
const asString = (v) => (v == null ? '' : String(v));
|
|
18
|
+
/** The callback-style per-column filter model -> `ServerFilterModel`. */
|
|
19
|
+
export function fromCallbackFilterModel(model) {
|
|
20
|
+
const columns = {};
|
|
21
|
+
for (const [id, f] of Object.entries(model ?? {})) {
|
|
22
|
+
if (!f)
|
|
23
|
+
continue;
|
|
24
|
+
if (f.filterType === 'set' && Array.isArray(f.values)) {
|
|
25
|
+
columns[id] = { operator: 'in', value: '', selectedValues: f.values.map(asString) };
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const operator = CALLBACK_TO_GRID_OPERATOR[f.type ?? ''] ?? f.type ?? 'equals';
|
|
29
|
+
columns[id] = {
|
|
30
|
+
operator,
|
|
31
|
+
value: asString(f.filter),
|
|
32
|
+
...(f.filterTo != null ? { valueTo: asString(f.filterTo) } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return Object.keys(columns).length ? { columns } : {};
|
|
36
|
+
}
|
|
37
|
+
/** `ServerFilterModel` -> the callback-style per-column filter model. The global search has no form there and is dropped. */
|
|
38
|
+
export function toCallbackFilterModel(model) {
|
|
39
|
+
const out = {};
|
|
40
|
+
for (const [id, f] of Object.entries(model.columns ?? {})) {
|
|
41
|
+
if (f.selectedValues) {
|
|
42
|
+
out[id] = { filterType: 'set', values: f.selectedValues };
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
out[id] = {
|
|
46
|
+
filterType: 'text',
|
|
47
|
+
type: GRID_TO_CALLBACK_OPERATOR[f.operator] ?? f.operator,
|
|
48
|
+
filter: f.value,
|
|
49
|
+
...(f.valueTo != null ? { filterTo: f.valueTo } : {}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** `ServerRequest` -> the callback-style request shape. */
|
|
55
|
+
export function toCallbackRequest(req) {
|
|
56
|
+
return {
|
|
57
|
+
startRow: req.startRow,
|
|
58
|
+
endRow: req.endRow,
|
|
59
|
+
rowGroupCols: (req.groupBy ?? []).map((id) => ({ id, field: id, displayName: id })),
|
|
60
|
+
groupKeys: [...(req.groupKeys ?? [])],
|
|
61
|
+
valueCols: (req.aggregations ?? []).map((a) => ({ id: a.col, field: a.col, displayName: a.col, aggFunc: a.fn })),
|
|
62
|
+
pivotCols: (req.pivotBy ?? []).map((id) => ({ id, field: id, displayName: id })),
|
|
63
|
+
pivotMode: !!req.pivotMode,
|
|
64
|
+
sortModel: req.sortModel.map((s) => ({ colId: s.id, sort: s.desc ? 'desc' : 'asc' })),
|
|
65
|
+
filterModel: toCallbackFilterModel(req.filterModel),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** The callback-style request shape -> `ServerRequest`. */
|
|
69
|
+
export function fromCallbackRequest(req, extra = {}) {
|
|
70
|
+
const startRow = req.startRow ?? 0;
|
|
71
|
+
const endRow = req.endRow ?? startRow + 100;
|
|
72
|
+
const pageSize = Math.max(1, endRow - startRow);
|
|
73
|
+
const sortModel = req.sortModel.map((s) => ({ id: s.colId, desc: s.sort === 'desc' }));
|
|
74
|
+
const out = {
|
|
75
|
+
startRow,
|
|
76
|
+
endRow,
|
|
77
|
+
pageIndex: Math.floor(startRow / pageSize),
|
|
78
|
+
pageSize,
|
|
79
|
+
sortModel,
|
|
80
|
+
filterModel: fromCallbackFilterModel(req.filterModel),
|
|
81
|
+
...extra,
|
|
82
|
+
};
|
|
83
|
+
if (req.rowGroupCols.length) {
|
|
84
|
+
out.groupBy = req.rowGroupCols.map((c) => c.id);
|
|
85
|
+
out.groupKeys = [...req.groupKeys];
|
|
86
|
+
}
|
|
87
|
+
if (req.valueCols.length) {
|
|
88
|
+
out.aggregations = req.valueCols.map((c) => ({
|
|
89
|
+
col: c.id,
|
|
90
|
+
fn: (c.aggFunc ?? 'sum'),
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
if (req.pivotMode && req.pivotCols.length) {
|
|
94
|
+
out.pivotBy = req.pivotCols.map((c) => c.id);
|
|
95
|
+
out.pivotMode = true;
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Wrap a callback-style datasource so `createServerRowModel` (or
|
|
101
|
+
* `createServerDataSource`) can drive it.
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* const ctl = createServerRowModel(adaptCallbackDatasource(myDatasource), { groupBy: ['country'] })
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export function adaptCallbackDatasource(ds) {
|
|
108
|
+
return {
|
|
109
|
+
getRows(req) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
let settled = false;
|
|
112
|
+
ds.getRows({
|
|
113
|
+
request: toCallbackRequest(req),
|
|
114
|
+
context: req.context,
|
|
115
|
+
parentNode: req.parentRow === undefined ? null : { data: req.parentRow },
|
|
116
|
+
success: ({ rowData, rowCount, pivotResultFields }) => {
|
|
117
|
+
if (settled)
|
|
118
|
+
return;
|
|
119
|
+
settled = true;
|
|
120
|
+
const result = {
|
|
121
|
+
rows: rowData,
|
|
122
|
+
rowCount: rowCount == null || rowCount < 0 ? -1 : rowCount,
|
|
123
|
+
};
|
|
124
|
+
if (pivotResultFields)
|
|
125
|
+
result.pivotResultFields = pivotResultFields;
|
|
126
|
+
resolve(result);
|
|
127
|
+
},
|
|
128
|
+
fail: () => {
|
|
129
|
+
if (settled)
|
|
130
|
+
return;
|
|
131
|
+
settled = true;
|
|
132
|
+
reject(new Error('The datasource reported a failed load'));
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
...(ds.destroy ? { destroy: () => ds.destroy() } : {}),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The other direction: a `ServerDataSource` as a callback-style datasource,
|
|
142
|
+
* so one backend can serve two grids side by side.
|
|
143
|
+
*/
|
|
144
|
+
export function toCallbackDatasource(source) {
|
|
145
|
+
return {
|
|
146
|
+
getRows(params) {
|
|
147
|
+
const extra = {};
|
|
148
|
+
if (params.context !== undefined)
|
|
149
|
+
extra.context = params.context;
|
|
150
|
+
if (params.parentNode?.data !== undefined)
|
|
151
|
+
extra.parentRow = params.parentNode.data;
|
|
152
|
+
source.getRows(fromCallbackRequest(params.request, extra)).then((res) => {
|
|
153
|
+
params.success({
|
|
154
|
+
rowData: [...res.rows],
|
|
155
|
+
rowCount: res.rowCount < 0 ? undefined : res.rowCount,
|
|
156
|
+
...(res.pivotResultFields ? { pivotResultFields: res.pivotResultFields } : {}),
|
|
157
|
+
});
|
|
158
|
+
}, () => params.fail());
|
|
159
|
+
},
|
|
160
|
+
...(source.destroy ? { destroy: () => source.destroy() } : {}),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** Whether a selection state is in the callback-style shape (either level). */
|
|
164
|
+
export function isCallbackSelectionState(state) {
|
|
165
|
+
return typeof state === 'object' && state !== null && 'toggledNodes' in state;
|
|
166
|
+
}
|
|
167
|
+
/** The selection rule -> the callback-style shape, flat or per group. */
|
|
168
|
+
export function toCallbackSelectionState(state, mapping = {}) {
|
|
169
|
+
if ('selectAll' in state)
|
|
170
|
+
return { selectAll: !!state.selectAll, toggledNodes: [...(state.toggled ?? [])] };
|
|
171
|
+
const walk = (node, route) => {
|
|
172
|
+
const out = {};
|
|
173
|
+
if (route.length) {
|
|
174
|
+
out.nodeId = node.group ? (mapping.groupId?.(route) ?? route[route.length - 1]) : route[route.length - 1];
|
|
175
|
+
}
|
|
176
|
+
out.selectAllChildren = !!node.selectAllChildren;
|
|
177
|
+
out.toggledNodes = Object.entries(node.toggled ?? {}).map(([key, child]) => walk(child, [...route, key]));
|
|
178
|
+
return out;
|
|
179
|
+
};
|
|
180
|
+
return walk(state, []);
|
|
181
|
+
}
|
|
182
|
+
/** The callback-style shape -> the selection rule this model keeps. */
|
|
183
|
+
export function fromCallbackSelectionState(state, mapping = {}) {
|
|
184
|
+
if ('selectAll' in state) {
|
|
185
|
+
const flat = state;
|
|
186
|
+
return { selectAll: !!flat.selectAll, toggled: (flat.toggledNodes ?? []).map(String) };
|
|
187
|
+
}
|
|
188
|
+
const walk = (node, route) => {
|
|
189
|
+
const toggled = {};
|
|
190
|
+
for (const child of node.toggledNodes ?? []) {
|
|
191
|
+
if (child.nodeId == null)
|
|
192
|
+
continue;
|
|
193
|
+
const id = String(child.nodeId);
|
|
194
|
+
const group = mapping.isGroup?.(id, route) ?? (child.toggledNodes?.length ?? 0) > 0;
|
|
195
|
+
const key = group ? (mapping.groupKey?.(id, route) ?? id) : id;
|
|
196
|
+
const plain = walk(child, [...route, key]);
|
|
197
|
+
toggled[key] = group ? { ...plain, group: true } : plain;
|
|
198
|
+
}
|
|
199
|
+
return { selectAllChildren: !!node.selectAllChildren, toggled };
|
|
200
|
+
};
|
|
201
|
+
return walk(state, []);
|
|
202
|
+
}
|