@svgrid/enterprise 3.0.1 → 3.0.2

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.
Files changed (197) hide show
  1. package/dist/SvFormulaBar.svelte +606 -0
  2. package/dist/SvFormulaBar.svelte.d.ts +62 -0
  3. package/dist/SvPivotDesigner.svelte +65 -14
  4. package/dist/SvRibbonIcon.svelte +46 -0
  5. package/dist/SvRibbonIcon.svelte.d.ts +17 -0
  6. package/dist/SvSchemaChart.svelte +4 -2
  7. package/dist/SvSheet.svelte +4114 -0
  8. package/dist/SvSheet.svelte.d.ts +142 -0
  9. package/dist/SvSheetComment.svelte +98 -0
  10. package/dist/SvSheetComment.svelte.d.ts +22 -0
  11. package/dist/SvSheetConditionalFormat.svelte +162 -0
  12. package/dist/SvSheetConditionalFormat.svelte.d.ts +14 -0
  13. package/dist/SvSheetDataValidation.svelte +249 -0
  14. package/dist/SvSheetDataValidation.svelte.d.ts +14 -0
  15. package/dist/SvSheetFilterMenu.svelte +217 -0
  16. package/dist/SvSheetFilterMenu.svelte.d.ts +17 -0
  17. package/dist/SvSheetFindReplace.svelte +132 -0
  18. package/dist/SvSheetFindReplace.svelte.d.ts +10 -0
  19. package/dist/SvSheetFormatCells.svelte +421 -0
  20. package/dist/SvSheetFormatCells.svelte.d.ts +17 -0
  21. package/dist/SvSheetGoalSeek.svelte +144 -0
  22. package/dist/SvSheetGoalSeek.svelte.d.ts +12 -0
  23. package/dist/SvSheetInsertFunction.svelte +147 -0
  24. package/dist/SvSheetInsertFunction.svelte.d.ts +8 -0
  25. package/dist/SvSheetListPicker.svelte +89 -0
  26. package/dist/SvSheetListPicker.svelte.d.ts +16 -0
  27. package/dist/SvSheetManageRules.svelte +185 -0
  28. package/dist/SvSheetManageRules.svelte.d.ts +16 -0
  29. package/dist/SvSheetNameManager.svelte +225 -0
  30. package/dist/SvSheetNameManager.svelte.d.ts +11 -0
  31. package/dist/SvSheetPasteSpecial.svelte +105 -0
  32. package/dist/SvSheetPasteSpecial.svelte.d.ts +12 -0
  33. package/dist/SvSheetRemoveDuplicates.svelte +149 -0
  34. package/dist/SvSheetRemoveDuplicates.svelte.d.ts +12 -0
  35. package/dist/SvSheetRibbon.svelte +1201 -0
  36. package/dist/SvSheetRibbon.svelte.d.ts +34 -0
  37. package/dist/SvSheetSizeDialog.svelte +58 -0
  38. package/dist/SvSheetSizeDialog.svelte.d.ts +11 -0
  39. package/dist/SvSheetTabs.svelte +441 -0
  40. package/dist/SvSheetTabs.svelte.d.ts +36 -0
  41. package/dist/SvSheetTabs.test-harness.svelte.d.ts +17 -0
  42. package/dist/SvSheetTabs.test-harness.svelte.js +22 -0
  43. package/dist/SvSheetTextToColumns.svelte +172 -0
  44. package/dist/SvSheetTextToColumns.svelte.d.ts +13 -0
  45. package/dist/SvSheetValidationAlert.svelte +83 -0
  46. package/dist/SvSheetValidationAlert.svelte.d.ts +15 -0
  47. package/dist/cdn/svgrid-enterprise.svelte-external.js +18997 -5396
  48. package/dist/designer/assets/GridMenus-BlsvL_aU.js +8 -0
  49. package/dist/designer/assets/SvChartMenu-BYO9cYdy.css +1 -0
  50. package/dist/designer/assets/SvChartMenu-D9hEeHar.js +1 -0
  51. package/dist/designer/assets/SvDateRangeInput-BBRzrQeg.js +1 -0
  52. package/dist/designer/assets/SvDateTimePicker-DARvKUL2.js +1 -0
  53. package/dist/designer/assets/SvGridCellEditor-C7uQXYds.js +4 -0
  54. package/dist/designer/assets/SvGridChart-B8j1SSy3.js +3 -0
  55. package/dist/designer/assets/SvGridChart-BgLuPO7I.css +1 -0
  56. package/dist/designer/assets/SvGridChartBuilder-08YWWeqY.css +1 -0
  57. package/dist/designer/assets/SvGridChartBuilder-kvyIU_Rl.js +1 -0
  58. package/dist/designer/assets/SvGridChartPanel-4Pc8y5yO.css +1 -0
  59. package/dist/designer/assets/SvGridChartPanel-pT6ITc2P.js +4 -0
  60. package/dist/designer/assets/{SvGridChartView-DUc-1RUf.css → SvGridChartView-7msfnWZT.css} +1 -1
  61. package/dist/designer/assets/SvGridChartView-bg281UA1.js +1 -0
  62. package/dist/designer/assets/SvListBox-BDS66lmZ.js +110 -0
  63. package/dist/designer/assets/SvMenuList-DJ47ba1h.css +1 -0
  64. package/dist/designer/assets/SvMenuList-Dgq2D5VN.js +1 -0
  65. package/dist/designer/assets/SvTabs-DKmwb5p1.css +1 -0
  66. package/dist/designer/assets/SvTabs-UFCMTHXS.js +1 -0
  67. package/dist/designer/assets/chart-cIPUsbM5.js +1 -0
  68. package/dist/designer/assets/chart-export-B6bkQ3X8.js +11 -0
  69. package/dist/designer/assets/chart-export-pdf-BbA28-gt.js +11 -0
  70. package/dist/designer/assets/chart-panel-messages-DtTxpBUU.js +1 -0
  71. package/dist/designer/assets/chart-summary-Czu_5epb.js +1 -0
  72. package/dist/designer/assets/chart-trend-D5I5VEe8.js +1 -0
  73. package/dist/designer/assets/chart-validate-BMqM-qkF.js +1 -0
  74. package/dist/designer/assets/column-resize-BYDzR1Ve.js +1 -0
  75. package/dist/designer/assets/date-format-B8JbEtIG.js +1 -0
  76. package/dist/designer/assets/date-format-DKS-z0xS.css +1 -0
  77. package/dist/designer/assets/editor-contract-Bpoa7A5g.js +1 -0
  78. package/dist/designer/assets/focus-trap-CAreAhlU.js +1 -0
  79. package/dist/designer/assets/index-CMFgAoVV.css +1 -0
  80. package/dist/designer/assets/{index-C_a9Cj8Y.js → index-DwU7CAMm.js} +291 -290
  81. package/dist/designer/assets/list-option-BP_dWS66.js +1 -0
  82. package/dist/designer/assets/row-resize-DLktcqUK.js +1 -0
  83. package/dist/designer/assets/src-CITpcm6b.js +1 -0
  84. package/dist/designer/assets/src-EdI3Xqds.js +58 -0
  85. package/dist/designer/index.html +23 -14
  86. package/dist/export-pdf.d.ts +89 -0
  87. package/dist/export-pdf.js +130 -0
  88. package/dist/export.js +17 -10
  89. package/dist/index.d.ts +64 -1
  90. package/dist/index.js +68 -1
  91. package/dist/install.js +5 -0
  92. package/dist/node/studio.js +64 -2
  93. package/dist/pivot-chart.d.ts +25 -1
  94. package/dist/pivot-chart.js +25 -69
  95. package/dist/sheet/address.d.ts +43 -0
  96. package/dist/sheet/address.js +81 -0
  97. package/dist/sheet/ast.d.ts +94 -0
  98. package/dist/sheet/ast.js +56 -0
  99. package/dist/sheet/auto-filter.d.ts +66 -0
  100. package/dist/sheet/auto-filter.js +147 -0
  101. package/dist/sheet/autocomplete.d.ts +42 -0
  102. package/dist/sheet/autocomplete.js +162 -0
  103. package/dist/sheet/coerce.d.ts +31 -0
  104. package/dist/sheet/coerce.js +122 -0
  105. package/dist/sheet/commands.d.ts +89 -0
  106. package/dist/sheet/commands.js +230 -0
  107. package/dist/sheet/comments.d.ts +29 -0
  108. package/dist/sheet/comments.js +73 -0
  109. package/dist/sheet/conditional-formats.d.ts +144 -0
  110. package/dist/sheet/conditional-formats.js +316 -0
  111. package/dist/sheet/deps.d.ts +60 -0
  112. package/dist/sheet/deps.js +199 -0
  113. package/dist/sheet/document.d.ts +150 -0
  114. package/dist/sheet/document.js +264 -0
  115. package/dist/sheet/edit-keys.d.ts +14 -0
  116. package/dist/sheet/edit-keys.js +40 -0
  117. package/dist/sheet/entry.d.ts +31 -0
  118. package/dist/sheet/entry.js +76 -0
  119. package/dist/sheet/evaluate.d.ts +61 -0
  120. package/dist/sheet/evaluate.js +337 -0
  121. package/dist/sheet/find-replace.d.ts +62 -0
  122. package/dist/sheet/find-replace.js +152 -0
  123. package/dist/sheet/format-store.d.ts +99 -0
  124. package/dist/sheet/format-store.js +233 -0
  125. package/dist/sheet/freeze.d.ts +54 -0
  126. package/dist/sheet/freeze.js +58 -0
  127. package/dist/sheet/function-catalog.d.ts +10 -0
  128. package/dist/sheet/function-catalog.js +94 -0
  129. package/dist/sheet/functions.d.ts +28 -0
  130. package/dist/sheet/functions.js +362 -0
  131. package/dist/sheet/goal-seek.d.ts +73 -0
  132. package/dist/sheet/goal-seek.js +153 -0
  133. package/dist/sheet/index.d.ts +53 -0
  134. package/dist/sheet/index.js +53 -0
  135. package/dist/sheet/merges.d.ts +71 -0
  136. package/dist/sheet/merges.js +137 -0
  137. package/dist/sheet/names.d.ts +31 -0
  138. package/dist/sheet/names.js +87 -0
  139. package/dist/sheet/navigate.d.ts +52 -0
  140. package/dist/sheet/navigate.js +135 -0
  141. package/dist/sheet/number-format.d.ts +63 -0
  142. package/dist/sheet/number-format.js +508 -0
  143. package/dist/sheet/palette.d.ts +19 -0
  144. package/dist/sheet/palette.js +84 -0
  145. package/dist/sheet/parse.d.ts +13 -0
  146. package/dist/sheet/parse.js +108 -0
  147. package/dist/sheet/paste-special.d.ts +164 -0
  148. package/dist/sheet/paste-special.js +592 -0
  149. package/dist/sheet/protection.d.ts +21 -0
  150. package/dist/sheet/protection.js +48 -0
  151. package/dist/sheet/rects.d.ts +45 -0
  152. package/dist/sheet/rects.js +112 -0
  153. package/dist/sheet/refs.d.ts +82 -0
  154. package/dist/sheet/refs.js +266 -0
  155. package/dist/sheet/ribbon-icons.d.ts +31 -0
  156. package/dist/sheet/ribbon-icons.js +350 -0
  157. package/dist/sheet/ribbon.d.ts +173 -0
  158. package/dist/sheet/ribbon.js +753 -0
  159. package/dist/sheet/shortcuts.d.ts +164 -0
  160. package/dist/sheet/shortcuts.js +623 -0
  161. package/dist/sheet/structure.d.ts +87 -0
  162. package/dist/sheet/structure.js +166 -0
  163. package/dist/sheet/tables.d.ts +70 -0
  164. package/dist/sheet/tables.js +147 -0
  165. package/dist/sheet/tokenize.d.ts +54 -0
  166. package/dist/sheet/tokenize.js +304 -0
  167. package/dist/sheet/transforms.d.ts +76 -0
  168. package/dist/sheet/transforms.js +154 -0
  169. package/dist/sheet/validation.d.ts +92 -0
  170. package/dist/sheet/validation.js +241 -0
  171. package/dist/sheet/workbook.d.ts +72 -0
  172. package/dist/sheet/workbook.js +409 -0
  173. package/dist/sheet-enable.d.ts +6 -0
  174. package/dist/sheet-enable.js +46 -0
  175. package/dist/studio/ui-components.generated.js +63 -1
  176. package/dist/version.d.ts +1 -1
  177. package/dist/version.js +1 -1
  178. package/package.json +9 -4
  179. package/dist/designer/assets/GridMenus-B1JtIN21.js +0 -8
  180. package/dist/designer/assets/SvDateRangeInput-CjO7nn_x.js +0 -1
  181. package/dist/designer/assets/SvDateTimePicker-ByBD_ov6.js +0 -1
  182. package/dist/designer/assets/SvField-YDLipR6O.css +0 -1
  183. package/dist/designer/assets/SvField-cj1PFNgZ.js +0 -1
  184. package/dist/designer/assets/SvGridCellEditor-0W1L2hJ1.js +0 -2
  185. package/dist/designer/assets/SvGridChart-DBOR4xcz.js +0 -2
  186. package/dist/designer/assets/SvGridChart-fkMWeh1J.css +0 -1
  187. package/dist/designer/assets/SvGridChartPanel-symrhNnR.js +0 -11
  188. package/dist/designer/assets/SvGridChartView-BmRxq6mU.js +0 -1
  189. package/dist/designer/assets/SvListBox-1oUF6Iav.js +0 -110
  190. package/dist/designer/assets/chart-DXFganU8.js +0 -1
  191. package/dist/designer/assets/column-resize-C_inr5zT.js +0 -1
  192. package/dist/designer/assets/date-format-DGagAqRc.css +0 -1
  193. package/dist/designer/assets/date-format-onlYDsrY.js +0 -1
  194. package/dist/designer/assets/easing-zaypKrr0.js +0 -3
  195. package/dist/designer/assets/index-k2stW6L8.css +0 -1
  196. package/dist/designer/assets/row-resize-B0FWHcNr.js +0 -1
  197. package/dist/designer/assets/src-D9p27OGC.js +0 -58
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { setLicenseKey, clearLicenseKey, getLicenseKey, isLicenseKeySet, hasVali
2
2
  export { parseLicenseExpiry } from './license-core.js';
3
3
  export { exportGrid, copyExportToClipboard, type ExportFormat, type ExportOptions, type ExportColumn, type ExportCellStyle, type ExportStyles, type ExportHeaderFooterLine, type ExportSheet, type ExportRowSource, type ExportProgress, type ExportResult, type ClipboardFormat, type ClipboardExportOptions, } from './export.js';
4
4
  export { default as SvExportMenu } from './SvExportMenu.svelte';
5
- export { buildPdfDocDefinition, type PdfExportOptions, type PdfPageSize } from './export-pdf.js';
5
+ export { buildPdfDocDefinition, resolvePdfCharts, resolvePdfVfs, registerPdfFonts, type PdfExportOptions, type PdfPageSize, type PdfChart, type PdfKpi, type PdfChartImage, type PdfVirtualFileSystem, type PdfMakeLike } from './export-pdf.js';
6
6
  export { printGrid, type PrintOptions } from './print.js';
7
7
  export { importData, readImportMatrix, mapImportMatrix, mapImportMatrixAsync, autoMapColumns, inferImportColumnTypes, type ImportFormat, type ImportFieldType, type ImportOptions, type ImportResult, type ImportProgress, type ImportColumnMap, type ImportColumnTypes, type ImportGridColumn, type ImportRowError, type ImportValidator, } from './import.js';
8
8
  export { default as SvImportDialog } from './SvImportDialog.svelte';
@@ -13,6 +13,69 @@ export { enableSelectionBar, SvGridSelectionBar } from './selection-bar.js';
13
13
  export { applyBulkEdit, bulkEditableFields, bulkEditInitialValues, coerceBulkValue, type BulkEditField, type BulkEditResult } from './bulk-edit.js';
14
14
  export { default as SvGridBulkEditDrawer } from './SvGridBulkEditDrawer.svelte';
15
15
  export { enablePivot } from './pivot-enable.js';
16
+ export { enableSheet } from './sheet-enable.js';
17
+ export { createTableRegistry, isValidTableName, resolveTableRange, columnIndexOf, rowCountOf, type TableRegion, type TableRegistry, type TableRange, type TableSpecifier, } from './sheet/tables.js';
18
+ export { goalSeek, goalSeekCell, type GoalSeekOptions, type GoalSeekResult, type GoalSeekSheet, type CellAddress as GoalSeekCellAddress, } from './sheet/goal-seek.js';
19
+ export { default as SvSheetTabs } from './SvSheetTabs.svelte';
20
+ export { createWorkbook, isValidSheetName, type Workbook, type SheetData, type WorkbookOptions, } from './sheet/workbook.js';
21
+ export { setWorkbook, getWorkbook } from './sheet/shortcuts.js';
22
+ export { createSheetDocument, type SheetDocument, type SheetDocumentInit, type SheetState, type SheetStateEntry, type PerSheetState, type SheetChangeReason, } from './sheet/document.js';
23
+ export { shiftRect, shiftRects, subtractRect, rectContains, rectsIntersect, remapNotes, lineShift, type NotesMap } from './sheet/rects.js';
24
+ export { isLocked, rectsHaveLocked, rectsMixLocked, PROTECTED_MESSAGE } from './sheet/protection.js';
25
+ export { commentAt, withComment, listComments, nextComment } from './sheet/comments.js';
26
+ export { ruleAt, rulesIn, checkEntry, listChoices, shiftValidation, removeValidation, describeRule, dateValue, validationId, DEFAULT_ALERT_MESSAGE, OPERATOR_LABELS, type ValidationRule, type ValidationAllow, type ValidationOperator, type ValidationContext, type ValidationVerdict, type ValidationSpec, } from './sheet/validation.js';
27
+ export { ruleStats, evaluateCf, shiftCf, removeCf, cfIn, describeCf, scaleColor, iconIndex, hasStyle, cfId, CF_PRESET_STYLES, COLOR_SCALES, DATA_BAR_COLOR, type CfRule, type CfRuleBody, type CfStyledRule, type CfBody, type CfPreset, type CfStyle, type CfStats, type CfResult, type CfContext, type CfOperator, type CfTextMatch, type CfIconSet, type CfScaleColors, type CfKind, } from './sheet/conditional-formats.js';
28
+ export { mergePlan, unmergePlan, mergeDropsValues, mergesIn, mergeAt as sheetMergeAt, isCoveredCell, selectionMerged, toGridMerges, sortBlockedByMerges, reorderMerges, normalRect, type MergeKind, type MergePlan, } from './sheet/merges.js';
29
+ export { distinctValues, hiddenRowsFor, passesFilter, isFiltering, withColumnFilter, valuesFilter, shiftAutoFilter, describeFilter, type AutoFilterState, type ColumnFilter, type FilterCondition, type FilterValue, } from './sheet/auto-filter.js';
30
+ export { splitText, textToColumns, guessDelimiter, findDuplicates, removeDuplicates, type SplitOptions, type DuplicateOptions, type DuplicateReport, } from './sheet/transforms.js';
31
+ export { insertRows, deleteRows, insertColumns, deleteColumns, axisForSelection, setStructureTarget, getStructureTarget, rewriteFormulas, type StructureTarget, } from './sheet/structure.js';
32
+ export { findAll, findNext, replaceOne, replaceAll, replaceInText, cellMatches, setFindTarget, getFindTarget, type FindOptions, type FindHit, type FindTarget, } from './sheet/find-replace.js';
33
+ export { splitFrozenRows, frozenColumnIds, applyFreeze, freezeAtActiveCell, freezeTopRow, freezeFirstColumn, unfreeze, type FreezeState, type FreezeSplit, } from './sheet/freeze.js';
34
+ export { buildClipboardPayload, parseClipboard, parseClipboardText, parseClipboardHtml, readClipboardOrigin, anchorForeignFormulas, resolvePasteCell, planPaste, msoNumberFormat, numFmtFromMso, isR1C1, r1c1ToA1, type PasteSpecialOptions, type PasteWhat, type PasteOperation, type ClipboardCell, type ClipboardGrid, type PasteResolution, } from './sheet/paste-special.js';
35
+ export { setFindReplaceHandler, setPasteSpecialHandler, setRibbonActionHandler, nudgeFontSize, type RibbonKeyAction } from './sheet/shortcuts.js';
36
+ export { default as SvFormulaBar } from './SvFormulaBar.svelte';
37
+ export { default as SvSheet } from './SvSheet.svelte';
38
+ export { default as SvSheetRibbon } from './SvSheetRibbon.svelte';
39
+ export { default as SvSheetFindReplace } from './SvSheetFindReplace.svelte';
40
+ export { default as SvSheetPasteSpecial } from './SvSheetPasteSpecial.svelte';
41
+ export { default as SvSheetFormatCells } from './SvSheetFormatCells.svelte';
42
+ export { default as SvSheetInsertFunction } from './SvSheetInsertFunction.svelte';
43
+ export { default as SvSheetSizeDialog } from './SvSheetSizeDialog.svelte';
44
+ export { default as SvSheetComment } from './SvSheetComment.svelte';
45
+ export { default as SvSheetDataValidation } from './SvSheetDataValidation.svelte';
46
+ export { default as SvSheetValidationAlert } from './SvSheetValidationAlert.svelte';
47
+ export { default as SvSheetListPicker } from './SvSheetListPicker.svelte';
48
+ export { default as SvSheetConditionalFormat } from './SvSheetConditionalFormat.svelte';
49
+ export { default as SvSheetManageRules } from './SvSheetManageRules.svelte';
50
+ export { default as SvSheetFilterMenu } from './SvSheetFilterMenu.svelte';
51
+ export { default as SvSheetNameManager } from './SvSheetNameManager.svelte';
52
+ export { default as SvSheetGoalSeek } from './SvSheetGoalSeek.svelte';
53
+ export { default as SvSheetTextToColumns } from './SvSheetTextToColumns.svelte';
54
+ export { default as SvSheetRemoveDuplicates } from './SvSheetRemoveDuplicates.svelte';
55
+ export { functionCatalog, FUNCTION_GROUPS, type FunctionInfo, type FunctionGroup } from './sheet/function-catalog.js';
56
+ export { parseEntry, completeEntry, type ParsedEntry } from './sheet/entry.js';
57
+ export { cycleReference, type TextEdit } from './sheet/edit-keys.js';
58
+ export { RIBBON_TABS, ribbonItems, withDecimals, applyBorders, type RibbonTab, type RibbonGroup, type RibbonItem, type RibbonOption, type RibbonItemKind, type RibbonActionId, type BorderPreset, } from './sheet/ribbon.js';
59
+ export { RIBBON_ICONS, RIBBON_ICON_NAMES, type RibbonIconName, type IconPath } from './sheet/ribbon-icons.js';
60
+ export { THEME_COLOURS, STANDARD_COLOURS, ALL_COLOURS, tint, type PaletteColour } from './sheet/palette.js';
61
+ export { default as SvRibbonIcon } from './SvRibbonIcon.svelte';
62
+ export { move, selectRegion, selectLine, applyFormat, toggleFormat, preset, autoSum, structural, switchSheet, gridOf, } from './sheet/shortcuts.js';
63
+ export { compileNumberFormat, formatWithPattern, FORMAT_PRESETS, type CompiledFormat, type FormatPresetName, } from './sheet/number-format.js';
64
+ export { createFormatStore, entryToStyle, borderShadows, type SheetFormatStore, type CellFormatEntry, type CellAddressLookup, } from './sheet/format-store.js';
65
+ export { createNames, isValidName, type SheetNames, type DefinedName, } from './sheet/names.js';
66
+ export { suggestFunctions, applySuggestion, signatureAt, partialAt, SIGNATURES, type FunctionSuggestion, } from './sheet/autocomplete.js';
67
+ export { setFormatTarget, getFormatTarget, setFormatDialogHandler, type SheetFormatTarget, } from './sheet/shortcuts.js';
68
+ export { parseFormula, parse as parseFormulaTokens } from './sheet/parse.js';
69
+ export { tokenize as tokenizeFormula, type Token as FormulaToken } from './sheet/tokenize.js';
70
+ export { evaluate as evaluateFormula, formatValue as formatCellValue, type EvalContext as SheetEvalContext, } from './sheet/evaluate.js';
71
+ export { FUNCTIONS as SHEET_FUNCTIONS, withCustomFunctions, type SheetFunction, type FnArgs as SheetFnArgs, } from './sheet/functions.js';
72
+ export { translateFormula, fixupReferences, renameSheetReferences, formatFormula, referenceSpans, REFERENCE_COLOURS, type StructuralEdit, type EditScope, type ReferenceSpan, } from './sheet/refs.js';
73
+ export { createDependencyGraph as createSheetDependencyGraph, precedentsOf, cellKey, parseCellKey, type DependencyGraph as SheetDependencyGraph, type CellKey, } from './sheet/deps.js';
74
+ export { parseA1, formatA1, colToLetters, lettersToCol, type CellRef, } from './sheet/address.js';
75
+ export { isError as isFormulaError, type CellValue as SheetCellValue, type SheetError, type Node as FormulaNode, } from './sheet/ast.js';
76
+ export { SHEET_BINDINGS, handleSheetKey, type SheetBinding, type SheetCommand, } from './sheet/shortcuts.js';
77
+ export { edgeOfRegion, currentRegion, isBlankValue, type Direction as SheetDirection, } from './sheet/navigate.js';
78
+ export { fillDown, fillRight, fillSelection, stampDate, stampNow, copyFromAbove, copyValueFromAbove, guessSumRange, looksNumeric, setFillTranslator, type FillTranslator, } from './sheet/commands.js';
16
79
  export { enableAdvancedFilter } from './advanced-filter-enable.js';
17
80
  export { default as SvAdvancedFilter } from './SvAdvancedFilter.svelte';
18
81
  export { exprColumnsFromGrid, type ExprColumnsOptions, } from './advanced-filter/expr-columns-from-grid.js';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ isLicenseExpired, getLicenseExpiry, } from './license.js';
