@svgrid/enterprise 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/LICENSE +94 -24
  2. package/README.md +36 -4
  3. package/dist/SvAdvancedFilter.svelte +1 -1
  4. package/dist/SvAlertsManager.svelte +2 -1
  5. package/dist/SvBoard.svelte +2 -1
  6. package/dist/SvExportMenu.svelte +4 -1
  7. package/dist/SvExportMenu.svelte.d.ts +0 -13
  8. package/dist/SvExpressionEditor.svelte +3 -3
  9. package/dist/SvFormulaBar.svelte +680 -0
  10. package/dist/SvFormulaBar.svelte.d.ts +69 -0
  11. package/dist/SvGridAlerts.svelte +49 -9
  12. package/dist/SvGridBoard.svelte +13 -8
  13. package/dist/SvGridBulkEditDrawer.svelte +26 -2
  14. package/dist/SvGridEditPanel.svelte +3 -0
  15. package/dist/SvGridScheduler.svelte +69 -40
  16. package/dist/SvGridSelectionBar.svelte +10 -3
  17. package/dist/SvPivotDesigner.svelte +263 -54
  18. package/dist/SvPivotDesigner.svelte.d.ts +27 -20
  19. package/dist/SvRibbonIcon.svelte +46 -0
  20. package/dist/SvRibbonIcon.svelte.d.ts +17 -0
  21. package/dist/SvSchemaChart.svelte +4 -2
  22. package/dist/SvSheet.svelte +7914 -0
  23. package/dist/SvSheet.svelte.d.ts +215 -0
  24. package/dist/SvSheetChartSetup.svelte +151 -0
  25. package/dist/SvSheetChartSetup.svelte.d.ts +18 -0
  26. package/dist/SvSheetComment.svelte +283 -0
  27. package/dist/SvSheetComment.svelte.d.ts +22 -0
  28. package/dist/SvSheetConditionalFormat.svelte +159 -0
  29. package/dist/SvSheetConditionalFormat.svelte.d.ts +14 -0
  30. package/dist/SvSheetDataValidation.svelte +273 -0
  31. package/dist/SvSheetDataValidation.svelte.d.ts +14 -0
  32. package/dist/SvSheetEditRanges.svelte +217 -0
  33. package/dist/SvSheetEditRanges.svelte.d.ts +15 -0
  34. package/dist/SvSheetErrors.svelte +125 -0
  35. package/dist/SvSheetErrors.svelte.d.ts +20 -0
  36. package/dist/SvSheetEvaluate.svelte +133 -0
  37. package/dist/SvSheetEvaluate.svelte.d.ts +15 -0
  38. package/dist/SvSheetFilterMenu.svelte +320 -0
  39. package/dist/SvSheetFilterMenu.svelte.d.ts +22 -0
  40. package/dist/SvSheetFindReplace.svelte +132 -0
  41. package/dist/SvSheetFindReplace.svelte.d.ts +10 -0
  42. package/dist/SvSheetFormatCells.svelte +465 -0
  43. package/dist/SvSheetFormatCells.svelte.d.ts +17 -0
  44. package/dist/SvSheetGoalSeek.svelte +145 -0
  45. package/dist/SvSheetGoalSeek.svelte.d.ts +12 -0
  46. package/dist/SvSheetInsertFunction.svelte +149 -0
  47. package/dist/SvSheetInsertFunction.svelte.d.ts +8 -0
  48. package/dist/SvSheetIteration.svelte +81 -0
  49. package/dist/SvSheetIteration.svelte.d.ts +10 -0
  50. package/dist/SvSheetLink.svelte +99 -0
  51. package/dist/SvSheetLink.svelte.d.ts +17 -0
  52. package/dist/SvSheetListPicker.svelte +91 -0
  53. package/dist/SvSheetListPicker.svelte.d.ts +10 -0
  54. package/dist/SvSheetManageRules.svelte +187 -0
  55. package/dist/SvSheetManageRules.svelte.d.ts +16 -0
  56. package/dist/SvSheetNameManager.svelte +227 -0
  57. package/dist/SvSheetNameManager.svelte.d.ts +11 -0
  58. package/dist/SvSheetPageSetup.svelte +159 -0
  59. package/dist/SvSheetPageSetup.svelte.d.ts +13 -0
  60. package/dist/SvSheetPasteSpecial.svelte +107 -0
  61. package/dist/SvSheetPasteSpecial.svelte.d.ts +12 -0
  62. package/dist/SvSheetPivot.svelte +220 -0
  63. package/dist/SvSheetPivot.svelte.d.ts +21 -0
  64. package/dist/SvSheetProtectSheet.svelte +81 -0
  65. package/dist/SvSheetProtectSheet.svelte.d.ts +11 -0
  66. package/dist/SvSheetRemoveDuplicates.svelte +152 -0
  67. package/dist/SvSheetRemoveDuplicates.svelte.d.ts +12 -0
  68. package/dist/SvSheetRibbon.svelte +1254 -0
  69. package/dist/SvSheetRibbon.svelte.d.ts +34 -0
  70. package/dist/SvSheetSizeDialog.svelte +60 -0
  71. package/dist/SvSheetSizeDialog.svelte.d.ts +11 -0
  72. package/dist/SvSheetSort.svelte +218 -0
  73. package/dist/SvSheetSort.svelte.d.ts +28 -0
  74. package/dist/SvSheetSparklines.svelte +135 -0
  75. package/dist/SvSheetSparklines.svelte.d.ts +14 -0
  76. package/dist/SvSheetTable.svelte +160 -0
  77. package/dist/SvSheetTable.svelte.d.ts +24 -0
  78. package/dist/SvSheetTabs.svelte +571 -0
  79. package/dist/SvSheetTabs.svelte.d.ts +50 -0
  80. package/dist/SvSheetTabs.test-harness.svelte.d.ts +17 -0
  81. package/dist/SvSheetTabs.test-harness.svelte.js +22 -0
  82. package/dist/SvSheetTextToColumns.svelte +172 -0
  83. package/dist/SvSheetTextToColumns.svelte.d.ts +13 -0
  84. package/dist/SvSheetValidationAlert.svelte +85 -0
  85. package/dist/SvSheetValidationAlert.svelte.d.ts +15 -0
  86. package/dist/advanced-filter-enable.js +1 -1
  87. package/dist/alerts/alert-engine.d.ts +6 -0
  88. package/dist/alerts/alert-engine.js +21 -4
  89. package/dist/alerts/alert-formats.js +2 -0
  90. package/dist/alerts/alert-types.d.ts +1 -1
  91. package/dist/alerts.d.ts +1 -1
  92. package/dist/alerts.js +2 -2
  93. package/dist/board.js +2 -2
  94. package/dist/bulk-edit.d.ts +3 -1
  95. package/dist/bulk-edit.js +1 -1
  96. package/dist/cdn/svgrid-enterprise.svelte-external.js +43538 -6539
  97. package/dist/designer/assets/GridMenus-8gTNssgV.js +8 -0
  98. package/dist/designer/assets/SvChartMenu-BDoeqGz6.js +1 -0
  99. package/dist/designer/assets/SvChartMenu-BYO9cYdy.css +1 -0
  100. package/dist/designer/assets/SvDateRangeInput-BBRzrQeg.js +1 -0
  101. package/dist/designer/assets/SvDateTimePicker-DCPg7WGN.js +1 -0
  102. package/dist/designer/assets/SvGridCellEditor-DMoWJjEI.js +4 -0
  103. package/dist/designer/assets/SvGridChart-BgLuPO7I.css +1 -0
  104. package/dist/designer/assets/SvGridChart-Cy1ATrWh.js +3 -0
  105. package/dist/designer/assets/SvGridChartBuilder-08YWWeqY.css +1 -0
  106. package/dist/designer/assets/SvGridChartBuilder-eQ3mn0L9.js +1 -0
  107. package/dist/designer/assets/SvGridChartPanel-4Pc8y5yO.css +1 -0
  108. package/dist/designer/assets/SvGridChartPanel-CATdVc9X.js +4 -0
  109. package/dist/designer/assets/{SvGridChartView-DUc-1RUf.css → SvGridChartView-7msfnWZT.css} +1 -1
  110. package/dist/designer/assets/SvGridChartView-CmsZtCED.js +1 -0
  111. package/dist/designer/assets/SvGridDropdown-Cjz0H-fI.js +1 -0
  112. package/dist/designer/assets/SvListBox-BDS66lmZ.js +110 -0
  113. package/dist/designer/assets/SvMenuList-DJ47ba1h.css +1 -0
  114. package/dist/designer/assets/SvMenuList-Dgq2D5VN.js +1 -0
  115. package/dist/designer/assets/SvTabs-2mHC6oaz.js +1 -0
  116. package/dist/designer/assets/SvTabs-DKmwb5p1.css +1 -0
  117. package/dist/designer/assets/cell-formatting-BbubJTVz.js +1 -0
  118. package/dist/designer/assets/chart-Cn7MnNqA.js +1 -0
  119. package/dist/designer/assets/chart-export-B6bkQ3X8.js +11 -0
  120. package/dist/designer/assets/chart-export-pdf-BbA28-gt.js +11 -0
  121. package/dist/designer/assets/chart-panel-messages-Dz7PTIqT.js +1 -0
  122. package/dist/designer/assets/chart-summary-BD1qYB2R.js +1 -0
  123. package/dist/designer/assets/chart-trend-B8xr5LuD.js +1 -0
  124. package/dist/designer/assets/chart-validate-BMqM-qkF.js +1 -0
  125. package/dist/designer/assets/column-resize-BYDzR1Ve.js +1 -0
  126. package/dist/designer/assets/date-format-B8JbEtIG.js +1 -0
  127. package/dist/designer/assets/date-format-DKS-z0xS.css +1 -0
  128. package/dist/designer/assets/{dismissable-BO547MH9.js → dismissable-ChWRPkoa.js} +1 -1
  129. package/dist/designer/assets/editor-contract-Bpoa7A5g.js +1 -0
  130. package/dist/designer/assets/{export-format-D-eP4b2l.js → export-format-DGckmgKr.js} +1 -1
  131. package/dist/designer/assets/focus-trap-V2-6Fy9I.js +1 -0
  132. package/dist/designer/assets/{index-C_a9Cj8Y.js → index-D5bVbuzI.js} +318 -315
  133. package/dist/designer/assets/index-_JVFxt02.css +1 -0
  134. package/dist/designer/assets/list-option-BP_dWS66.js +1 -0
  135. package/dist/designer/assets/row-resize-BInFWCpr.js +1 -0
  136. package/dist/designer/assets/server-block-cache-CXJKkJpy.js +1 -0
  137. package/dist/designer/assets/src-CITpcm6b.js +1 -0
  138. package/dist/designer/assets/src-DUQ4xE3x.js +58 -0
  139. package/dist/designer/assets/validate-C3B8QKsM.js +1 -0
  140. package/dist/designer/index.html +29 -19
  141. package/dist/export-pdf.d.ts +164 -0
  142. package/dist/export-pdf.js +346 -15
  143. package/dist/export.js +25 -10
  144. package/dist/gantt/SvGridGantt.svelte +2890 -0
  145. package/dist/gantt/SvGridGantt.svelte.d.ts +30 -0
  146. package/dist/gantt/gantt-config.d.ts +73 -0
  147. package/dist/gantt/gantt-config.js +1 -0
  148. package/dist/gantt/gantt-critical-path.d.ts +67 -0
  149. package/dist/gantt/gantt-critical-path.js +207 -0
  150. package/dist/gantt/gantt-model.d.ts +257 -0
  151. package/dist/gantt/gantt-model.js +651 -0
  152. package/dist/gantt/gantt-resources.d.ts +59 -0
  153. package/dist/gantt/gantt-resources.js +71 -0
  154. package/dist/gantt/gantt.d.ts +7 -0
  155. package/dist/gantt/gantt.js +36 -0
  156. package/dist/gantt/index.d.ts +15 -0
  157. package/dist/gantt/index.js +22 -0
  158. package/dist/gantt/timeline-arrows.d.ts +102 -0
  159. package/dist/gantt/timeline-arrows.js +181 -0
  160. package/dist/import.d.ts +2 -2
  161. package/dist/import.js +1 -1
  162. package/dist/index.d.ts +93 -3
  163. package/dist/index.js +107 -3
  164. package/dist/install.js +13 -1
  165. package/dist/license-core.d.ts +17 -1
  166. package/dist/license-core.js +16 -5
  167. package/dist/license.d.ts +18 -2
  168. package/dist/license.js +71 -6
  169. package/dist/node/studio.js +203 -9
  170. package/dist/pivot-chart.d.ts +25 -1
  171. package/dist/pivot-chart.js +25 -69
  172. package/dist/pivot-enable.js +2 -2
  173. package/dist/scheduler-dependencies.d.ts +35 -0
  174. package/dist/scheduler-dependencies.js +36 -1
  175. package/dist/scheduler.js +2 -2
  176. package/dist/selection-bar.js +2 -2
  177. package/dist/server/SvGroupCell.svelte +213 -0
  178. package/dist/server/SvGroupCell.svelte.d.ts +62 -0
  179. package/dist/server/SvRowGroupPanel.svelte +322 -0
  180. package/dist/server/SvRowGroupPanel.svelte.d.ts +37 -0
  181. package/dist/server/enable.d.ts +17 -0
  182. package/dist/server/enable.js +49 -0
  183. package/dist/server/index.d.ts +22 -0
  184. package/dist/server/index.js +24 -0
  185. package/dist/server/messages.d.ts +45 -0
  186. package/dist/server/messages.js +35 -0
  187. package/dist/server/server-group-model.d.ts +104 -0
  188. package/dist/server/server-group-model.js +272 -0
  189. package/dist/server/server-pivot.d.ts +46 -0
  190. package/dist/server/server-pivot.js +57 -0
  191. package/dist/server/server-row-model.d.ts +547 -0
  192. package/dist/server/server-row-model.js +1551 -0
  193. package/dist/server/server-selection.d.ts +99 -0
  194. package/dist/server/server-selection.js +215 -0
  195. package/dist/server/svgrid-adapter.d.ts +155 -0
  196. package/dist/server/svgrid-adapter.js +202 -0
  197. package/dist/sheet/address.d.ts +43 -0
  198. package/dist/sheet/address.js +81 -0
  199. package/dist/sheet/ast.d.ts +138 -0
  200. package/dist/sheet/ast.js +70 -0
  201. package/dist/sheet/auto-filter.d.ts +120 -0
  202. package/dist/sheet/auto-filter.js +295 -0
  203. package/dist/sheet/autocomplete.d.ts +51 -0
  204. package/dist/sheet/autocomplete.js +248 -0
  205. package/dist/sheet/cell-images.d.ts +39 -0
  206. package/dist/sheet/cell-images.js +90 -0
  207. package/dist/sheet/cell-types.d.ts +58 -0
  208. package/dist/sheet/cell-types.js +96 -0
  209. package/dist/sheet/coerce.d.ts +71 -0
  210. package/dist/sheet/coerce.js +289 -0
  211. package/dist/sheet/commands.d.ts +89 -0
  212. package/dist/sheet/commands.js +230 -0
  213. package/dist/sheet/comments.d.ts +63 -0
  214. package/dist/sheet/comments.js +131 -0
  215. package/dist/sheet/conditional-formats.d.ts +167 -0
  216. package/dist/sheet/conditional-formats.js +341 -0
  217. package/dist/sheet/csv.d.ts +32 -0
  218. package/dist/sheet/csv.js +158 -0
  219. package/dist/sheet/culture.d.ts +87 -0
  220. package/dist/sheet/culture.js +247 -0
  221. package/dist/sheet/delta.d.ts +102 -0
  222. package/dist/sheet/delta.js +203 -0
  223. package/dist/sheet/deps.d.ts +104 -0
  224. package/dist/sheet/deps.js +274 -0
  225. package/dist/sheet/document.d.ts +252 -0
  226. package/dist/sheet/document.js +465 -0
  227. package/dist/sheet/edit-keys.d.ts +14 -0
  228. package/dist/sheet/edit-keys.js +40 -0
  229. package/dist/sheet/engine.d.ts +67 -0
  230. package/dist/sheet/engine.js +19 -0
  231. package/dist/sheet/entry.d.ts +35 -0
  232. package/dist/sheet/entry.js +226 -0
  233. package/dist/sheet/error-check.d.ts +49 -0
  234. package/dist/sheet/error-check.js +83 -0
  235. package/dist/sheet/evaluate-steps.d.ts +48 -0
  236. package/dist/sheet/evaluate-steps.js +196 -0
  237. package/dist/sheet/evaluate.d.ts +128 -0
  238. package/dist/sheet/evaluate.js +1049 -0
  239. package/dist/sheet/filter-files.d.ts +37 -0
  240. package/dist/sheet/filter-files.js +465 -0
  241. package/dist/sheet/find-replace.d.ts +62 -0
  242. package/dist/sheet/find-replace.js +152 -0
  243. package/dist/sheet/format-store.d.ts +114 -0
  244. package/dist/sheet/format-store.js +243 -0
  245. package/dist/sheet/freeze.d.ts +54 -0
  246. package/dist/sheet/freeze.js +58 -0
  247. package/dist/sheet/from-rows.d.ts +14 -0
  248. package/dist/sheet/from-rows.js +50 -0
  249. package/dist/sheet/function-catalog.d.ts +10 -0
  250. package/dist/sheet/function-catalog.js +385 -0
  251. package/dist/sheet/functions.d.ts +28 -0
  252. package/dist/sheet/functions.js +634 -0
  253. package/dist/sheet/goal-seek.d.ts +73 -0
  254. package/dist/sheet/goal-seek.js +153 -0
  255. package/dist/sheet/index.d.ts +80 -0
  256. package/dist/sheet/index.js +80 -0
  257. package/dist/sheet/links.d.ts +57 -0
  258. package/dist/sheet/links.js +174 -0
  259. package/dist/sheet/merges.d.ts +71 -0
  260. package/dist/sheet/merges.js +137 -0
  261. package/dist/sheet/messages.d.ts +778 -0
  262. package/dist/sheet/messages.js +806 -0
  263. package/dist/sheet/names.d.ts +31 -0
  264. package/dist/sheet/names.js +87 -0
  265. package/dist/sheet/navigate.d.ts +52 -0
  266. package/dist/sheet/navigate.js +135 -0
  267. package/dist/sheet/number-format.d.ts +110 -0
  268. package/dist/sheet/number-format.js +905 -0
  269. package/dist/sheet/objects.d.ts +106 -0
  270. package/dist/sheet/objects.js +149 -0
  271. package/dist/sheet/ods-document.d.ts +44 -0
  272. package/dist/sheet/ods-document.js +1275 -0
  273. package/dist/sheet/open-file.d.ts +26 -0
  274. package/dist/sheet/open-file.js +56 -0
  275. package/dist/sheet/outline.d.ts +82 -0
  276. package/dist/sheet/outline.js +228 -0
  277. package/dist/sheet/packs/array.d.ts +16 -0
  278. package/dist/sheet/packs/array.js +172 -0
  279. package/dist/sheet/packs/database.d.ts +42 -0
  280. package/dist/sheet/packs/database.js +142 -0
  281. package/dist/sheet/packs/engineering.d.ts +2 -0
  282. package/dist/sheet/packs/engineering.js +296 -0
  283. package/dist/sheet/packs/financial.d.ts +5 -0
  284. package/dist/sheet/packs/financial.js +220 -0
  285. package/dist/sheet/packs/math-stats.d.ts +2 -0
  286. package/dist/sheet/packs/math-stats.js +372 -0
  287. package/dist/sheet/packs/special.d.ts +44 -0
  288. package/dist/sheet/packs/special.js +187 -0
  289. package/dist/sheet/packs/stats-dist.d.ts +2 -0
  290. package/dist/sheet/packs/stats-dist.js +785 -0
  291. package/dist/sheet/packs/text-date.d.ts +2 -0
  292. package/dist/sheet/packs/text-date.js +332 -0
  293. package/dist/sheet/packs/trig.d.ts +2 -0
  294. package/dist/sheet/packs/trig.js +73 -0
  295. package/dist/sheet/page-setup.d.ts +73 -0
  296. package/dist/sheet/page-setup.js +73 -0
  297. package/dist/sheet/palette.d.ts +19 -0
  298. package/dist/sheet/palette.js +84 -0
  299. package/dist/sheet/parse.d.ts +13 -0
  300. package/dist/sheet/parse.js +140 -0
  301. package/dist/sheet/paste-special.d.ts +186 -0
  302. package/dist/sheet/paste-special.js +601 -0
  303. package/dist/sheet/pivot-range.d.ts +160 -0
  304. package/dist/sheet/pivot-range.js +333 -0
  305. package/dist/sheet/presence.d.ts +73 -0
  306. package/dist/sheet/presence.js +79 -0
  307. package/dist/sheet/print.d.ts +104 -0
  308. package/dist/sheet/print.js +169 -0
  309. package/dist/sheet/protection.d.ts +75 -0
  310. package/dist/sheet/protection.js +101 -0
  311. package/dist/sheet/rects.d.ts +45 -0
  312. package/dist/sheet/rects.js +112 -0
  313. package/dist/sheet/refs.d.ts +130 -0
  314. package/dist/sheet/refs.js +413 -0
  315. package/dist/sheet/ribbon-icons.d.ts +31 -0
  316. package/dist/sheet/ribbon-icons.js +536 -0
  317. package/dist/sheet/ribbon.d.ts +173 -0
  318. package/dist/sheet/ribbon.js +1054 -0
  319. package/dist/sheet/sheet-kinds.d.ts +74 -0
  320. package/dist/sheet/sheet-kinds.js +91 -0
  321. package/dist/sheet/shortcuts.d.ts +174 -0
  322. package/dist/sheet/shortcuts.js +674 -0
  323. package/dist/sheet/sort.d.ts +51 -0
  324. package/dist/sheet/sort.js +107 -0
  325. package/dist/sheet/sparklines.d.ts +111 -0
  326. package/dist/sheet/sparklines.js +204 -0
  327. package/dist/sheet/structure.d.ts +87 -0
  328. package/dist/sheet/structure.js +166 -0
  329. package/dist/sheet/table-styles.d.ts +74 -0
  330. package/dist/sheet/table-styles.js +152 -0
  331. package/dist/sheet/tables.d.ts +89 -0
  332. package/dist/sheet/tables.js +178 -0
  333. package/dist/sheet/tokenize.d.ts +71 -0
  334. package/dist/sheet/tokenize.js +355 -0
  335. package/dist/sheet/transforms.d.ts +76 -0
  336. package/dist/sheet/transforms.js +154 -0
  337. package/dist/sheet/validation.d.ts +108 -0
  338. package/dist/sheet/validation.js +278 -0
  339. package/dist/sheet/workbook.d.ts +217 -0
  340. package/dist/sheet/workbook.js +1120 -0
  341. package/dist/sheet/xls-cfb.d.ts +32 -0
  342. package/dist/sheet/xls-cfb.js +290 -0
  343. package/dist/sheet/xls-document.d.ts +10 -0
  344. package/dist/sheet/xls-document.js +1243 -0
  345. package/dist/sheet/xls-formula.d.ts +40 -0
  346. package/dist/sheet/xls-formula.js +569 -0
  347. package/dist/sheet/xlsx-document.d.ts +108 -0
  348. package/dist/sheet/xlsx-document.js +1849 -0
  349. package/dist/sheet/xlsx-drawing.d.ts +99 -0
  350. package/dist/sheet/xlsx-drawing.js +420 -0
  351. package/dist/sheet-enable.d.ts +6 -0
  352. package/dist/sheet-enable.js +45 -0
  353. package/dist/sheet-text.d.ts +7 -0
  354. package/dist/sheet-text.js +29 -0
  355. package/dist/sources/auth-supabase.js +2 -2
  356. package/dist/sources/realtime-supabase.js +2 -2
  357. package/dist/sources/rest.d.ts +6 -2
  358. package/dist/sources/rest.js +42 -7
  359. package/dist/sources/supabase.d.ts +10 -1
  360. package/dist/sources/supabase.js +73 -40
  361. package/dist/studio/emit-project.js +14 -1
  362. package/dist/studio/index.js +1 -1
  363. package/dist/studio/project.d.ts +11 -2
  364. package/dist/studio/project.js +5 -2
  365. package/dist/studio/ui-components.generated.js +170 -3
  366. package/dist/sveltekit/in-memory.d.ts +2 -2
  367. package/dist/sveltekit/in-memory.js +125 -4
  368. package/dist/sveltekit/index.d.ts +1 -1
  369. package/dist/sveltekit/index.js +1 -1
  370. package/dist/sveltekit/query-plan.d.ts +50 -4
  371. package/dist/sveltekit/query-plan.js +25 -3
  372. package/dist/sveltekit/sql-source.d.ts +6 -0
  373. package/dist/sveltekit/sql-source.js +34 -6
  374. package/dist/sveltekit/sql.d.ts +31 -0
  375. package/dist/sveltekit/sql.js +135 -25
  376. package/dist/sveltekit/transport.d.ts +10 -2
  377. package/dist/sveltekit/transport.js +30 -6
  378. package/dist/upgrade-prompt.d.ts +1 -1
  379. package/dist/version.d.ts +1 -1
  380. package/dist/version.js +1 -1
  381. package/dist/watermark.js +35 -2
  382. package/dist/wc/GridMenus-By9vPuq0.js +1088 -0
  383. package/dist/wc/SvChartMenu-CQNrQGT2.js +308 -0
  384. package/dist/wc/SvDateRangeInput-DR6m7bSM.js +199 -0
  385. package/dist/wc/SvDateTimePicker-D-vRnaMo.js +771 -0
  386. package/dist/wc/SvField-B_kurx_P.js +149 -0
  387. package/dist/wc/SvGrid.helpers-BdVDtjUm.js +135 -0
  388. package/dist/wc/SvGridCellEditor-Bnf1Kr5C.js +560 -0
  389. package/dist/wc/SvGridChart-BqUJh2pG.js +3572 -0
  390. package/dist/wc/SvGridChartBuilder-CGycC5cn.js +988 -0
  391. package/dist/wc/SvGridChartPanel-CRnizsHD.js +1746 -0
  392. package/dist/wc/SvGridChartView-D1pa_xMy.js +47 -0
  393. package/dist/wc/SvGridDropdown-45WsObLL.js +259 -0
  394. package/dist/wc/SvModal-DrfOYYyX.js +189 -0
  395. package/dist/wc/cell-formatting-CBfgahv1.js +86 -0
  396. package/dist/wc/chart-6OXlybVT.js +4341 -0
  397. package/dist/wc/chart-export-CeSADGfi.js +135 -0
  398. package/dist/wc/chart-export-pdf-BGko7MER.js +104 -0
  399. package/dist/wc/chart-summary-2m3ia1-n.js +137 -0
  400. package/dist/wc/chart-trend-CQOQtTMl.js +50 -0
  401. package/dist/wc/chart-validate-CD6ptiwg.js +180 -0
  402. package/dist/wc/client-DQIzjDBG.js +3064 -0
  403. package/dist/wc/column-resize-DUPgynvc.js +101 -0
  404. package/dist/wc/date-format-DS-z_h9v.js +1130 -0
  405. package/dist/wc/dismissable-CQ6XFXsk.js +45 -0
  406. package/dist/wc/editor-contract-peBDxir_.js +22 -0
  407. package/dist/wc/editor-registry-DxGKqcvx.js +24 -0
  408. package/dist/wc/focus-trap-Dbb2tJxb.js +65 -0
  409. package/dist/wc/list-option-DrRyivWp.js +82 -0
  410. package/dist/wc/popover-WsGlvtQv.js +69 -0
  411. package/dist/wc/positioning-BiKLfu1E.js +112 -0
  412. package/dist/wc/react.d.ts +41 -0
  413. package/dist/wc/react.js +90 -0
  414. package/dist/wc/rolldown-runtime-Dy4uBu1J.js +11 -0
  415. package/dist/wc/row-drag-touch-CycRR65n.js +93 -0
  416. package/dist/wc/row-resize-limG_N1z.js +111 -0
  417. package/dist/wc/sv-sheet-element.d.ts +97 -0
  418. package/dist/wc/sv-sheet-element.js +44213 -0
  419. package/dist/wc/svelte-virtualizer.svelte-CXtQy2TQ.js +530 -0
  420. package/dist/wc/validate-BqDthkNr.js +88 -0
  421. package/dist/wc/vue.d.ts +31 -0
  422. package/dist/wc/vue.js +75 -0
  423. package/package.json +36 -6
  424. package/dist/designer/assets/GridMenus-B1JtIN21.js +0 -8
  425. package/dist/designer/assets/SvDateRangeInput-CjO7nn_x.js +0 -1
  426. package/dist/designer/assets/SvDateTimePicker-ByBD_ov6.js +0 -1
  427. package/dist/designer/assets/SvField-YDLipR6O.css +0 -1
  428. package/dist/designer/assets/SvField-cj1PFNgZ.js +0 -1
  429. package/dist/designer/assets/SvGridCellEditor-0W1L2hJ1.js +0 -2
  430. package/dist/designer/assets/SvGridChart-DBOR4xcz.js +0 -2
  431. package/dist/designer/assets/SvGridChart-fkMWeh1J.css +0 -1
  432. package/dist/designer/assets/SvGridChartPanel-symrhNnR.js +0 -11
  433. package/dist/designer/assets/SvGridChartView-BmRxq6mU.js +0 -1
  434. package/dist/designer/assets/SvGridDropdown-Bb3HH2Aj.js +0 -1
  435. package/dist/designer/assets/SvListBox-1oUF6Iav.js +0 -110
  436. package/dist/designer/assets/cell-formatting-wr5wm7US.js +0 -1
  437. package/dist/designer/assets/chart-DXFganU8.js +0 -1
  438. package/dist/designer/assets/column-resize-C_inr5zT.js +0 -1
  439. package/dist/designer/assets/date-format-DGagAqRc.css +0 -1
  440. package/dist/designer/assets/date-format-onlYDsrY.js +0 -1
  441. package/dist/designer/assets/easing-zaypKrr0.js +0 -3
  442. package/dist/designer/assets/index-k2stW6L8.css +0 -1
  443. package/dist/designer/assets/row-resize-B0FWHcNr.js +0 -1
  444. package/dist/designer/assets/src-D9p27OGC.js +0 -58
  445. package/dist/designer/assets/validate-h-aslRV9.js +0 -1
