@svgrid/enterprise 3.0.2 → 3.1.0
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 +94 -20
- package/dist/SvFormulaBar.svelte.d.ts +7 -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 +198 -40
- package/dist/SvPivotDesigner.svelte.d.ts +27 -20
- package/dist/SvSheet.svelte +4043 -243
- package/dist/SvSheet.svelte.d.ts +76 -3
- package/dist/SvSheetChartSetup.svelte +151 -0
- package/dist/SvSheetChartSetup.svelte.d.ts +18 -0
- package/dist/SvSheetComment.svelte +216 -31
- package/dist/SvSheetComment.svelte.d.ts +11 -11
- package/dist/SvSheetConditionalFormat.svelte +28 -31
- package/dist/SvSheetDataValidation.svelte +66 -42
- 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 +137 -34
- package/dist/SvSheetFilterMenu.svelte.d.ts +5 -0
- package/dist/SvSheetFindReplace.svelte +19 -19
- package/dist/SvSheetFormatCells.svelte +125 -81
- package/dist/SvSheetGoalSeek.svelte +17 -16
- package/dist/SvSheetInsertFunction.svelte +15 -13
- 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 +4 -2
- package/dist/SvSheetListPicker.svelte.d.ts +0 -6
- package/dist/SvSheetManageRules.svelte +20 -18
- package/dist/SvSheetNameManager.svelte +17 -15
- package/dist/SvSheetPageSetup.svelte +159 -0
- package/dist/SvSheetPageSetup.svelte.d.ts +13 -0
- package/dist/SvSheetPasteSpecial.svelte +22 -20
- 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 +13 -10
- package/dist/SvSheetRibbon.svelte +104 -51
- package/dist/SvSheetSizeDialog.svelte +4 -2
- 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 +161 -31
- package/dist/SvSheetTabs.svelte.d.ts +22 -8
- package/dist/SvSheetTextToColumns.svelte +20 -20
- package/dist/SvSheetValidationAlert.svelte +8 -6
- 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 +39827 -16429
- package/dist/designer/assets/GridMenus-8gTNssgV.js +8 -0
- package/dist/designer/assets/{SvChartMenu-D9hEeHar.js → SvChartMenu-BDoeqGz6.js} +1 -1
- package/dist/designer/assets/{SvDateTimePicker-DARvKUL2.js → SvDateTimePicker-DCPg7WGN.js} +1 -1
- package/dist/designer/assets/SvGridCellEditor-DMoWJjEI.js +4 -0
- package/dist/designer/assets/{SvGridChart-B8j1SSy3.js → SvGridChart-Cy1ATrWh.js} +2 -2
- package/dist/designer/assets/SvGridChartBuilder-eQ3mn0L9.js +1 -0
- package/dist/designer/assets/{SvGridChartPanel-pT6ITc2P.js → SvGridChartPanel-CATdVc9X.js} +3 -3
- package/dist/designer/assets/{SvGridChartView-bg281UA1.js → SvGridChartView-CmsZtCED.js} +1 -1
- package/dist/designer/assets/SvGridDropdown-Cjz0H-fI.js +1 -0
- package/dist/designer/assets/{SvTabs-UFCMTHXS.js → SvTabs-2mHC6oaz.js} +1 -1
- package/dist/designer/assets/cell-formatting-BbubJTVz.js +1 -0
- package/dist/designer/assets/{chart-cIPUsbM5.js → chart-Cn7MnNqA.js} +1 -1
- package/dist/designer/assets/{chart-panel-messages-DtTxpBUU.js → chart-panel-messages-Dz7PTIqT.js} +1 -1
- package/dist/designer/assets/{chart-summary-Czu_5epb.js → chart-summary-BD1qYB2R.js} +1 -1
- package/dist/designer/assets/{chart-trend-D5I5VEe8.js → chart-trend-B8xr5LuD.js} +1 -1
- package/dist/designer/assets/{dismissable-BO547MH9.js → dismissable-ChWRPkoa.js} +1 -1
- package/dist/designer/assets/{export-format-D-eP4b2l.js → export-format-DGckmgKr.js} +1 -1
- package/dist/designer/assets/{focus-trap-CAreAhlU.js → focus-trap-V2-6Fy9I.js} +1 -1
- package/dist/designer/assets/{index-DwU7CAMm.js → index-BSjv6Qec.js} +317 -315
- package/dist/designer/assets/index-_JVFxt02.css +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-DUQ4xE3x.js +58 -0
- package/dist/designer/assets/validate-C3B8QKsM.js +1 -0
- package/dist/designer/index.html +17 -16
- package/dist/export-pdf.d.ts +75 -0
- package/dist/export-pdf.js +216 -15
- package/dist/export.js +10 -2
- 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 +34 -7
- package/dist/index.js +44 -7
- package/dist/install.js +8 -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 +140 -8
- 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/ast.d.ts +45 -1
- package/dist/sheet/ast.js +14 -0
- package/dist/sheet/auto-filter.d.ts +58 -4
- package/dist/sheet/auto-filter.js +159 -11
- package/dist/sheet/autocomplete.d.ts +9 -0
- package/dist/sheet/autocomplete.js +90 -4
- 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 +40 -0
- package/dist/sheet/coerce.js +170 -3
- package/dist/sheet/comments.d.ts +43 -9
- package/dist/sheet/comments.js +85 -27
- package/dist/sheet/conditional-formats.d.ts +29 -6
- package/dist/sheet/conditional-formats.js +37 -12
- 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 +45 -1
- package/dist/sheet/deps.js +77 -2
- package/dist/sheet/document.d.ts +106 -4
- package/dist/sheet/document.js +204 -3
- package/dist/sheet/engine.d.ts +67 -0
- package/dist/sheet/engine.js +19 -0
- package/dist/sheet/entry.d.ts +8 -4
- package/dist/sheet/entry.js +171 -21
- 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 +67 -0
- package/dist/sheet/evaluate.js +725 -13
- package/dist/sheet/filter-files.d.ts +37 -0
- package/dist/sheet/filter-files.js +465 -0
- package/dist/sheet/format-store.d.ts +15 -0
- package/dist/sheet/format-store.js +11 -1
- package/dist/sheet/from-rows.d.ts +14 -0
- package/dist/sheet/from-rows.js +50 -0
- package/dist/sheet/function-catalog.d.ts +1 -1
- package/dist/sheet/function-catalog.js +296 -5
- package/dist/sheet/functions.js +363 -91
- package/dist/sheet/index.d.ts +35 -8
- package/dist/sheet/index.js +35 -8
- package/dist/sheet/links.d.ts +57 -0
- package/dist/sheet/links.js +174 -0
- package/dist/sheet/messages.d.ts +778 -0
- package/dist/sheet/messages.js +806 -0
- package/dist/sheet/number-format.d.ts +52 -5
- package/dist/sheet/number-format.js +465 -68
- 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/parse.js +42 -10
- package/dist/sheet/paste-special.d.ts +22 -0
- package/dist/sheet/paste-special.js +14 -5
- 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 +55 -1
- package/dist/sheet/protection.js +55 -2
- package/dist/sheet/rects.d.ts +1 -1
- package/dist/sheet/refs.d.ts +48 -0
- package/dist/sheet/refs.js +155 -8
- package/dist/sheet/ribbon-icons.d.ts +1 -1
- package/dist/sheet/ribbon-icons.js +186 -0
- package/dist/sheet/ribbon.d.ts +1 -1
- package/dist/sheet/ribbon.js +324 -23
- package/dist/sheet/sheet-kinds.d.ts +74 -0
- package/dist/sheet/sheet-kinds.js +91 -0
- package/dist/sheet/shortcuts.d.ts +13 -3
- package/dist/sheet/shortcuts.js +63 -12
- 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/table-styles.d.ts +74 -0
- package/dist/sheet/table-styles.js +152 -0
- package/dist/sheet/tables.d.ts +19 -0
- package/dist/sheet/tables.js +31 -0
- package/dist/sheet/tokenize.d.ts +18 -1
- package/dist/sheet/tokenize.js +60 -9
- package/dist/sheet/validation.d.ts +16 -0
- package/dist/sheet/validation.js +37 -0
- package/dist/sheet/workbook.d.ts +148 -3
- package/dist/sheet/workbook.js +742 -31
- 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.js +6 -7
- 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 +107 -2
- 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 +30 -5
- package/dist/designer/assets/GridMenus-BlsvL_aU.js +0 -8
- package/dist/designer/assets/SvGridCellEditor-C7uQXYds.js +0 -4
- package/dist/designer/assets/SvGridChartBuilder-kvyIU_Rl.js +0 -1
- package/dist/designer/assets/SvGridDropdown-Bb3HH2Aj.js +0 -1
- package/dist/designer/assets/cell-formatting-wr5wm7US.js +0 -1
- package/dist/designer/assets/index-CMFgAoVV.css +0 -1
- package/dist/designer/assets/row-resize-DLktcqUK.js +0 -1
- package/dist/designer/assets/src-EdI3Xqds.js +0 -58
- package/dist/designer/assets/validate-h-aslRV9.js +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { GridIcons, ServerDisplayRow, ServerPlaceholderRow } from '@svgrid/grid';
|
|
2
|
+
import { type ServerGroupMessages } from './messages.js';
|
|
3
|
+
declare function $$render<TData>(): {
|
|
4
|
+
props: {
|
|
5
|
+
/** The grid row from `serverGroupRows` (carries the `__group` marker). */
|
|
6
|
+
row: {
|
|
7
|
+
__group?: ServerDisplayRow<TData> | ServerPlaceholderRow;
|
|
8
|
+
} & Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Expand / collapse a group, or load more children. Receives the grid row;
|
|
11
|
+
* wire to `serverGroupNav(ctl).onToggle` (which drives clicks and keyboard).
|
|
12
|
+
*/
|
|
13
|
+
onToggle: (row: {
|
|
14
|
+
__group?: ServerDisplayRow<TData> | ServerPlaceholderRow;
|
|
15
|
+
} & Record<string, unknown>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Field to show for leaf rows in the group column (blank if omitted).
|
|
18
|
+
* Under `treeData` every row is a node of the same shape, so it names
|
|
19
|
+
* the label of expandable nodes too; a group row's key is otherwise
|
|
20
|
+
* the text.
|
|
21
|
+
*/
|
|
22
|
+
leafField?: string;
|
|
23
|
+
/** Pixels of indentation per level. Default 18. */
|
|
24
|
+
indent?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Icon overrides, the same map `<SvGrid icons>` takes. Only
|
|
27
|
+
* `chevron-right` is drawn here. You mount this component yourself, so it
|
|
28
|
+
* cannot inherit the grid's icons - pass the same object to both to keep
|
|
29
|
+
* the expander consistent with the rest of the chrome.
|
|
30
|
+
*/
|
|
31
|
+
icons?: GridIcons;
|
|
32
|
+
/**
|
|
33
|
+
* Strings, for localization: the "load more" row, the footer and grand
|
|
34
|
+
* total labels. Partial; missing keys keep the English default. Pass the
|
|
35
|
+
* same map to `SvRowGroupPanel` and `serverGroupText`.
|
|
36
|
+
*/
|
|
37
|
+
messages?: Partial<ServerGroupMessages>;
|
|
38
|
+
/** Locale for the child count and the "load more" number. Default: the browser's. */
|
|
39
|
+
locale?: string | ReadonlyArray<string>;
|
|
40
|
+
};
|
|
41
|
+
exports: {};
|
|
42
|
+
bindings: "";
|
|
43
|
+
slots: {};
|
|
44
|
+
events: {};
|
|
45
|
+
};
|
|
46
|
+
declare class __sveltets_Render<TData> {
|
|
47
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
48
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
49
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
50
|
+
bindings(): "";
|
|
51
|
+
exports(): {};
|
|
52
|
+
}
|
|
53
|
+
interface $$IsomorphicComponent {
|
|
54
|
+
new <TData>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
55
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
56
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
57
|
+
<TData>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
58
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
59
|
+
}
|
|
60
|
+
declare const SvGroupCell: $$IsomorphicComponent;
|
|
61
|
+
type SvGroupCell<TData> = InstanceType<typeof SvGroupCell<TData>>;
|
|
62
|
+
export default SvGroupCell;
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A row-group panel (like the "drag columns to group" bar in enterprise grids).
|
|
3
|
+
Shows the current group-by columns as chips you can remove or drag to reorder,
|
|
4
|
+
plus a "+ Group by" menu to add one. It is also a drop target: a column drag
|
|
5
|
+
that carries `text/sv-column` (its column id) adds that column. Wire `onChange`
|
|
6
|
+
to a server group model's `setGroupBy`, or to client grouping.
|
|
7
|
+
|
|
8
|
+
<SvRowGroupPanel
|
|
9
|
+
columns={[{ id: 'region', label: 'Region' }, { id: 'country', label: 'Country' }]}
|
|
10
|
+
groupBy={view.groupBy}
|
|
11
|
+
onChange={(g) => ctl.setGroupBy(g)}
|
|
12
|
+
/>
|
|
13
|
+
-->
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { untrack } from 'svelte'
|
|
16
|
+
import { GRID_ICON_GLYPHS, type GridIconName, type GridIcons } from '@svgrid/grid'
|
|
17
|
+
import { fillMessage, resolveServerGroupMessages, type ServerGroupMessages } from './messages'
|
|
18
|
+
|
|
19
|
+
type Col = { id: string; label: string }
|
|
20
|
+
type Props = {
|
|
21
|
+
/** Columns that can be grouped on. */
|
|
22
|
+
columns: Col[]
|
|
23
|
+
/** Current group-by column ids, outer to inner. */
|
|
24
|
+
groupBy: string[]
|
|
25
|
+
/** Called with the new group-by order. */
|
|
26
|
+
onChange: (groupBy: string[]) => void
|
|
27
|
+
/** Text shown when nothing is grouped. Default: `messages.dropHere`. */
|
|
28
|
+
placeholder?: string
|
|
29
|
+
/**
|
|
30
|
+
* Icon overrides, the same map `<SvGrid icons>` takes. This panel draws
|
|
31
|
+
* `drag-handle`, `remove` and `breadcrumb-separator`. You mount it
|
|
32
|
+
* yourself, so pass the same object you gave the grid to keep them
|
|
33
|
+
* consistent.
|
|
34
|
+
*/
|
|
35
|
+
icons?: GridIcons
|
|
36
|
+
/**
|
|
37
|
+
* `'immediate'` (default) calls `onChange` on every edit. `'deferred'`
|
|
38
|
+
* collects edits in the panel and shows Apply / Cancel, so a server
|
|
39
|
+
* model reloads once per session of changes rather than once per chip.
|
|
40
|
+
*/
|
|
41
|
+
applyMode?: 'immediate' | 'deferred'
|
|
42
|
+
/**
|
|
43
|
+
* Strings, for localization. Partial; missing keys keep the English
|
|
44
|
+
* default. Pass the same map to `SvGroupCell`.
|
|
45
|
+
*/
|
|
46
|
+
messages?: Partial<ServerGroupMessages>
|
|
47
|
+
}
|
|
48
|
+
let {
|
|
49
|
+
columns,
|
|
50
|
+
groupBy,
|
|
51
|
+
onChange,
|
|
52
|
+
placeholder,
|
|
53
|
+
icons,
|
|
54
|
+
applyMode = 'immediate',
|
|
55
|
+
messages,
|
|
56
|
+
}: Props = $props()
|
|
57
|
+
const m = $derived(resolveServerGroupMessages(messages))
|
|
58
|
+
|
|
59
|
+
// Deferred mode edits a local copy; a `groupBy` that changes from outside
|
|
60
|
+
// wins over it (a change from elsewhere drops what was pending here). By
|
|
61
|
+
// value, not by identity: a server row model hands out a fresh array on
|
|
62
|
+
// every emit, and a block landing must not throw away un-applied chips.
|
|
63
|
+
let pending = $state<string[] | null>(null)
|
|
64
|
+
let seen = untrack(() => JSON.stringify(groupBy))
|
|
65
|
+
$effect(() => {
|
|
66
|
+
const now = JSON.stringify(groupBy)
|
|
67
|
+
if (now === seen) return
|
|
68
|
+
seen = now
|
|
69
|
+
pending = null
|
|
70
|
+
})
|
|
71
|
+
const shown = $derived(pending ?? groupBy)
|
|
72
|
+
const dirty = $derived(pending !== null && JSON.stringify(pending) !== JSON.stringify(groupBy))
|
|
73
|
+
function commit(next: string[]) {
|
|
74
|
+
if (applyMode === 'deferred') pending = next
|
|
75
|
+
else onChange(next)
|
|
76
|
+
}
|
|
77
|
+
function apply() {
|
|
78
|
+
if (!pending) return
|
|
79
|
+
const next = pending
|
|
80
|
+
pending = null
|
|
81
|
+
onChange(next)
|
|
82
|
+
}
|
|
83
|
+
function cancel() {
|
|
84
|
+
pending = null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const labelOf = (id: string) => columns.find((c) => c.id === id)?.label ?? id
|
|
88
|
+
const available = $derived(columns.filter((c) => !shown.includes(c.id)))
|
|
89
|
+
|
|
90
|
+
let dragIndex = $state<number | null>(null)
|
|
91
|
+
/** Where a dragged chip would land, for the insertion mark. */
|
|
92
|
+
let dropIndex = $state<number | null>(null)
|
|
93
|
+
/** What a keyboard reorder just did, for the live region. */
|
|
94
|
+
let announcement = $state('')
|
|
95
|
+
|
|
96
|
+
function remove(id: string) {
|
|
97
|
+
commit(shown.filter((g) => g !== id))
|
|
98
|
+
}
|
|
99
|
+
function add(id: string) {
|
|
100
|
+
if (id && !shown.includes(id)) commit([...shown, id])
|
|
101
|
+
}
|
|
102
|
+
function reorder(to: number) {
|
|
103
|
+
dropIndex = null
|
|
104
|
+
if (dragIndex === null || dragIndex === to) {
|
|
105
|
+
dragIndex = null
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
const next = [...shown]
|
|
109
|
+
const [moved] = next.splice(dragIndex, 1)
|
|
110
|
+
next.splice(to, 0, moved!)
|
|
111
|
+
dragIndex = null
|
|
112
|
+
commit(next)
|
|
113
|
+
}
|
|
114
|
+
function onPanelDrop(e: DragEvent) {
|
|
115
|
+
e.preventDefault()
|
|
116
|
+
const id = e.dataTransfer?.getData('text/sv-column')
|
|
117
|
+
if (id) add(id)
|
|
118
|
+
}
|
|
119
|
+
function onChipDragStart(e: DragEvent, i: number) {
|
|
120
|
+
dragIndex = i
|
|
121
|
+
// Firefox starts no drag without data on the transfer.
|
|
122
|
+
if (e.dataTransfer) {
|
|
123
|
+
e.dataTransfer.setData('text/plain', shown[i] ?? '')
|
|
124
|
+
e.dataTransfer.effectAllowed = 'move'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Keyboard equivalent of dragging a chip: moves the chip at `i` one slot earlier/later,
|
|
128
|
+
* reusing `reorder()` (via `dragIndex`) so there is a single source of truth for the move. */
|
|
129
|
+
function moveByKeyboard(i: number, delta: number) {
|
|
130
|
+
const to = i + delta
|
|
131
|
+
if (to < 0 || to >= shown.length) return
|
|
132
|
+
const id = shown[i]!
|
|
133
|
+
dragIndex = i
|
|
134
|
+
reorder(to)
|
|
135
|
+
announcement = fillMessage(m.movedTo, { label: labelOf(id), index: to + 1, total: shown.length })
|
|
136
|
+
}
|
|
137
|
+
function onChipKeydown(e: KeyboardEvent, i: number) {
|
|
138
|
+
if (!e.altKey) return
|
|
139
|
+
if (e.key === 'ArrowLeft') {
|
|
140
|
+
e.preventDefault()
|
|
141
|
+
moveByKeyboard(i, -1)
|
|
142
|
+
} else if (e.key === 'ArrowRight') {
|
|
143
|
+
e.preventDefault()
|
|
144
|
+
moveByKeyboard(i, 1)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<!-- Same override-or-default resolution SvGrid uses, kept local because this
|
|
150
|
+
component is mounted by the consumer and never sees the grid's snippet. -->
|
|
151
|
+
{#snippet ic(name: GridIconName)}
|
|
152
|
+
{@const override = icons?.[name]}
|
|
153
|
+
{#if override}{@render override()}{:else}{GRID_ICON_GLYPHS[name]}{/if}
|
|
154
|
+
{/snippet}
|
|
155
|
+
|
|
156
|
+
<div
|
|
157
|
+
class="sv-rowgroup-panel"
|
|
158
|
+
role="group"
|
|
159
|
+
aria-label={m.rowGroups}
|
|
160
|
+
ondragover={(e) => e.preventDefault()}
|
|
161
|
+
ondrop={onPanelDrop}
|
|
162
|
+
>
|
|
163
|
+
<span class="sv-rgp-label" aria-hidden="true">{m.groupBy}</span>
|
|
164
|
+
{#if shown.length === 0}
|
|
165
|
+
<span class="sv-rgp-empty">{placeholder ?? m.dropHere}</span>
|
|
166
|
+
{:else}
|
|
167
|
+
{#each shown as id, i (id)}
|
|
168
|
+
{#if i > 0}<span class="sv-rgp-sep" aria-hidden="true">{@render ic('breadcrumb-separator')}</span>{/if}
|
|
169
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_no_noninteractive_element_interactions -->
|
|
170
|
+
<span
|
|
171
|
+
class="sv-rgp-chip"
|
|
172
|
+
class:sv-rgp-chip-drag={dragIndex === i}
|
|
173
|
+
class:sv-rgp-chip-drop={dropIndex === i && dragIndex !== i}
|
|
174
|
+
role="group"
|
|
175
|
+
tabindex="0"
|
|
176
|
+
aria-label={fillMessage(m.groupedBy, { label: labelOf(id), index: i + 1, total: shown.length })}
|
|
177
|
+
draggable="true"
|
|
178
|
+
ondragstart={(e) => onChipDragStart(e, i)}
|
|
179
|
+
ondragend={() => {
|
|
180
|
+
dragIndex = null
|
|
181
|
+
dropIndex = null
|
|
182
|
+
}}
|
|
183
|
+
ondragover={(e) => {
|
|
184
|
+
e.preventDefault()
|
|
185
|
+
if (dragIndex !== null) dropIndex = i
|
|
186
|
+
}}
|
|
187
|
+
ondragleave={() => {
|
|
188
|
+
if (dropIndex === i) dropIndex = null
|
|
189
|
+
}}
|
|
190
|
+
ondrop={(e) => {
|
|
191
|
+
// Handled here: without preventDefault Firefox opens the dropped
|
|
192
|
+
// text as a URL.
|
|
193
|
+
e.preventDefault()
|
|
194
|
+
e.stopPropagation()
|
|
195
|
+
reorder(i)
|
|
196
|
+
}}
|
|
197
|
+
onkeydown={(e) => onChipKeydown(e, i)}
|
|
198
|
+
>
|
|
199
|
+
<span class="sv-rgp-grip" aria-hidden="true">{@render ic('drag-handle')}</span>
|
|
200
|
+
{labelOf(id)}
|
|
201
|
+
<button type="button" class="sv-rgp-x" onclick={() => remove(id)} aria-label={fillMessage(m.stopGroupingBy, { label: labelOf(id) })}>{@render ic('remove')}</button>
|
|
202
|
+
</span>
|
|
203
|
+
{/each}
|
|
204
|
+
{/if}
|
|
205
|
+
{#if available.length}
|
|
206
|
+
<select
|
|
207
|
+
class="sv-rgp-add"
|
|
208
|
+
aria-label={m.addGroupLabel}
|
|
209
|
+
onchange={(e) => { add(e.currentTarget.value); e.currentTarget.value = '' }}
|
|
210
|
+
>
|
|
211
|
+
<option value="">{m.addGroup}</option>
|
|
212
|
+
{#each available as c (c.id)}<option value={c.id}>{c.label}</option>{/each}
|
|
213
|
+
</select>
|
|
214
|
+
{/if}
|
|
215
|
+
{#if applyMode === 'deferred'}
|
|
216
|
+
<span class="sv-rgp-apply" role="group" aria-label={m.applyGrouping}>
|
|
217
|
+
<button type="button" class="sv-rgp-btn sv-rgp-btn-primary" disabled={!dirty} onclick={apply}>{m.apply}</button>
|
|
218
|
+
<button type="button" class="sv-rgp-btn" disabled={!dirty} onclick={cancel}>{m.cancel}</button>
|
|
219
|
+
</span>
|
|
220
|
+
{/if}
|
|
221
|
+
<span class="sv-rgp-live" aria-live="polite">{announcement}</span>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<style>
|
|
225
|
+
.sv-rowgroup-panel {
|
|
226
|
+
position: relative;
|
|
227
|
+
display: flex;
|
|
228
|
+
align-items: center;
|
|
229
|
+
flex-wrap: wrap;
|
|
230
|
+
gap: 6px;
|
|
231
|
+
padding: 8px 10px;
|
|
232
|
+
border: 1px dashed var(--sg-border, #cbd5e1);
|
|
233
|
+
border-radius: 10px;
|
|
234
|
+
background: var(--sg-header-bg, #f8fafc);
|
|
235
|
+
font-size: 13px;
|
|
236
|
+
}
|
|
237
|
+
.sv-rgp-label { color: var(--sg-muted, #64748b); font-weight: 600; }
|
|
238
|
+
.sv-rgp-empty { color: var(--sg-muted, #94a3b8); font-style: italic; }
|
|
239
|
+
.sv-rgp-sep { color: var(--sg-muted, #94a3b8); }
|
|
240
|
+
.sv-rgp-chip {
|
|
241
|
+
display: inline-flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
gap: 6px;
|
|
244
|
+
padding: 3px 6px 3px 8px;
|
|
245
|
+
border-radius: 999px;
|
|
246
|
+
background: var(--sg-bg, #fff);
|
|
247
|
+
border: 1px solid var(--sg-border, #e2e8f0);
|
|
248
|
+
cursor: grab;
|
|
249
|
+
user-select: none;
|
|
250
|
+
font-weight: 600;
|
|
251
|
+
}
|
|
252
|
+
.sv-rgp-chip-drag { opacity: 0.5; }
|
|
253
|
+
/* Where the dragged chip will land: an accent edge on the chip it displaces. */
|
|
254
|
+
.sv-rgp-chip-drop { box-shadow: -3px 0 0 0 var(--sg-accent, #2563eb); }
|
|
255
|
+
.sv-rgp-grip { color: var(--sg-muted, #94a3b8); cursor: grab; }
|
|
256
|
+
.sv-rgp-x {
|
|
257
|
+
display: inline-flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
justify-content: center;
|
|
260
|
+
width: 24px;
|
|
261
|
+
height: 24px;
|
|
262
|
+
margin: -4px -4px -4px 0;
|
|
263
|
+
border: 0;
|
|
264
|
+
border-radius: 50%;
|
|
265
|
+
background: none;
|
|
266
|
+
color: var(--sg-muted, #64748b);
|
|
267
|
+
cursor: pointer;
|
|
268
|
+
font-size: 14px;
|
|
269
|
+
line-height: 1;
|
|
270
|
+
}
|
|
271
|
+
.sv-rgp-x:hover { background: var(--sg-header-bg, #f1f5f9); color: var(--sg-fg, #0f172a); }
|
|
272
|
+
.sv-rgp-add {
|
|
273
|
+
font: inherit;
|
|
274
|
+
font-size: 13px;
|
|
275
|
+
padding: 4px 8px;
|
|
276
|
+
border-radius: 8px;
|
|
277
|
+
border: 1px solid var(--sg-border, #e2e8f0);
|
|
278
|
+
background: var(--sg-bg, #fff);
|
|
279
|
+
color: var(--sg-accent, #2563eb);
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
}
|
|
282
|
+
.sv-rgp-apply { display: inline-flex; gap: 6px; margin-left: auto; }
|
|
283
|
+
.sv-rgp-btn {
|
|
284
|
+
font: inherit;
|
|
285
|
+
font-size: 13px;
|
|
286
|
+
padding: 4px 10px;
|
|
287
|
+
border-radius: 8px;
|
|
288
|
+
border: 1px solid var(--sg-border, #e2e8f0);
|
|
289
|
+
background: var(--sg-bg, #fff);
|
|
290
|
+
color: var(--sg-fg, #0f172a);
|
|
291
|
+
cursor: pointer;
|
|
292
|
+
}
|
|
293
|
+
.sv-rgp-btn-primary {
|
|
294
|
+
background: var(--sg-accent, #2563eb);
|
|
295
|
+
border-color: var(--sg-accent, #2563eb);
|
|
296
|
+
color: var(--sg-on-accent, #fff);
|
|
297
|
+
}
|
|
298
|
+
.sv-rgp-btn:disabled { opacity: 0.5; cursor: default; }
|
|
299
|
+
/* Apply with nothing to apply reads as off, not as a paler Apply. */
|
|
300
|
+
.sv-rgp-btn-primary:disabled {
|
|
301
|
+
opacity: 1;
|
|
302
|
+
background: var(--sg-header-bg, #f1f5f9);
|
|
303
|
+
border-color: var(--sg-border, #e2e8f0);
|
|
304
|
+
color: var(--sg-muted, #64748b);
|
|
305
|
+
}
|
|
306
|
+
.sv-rgp-chip:focus-visible,
|
|
307
|
+
.sv-rgp-x:focus-visible,
|
|
308
|
+
.sv-rgp-add:focus-visible,
|
|
309
|
+
.sv-rgp-btn:focus-visible {
|
|
310
|
+
outline: 2px solid var(--sg-accent, #2563eb);
|
|
311
|
+
outline-offset: 2px;
|
|
312
|
+
}
|
|
313
|
+
/* The live region reads to a screen reader and takes no space. */
|
|
314
|
+
.sv-rgp-live {
|
|
315
|
+
position: absolute;
|
|
316
|
+
width: 1px;
|
|
317
|
+
height: 1px;
|
|
318
|
+
overflow: hidden;
|
|
319
|
+
clip: rect(0 0 0 0);
|
|
320
|
+
white-space: nowrap;
|
|
321
|
+
}
|
|
322
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type GridIcons } from '@svgrid/grid';
|
|
2
|
+
import { type ServerGroupMessages } from './messages.js';
|
|
3
|
+
type Col = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
/** Columns that can be grouped on. */
|
|
9
|
+
columns: Col[];
|
|
10
|
+
/** Current group-by column ids, outer to inner. */
|
|
11
|
+
groupBy: string[];
|
|
12
|
+
/** Called with the new group-by order. */
|
|
13
|
+
onChange: (groupBy: string[]) => void;
|
|
14
|
+
/** Text shown when nothing is grouped. Default: `messages.dropHere`. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Icon overrides, the same map `<SvGrid icons>` takes. This panel draws
|
|
18
|
+
* `drag-handle`, `remove` and `breadcrumb-separator`. You mount it
|
|
19
|
+
* yourself, so pass the same object you gave the grid to keep them
|
|
20
|
+
* consistent.
|
|
21
|
+
*/
|
|
22
|
+
icons?: GridIcons;
|
|
23
|
+
/**
|
|
24
|
+
* `'immediate'` (default) calls `onChange` on every edit. `'deferred'`
|
|
25
|
+
* collects edits in the panel and shows Apply / Cancel, so a server
|
|
26
|
+
* model reloads once per session of changes rather than once per chip.
|
|
27
|
+
*/
|
|
28
|
+
applyMode?: 'immediate' | 'deferred';
|
|
29
|
+
/**
|
|
30
|
+
* Strings, for localization. Partial; missing keys keep the English
|
|
31
|
+
* default. Pass the same map to `SvGroupCell`.
|
|
32
|
+
*/
|
|
33
|
+
messages?: Partial<ServerGroupMessages>;
|
|
34
|
+
};
|
|
35
|
+
declare const SvRowGroupPanel: import("svelte").Component<Props, {}, "">;
|
|
36
|
+
type SvRowGroupPanel = ReturnType<typeof SvRowGroupPanel>;
|
|
37
|
+
export default SvRowGroupPanel;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn on the Enterprise server-side row model. Idempotent. Also invoked by
|
|
3
|
+
* {@link installEnterprise}, so wiring the Pro API covers it.
|
|
4
|
+
*
|
|
5
|
+
* Calling it is optional: the model factories nudge on their own first call
|
|
6
|
+
* (see {@link nudgeServerRowModel}), so an app that only imports
|
|
7
|
+
* `createServerRowModel` is still gated.
|
|
8
|
+
*/
|
|
9
|
+
export declare function enableServerRowModel(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Raise the unlicensed nudge from a model factory. Shares the `enabled` latch with
|
|
12
|
+
* {@link enableServerRowModel} so an app that calls both (or constructs many
|
|
13
|
+
* models) still gets exactly one nudge.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function nudgeServerRowModel(): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Side Row Model (Pro). The free `@svgrid/grid` ships the datasource
|
|
3
|
+
* CONTRACT (`ServerDataSource`, `ServerRequest`, `ServerResult`) and the flat
|
|
4
|
+
* controller `createServerDataSource` - sort, filter, paging and CRUD against
|
|
5
|
+
* a server. Everything above flat rows lives here: lazy server-side grouping
|
|
6
|
+
* and tree data, aggregation rows, footers, and the group chrome.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the scheduler and board there is no renderer to register with the
|
|
9
|
+
* grid - the model hands the grid ordinary rows - so this module exists to
|
|
10
|
+
* give Enterprise one uniform `enableX()` entry point and to raise the
|
|
11
|
+
* unlicensed nudge at install time rather than at first expand.
|
|
12
|
+
*
|
|
13
|
+
* Like the rest of Enterprise it runs without a license key during the
|
|
14
|
+
* evaluation; the grid shows the watermark and a one-time console notice.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { setLicenseKey, createServerRowModel } from '@svgrid/enterprise'
|
|
18
|
+
* setLicenseKey('YOUR-KEY')
|
|
19
|
+
* const ctl = createServerRowModel(source, { groupBy: ['region'], onChange })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import { isLicenseKeySet } from '../license.js';
|
|
23
|
+
import { emitUnlicensedNudge } from '../watermark.js';
|
|
24
|
+
let enabled = false;
|
|
25
|
+
/**
|
|
26
|
+
* Turn on the Enterprise server-side row model. Idempotent. Also invoked by
|
|
27
|
+
* {@link installEnterprise}, so wiring the Pro API covers it.
|
|
28
|
+
*
|
|
29
|
+
* Calling it is optional: the model factories nudge on their own first call
|
|
30
|
+
* (see {@link nudgeServerRowModel}), so an app that only imports
|
|
31
|
+
* `createServerRowModel` is still gated.
|
|
32
|
+
*/
|
|
33
|
+
export function enableServerRowModel() {
|
|
34
|
+
if (enabled)
|
|
35
|
+
return;
|
|
36
|
+
enabled = true;
|
|
37
|
+
if (!isLicenseKeySet())
|
|
38
|
+
emitUnlicensedNudge();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Raise the unlicensed nudge from a model factory. Shares the `enabled` latch with
|
|
42
|
+
* {@link enableServerRowModel} so an app that calls both (or constructs many
|
|
43
|
+
* models) still gets exactly one nudge.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export function nudgeServerRowModel() {
|
|
48
|
+
enableServerRowModel();
|
|
49
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@svgrid/enterprise/server` - the Server-Side Row Model.
|
|
3
|
+
*
|
|
4
|
+
* The free grid owns the datasource contract and the flat controller
|
|
5
|
+
* (`createServerDataSource`: sort, filter, paging, CRUD). This entry point adds
|
|
6
|
+
* everything above flat rows: lazy server-side GROUPING and TREE data through
|
|
7
|
+
* the same one `getRows` call, per-group aggregation, subtotal footers,
|
|
8
|
+
* skeleton placeholders, intra-group paging, and the group chrome
|
|
9
|
+
* (`SvGroupCell`, `SvRowGroupPanel`).
|
|
10
|
+
*
|
|
11
|
+
* Importing from the package root works too; this subpath exists so an app
|
|
12
|
+
* that only wants the row model does not pull the whole Enterprise barrel.
|
|
13
|
+
*/
|
|
14
|
+
export { createServerRowModel, serverRowModelRows, serverRowModelNav, serverGroupText, GRAND_TOTAL_ROW_ID, GROUP_TOTAL_ROW_ID_PREFIX, type ServerRowModel, type ServerRowModelOptions, type ServerRowModelState, type ServerRowModelGridRow, type ServerRowModelDisplayRow, type ServerLevelParams, type ServerLevelState, type RefreshOptions, type ServerTransaction, type ServerTransactionResult, type ServerTransactionStatus, type ServerRowModelPaginationOptions, type ServerRowModelPagination, } from './server-row-model.js';
|
|
15
|
+
export { adaptCallbackDatasource, toCallbackDatasource, fromCallbackRequest, toCallbackRequest, fromCallbackFilterModel, toCallbackFilterModel, fromCallbackSelectionState, toCallbackSelectionState, isCallbackSelectionState, type CallbackSelectionState, type CallbackGroupSelectionState, type SelectionStateMapping, type CallbackServerRequest, type CallbackColumnFilter, type CallbackGetRowsParams, type CallbackDatasource, } from './svgrid-adapter.js';
|
|
16
|
+
export { createServerGroupModel, serverGroupRows, serverGroupNav, type ServerGroupController, type ServerGroupControllerOptions, type ServerGroupState, type ServerGroupGridRow, } from './server-group-model.js';
|
|
17
|
+
export { createServerSelectionModel, type ServerSelectionModel, type ServerSelectionModelOptions, type ServerSelectionState, type ServerGroupSelectionNode, type ServerSelectionGroupMode, } from './server-selection.js';
|
|
18
|
+
export { buildPivotResultColumns, type PivotResultColumnOptions, } from './server-pivot.js';
|
|
19
|
+
export { enableServerRowModel } from './enable.js';
|
|
20
|
+
export { defaultServerGroupMessages, resolveServerGroupMessages, type ServerGroupMessages, } from './messages.js';
|
|
21
|
+
export { default as SvGroupCell } from './SvGroupCell.svelte';
|
|
22
|
+
export { default as SvRowGroupPanel } from './SvRowGroupPanel.svelte';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@svgrid/enterprise/server` - the Server-Side Row Model.
|
|
3
|
+
*
|
|
4
|
+
* The free grid owns the datasource contract and the flat controller
|
|
5
|
+
* (`createServerDataSource`: sort, filter, paging, CRUD). This entry point adds
|
|
6
|
+
* everything above flat rows: lazy server-side GROUPING and TREE data through
|
|
7
|
+
* the same one `getRows` call, per-group aggregation, subtotal footers,
|
|
8
|
+
* skeleton placeholders, intra-group paging, and the group chrome
|
|
9
|
+
* (`SvGroupCell`, `SvRowGroupPanel`).
|
|
10
|
+
*
|
|
11
|
+
* Importing from the package root works too; this subpath exists so an app
|
|
12
|
+
* that only wants the row model does not pull the whole Enterprise barrel.
|
|
13
|
+
*/
|
|
14
|
+
export { createServerRowModel, serverRowModelRows, serverRowModelNav, serverGroupText, GRAND_TOTAL_ROW_ID, GROUP_TOTAL_ROW_ID_PREFIX, } from './server-row-model.js';
|
|
15
|
+
export { adaptCallbackDatasource, toCallbackDatasource, fromCallbackRequest, toCallbackRequest, fromCallbackFilterModel, toCallbackFilterModel, fromCallbackSelectionState, toCallbackSelectionState, isCallbackSelectionState, } from './svgrid-adapter.js';
|
|
16
|
+
// The previous model: block-append with a "Load N more" button. Still
|
|
17
|
+
// supported; `createServerRowModel` above is the one to reach for.
|
|
18
|
+
export { createServerGroupModel, serverGroupRows, serverGroupNav, } from './server-group-model.js';
|
|
19
|
+
export { createServerSelectionModel, } from './server-selection.js';
|
|
20
|
+
export { buildPivotResultColumns, } from './server-pivot.js';
|
|
21
|
+
export { enableServerRowModel } from './enable.js';
|
|
22
|
+
export { defaultServerGroupMessages, resolveServerGroupMessages, } from './messages.js';
|
|
23
|
+
export { default as SvGroupCell } from './SvGroupCell.svelte';
|
|
24
|
+
export { default as SvRowGroupPanel } from './SvRowGroupPanel.svelte';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every string the group chrome draws: `SvGroupCell`, `SvRowGroupPanel` and
|
|
3
|
+
* the text `serverGroupText` hands to copy, export and a pinned grand total.
|
|
4
|
+
* Both components are mounted by the app rather than by the grid, so they
|
|
5
|
+
* cannot read the grid's `localization.text`; pass the same partial map to
|
|
6
|
+
* each (and to `serverGroupText`) and every string follows.
|
|
7
|
+
*
|
|
8
|
+
* `{count}`, `{label}`, `{index}` and `{total}` are substituted where the
|
|
9
|
+
* default shows them.
|
|
10
|
+
*/
|
|
11
|
+
export type ServerGroupMessages = {
|
|
12
|
+
/** The "load more" row of a level that pages by click: `Load {count} more`. */
|
|
13
|
+
loadMore: string;
|
|
14
|
+
/** The same row while its block is in flight. */
|
|
15
|
+
loading: string;
|
|
16
|
+
/** The subtotal footer under an expanded group: `Total {label}`. */
|
|
17
|
+
total: string;
|
|
18
|
+
/** The grand-total row. */
|
|
19
|
+
grandTotal: string;
|
|
20
|
+
/** The accessible name of the row-group panel. */
|
|
21
|
+
rowGroups: string;
|
|
22
|
+
/** The panel's leading label. */
|
|
23
|
+
groupBy: string;
|
|
24
|
+
/** The panel's empty text. */
|
|
25
|
+
dropHere: string;
|
|
26
|
+
/** The first option of the add-a-column select. */
|
|
27
|
+
addGroup: string;
|
|
28
|
+
/** The accessible name of that select. */
|
|
29
|
+
addGroupLabel: string;
|
|
30
|
+
/** A chip's accessible name: `{label}`, `{index}`, `{total}`. */
|
|
31
|
+
groupedBy: string;
|
|
32
|
+
/** A chip's remove button: `{label}`. */
|
|
33
|
+
stopGroupingBy: string;
|
|
34
|
+
/** A live announcement after a keyboard reorder: `{label}`, `{index}`, `{total}`. */
|
|
35
|
+
movedTo: string;
|
|
36
|
+
/** The accessible name of the Apply / Cancel pair (deferred mode). */
|
|
37
|
+
applyGrouping: string;
|
|
38
|
+
apply: string;
|
|
39
|
+
cancel: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const defaultServerGroupMessages: ServerGroupMessages;
|
|
42
|
+
/** Merge a partial map over the English defaults; empty or missing keys keep the default. */
|
|
43
|
+
export declare function resolveServerGroupMessages(overrides?: Partial<ServerGroupMessages> | null): ServerGroupMessages;
|
|
44
|
+
/** Substitute `{name}` placeholders. Unknown placeholders are left as they are. */
|
|
45
|
+
export declare function fillMessage(template: string, values: Record<string, string | number>): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const defaultServerGroupMessages = {
|
|
2
|
+
loadMore: 'Load {count} more',
|
|
3
|
+
loading: 'Loading...',
|
|
4
|
+
total: 'Total {label}',
|
|
5
|
+
grandTotal: 'Grand total',
|
|
6
|
+
rowGroups: 'Row groups',
|
|
7
|
+
groupBy: 'Group by:',
|
|
8
|
+
dropHere: 'Drag a column here to group by it',
|
|
9
|
+
addGroup: '+ Group by',
|
|
10
|
+
addGroupLabel: 'Add a group column',
|
|
11
|
+
groupedBy: 'Grouped by {label}, position {index} of {total}. Press Alt+Arrow keys to reorder.',
|
|
12
|
+
stopGroupingBy: 'Stop grouping by {label}',
|
|
13
|
+
movedTo: '{label} moved to position {index} of {total}',
|
|
14
|
+
applyGrouping: 'Apply grouping',
|
|
15
|
+
apply: 'Apply',
|
|
16
|
+
cancel: 'Cancel',
|
|
17
|
+
};
|
|
18
|
+
/** Merge a partial map over the English defaults; empty or missing keys keep the default. */
|
|
19
|
+
export function resolveServerGroupMessages(overrides) {
|
|
20
|
+
// The same merge the grid's resolveMessages does, kept local: the unit
|
|
21
|
+
// test project must not pull the grid's root barrel into a server module.
|
|
22
|
+
if (!overrides)
|
|
23
|
+
return defaultServerGroupMessages;
|
|
24
|
+
const out = { ...defaultServerGroupMessages };
|
|
25
|
+
for (const k of Object.keys(overrides)) {
|
|
26
|
+
const v = overrides[k];
|
|
27
|
+
if (v != null && v !== '')
|
|
28
|
+
out[k] = v;
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/** Substitute `{name}` placeholders. Unknown placeholders are left as they are. */
|
|
33
|
+
export function fillMessage(template, values) {
|
|
34
|
+
return template.replace(/\{(\w+)\}/g, (m, key) => (key in values ? String(values[key]) : m));
|
|
35
|
+
}
|