5
5
  export { parseLicenseExpiry } from './license-core.js';
6
6
  export { exportGrid, copyExportToClipboard, } from './export.js';
7
7
  export { default as SvExportMenu } from './SvExportMenu.svelte';
8
- export { buildPdfDocDefinition } from './export-pdf.js';
8
+ export { buildPdfDocDefinition, resolvePdfCharts, resolvePdfVfs, registerPdfFonts } from './export-pdf.js';
9
9
  export { printGrid } from './print.js';
10
10
  export { importData, readImportMatrix, mapImportMatrix, mapImportMatrixAsync, autoMapColumns, inferImportColumnTypes, } from './import.js';
11
11
  export { default as SvImportDialog } from './SvImportDialog.svelte';
@@ -28,6 +28,73 @@ export { default as SvGridBulkEditDrawer } from './SvGridBulkEditDrawer.svelte';
28
28
  // In-grid pivot mode (Pro). `enablePivot()` registers the pivot engine so
29
29
  // `<SvGrid pivot={...}>` renders a pivot table in place of the flat table.
30
30
  export { enablePivot } from './pivot-enable.js';
31
+ export { enableSheet } from './sheet-enable.js';
32
+ export { createTableRegistry, isValidTableName, resolveTableRange, columnIndexOf, rowCountOf, } from './sheet/tables.js';
33
+ export { goalSeek, goalSeekCell, } from './sheet/goal-seek.js';
34
+ export { default as SvSheetTabs } from './SvSheetTabs.svelte';
35
+ export { createWorkbook, isValidSheetName, } from './sheet/workbook.js';
36
+ export { setWorkbook, getWorkbook } from './sheet/shortcuts.js';
37
+ export { createSheetDocument, } from './sheet/document.js';
38
+ export { shiftRect, shiftRects, subtractRect, rectContains, rectsIntersect, remapNotes, lineShift } from './sheet/rects.js';
39
+ export { isLocked, rectsHaveLocked, rectsMixLocked, PROTECTED_MESSAGE } from './sheet/protection.js';
40
+ export { commentAt, withComment, listComments, nextComment } from './sheet/comments.js';
41
+ export { ruleAt, rulesIn, checkEntry, listChoices, shiftValidation, removeValidation, describeRule, dateValue, validationId, DEFAULT_ALERT_MESSAGE, OPERATOR_LABELS, } from './sheet/validation.js';
42
+ export { ruleStats, evaluateCf, shiftCf, removeCf, cfIn, describeCf, scaleColor, iconIndex, hasStyle, cfId, CF_PRESET_STYLES, COLOR_SCALES, DATA_BAR_COLOR, } from './sheet/conditional-formats.js';
43
+ export { mergePlan, unmergePlan, mergeDropsValues, mergesIn, mergeAt as sheetMergeAt, isCoveredCell, selectionMerged, toGridMerges, sortBlockedByMerges, reorderMerges, normalRect, } from './sheet/merges.js';
44
+ export { distinctValues, hiddenRowsFor, passesFilter, isFiltering, withColumnFilter, valuesFilter, shiftAutoFilter, describeFilter, } from './sheet/auto-filter.js';
45
+ export { splitText, textToColumns, guessDelimiter, findDuplicates, removeDuplicates, } from './sheet/transforms.js';
46
+ export { insertRows, deleteRows, insertColumns, deleteColumns, axisForSelection, setStructureTarget, getStructureTarget, rewriteFormulas, } from './sheet/structure.js';
47
+ export { findAll, findNext, replaceOne, replaceAll, replaceInText, cellMatches, setFindTarget, getFindTarget, } from './sheet/find-replace.js';
48
+ export { splitFrozenRows, frozenColumnIds, applyFreeze, freezeAtActiveCell, freezeTopRow, freezeFirstColumn, unfreeze, } from './sheet/freeze.js';
49
+ export { buildClipboardPayload, parseClipboard, parseClipboardText, parseClipboardHtml, readClipboardOrigin, anchorForeignFormulas, resolvePasteCell, planPaste, msoNumberFormat, numFmtFromMso, isR1C1, r1c1ToA1, } from './sheet/paste-special.js';
50
+ export { setFindReplaceHandler, setPasteSpecialHandler, setRibbonActionHandler, nudgeFontSize } from './sheet/shortcuts.js';
51
+ export { default as SvFormulaBar } from './SvFormulaBar.svelte';
52
+ export { default as SvSheet } from './SvSheet.svelte';
53
+ export { default as SvSheetRibbon } from './SvSheetRibbon.svelte';
54
+ export { default as SvSheetFindReplace } from './SvSheetFindReplace.svelte';
55
+ export { default as SvSheetPasteSpecial } from './SvSheetPasteSpecial.svelte';
56
+ export { default as SvSheetFormatCells } from './SvSheetFormatCells.svelte';
57
+ export { default as SvSheetInsertFunction } from './SvSheetInsertFunction.svelte';
58
+ export { default as SvSheetSizeDialog } from './SvSheetSizeDialog.svelte';
59
+ export { default as SvSheetComment } from './SvSheetComment.svelte';
60
+ export { default as SvSheetDataValidation } from './SvSheetDataValidation.svelte';
61
+ export { default as SvSheetValidationAlert } from './SvSheetValidationAlert.svelte';
62
+ export { default as SvSheetListPicker } from './SvSheetListPicker.svelte';
63
+ export { default as SvSheetConditionalFormat } from './SvSheetConditionalFormat.svelte';
64
+ export { default as SvSheetManageRules } from './SvSheetManageRules.svelte';
65
+ export { default as SvSheetFilterMenu } from './SvSheetFilterMenu.svelte';
66
+ export { default as SvSheetNameManager } from './SvSheetNameManager.svelte';
67
+ export { default as SvSheetGoalSeek } from './SvSheetGoalSeek.svelte';
68
+ export { default as SvSheetTextToColumns } from './SvSheetTextToColumns.svelte';
69
+ export { default as SvSheetRemoveDuplicates } from './SvSheetRemoveDuplicates.svelte';
70
+ export { functionCatalog, FUNCTION_GROUPS } from './sheet/function-catalog.js';
71
+ export { parseEntry, completeEntry } from './sheet/entry.js';
72
+ export { cycleReference } from './sheet/edit-keys.js';
73
+ export { RIBBON_TABS, ribbonItems, withDecimals, applyBorders, } from './sheet/ribbon.js';
74
+ export { RIBBON_ICONS, RIBBON_ICON_NAMES } from './sheet/ribbon-icons.js';
75
+ export { THEME_COLOURS, STANDARD_COLOURS, ALL_COLOURS, tint } from './sheet/palette.js';
76
+ export { default as SvRibbonIcon } from './SvRibbonIcon.svelte';
77
+ export { move, selectRegion, selectLine, applyFormat, toggleFormat, preset, autoSum, structural, switchSheet, gridOf, } from './sheet/shortcuts.js';
78
+ export { compileNumberFormat, formatWithPattern, FORMAT_PRESETS, } from './sheet/number-format.js';
79
+ export { createFormatStore, entryToStyle, borderShadows, } from './sheet/format-store.js';
80
+ export { createNames, isValidName, } from './sheet/names.js';
81
+ export { suggestFunctions, applySuggestion, signatureAt, partialAt, SIGNATURES, } from './sheet/autocomplete.js';
82
+ export { setFormatTarget, getFormatTarget, setFormatDialogHandler, } from './sheet/shortcuts.js';
83
+ // The formula engine. Names are Sheet-prefixed HERE because the barrel already
84
+ // exports a `DependencyGraph` (scheduler) and an `EvalContext` (the expression
85
+ // language), and two different things under one name in one namespace is worse
86
+ // than a prefix. The `@svgrid/enterprise/sheet` subpath exports them unprefixed.
87
+ export { parseFormula, parse as parseFormulaTokens } from './sheet/parse.js';
88
+ export { tokenize as tokenizeFormula } from './sheet/tokenize.js';
89
+ export { evaluate as evaluateFormula, formatValue as formatCellValue, } from './sheet/evaluate.js';
90
+ export { FUNCTIONS as SHEET_FUNCTIONS, withCustomFunctions, } from './sheet/functions.js';
91
+ export { translateFormula, fixupReferences, renameSheetReferences, formatFormula, referenceSpans, REFERENCE_COLOURS, } from './sheet/refs.js';
92
+ export { createDependencyGraph as createSheetDependencyGraph, precedentsOf, cellKey, parseCellKey, } from './sheet/deps.js';
93
+ export { parseA1, formatA1, colToLetters, lettersToCol, } from './sheet/address.js';
94
+ export { isError as isFormulaError, } from './sheet/ast.js';
95
+ export { SHEET_BINDINGS, handleSheetKey, } from './sheet/shortcuts.js';
96
+ export { edgeOfRegion, currentRegion, isBlankValue, } from './sheet/navigate.js';
97
+ export { fillDown, fillRight, fillSelection, stampDate, stampNow, copyFromAbove, copyValueFromAbove, guessSumRange, looksNumeric, setFillTranslator, } from './sheet/commands.js';
31
98
  export { enableAdvancedFilter } from './advanced-filter-enable.js';