@@ -9,6 +9,175 @@
9
9
  * docDefinition object, so it's fully unit-testable; `exportGrid` feeds the
10
10
  * result to `pdfMake.createPdf(def).download(...)`.
11
11
  */
12
+ /**
13
+ * The font map inside whatever `import('pdfmake/build/vfs_fonts')` returned.
14
+ *
15
+ * The file has changed shape across pdfmake releases and bundlers wrap it
16
+ * once more: `{ pdfMake: { vfs } }` (0.1.x), `{ vfs }`, either of those under
17
+ * `default`, and since 0.2.8 the module IS the map (`module.exports = vfs`,
18
+ * so an ESM interop hands it over as `default` with the `.ttf` names as
19
+ * keys). Only the last shape ships today, and it is the one the old lookup
20
+ * did not recognise, which left registration to a side effect of import
21
+ * order (see {@link registerPdfFonts}). Returns `null` when nothing in the
22
+ * module looks like a font map.
23
+ */
24
+ export function resolvePdfVfs(mod) {
25
+ const isMap = (v) => !!v && typeof v === 'object' && Object.keys(v).some((k) => /\.(ttf|otf)$/i.test(k)) &&
26
+ Object.values(v).every((x) => typeof x === 'string');
27
+ const seen = new Set();
28
+ const walk = (v) => {
29
+ if (!v || typeof v !== 'object' || seen.has(v))
30
+ return null;
31
+ seen.add(v);
32
+ if (isMap(v))
33
+ return v;
34
+ const o = v;
35
+ return walk(o.pdfMake?.vfs) ?? walk(o.vfs) ?? walk(o.default);
36
+ };
37
+ return walk(mod);
38
+ }
39
+ /**
40
+ * Hand the fonts to the pdfmake instance that will create the document,
41
+ * explicitly. `vfs_fonts` registers itself only as a side effect: at import
42
+ * time it looks for a global `pdfMake` with `addVirtualFileSystem` and calls
43
+ * it. Under a bundler that global is whichever instance happened to load
44
+ * first, and when a dev server re-optimises its dependencies mid-session
45
+ * that is a stale one, so the instance doing the export has no fonts and
46
+ * `createPdf` fails with "File 'Roboto-Medium.ttf' not found in virtual
47
+ * file system". Registering here, on the instance in hand, removes the
48
+ * dependence on import order: `addVirtualFileSystem` where the version has
49
+ * it (0.2.x, where `createPdf` reads that before the `vfs` property) and the
50
+ * `vfs` property as well, which older versions read. Returns whether a map
51
+ * was found to register.
52
+ */
53
+ export function registerPdfFonts(pdfMake, vfsModule) {
54
+ const vfs = resolvePdfVfs(vfsModule);
55
+ if (!vfs)
56
+ return false;
57
+ if (typeof pdfMake.addVirtualFileSystem === 'function')
58
+ pdfMake.addVirtualFileSystem(vfs);
59
+ pdfMake.vfs = vfs;
60
+ return true;
61
+ }
62
+ /** `rgb(...)` / `rgba(...)` / `#hex` -> `#rrggbb`, or null for transparent and anything else. */
63
+ export function cssColorToHex(value) {
64
+ if (!value)
65
+ return null;
66
+ const v = value.trim();
67
+ const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(v);
68
+ if (hex) {
69
+ const h = hex[1];
70
+ return '#' + (h.length === 3 ? h.split('').map((c) => c + c).join('') : h).toLowerCase();
71
+ }
72
+ const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(v);
73
+ if (!rgb)
74
+ return null;
75
+ const alpha = rgb[4] === undefined ? 1 : rgb[4].endsWith('%') ? Number(rgb[4].slice(0, -1)) / 100 : Number(rgb[4]);
76
+ if (!(alpha > 0.05))
77
+ return null;
78
+ const to = (n) => Math.max(0, Math.min(255, Math.round(Number(n)))).toString(16).padStart(2, '0');
79
+ return '#' + to(rgb[1]) + to(rgb[2]) + to(rgb[3]);
80
+ }
81
+ /** Relative luminance of a `#rrggbb`, 0 (black) to 1 (white). */
82
+ export function hexLuminance(hex) {
83
+ const n = parseInt(hex.slice(1), 16);
84
+ const ch = (c) => {
85
+ const s = c / 255;
86
+ return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
87
+ };
88
+ return 0.2126 * ch((n >> 16) & 255) + 0.7152 * ch((n >> 8) & 255) + 0.0722 * ch(n & 255);
89
+ }
90
+ /**
91
+ * Read the colours a mounted grid is drawn with, from computed styles: the
92
+ * header cell's fill and text, a body cell's text and line colour, the
93
+ * stripe of an alternate row, a group row's fill and text. Colours that are
94
+ * transparent or unreadable are left out, and under a dark theme (a dark
95
+ * body background) only the header colours are reported, since the page
96
+ * the PDF prints on is white.
97
+ */
98
+ export function readGridPdfTheme(root) {
99
+ if (!root || typeof getComputedStyle !== 'function')
100
+ return {};
101
+ const q = (sel) => root.querySelector(sel);
102
+ const style = (el, prop) => (el ? cssColorToHex(getComputedStyle(el).getPropertyValue(prop)) : null);
103
+ // The fill an element shows is the first painted background on the way
104
+ // up: a header cell is transparent over its column, a body cell over its
105
+ // row, the grid over the page. The walk goes past the root because a
106
+ // dark page is often what a dark theme's grid sits on, unpainted itself.
107
+ const fill = (el) => {
108
+ for (let node = el; node; node = node.parentElement) {
109
+ const c = style(node, 'background-color');
110
+ if (c)
111
+ return c;
112
+ }
113
+ return null;
114
+ };
115
+ // A data column, not the row-number gutter or the checkbox column, and
116
+ // a data row, not the header row (which is a `.sv-grid-row` too).
117
+ const plain = ':not([class*="row-number"]):not([class*="selection"])';
118
+ const header = q(`.sv-grid-head .sv-grid-column${plain}`) ?? q('.sv-grid-header-cell') ?? q('thead th');
119
+ const cell = q(`.sv-grid-body .sv-grid-row:not(.sv-grid-row-alt):not(.sv-grid-header-row) .sv-grid-cell${plain}`) ?? q('tbody td');
120
+ const alt = q(`.sv-grid-body .sv-grid-row-alt .sv-grid-cell${plain}`);
121
+ const group = q('.sv-grid-group-row .sv-grid-cell');
122
+ const out = {};
123
+ const headerFill = fill(header);
124
+ const headerText = style(header, 'color');
125
+ if (headerFill)
126
+ out.headerColor = headerFill;
127
+ if (headerText)
128
+ out.headerTextColor = headerText;
129
+ const bodyBg = cell ? fill(cell.parentElement) : fill(q('.sv-grid-container') ?? root);
130
+ const text = style(cell, 'color');
131
+ // Dark: a dark ground, or light text (which would vanish on the white page
132
+ // whatever the ground was).
133
+ const dark = (bodyBg ? hexLuminance(bodyBg) < 0.4 : false) || (text ? hexLuminance(text) > 0.5 : false);
134
+ if (dark)
135
+ return out;
136
+ if (text)
137
+ out.textColor = text;
138
+ const line = style(cell, 'border-bottom-color') ?? style(header, 'border-bottom-color');
139
+ if (line)
140
+ out.borderColor = line;
141
+ const stripe = style(alt, 'background-color');
142
+ if (stripe && stripe !== bodyBg)
143
+ out.zebraColor = stripe;
144
+ const groupFill = style(group, 'background-color');
145
+ const groupText = style(group, 'color');
146
+ if (groupFill && groupFill !== bodyBg)
147
+ out.groupColor = groupFill;
148
+ if (groupText)
149
+ out.groupTextColor = groupText;
150
+ return out;
151
+ }
152
+ /** Page sizes in pt (portrait), for the content width the charts fill. */
153
+ const PAGE_PT = {
154
+ A4: [595.28, 841.89], A3: [841.89, 1190.55], A5: [419.53, 595.28], LETTER: [612, 792], LEGAL: [612, 1008],
155
+ };
156
+ /**
157
+ * Turn every `element` chart into an image through `rasterize` (the grid's
158
+ * `chartToPngBlob`, injected so this stays testable without a canvas); image
159
+ * charts pass through. Order is kept.
160
+ */
161
+ export async function resolvePdfCharts(charts, rasterize) {
162
+ if (!charts?.length)
163
+ return [];
164
+ const out = [];
165
+ for (const c of charts) {
166
+ if ('image' in c) {
167
+ out.push(c);
168
+ continue;
169
+ }
170
+ const blob = await rasterize(c.element);
171
+ const image = await new Promise((resolve, reject) => {
172
+ const fr = new FileReader();
173
+ fr.onload = () => resolve(String(fr.result));
174
+ fr.onerror = () => reject(fr.error ?? new Error('could not read the chart image'));
175
+ fr.readAsDataURL(blob);
176
+ });
177
+ out.push({ image, title: c.title, caption: c.caption, width: c.width });
178
+ }
179
+ return out;
180
+ }
12
181
  /**
13
182
  * Build a pdfmake docDefinition from resolved columns + formatted string rows.
14
183
  * `now` is injected for a deterministic footer date in tests.
@@ -16,29 +185,79 @@
16
185
  export function buildPdfDocDefinition(params) {
17
186
  const { columns } = params;
18
187
  const o = params.opts ?? {};
188
+ const st = params.styles ?? {};
189
+ const theme = params.theme ?? {};
19
190
  const now = params.now ?? new Date(0);
20
191
  const fontSize = o.fontSize ?? 8;
21
- const headerColor = o.headerColor ?? '#334155';
22
- const headerTextColor = o.headerTextColor ?? '#ffffff';
192
+ // Explicit PDF options, then the blanket styles, then the grid on screen, then the slate defaults.
193
+ const headerColor = o.headerColor ?? st.headerRow?.backgroundColor ?? theme.headerColor ?? '#334155';
194
+ const headerTextColor = o.headerTextColor ?? st.headerRow?.color ?? theme.headerTextColor ?? '#ffffff';
23
195
  const zebra = o.zebra ?? true;
24
- const zebraColor = o.zebraColor ?? '#f1f5f9';
25
- const groupColor = o.groupColor ?? '#e2e8f0';
26
- const groupTextColor = o.groupTextColor ?? '#0f172a';
27
- const subtotalColor = o.subtotalColor ?? '#f8fafc';
196
+ const zebraColor = o.zebraColor ?? st.rowAlternate?.backgroundColor ?? theme.zebraColor ?? '#f1f5f9';
197
+ const groupColor = o.groupColor ?? theme.groupColor ?? '#e2e8f0';
198
+ const groupTextColor = o.groupTextColor ?? theme.groupTextColor ?? '#0f172a';
199
+ const subtotalColor = o.subtotalColor ?? theme.subtotalColor ?? '#f8fafc';
200
+ const textColor = o.textColor ?? st.rows?.color ?? theme.textColor;
201
+ const borderColor = o.borderColor ?? theme.borderColor ?? '#e2e8f0';
28
202
  const repeatHeader = o.repeatHeader ?? true;
203
+ const isBold = (w) => w === 'bold' || (typeof w === 'number' && w >= 600);
204
+ const ptSize = (v) => {
205
+ if (v === undefined)
206
+ return undefined;
207
+ const n = typeof v === 'number' ? v : parseFloat(v);
208
+ return Number.isFinite(n) && n > 0 ? n : undefined;
209
+ };
210
+ /** Lay one cell style over a cell, keys the style names. */
211
+ const applyStyle = (cell, s) => {
212
+ if (!s)
213
+ return;
214
+ if (s.backgroundColor)
215
+ cell.fillColor = s.backgroundColor;
216
+ if (s.color)
217
+ cell.color = s.color;
218
+ if (isBold(s.fontWeight))
219
+ cell.bold = true;
220
+ else if (s.fontWeight === 'normal')
221
+ cell.bold = false;
222
+ if (s.fontStyle === 'italic')
223
+ cell.italics = true;
224
+ const size = ptSize(s.fontSize);
225
+ if (size)
226
+ cell.fontSize = size;
227
+ if (s.textAlign)
228
+ cell.alignment = s.textAlign;
229
+ };
230
+ // Per-cell overrides by A1 reference: row 1 is the header, so a data row
231
+ // `r` (0-based) is row `r + 2`, matching the xlsx and html writers.
232
+ const cellRefs = new Map();
233
+ for (const [ref, s] of Object.entries(st.cells ?? {})) {
234
+ const m = /^([A-Z]+)(\d+)$/i.exec(ref.trim());
235
+ if (!m)
236
+ continue;
237
+ let col = 0;
238
+ for (const ch of m[1].toUpperCase())
239
+ col = col * 26 + (ch.charCodeAt(0) - 64);
240
+ cellRefs.set(`${Number(m[2]) - 1}:${col - 1}`, s);
241
+ }
29
242
  const orientation = o.pageOrientation ??
30
243
  (columns.length > (o.autoLandscapeThreshold ?? 8) ? 'landscape' : 'portrait');
31
244
  const widths = Array.isArray(o.columnWidths)
32
245
  ? o.columnWidths
33
246
  : columns.map(() => (o.columnWidths === 'auto' ? 'auto' : '*'));
34
247
  // Header row.
35
- const headerRow = columns.map((c) => ({
36
- text: c.header,
37
- bold: true,
38
- alignment: c.align ?? 'left',
39
- color: headerTextColor,
40
- fillColor: headerColor,
41
- }));
248
+ const headerRow = columns.map((c, ci) => {
249
+ const cell = {
250
+ text: c.header,
251
+ bold: true,
252
+ alignment: c.align ?? 'left',
253
+ color: headerTextColor,
254
+ fillColor: headerColor,
255
+ };
256
+ // The blanket header style already set the colours above; its weight, size and alignment apply here.
257
+ applyStyle(cell, st.headerRow ? { ...st.headerRow, backgroundColor: undefined, color: undefined } : undefined);
258
+ applyStyle(cell, cellRefs.get(`0:${ci}`));
259
+ return cell;
260
+ });
42
261
  // Normalize to a structured body: `body` wins, else wrap flat `rows`.
43
262
  const model = params.body ?? (params.rows ?? []).map((cells) => ({ kind: 'data', cells }));