32
99
  export { default as SvAdvancedFilter } from './SvAdvancedFilter.svelte';
33
100
  export { exprColumnsFromGrid, } from './advanced-filter/expr-columns-from-grid.js';
package/dist/install.js CHANGED
@@ -12,6 +12,7 @@ import { enableBoardView } from './board.js';
12
12
  import { enableSelectionBar } from './selection-bar.js';
13
13
  import { enableAdvancedFilter } from './advanced-filter-enable.js';
14
14
  import { enablePivot } from './pivot-enable.js';
15
+ import { enableSheet } from './sheet-enable.js';
15
16
  /**
16
17
  * Augment a SvGridApi instance with Pro methods (`exportData`, `print`,
17
18
  * `ai.*`). Mutates and returns the same object so existing references
@@ -49,6 +50,10 @@ export function installEnterprise(api) {
49
50
  registerExportProvider(exportGrid);
50
51
  enablePivot();
51
52
  enableAdvancedFilter();
53
+ // Register the Excel keymap (Ctrl+Arrow, Ctrl+D, Ctrl+A and the rest). The
54
+ // grid interprets a key itself only when nothing claims it, so a free grid
55
+ // is unaffected.
56
+ enableSheet();
52
57
  pro.pivot = {
53
58
  build: (config) => createPivotModel(pro.getData(), config),
54
59
  buildFrom: (data, config) =>
@@ -8949,11 +8949,34 @@ var GENERATED_UI_SURFACE = {
8949
8949
  "description": "Prepend a header row (the column labels) to copied cell ranges, so pasting into Excel / Sheets includes the headers. Applies per copied range.",
8950
8950
  "group": "common"
8951
8951
  },
8952
+ {
8953
+ "key": "processCellForFill",
8954
+ "label": "Process Cell For Fill",
8955
+ "type": "json",
8956
+ "description": "Decide what the fill handle writes into one cell, ahead of the grid's own pattern rules (series, weekdays, \"Item 1\"). Receives the source cell's value and how far the target sits from it; return the value to write, or `undefined` to let the pattern decide. A spreadsheet uses it to move a formula's references by the distance filled, which the pattern rules would otherwise mangle (\"=A1+B1\" reads as \"Item 1\").",
8957
+ "code": true,
8958
+ "group": "advanced"
8959
+ },
8952
8960
  {
8953
8961
  "key": "processCellForClipboard",
8954
8962
  "label": "Process Cell For Clipboard",
8955
8963
  "type": "json",
8956
- "description": "Transform each cell value on its way to the clipboard - e.g. strip currency symbols, expand codes to labels, or redact. Receives the display value plus the row/column context; return the string (or value) to copy.",
8964
+ "code": true,
8965
+ "group": "advanced"
8966
+ },
8967
+ {
8968
+ "key": "clipboardHtml",
8969
+ "label": "Clipboard Html",
8970
+ "type": "json",
8971
+ "description": "An HTML rendering of what Ctrl+C copies, written to the clipboard as `text/html` beside the TSV. Excel and Google Sheets read the HTML first, so a table with inline styles pastes into them with its formats, and the same markup can carry what the text cannot (a formula in a `data-` attribute) for a round trip back into a grid that reads it. Called after every cell has been through `processCellForClipboard`, with the rectangles copied and the text about to be written. Return nothing to write text alone. Runs synchronously inside the key press, which is what the clipboard needs.",
8972
+ "code": true,
8973
+ "group": "advanced"
8974
+ },
8975
+ {
8976
+ "key": "processCellFromClipboard",
8977
+ "label": "Process Cell From Clipboard",
8978
+ "type": "json",
8979
+ "description": "Transform each cell on its way IN from the clipboard, before the grid coerces it for the column's editor. Symmetric with `processCellForClipboard`: the pair is what lets a round trip survive. Receives the raw clipboard text for the cell plus where it is landing. Return the value to write, or `undefined` to leave the cell untouched. This is also the seam a feature pack uses to take over a paste entirely: `@svgrid/enterprise`'s paste-special reads the clipboard's `text/html` for formats and formulas and writes through here.",
8957
8980
  "code": true,
8958
8981
  "group": "advanced"
8959
8982
  },
@@ -8964,6 +8987,13 @@ var GENERATED_UI_SURFACE = {
8964
8987
  "description": "Inline cell editing: F2 or double-click opens an editor in the active cell, Enter commits, Esc cancels. Off by default. A column still needs an `editorType` to pick its editor (text, number, date, checkbox, list, ...); without one it gets a plain text editor. `editable` is the shortcut alias and wins over this.",
8965
8988
  "group": "common"
8966
8989
  },
8990
+ {
8991
+ "key": "editOnSecondClick",
8992
+ "label": "Edit On Second Click",
8993
+ "type": "boolean",
8994
+ "description": "A click on the cell that is already active opens its editor, the way a second click on a selected file name starts renaming it. On by default. A spreadsheet turns it off: Excel edits on double-click or F2 only, and a user clicking the cell they are on to get back to it after a dialog would otherwise find the next shortcut typed into an editor.",
8995
+ "group": "common"
8996
+ },
8967
8997
  {
8968
8998
  "key": "fullRowEditing",
8969
8999
  "label": "Full Row Editing",
@@ -9169,6 +9199,20 @@ var GENERATED_UI_SURFACE = {
9169
9199
  "description": "Rows to pin to the TOP of the grid - rendered above the regular rows and sticky-positioned so they stay visible while the user scrolls. Typical use: a \"totals\" or \"headline\" row that should always be in view. Rows are read-only (no inline editing, no row-selection checkbox). They share the column schema with the main grid; field/format/cell/cellClass all apply.",
9170
9200
  "group": "common"
9171
9201
  },
9202
+ {
9203
+ "key": "frozenRows",
9204
+ "label": "Frozen Rows",
9205
+ "type": "number",
9206
+ "description": "Freeze the first N rows: they stay under the header while the body scrolls, and unlike `pinnedTopRows` they are the grid's own rows, still editable, selectable and numbered as rows 1..N. Excel's Freeze Panes, for the row half; the column half is `columnPinning`. Under `virtualization` the frozen rows are always rendered and the window skips them.",
9207
+ "group": "common"
9208
+ },
9209
+ {
9210
+ "key": "mergedCells",
9211
+ "label": "Merged Cells",
9212
+ "type": "json",
9213
+ "description": "Merged cells: rectangles drawn as one cell, a spreadsheet's Merge & Center. Each entry is the top-left cell (display indices) and how many rows and columns it covers. The origin's td takes the span and shows the origin's value; the covered cells are not drawn, a selection grows to whole merges, the active cell inside a merge is its origin, and the arrow keys step over a merge as one cell. A merge that crosses the frozen boundary or the rendered window is drawn in parts, one per band. The grid does not write into covered cells on its own; a consumer that merges cells keeps them empty or marks them read-only through the column's `editable`.",
9214
+ "group": "common"
9215
+ },
9172
9216
  {
9173
9217
  "key": "pinnedBottomRows",
9174
9218
  "label": "Pinned Bottom Rows",
@@ -9245,6 +9289,24 @@ var GENERATED_UI_SURFACE = {
9245
9289
  "prop": "onPaginationChange",
9246
9290
  "description": "Fires when the user changes page or page size while `externalPagination` is on. Fetch that page and update `data` / `rowCount` / `pageIndex`."
9247
9291
  },
9292
+ {
9293
+ "key": "columnResize",
9294
+ "label": "Column Resize",
9295
+ "prop": "onColumnResize",
9296
+ "description": "The user dragged a column's edge (or double-clicked it to autosize). Programmatic `api.setColumnWidth` does not fire it."
9297
+ },
9298
+ {
9299
+ "key": "rowResize",
9300
+ "label": "Row Resize",
9301
+ "prop": "onRowResize",
9302
+ "description": "The user dragged a row's edge, or double-clicked it: `height` is then `null`, the row back at its declared height. Programmatic `api.setRowHeight` does not fire it."
9303
+ },
9304
+ {
9305
+ "key": "pasteClipboard",
9306
+ "label": "Paste Clipboard",
9307
+ "prop": "onPasteClipboard",
9308
+ "description": "Take over a paste. Receives the clipboard's `text/plain` and, when the source put one there, its `text/html` (Excel's carries formats and formulas; a grid's own `clipboardHtml` carries whatever it chose to). Return `true` to say the paste was applied; anything else lets the grid paste the text as it always has. Runs inside one history group, so every `setCellValue` and `recordUndo` the handler makes is one Ctrl+Z. With this set, Ctrl+V lets the browser's own `paste` event through (that is where the unsanitised HTML is), and the async Clipboard API is the fallback for a browser that does not deliver it. `source` says which path the payload came by."
9309
+ },
9248
9310
  {
9249
9311
  "key": "apiReady",
9250
9312
  "label": "Api Ready",
@@ -15851,7 +15913,7 @@ function hasFieldConditions(schema) {
15851
15913
  *
15852
15914
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
15853
15915
  */