44
263
  // Track which body-row indices are plain data rows, so zebra striping only
@@ -75,6 +294,13 @@ export function buildPdfDocDefinition(params) {
75
294
  const ord = dataOrdinal++;
76
295
  bodyCells.push(columns.map((c, ci) => {
77
296
  const cell = { text: row.cells[ci] ?? '', alignment: c.align ?? 'left' };
297
+ if (textColor)
298
+ cell.color = textColor;
299
+ // Blanket row style, the zebra text colour on alternate rows, then the A1 override.
300
+ applyStyle(cell, st.rows ? { ...st.rows, backgroundColor: undefined } : undefined);
301
+ if (zebra && ord % 2 === 1 && st.rowAlternate?.color)
302
+ cell.color = st.rowAlternate.color;
303
+ applyStyle(cell, cellRefs.get(`${ord + 1}:${ci}`));
78
304
  const s = dataCellStyle?.(ord, ci);
79
305
  if (s) {
80
306
  if (s.fill)
@@ -95,6 +321,37 @@ export function buildPdfDocDefinition(params) {
95
321
  }));
96
322
  }
97
323
  });
324
+ // Merged data cells: pdfmake spans from the top-left cell and expects the
325
+ // covered cells to be present and empty. Only flat exports: with group
326
+ // or subtotal rows the data row numbering would not be the body's.
327
+ if (params.merges?.length && !params.body) {
328
+ const dataRowsAt = [...dataRowIdx].sort((a, b) => a - b);
329
+ for (const m of params.merges) {
330
+ const rs = Math.max(1, Math.floor(m.rowSpan ?? 1));
331
+ const cs = Math.max(1, Math.floor(m.colSpan ?? 1));
332
+ if (rs === 1 && cs === 1)
333
+ continue;
334
+ const top = dataRowsAt[m.row];
335
+ if (top === undefined || m.col < 0 || m.col >= columns.length)
336
+ continue;
337
+ const anchor = bodyCells[top]?.[m.col];
338
+ if (!anchor)
339
+ continue;
340
+ if (rs > 1)
341
+ anchor.rowSpan = Math.min(rs, bodyCells.length - top);
342
+ if (cs > 1)
343
+ anchor.colSpan = Math.min(cs, columns.length - m.col);
344
+ for (let r = 0; r < (anchor.rowSpan ?? 1); r += 1) {
345
+ for (let c = 0; c < (anchor.colSpan ?? 1); c += 1) {
346
+ if (r === 0 && c === 0)
347
+ continue;
348
+ const covered = bodyCells[top + r]?.[m.col + c];
349
+ if (covered)
350
+ covered.text = '';
351
+ }
352
+ }
353
+ }
354
+ }
98
355
  const table = {
99
356
  table: {
100
357
  headerRows: repeatHeader ? 1 : 0,
@@ -107,22 +364,96 @@ export function buildPdfDocDefinition(params) {
107
364
  fillColor: (rowIndex) => zebra && rowIndex > 0 && rowIndex % 2 === 0 && dataRowIdx.has(rowIndex) ? zebraColor : null,
108
365
  hLineWidth: () => 0.5,
109
366
  vLineWidth: () => 0.5,
110
- hLineColor: () => '#e2e8f0',
111
- vLineColor: () => '#e2e8f0',
367
+ hLineColor: () => borderColor,
368
+ vLineColor: () => borderColor,
112
369
  paddingTop: () => 3,
113
370
  paddingBottom: () => 3,
114
371
  paddingLeft: () => 5,
115
372
  paddingRight: () => 5,
116
373
  },
117
374
  };
375
+ // The lines `ExportOptions.header` / `footer` carry: text with a style, an
376
+ // image, or a left / centre / right triple, above and below the table the
377
+ // way the xlsx writer puts them in rows around it.
378
+ const pageLines = (lines, margin) => (lines ?? []).map((line) => {
379
+ if ('image' in line) {
380
+ return { image: line.image, ...(line.width ? { width: line.width } : {}), ...(line.height ? { height: line.height } : {}), margin };
381
+ }
382
+ if ('text' in line) {
383
+ const cell = { text: line.text };
384
+ applyStyle(cell, line.style);
385
+ return { ...cell, margin };
386
+ }
387
+ return {
388
+ columns: [
389
+ { text: line.left ?? '', alignment: 'left' },
390
+ { text: line.center ?? '', alignment: 'center' },
391
+ { text: line.right ?? '', alignment: 'right' },
392
+ ],
393
+ margin,
394
+ };
395
+ });
118
396
  const content = [];
397
+ content.push(...pageLines(params.headerLines, [0, 0, 0, 4]));
119
398
  if (o.logo)
120
399
  content.push({ image: o.logo, width: o.logoWidth ?? 90, margin: [0, 0, 0, 8] });
121
400
  if (o.title)
122
401
  content.push({ text: o.title, fontSize: fontSize + 8, bold: true, margin: [0, 0, 0, 2] });
123
402
  if (o.subtitle)
124
403
  content.push({ text: o.subtitle, fontSize: fontSize + 1, color: '#64748b', margin: [0, 0, 0, 8] });
404
+ // The KPI strip: one row of boxes, each a label over a big number.
405
+ if (o.kpis?.length) {
406
+ const fill = o.kpiColor ?? '#f8fafc';
407
+ content.push({
408
+ table: {
409
+ widths: o.kpis.map(() => '*'),
410
+ body: [
411
+ o.kpis.map((k) => ({
412
+ fillColor: fill,
413
+ margin: [8, 6, 8, 6],
414
+ stack: [
415
+ { text: k.label, fontSize: fontSize, color: '#64748b' },
416
+ { text: k.value, fontSize: fontSize + 10, bold: true, margin: [0, 2, 0, 0] },
417
+ ...(k.delta ? [{ text: k.delta, fontSize: fontSize, color: k.color ?? '#64748b', margin: [0, 2, 0, 0] }] : []),
418
+ ],
419
+ })),
420
+ ],
421
+ },
422
+ layout: {
423
+ hLineWidth: () => 0,
424
+ vLineWidth: () => 4,
425
+ vLineColor: () => '#ffffff',
426
+ paddingLeft: () => 0,
427
+ paddingRight: () => 0,
428
+ paddingTop: () => 0,
429
+ paddingBottom: () => 0,
430
+ },
431
+ margin: [0, 0, 0, 10],
432
+ });
433
+ }
434
+ // Charts: the resolved images, at the content width unless told otherwise.
435
+ const margins = o.margins ?? [28, 34, 28, 34];
436
+ const [pw, ph] = PAGE_PT[o.pageSize ?? 'A4'];
437
+ const contentWidth = (orientation === 'landscape' ? ph : pw) - margins[0] - margins[2];
438
+ const chartImages = params.charts ?? (o.charts ?? []).filter((c) => 'image' in c);
439
+ const chartBlocks = chartImages.map((c) => ({
440
+ stack: [
441
+ ...(c.title ? [{ text: c.title, fontSize: fontSize + 3, bold: true, margin: [0, 0, 0, 4] }] : []),
442
+ { image: c.image, width: Math.min(c.width ?? contentWidth, contentWidth) },
443
+ ...(c.caption ? [{ text: c.caption, fontSize: fontSize, color: '#64748b', margin: [0, 3, 0, 0] }] : []),
444
+ ],
445
+ margin: [0, 0, 0, 12],
446
+ unbreakable: true,
447
+ }));
448
+ if (o.chartsPosition !== 'below')
449
+ content.push(...chartBlocks);
125
450
  content.push(table);
451
+ if (o.chartsPosition === 'below') {
452
+ if (chartBlocks.length)
453
+ content.push({ text: '', margin: [0, 0, 0, 12] });
454
+ content.push(...chartBlocks);
455
+ }
456
+ content.push(...pageLines(params.footerLines, [0, 4, 0, 0]));
126
457
  const def = {
127
458
  pageSize: o.pageSize ?? 'A4',
128
459
  pageOrientation: orientation,
package/dist/export.js CHANGED
@@ -6,7 +6,7 @@ import { installSmartShim } from './smart-shim.js';
6
6
  import { downloadBlobFile, downloadTextFile, serializeDelimited, serializeHtml, serializeJson, serializeMarkdown, serializeXml, } from './export-serialize.js';
7
7
  import { serializeSpreadsheetML } from './export-xls.js';
8
8
  import { buildXlsxParts, packageXlsx } from './export-ooxml.js';
9
- import { buildPdfDocDefinition } from './export-pdf.js';
9
+ import { buildPdfDocDefinition, readGridPdfTheme, registerPdfFonts, resolvePdfCharts } from './export-pdf.js';
10
10
  import { buildConditionalResolver } from './export-conditional.js';
11
11
  /** Formats served by the native, dependency-free, streaming serializers. */
12
12
  const NATIVE_TEXT_FORMATS = [
@@ -68,14 +68,11 @@ async function ensureGlobals(format) {
68
68
  'Install it with: pnpm add pdfmake');
69
69
  }
70
70
  const pdfMake = (pdfMakeMod.default ?? pdfMakeMod);
71
- const vfsRoot = vfsMod.default ?? vfsMod;
72
- // pdfmake's vfs_fonts file historically exports either { pdfMake: { vfs } }
73
- // or { default: { vfs } } or { vfs } depending on bundler. Try each shape.
74
- const candidate = vfsRoot.pdfMake?.vfs ??
75
- vfsRoot.vfs ??
76
- vfsRoot.default?.vfs;
77
- if (candidate)
78
- pdfMake.vfs = candidate;
71
+ // Explicit, on this instance: the fonts module's own registration is a
72
+ // side effect on a global that can point at a stale instance.
73
+ if (!registerPdfFonts(pdfMake, vfsMod)) {
74
+ throw new Error('@svgrid/enterprise: "pdfmake/build/vfs_fonts" did not contain a font map; the installed pdfmake is not one this export knows.');
75
+ }
79
76
  g.pdfMake = pdfMake;
80
77
  }
81
78
  }