15854
- var SVGRID_VERSION = "3.0.0";
15916
+ var SVGRID_VERSION = "3.0.2";
15855
15917
  //#endregion
15856
15918
  //#region src/studio/emit-project.ts
15857
15919
  var has = (blocks, kind) => blocks.some((b) => b.config.kind === kind);
@@ -13,16 +13,40 @@
13
13
  * measure). The grand-total column is excluded unless `includeTotals`.
14
14
  * - values = each leaf row's aggregated cell for that series column.
15
15
  */
16
- import type { ChartSpec, ChartType, TableFeatures } from '@svgrid/grid';
16
+ import { type CellFormatConfig, type ChartSpec, type ChartType, type TableFeatures } from '@svgrid/grid';
17
17
  import type { PivotResult } from './pivot.js';
18
+ /** Options for {@link pivotToChartSpec}: the chart type and stacking, whether totals chart, a category cap, the measure's format and the value-axis name. */
18
19
  export type PivotChartOptions = {
19
20
  /** Chart type. Default `'bar'`. */
20
21
  type?: ChartType;
21
22
  /** Stack the series. Default false. */
22
23
  stacked?: boolean;
24
+ /** Stack to 100%. Implies `stacked`. Default false. */
25
+ stacked100?: boolean;
23
26
  /** Include the grand-total column / row as a series / category. Default false. */
24
27
  includeTotals?: boolean;
25
28
  /** Cap the number of categories (row leaves) charted. */
26
29
  maxCategories?: number;
30
+ /**
31
+ * The measure's cell format, carried to the chart as `valueFormat` (with
32
+ * `currency` and `locale`), so a cell the table shows as "$469,662" charts
33
+ * as "$470k" on the axis and "$469,662" in the tooltip rather than "470k".
34
+ * The designer passes the first value chip's format; with several
35
+ * measures in different formats, pass none and the chart formats plainly.
36
+ */
37
+ format?: CellFormatConfig;
38
+ /**
39
+ * Name the value axis. Default: the measure's label when the layout has
40
+ * one measure, nothing otherwise.
41
+ */
42
+ yAxisTitle?: string | null;
27
43
  };