@@ -637,13 +634,26 @@ async function exportPdf(api, opts) {
637
634
  ...opts.pdf,
638
635
  pageOrientation: opts.pdf?.pageOrientation ?? opts.pageOrientation,
639
636
  };
637
+ // The grid on screen lends its colours unless told not to; explicit
638
+ // `pdf` colours and `styles` still win inside the builder.
639
+ const theme = pdfOpts.matchTheme === false ? {} : readGridPdfTheme(api.getElement?.() ?? null);
640
+ const lines = { headerLines: opts.header, footerLines: opts.footer };
641
+ // Charts handed over as elements are rasterised here, once, through the
642
+ // grid chart's own PNG path at 2x, so the page gets the picture on screen.
643
+ // The rasteriser comes from the grid's barrel, imported on demand: the
644
+ // barrel carries the Svelte components, and a static import would drag them
645
+ // into every export call site (and into the Svelte-free test project).
646
+ const charts = await resolvePdfCharts(pdfOpts.charts, async (el) => {
647
+ const { chartToPngBlob } = await import('@svgrid/grid');
648
+ return chartToPngBlob(el, { scale: 2 });
649
+ });
640
650
  const now = new Date();
641
651
  let def;
642
652
  if (effGroupBy?.length) {
643
653
  // Conditional formatting is skipped for grouped PDFs (group / subtotal
644
654
  // rows own the layout); the grid colors still show on screen.
645
655
  const body = buildGroupedPdfBody(cols, sourceRows, effGroupBy);
646
- def = buildPdfDocDefinition({ columns, body, opts: pdfOpts, now });
656
+ def = buildPdfDocDefinition({ columns, body, opts: pdfOpts, styles: opts.styles, theme, ...lines, charts, now });
647
657
  }
648
658
  else {
649
659
  const projected = await projectRows(sourceRows, cols, opts);
@@ -667,6 +677,11 @@ async function exportPdf(api, opts) {
667
677
  },
668
678
  dataCellLink: link,
669
679
  opts: pdfOpts,
680
+ styles: opts.styles,
681
+ theme,
682
+ ...lines,
683
+ merges: opts.merges,
684
+ charts,
670
685
  now,
671
686
  });
672
687
  }