44
+ /**
45
+ * A computed pivot as a `ChartSpec` for the free chart: row leaves become
46
+ * categories (nested rows a grouped axis), column leaves the series, totals
47
+ * left out unless asked for, the measure's format carried over and an empty
48
+ * cell read as a gap. The designer's Chart view is this function, and the
49
+ * grid's own Chart panel runs the same mapping (`pivotResultToChartSpec` in
50
+ * `@svgrid/grid`) in pivot mode.
51
+ */
28
52
  export declare function pivotToChartSpec<TFeatures extends TableFeatures>(result: PivotResult<TFeatures>, opts?: PivotChartOptions): ChartSpec;
@@ -1,71 +1,27 @@
1
+ /**
2
+ * Pivot -> chart bridge.
3
+ *
4
+ * Turns a computed {@link PivotResult} (the row/column/value matrix the pivot
5
+ * engine produces) into a core {@link ChartSpec} the free `SvGridChart` can
6
+ * render - so one pivot layout drives both a table and a chart (the Excel
7
+ * PivotTable <-> PivotChart pairing).
8
+ *
9
+ * Mapping:
10
+ * - categories = the row-axis LEAF rows (deepest grouping; subtotals and the
11
+ * grand-total row are skipped). With no row dims, the single total row.
12
+ * - series = the column-axis leaf value columns (one per col-path x
13
+ * measure). The grand-total column is excluded unless `includeTotals`.
14
+ * - values = each leaf row's aggregated cell for that series column.
15
+ */
16
+ import { pivotResultToChartSpec } from '@svgrid/grid';
17
+ /**
18
+ * A computed pivot as a `ChartSpec` for the free chart: row leaves become
19
+ * categories (nested rows a grouped axis), column leaves the series, totals
20
+ * left out unless asked for, the measure's format carried over and an empty
21
+ * cell read as a gap. The designer's Chart view is this function, and the
22
+ * grid's own Chart panel runs the same mapping (`pivotResultToChartSpec` in
23
+ * `@svgrid/grid`) in pivot mode.
24
+ */
1
25
  export function pivotToChartSpec(result, opts = {}) {
2
- const type = opts.type ?? 'bar';
3
- // Category rows: the row-axis leaves. Fall back to the grand-total (single
4
- // "All") row when no row dims are configured, then to every row.
5
- let catRows = result.rows.filter((r) => r.__pivotKind === 'leaf');
6
- if (!catRows.length)
7
- catRows = result.rows.filter((r) => r.__pivotKind === 'grandTotal');
8
- if (!catRows.length)
9
- catRows = result.rows.slice();
10
- if (opts.maxCategories && catRows.length > opts.maxCategories) {
11
- catRows = catRows.slice(0, opts.maxCategories);
12
- }
13
- // Categories are the leaf's OWN label; when rows are nested, emit a parent
14
- // tier (categoryGroups) so the axis reads "Americas | Canada · USA ..." as a
15
- // grouped axis rather than colliding on a bare repeated leaf label.
16
- const byId = new Map(result.rows.map((r) => [r.__pivotId, r]));
17
- const ownLabel = (r) => String(r.__pivotLabel ?? '').trim() || '(blank)';
18
- const categories = catRows.map(ownLabel);
19
- const parentOf = (r) => r.__pivotParentId ? byId.get(r.__pivotParentId) : undefined;
20
- const nested = catRows.length > 0 && catRows.every((r) => parentOf(r) !== undefined);
21
- let categoryGroups;
22
- if (nested) {
23
- categoryGroups = [];
24
- let prevId;
25
- for (const r of catRows) {
26
- const pid = r.__pivotParentId;
27
- const last = categoryGroups[categoryGroups.length - 1];
28
- if (last && pid === prevId)
29
- last.span += 1;
30
- else {
31
- categoryGroups.push({ label: ownLabel(parentOf(r)), span: 1 });
32
- prevId = pid;
33
- }
34
- }
35
- }
36
- const leaves = [];
37
- const walk = (cols, path) => {
38
- for (const c of cols ?? []) {
39
- if (!c || c.id === '__pivotRowHeader')
40
- continue;
41
- // Skip the grand-total column group (and its leaves) unless asked for.
42
- if (!opts.includeTotals && typeof c.id === 'string' && c.id.startsWith('pv_group__grand'))
43
- continue;
44
- if (Array.isArray(c.columns))
45
- walk(c.columns, [...path, String(c.header ?? '')]);
46
- else if (typeof c.id === 'string')
47
- leaves.push({ id: c.id, path, header: String(c.header ?? '') });
48
- }
49
- };
50
- walk(result.columns, []);
51
- const filtered = opts.includeTotals ? leaves : leaves.filter((l) => !l.id.includes('__total'));
52
- const uniqueHeaders = new Set(filtered.map((l) => l.header));
53
- const series = filtered.map((l) => ({
54
- label: l.path.length === 0
55
- ? l.header
56
- : uniqueHeaders.size > 1
57
- ? [...l.path, l.header].join(' · ')
58
- : l.path.join(' · '),
59
- values: catRows.map((r) => {
60
- const v = r[l.id];
61
- return typeof v === 'number' ? v : Number(v) || 0;
62
- }),
63
- }));
64
- return {
65
- type,
66
- categories,
67
- series,
68
- ...(categoryGroups && categoryGroups.length > 1 ? { categoryGroups } : {}),
69
- ...(opts.stacked ? { stacked: true } : {}),
70
- };
26
+ return pivotResultToChartSpec(result, opts);
71
27
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A1 addressing, with absolute and relative parts kept apart.
3
+ *
4
+ * Every demo copy of this engine does `part.replace(/\$/g, '')` and then treats
5
+ * what is left as relative, so `$A$1` parses and evaluates as `A1`. Nothing
6
+ * notices while nothing translates a formula. The moment fill-down, copy/paste
7
+ * or insert-row exists, `=$A$1*B2` copied down starts reading the wrong cell
8
+ * and quietly returns a plausible wrong number, which is the worst failure mode
9
+ * a spreadsheet has.
10
+ *
11
+ * So `$` is structure here, not noise: `parseA1` reports which halves were
12
+ * pinned, and `refs.ts` is the only module allowed to move the unpinned ones.
13
+ *
14
+ * Rows and columns are 0-based internally (`A1` is `{ row: 0, col: 0 }`) and
15
+ * 1-based on the wire, which is the same convention the grid's selection model
16
+ * uses so nothing has to convert at the boundary.
17
+ */
18
+ /** A parsed cell reference. `row: null` means a whole-column ref (`A:A`). */
19
+ export type CellRef = {
20
+ col: number;
21
+ colAbs: boolean;
22
+ /** null for a column-only reference. */
23
+ row: number | null;
24
+ rowAbs: boolean;
25
+ /** null means "the sheet the formula lives on". */
26
+ sheet: string | null;
27
+ };
28
+ /** 0-based column index to letters: 0 -> A, 25 -> Z, 26 -> AA. */
29
+ export declare function colToLetters(col: number): string;
30
+ /** Letters to a 0-based column index. Returns -1 for anything unparseable. */
31
+ export declare function lettersToCol(letters: string): number;
32
+ /**
33
+ * Parse one reference part: `A1`, `$A$1`, `A$1`, `$A1`, or a bare column `A`.
34
+ * Returns null when the text is not a reference at all, which is how the
35
+ * tokenizer tells a reference from a bare name.
36
+ */
37
+ export declare function parseA1(text: string, sheet?: string | null): CellRef | null;
38
+ /** Render a reference back to A1, `$` included, sheet prefix and all. */
39
+ export declare function formatA1(ref: CellRef): string;
40
+ /** A sheet name needs quoting unless it is a bare word. */
41
+ export declare function quoteSheet(name: string): string;
42
+ /** True when the reference points outside a sheet of this size. */
43
+ export declare function isOutOfBounds(ref: CellRef, rowCount: number, colCount: number): boolean;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * A1 addressing, with absolute and relative parts kept apart.
3
+ *
4
+ * Every demo copy of this engine does `part.replace(/\$/g, '')` and then treats
5
+ * what is left as relative, so `$A$1` parses and evaluates as `A1`. Nothing
6
+ * notices while nothing translates a formula. The moment fill-down, copy/paste
7
+ * or insert-row exists, `=$A$1*B2` copied down starts reading the wrong cell
8
+ * and quietly returns a plausible wrong number, which is the worst failure mode
9
+ * a spreadsheet has.
10
+ *
11
+ * So `$` is structure here, not noise: `parseA1` reports which halves were
12
+ * pinned, and `refs.ts` is the only module allowed to move the unpinned ones.
13
+ *
14
+ * Rows and columns are 0-based internally (`A1` is `{ row: 0, col: 0 }`) and
15
+ * 1-based on the wire, which is the same convention the grid's selection model
16
+ * uses so nothing has to convert at the boundary.
17
+ */
18
+ /** 0-based column index to letters: 0 -> A, 25 -> Z, 26 -> AA. */
19
+ export function colToLetters(col) {
20
+ if (!Number.isInteger(col) || col < 0)
21
+ return '';
22
+ let n = col;
23
+ let out = '';
24
+ while (n >= 0) {
25
+ out = String.fromCharCode(65 + (n % 26)) + out;
26
+ n = Math.floor(n / 26) - 1;
27
+ }
28
+ return out;
29
+ }
30
+ /** Letters to a 0-based column index. Returns -1 for anything unparseable. */
31
+ export function lettersToCol(letters) {
32
+ if (!letters || !/^[A-Za-z]+$/.test(letters))
33
+ return -1;
34
+ let col = 0;
35
+ for (const ch of letters.toUpperCase())
36
+ col = col * 26 + (ch.charCodeAt(0) - 64);
37
+ return col - 1;
38
+ }
39
+ const REF_RE = /^(\$?)([A-Za-z]+)(?:(\$?)(\d+))?$/;
40
+ /**
41
+ * Parse one reference part: `A1`, `$A$1`, `A$1`, `$A1`, or a bare column `A`.
42
+ * Returns null when the text is not a reference at all, which is how the
43
+ * tokenizer tells a reference from a bare name.
44
+ */
45
+ export function parseA1(text, sheet = null) {
46
+ const m = REF_RE.exec(text);
47
+ if (!m)
48
+ return null;
49
+ const col = lettersToCol(m[2]);
50
+ if (col < 0)
51
+ return null;
52
+ const rowText = m[4];
53
+ if (rowText === undefined) {
54
+ return { col, colAbs: m[1] === '$', row: null, rowAbs: false, sheet };
55
+ }
56
+ const row = Number(rowText) - 1;
57
+ // Row 0 does not exist in A1 notation; `A0` is a name, not a reference.
58
+ if (!Number.isInteger(row) || row < 0)
59
+ return null;
60
+ return { col, colAbs: m[1] === '$', row, rowAbs: m[3] === '$', sheet };
61
+ }
62
+ /** Render a reference back to A1, `$` included, sheet prefix and all. */
63
+ export function formatA1(ref) {
64
+ const col = `${ref.colAbs ? '$' : ''}${colToLetters(ref.col)}`;
65
+ const cell = ref.row === null ? col : `${col}${ref.rowAbs ? '$' : ''}${ref.row + 1}`;
66
+ if (ref.sheet === null)
67
+ return cell;
68
+ return `${quoteSheet(ref.sheet)}!${cell}`;
69
+ }
70
+ /** A sheet name needs quoting unless it is a bare word. */
71
+ export function quoteSheet(name) {
72
+ return /^[A-Za-z_][A-Za-z0-9_.]*$/.test(name) ? name : `'${name.replace(/'/g, "''")}'`;
73
+ }
74
+ /** True when the reference points outside a sheet of this size. */
75
+ export function isOutOfBounds(ref, rowCount, colCount) {
76
+ if (ref.col < 0 || ref.col >= colCount)
77
+ return true;
78
+ if (ref.row === null)
79
+ return false;
80
+ return ref.row < 0 || ref.row >= rowCount;
81
+ }