@svgrid/grid 1.2.22 → 1.2.24

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 (263) hide show
  1. package/dist/GridFooter.svelte +34 -20
  2. package/dist/GridFooter.svelte.d.ts +8 -0
  3. package/dist/SvAutoComplete.svelte +89 -0
  4. package/dist/SvAutoComplete.svelte.d.ts +16 -0
  5. package/dist/SvButton.svelte +97 -0
  6. package/dist/SvButton.svelte.d.ts +23 -0
  7. package/dist/SvCalendar.svelte +409 -0
  8. package/dist/SvCalendar.svelte.d.ts +52 -0
  9. package/dist/SvCheckBox.svelte +82 -0
  10. package/dist/SvCheckBox.svelte.d.ts +19 -0
  11. package/dist/SvColorInput.svelte +160 -0
  12. package/dist/SvColorInput.svelte.d.ts +15 -0
  13. package/dist/SvComboBox.svelte +108 -0
  14. package/dist/SvComboBox.svelte.d.ts +15 -0
  15. package/dist/SvCountryInput.svelte +125 -0
  16. package/dist/SvCountryInput.svelte.d.ts +14 -0
  17. package/dist/SvDateTimePicker.svelte +265 -0
  18. package/dist/SvDateTimePicker.svelte.d.ts +38 -0
  19. package/dist/SvDropDownList.svelte +120 -0
  20. package/dist/SvDropDownList.svelte.d.ts +15 -0
  21. package/dist/SvForm.svelte +147 -0
  22. package/dist/SvForm.svelte.d.ts +29 -0
  23. package/dist/SvGauge.svelte +97 -0
  24. package/dist/SvGauge.svelte.d.ts +26 -0
  25. package/dist/SvGrid.controller.svelte.d.ts +16 -2
  26. package/dist/SvGrid.controller.svelte.js +63 -8
  27. package/dist/SvGrid.css +84 -31
  28. package/dist/SvGrid.helpers.d.ts +4 -0
  29. package/dist/SvGrid.helpers.js +40 -12
  30. package/dist/SvGrid.svelte +84 -5
  31. package/dist/SvGrid.types.d.ts +36 -0
  32. package/dist/SvGridDropdown.svelte +16 -30
  33. package/dist/SvGridDropdown.svelte.d.ts +4 -0
  34. package/dist/SvListBox.svelte +89 -0
  35. package/dist/SvListBox.svelte.d.ts +22 -0
  36. package/dist/SvMaskedInput.svelte +66 -0
  37. package/dist/SvMaskedInput.svelte.d.ts +15 -0
  38. package/dist/SvNumberInput.svelte +116 -0
  39. package/dist/SvNumberInput.svelte.d.ts +18 -0
  40. package/dist/SvPasswordInput.svelte +100 -0
  41. package/dist/SvPasswordInput.svelte.d.ts +18 -0
  42. package/dist/SvPhoneInput.svelte +87 -0
  43. package/dist/SvPhoneInput.svelte.d.ts +19 -0
  44. package/dist/SvRadioGroup.svelte +85 -0
  45. package/dist/SvRadioGroup.svelte.d.ts +20 -0
  46. package/dist/SvRating.svelte +91 -0
  47. package/dist/SvRating.svelte.d.ts +18 -0
  48. package/dist/SvRepeatButton.svelte +89 -0
  49. package/dist/SvRepeatButton.svelte.d.ts +21 -0
  50. package/dist/SvSlider.svelte +155 -0
  51. package/dist/SvSlider.svelte.d.ts +20 -0
  52. package/dist/SvSwitchButton.svelte +87 -0
  53. package/dist/SvSwitchButton.svelte.d.ts +14 -0
  54. package/dist/SvTabs.svelte +109 -0
  55. package/dist/SvTabs.svelte.d.ts +26 -0
  56. package/dist/SvTagsInput.svelte +70 -0
  57. package/dist/SvTagsInput.svelte.d.ts +14 -0
  58. package/dist/SvTimePicker.svelte +201 -0
  59. package/dist/SvTimePicker.svelte.d.ts +30 -0
  60. package/dist/SvToggleButton.svelte +57 -0
  61. package/dist/SvToggleButton.svelte.d.ts +16 -0
  62. package/dist/SvTree.svelte +131 -0
  63. package/dist/SvTree.svelte.d.ts +27 -0
  64. package/dist/build-api.js +78 -1
  65. package/dist/cdn/svgrid.js +11674 -5907
  66. package/dist/cdn/svgrid.svelte-external.js +10436 -4671
  67. package/dist/cell-render.d.ts +4 -0
  68. package/dist/cell-render.js +35 -1
  69. package/dist/clipboard.js +19 -1
  70. package/dist/collaboration.d.ts +2 -0
  71. package/dist/collaboration.js +4 -0
  72. package/dist/core.d.ts +22 -1
  73. package/dist/countries.d.ts +15 -0
  74. package/dist/countries.js +61 -0
  75. package/dist/createAutocomplete.svelte.d.ts +77 -0
  76. package/dist/createAutocomplete.svelte.js +100 -0
  77. package/dist/createCalendar.svelte.d.ts +192 -0
  78. package/dist/createCalendar.svelte.js +402 -0
  79. package/dist/createCheckbox.svelte.d.ts +45 -0
  80. package/dist/createCheckbox.svelte.js +26 -0
  81. package/dist/createColorInput.svelte.d.ts +67 -0
  82. package/dist/createColorInput.svelte.js +100 -0
  83. package/dist/createCombobox.svelte.d.ts +102 -0
  84. package/dist/createCombobox.svelte.js +171 -0
  85. package/dist/createCountryInput.svelte.d.ts +86 -0
  86. package/dist/createCountryInput.svelte.js +126 -0
  87. package/dist/createDateTimePicker.svelte.d.ts +83 -0
  88. package/dist/createDateTimePicker.svelte.js +202 -0
  89. package/dist/createDropdownList.svelte.d.ts +78 -0
  90. package/dist/createDropdownList.svelte.js +117 -0
  91. package/dist/createGauge.svelte.d.ts +56 -0
  92. package/dist/createGauge.svelte.js +49 -0
  93. package/dist/createListbox.svelte.d.ts +79 -0
  94. package/dist/createListbox.svelte.js +117 -0
  95. package/dist/createMaskedInput.svelte.d.ts +30 -0
  96. package/dist/createMaskedInput.svelte.js +62 -0
  97. package/dist/createNumberInput.svelte.d.ts +72 -0
  98. package/dist/createNumberInput.svelte.js +167 -0
  99. package/dist/createPasswordInput.svelte.d.ts +60 -0
  100. package/dist/createPasswordInput.svelte.js +72 -0
  101. package/dist/createPhoneInput.svelte.d.ts +46 -0
  102. package/dist/createPhoneInput.svelte.js +105 -0
  103. package/dist/createRadioGroup.svelte.d.ts +64 -0
  104. package/dist/createRadioGroup.svelte.js +73 -0
  105. package/dist/createRating.svelte.d.ts +70 -0
  106. package/dist/createRating.svelte.js +85 -0
  107. package/dist/createSlider.svelte.d.ts +71 -0
  108. package/dist/createSlider.svelte.js +123 -0
  109. package/dist/createSwitch.svelte.d.ts +43 -0
  110. package/dist/createSwitch.svelte.js +41 -0
  111. package/dist/createTabs.svelte.d.ts +78 -0
  112. package/dist/createTabs.svelte.js +92 -0
  113. package/dist/createTagsInput.svelte.d.ts +65 -0
  114. package/dist/createTagsInput.svelte.js +93 -0
  115. package/dist/createTimePicker.svelte.d.ts +106 -0
  116. package/dist/createTimePicker.svelte.js +248 -0
  117. package/dist/createToggle.svelte.d.ts +43 -0
  118. package/dist/createToggle.svelte.js +39 -0
  119. package/dist/createTree.svelte.d.ts +96 -0
  120. package/dist/createTree.svelte.js +194 -0
  121. package/dist/datetime/date-core.d.ts +88 -0
  122. package/dist/datetime/date-core.js +165 -0
  123. package/dist/datetime/date-format.d.ts +39 -0
  124. package/dist/datetime/date-format.js +371 -0
  125. package/dist/datetime/date-restrict.d.ts +23 -0
  126. package/dist/datetime/date-restrict.js +50 -0
  127. package/dist/datetime/date-selection.d.ts +25 -0
  128. package/dist/datetime/date-selection.js +94 -0
  129. package/dist/datetime/mask.d.ts +21 -0
  130. package/dist/datetime/mask.js +90 -0
  131. package/dist/editing.d.ts +1 -1
  132. package/dist/editing.js +7 -0
  133. package/dist/editor-contract.d.ts +48 -0
  134. package/dist/editor-contract.js +26 -0
  135. package/dist/editors/cell-editors.d.ts +2 -2
  136. package/dist/editors/cell-editors.js +3 -1
  137. package/dist/export-format.d.ts +178 -0
  138. package/dist/export-format.js +419 -0
  139. package/dist/hyperformula-adapter.d.ts +4 -0
  140. package/dist/hyperformula-adapter.js +15 -6
  141. package/dist/index.d.ts +60 -0
  142. package/dist/index.js +72 -0
  143. package/dist/list-option.d.ts +10 -0
  144. package/dist/list-option.js +7 -0
  145. package/dist/menus.js +18 -2
  146. package/dist/popover.d.ts +48 -0
  147. package/dist/popover.js +65 -0
  148. package/dist/row-resize.d.ts +4 -4
  149. package/dist/row-resize.js +8 -5
  150. package/dist/selection.d.ts +6 -0
  151. package/dist/selection.js +31 -5
  152. package/dist/server-data-source.d.ts +43 -0
  153. package/dist/server-data-source.js +100 -0
  154. package/dist/sparkline.js +8 -4
  155. package/dist/svgrid-wrapper.types.d.ts +26 -1
  156. package/package.json +6 -1
  157. package/src/GridFooter.svelte +34 -20
  158. package/src/SvAutoComplete.svelte +89 -0
  159. package/src/SvButton.svelte +97 -0
  160. package/src/SvCalendar.svelte +409 -0
  161. package/src/SvCalendar.test.ts +211 -0
  162. package/src/SvCheckBox.svelte +82 -0
  163. package/src/SvColorInput.svelte +160 -0
  164. package/src/SvComboBox.svelte +108 -0
  165. package/src/SvCountryInput.svelte +125 -0
  166. package/src/SvDateTimePicker.svelte +265 -0
  167. package/src/SvDateTimePicker.test.ts +136 -0
  168. package/src/SvDropDownList.svelte +120 -0
  169. package/src/SvForm.svelte +147 -0
  170. package/src/SvGauge.svelte +97 -0
  171. package/src/SvGrid.controller.svelte.ts +74 -8
  172. package/src/SvGrid.css +84 -31
  173. package/src/SvGrid.helpers.ts +41 -12
  174. package/src/SvGrid.svelte +84 -5
  175. package/src/SvGrid.types.ts +33 -0
  176. package/src/SvGridDropdown.svelte +16 -30
  177. package/src/SvListBox.svelte +89 -0
  178. package/src/SvMaskedInput.svelte +66 -0
  179. package/src/SvNumberInput.svelte +116 -0
  180. package/src/SvPasswordInput.svelte +100 -0
  181. package/src/SvPhoneInput.svelte +87 -0
  182. package/src/SvRadioGroup.svelte +85 -0
  183. package/src/SvRating.svelte +91 -0
  184. package/src/SvRepeatButton.svelte +89 -0
  185. package/src/SvSlider.svelte +155 -0
  186. package/src/SvSwitchButton.svelte +87 -0
  187. package/src/SvTabs.svelte +109 -0
  188. package/src/SvTagsInput.svelte +70 -0
  189. package/src/SvTimePicker.svelte +201 -0
  190. package/src/SvTimePicker.test.ts +98 -0
  191. package/src/SvToggleButton.svelte +57 -0
  192. package/src/SvTree.svelte +131 -0
  193. package/src/build-api.ts +115 -0
  194. package/src/cell-render.test.ts +38 -0
  195. package/src/cell-render.ts +43 -0
  196. package/src/clipboard.test.ts +18 -0
  197. package/src/clipboard.ts +24 -1
  198. package/src/collaboration.test.ts +30 -0
  199. package/src/collaboration.ts +6 -0
  200. package/src/core.ts +27 -3
  201. package/src/countries.ts +71 -0
  202. package/src/createAutocomplete.svelte.ts +104 -0
  203. package/src/createCalendar.svelte.ts +488 -0
  204. package/src/createCheckbox.svelte.ts +74 -0
  205. package/src/createColorInput.svelte.ts +115 -0
  206. package/src/createCombobox.svelte.ts +158 -0
  207. package/src/createCountryInput.svelte.ts +126 -0
  208. package/src/createDateTimePicker.svelte.ts +216 -0
  209. package/src/createDropdownList.svelte.ts +125 -0
  210. package/src/createGauge.svelte.ts +86 -0
  211. package/src/createListbox.svelte.ts +186 -0
  212. package/src/createMaskedInput.svelte.ts +81 -0
  213. package/src/createNumberInput.svelte.ts +193 -0
  214. package/src/createPasswordInput.svelte.ts +87 -0
  215. package/src/createPhoneInput.svelte.ts +119 -0
  216. package/src/createRadioGroup.svelte.ts +132 -0
  217. package/src/createRating.svelte.ts +145 -0
  218. package/src/createSlider.svelte.ts +160 -0
  219. package/src/createSwitch.svelte.ts +78 -0
  220. package/src/createTabs.svelte.ts +129 -0
  221. package/src/createTagsInput.svelte.ts +98 -0
  222. package/src/createTimePicker.svelte.ts +289 -0
  223. package/src/createToggle.svelte.ts +69 -0
  224. package/src/createTree.svelte.ts +216 -0
  225. package/src/datetime/date-core.test.ts +217 -0
  226. package/src/datetime/date-core.ts +204 -0
  227. package/src/datetime/date-format.test.ts +121 -0
  228. package/src/datetime/date-format.ts +317 -0
  229. package/src/datetime/date-restrict.ts +60 -0
  230. package/src/datetime/date-selection.test.ts +129 -0
  231. package/src/datetime/date-selection.ts +137 -0
  232. package/src/datetime/mask.test.ts +36 -0
  233. package/src/datetime/mask.ts +84 -0
  234. package/src/editing.test.ts +22 -0
  235. package/src/editing.ts +7 -1
  236. package/src/editor-contract.test.ts +32 -0
  237. package/src/editor-contract.ts +60 -0
  238. package/src/editors/cell-editors.ts +7 -1
  239. package/src/export-data-api.test.ts +126 -0
  240. package/src/export-format.test.ts +107 -0
  241. package/src/export-format.ts +598 -0
  242. package/src/hyperformula-adapter.test.ts +35 -1
  243. package/src/hyperformula-adapter.ts +18 -6
  244. package/src/index.ts +110 -0
  245. package/src/list-option.ts +15 -0
  246. package/src/menus.ts +21 -2
  247. package/src/popover.ts +79 -0
  248. package/src/row-resize.test.ts +25 -0
  249. package/src/row-resize.ts +8 -5
  250. package/src/selection.test.ts +36 -4
  251. package/src/selection.ts +30 -9
  252. package/src/server-data-source.test.ts +201 -0
  253. package/src/server-data-source.ts +148 -0
  254. package/src/sparkline.test.ts +9 -0
  255. package/src/sparkline.ts +9 -4
  256. package/src/svgrid-wrapper.types.ts +28 -1
  257. package/src/svgrid.behavior.test.ts +27 -0
  258. package/src/svgrid.new-features.wrapper.test.ts +27 -1
  259. package/src/ui-buttons.test.ts +105 -0
  260. package/src/ui-composite.test.ts +89 -0
  261. package/src/ui-inputs.test.ts +118 -0
  262. package/src/ui-range.test.ts +61 -0
  263. package/src/ui-selection.test.ts +119 -0
package/dist/editing.js CHANGED
@@ -299,6 +299,13 @@ export function createEditing(ctx) {
299
299
  * (no preventDefault) whenever the async API is unavailable.
300
300
  */
301
301
  function onGridPaste(event) {
302
+ // A cell is being edited: the focused editor input handles its own paste
303
+ // natively. Never hijack it for a range paste - doing so (on Firefox /
304
+ // insecure contexts, where the async Clipboard API is unavailable) would
305
+ // preventDefault the editor's paste and write to the data cell instead,
306
+ // so the edit "wouldn't update".
307
+ if (ctx.editingCell)
308
+ return;
302
309
  // When the async API is available the keydown handler already pasted via
303
310
  // pasteFromClipboard(); ignore the (suppressed) native event so we don't
304
311
  // paste twice.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The shared "editor contract" for the SvGrid UI kit.
3
+ *
4
+ * Every value-bearing editor (inputs, selects, pickers) accepts this common set
5
+ * of props so forms, validation and accessibility behave IDENTICALLY across the
6
+ * kit - the same spirit as the grid's headless core, applied to the editors.
7
+ * Components spread their own `value` / options / behavior on top of this base.
8
+ *
9
+ * Framework-free (no Svelte, no DOM) so it can be unit-tested and reused.
10
+ */
11
+ export type EditorSize = 'sm' | 'md' | 'lg';
12
+ /** Props shared by every value-bearing editor in the kit. */
13
+ export type SvEditorProps = {
14
+ /** Disable interaction + form submission. */
15
+ disabled?: boolean;
16
+ /** Read-only: the value is shown but not editable. */
17
+ readonly?: boolean;
18
+ /** Required for validation (adds `aria-required` + participates in validity). */
19
+ required?: boolean;
20
+ /** Marks the control invalid (`aria-invalid` + error styling). */
21
+ invalid?: boolean;
22
+ /** Error message; when set it is announced via `aria-describedby` and shown. */
23
+ error?: string;
24
+ /** Control size / density. */
25
+ size?: EditorSize;
26
+ /** Form field name; the editor emits a hidden input carrying its value. */
27
+ name?: string;
28
+ /** Root/control element id (the error-text id derives from it). */
29
+ id?: string;
30
+ /** Accessible name when there is no visible `<label>`. */
31
+ ariaLabel?: string;
32
+ };
33
+ /** Stable DOM id for an editor's error text, for `aria-describedby` wiring. */
34
+ export declare const editorErrorId: (id?: string) => string | undefined;
35
+ /** A subset of {@link SvEditorProps} that drives ARIA on the focusable control. */
36
+ export type EditorAriaState = Pick<SvEditorProps, 'id' | 'invalid' | 'required' | 'error' | 'ariaLabel'>;
37
+ /**
38
+ * ARIA attributes for the focusable control of an editor, derived from its state.
39
+ * Spread onto the input/button/combobox:
40
+ * `<input {...editorAria({ id, invalid, required, error, ariaLabel })} />`
41
+ * Undefined values are omitted by Svelte, so unset props add no attributes.
42
+ */
43
+ export declare function editorAria(state: EditorAriaState): {
44
+ 'aria-invalid': 'true' | undefined;
45
+ 'aria-required': 'true' | undefined;
46
+ 'aria-describedby': string | undefined;
47
+ 'aria-label': string | undefined;
48
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The shared "editor contract" for the SvGrid UI kit.
3
+ *
4
+ * Every value-bearing editor (inputs, selects, pickers) accepts this common set
5
+ * of props so forms, validation and accessibility behave IDENTICALLY across the
6
+ * kit - the same spirit as the grid's headless core, applied to the editors.
7
+ * Components spread their own `value` / options / behavior on top of this base.
8
+ *
9
+ * Framework-free (no Svelte, no DOM) so it can be unit-tested and reused.
10
+ */
11
+ /** Stable DOM id for an editor's error text, for `aria-describedby` wiring. */
12
+ export const editorErrorId = (id) => (id ? `${id}__error` : undefined);
13
+ /**
14
+ * ARIA attributes for the focusable control of an editor, derived from its state.
15
+ * Spread onto the input/button/combobox:
16
+ * `<input {...editorAria({ id, invalid, required, error, ariaLabel })} />`
17
+ * Undefined values are omitted by Svelte, so unset props add no attributes.
18
+ */
19
+ export function editorAria(state) {
20
+ return {
21
+ 'aria-invalid': state.invalid ? 'true' : undefined,
22
+ 'aria-required': state.required ? 'true' : undefined,
23
+ 'aria-describedby': state.error ? editorErrorId(state.id) : undefined,
24
+ 'aria-label': state.ariaLabel,
25
+ };
26
+ }
@@ -1,4 +1,4 @@
1
- export type CellEditorType = 'text' | 'number' | 'date' | 'datetime' | 'time' | 'password' | 'checkbox' | 'list' | 'chips' | 'select' | 'rich-select' | 'autocomplete' | 'textarea' | 'color' | 'rating';
1
+ export type CellEditorType = 'text' | 'number' | 'date' | 'datetime' | 'time' | 'date-native' | 'datetime-native' | 'time-native' | 'password' | 'checkbox' | 'list' | 'chips' | 'select' | 'rich-select' | 'autocomplete' | 'textarea' | 'color' | 'rating';
2
2
  /** Normalized option used by list/chips editors. The optional `color`
3
3
  * paints the chip - both in the in-cell readonly chips render and in
4
4
  * the dropdown trigger when `renderChipsInTrigger` is on. Any CSS
@@ -20,4 +20,4 @@ export declare function normalizeEditorOptions(options: ReadonlyArray<string | n
20
20
  label?: string;
21
21
  color?: string;
22
22
  }> | undefined): CellEditorOption[];
23
- export declare function parseEditorValue(type: CellEditorType, value: unknown, opts?: ParseEditorValueOptions): any;
23
+ export declare function parseEditorValue(rawType: CellEditorType, value: unknown, opts?: ParseEditorValueOptions): any;
@@ -14,7 +14,9 @@ export function normalizeEditorOptions(options) {
14
14
  };
15
15
  });
16
16
  }
17
- export function parseEditorValue(type, value, opts) {
17
+ export function parseEditorValue(rawType, value, opts) {
18
+ // `date-native` etc. parse identically to their rich counterparts.
19
+ const type = rawType.replace(/-native$/, '');
18
20
  if (type === 'number') {
19
21
  const parsed = Number(value);
20
22
  return Number.isFinite(parsed) ? parsed : null;
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Pure, render-free value formatting for data export. The grid's on-screen
3
+ * `formatCellValue` (see cell-render.ts) is a closure bound to a `Row<TData>`
4
+ * and the live table, so it can't be reused directly by an exporter that only
5
+ * has raw values + a column's `format` config. These helpers replicate the
6
+ * numeric / date / percent branches of that formatter as standalone functions:
7
+ *
8
+ * - `formatValueForExport(value, format)` returns the display STRING a user
9
+ * sees on screen, so CSV / TSV / HTML / PDF exports are faithful to the
10
+ * grid ("what you see is what you export") instead of dumping raw values.
11
+ * - `toExcelNumFmt(format)` maps a `CellFormatConfig` to an Excel number
12
+ * format code, so an xlsx cell can stay a real number / date while still
13
+ * displaying formatted (currency symbol, thousands, date pattern).
14
+ *
15
+ * Custom per-row `formatter` callbacks are intentionally NOT handled here -
16
+ * they may close over row/table state. Columns that need custom export text
17
+ * should provide an `exportValue(row)` hook at the export layer instead.
18
+ */
19
+ import type { CellFormatConfig } from './core';
20
+ export { computeColumnStat, contrastText, formatsNeedingStats, resolveCellFormat, type ColumnStat, type ConditionalFormat, type ResolvedCellFormat, } from './conditional-formatting';
21
+ /** Best-effort coercion of a cell value to a Date. Accepts Date, epoch ms
22
+ * numbers, and parseable date strings. Returns null when it isn't a date. */
23
+ export declare function coerceExportDate(value: unknown): Date | null;
24
+ /**
25
+ * Format a raw cell value to its on-screen display string using the column's
26
+ * `format` config. Mirrors the grid's own numeric / currency / percent / date
27
+ * branches. Values with no (or an unrecognised) format fall back to
28
+ * `String(value)`, and `null` / `undefined` become an empty string.
29
+ */
30
+ export declare function formatValueForExport(value: unknown, format: CellFormatConfig | undefined): string;
31
+ /**
32
+ * Map a `CellFormatConfig` to an Excel/OOXML number-format code, so an xlsx
33
+ * writer can keep the cell numeric/date while displaying it formatted.
34
+ * Returns `undefined` when the format has no natural Excel representation
35
+ * (or the caller should just write a string).
36
+ *
37
+ * These are deliberately conservative, widely-recognised codes:
38
+ * number → `#,##0[.00…]` (grouping + N decimals)
39
+ * currency → `"$"#,##0.00` (symbol + grouping + 2 decimals)
40
+ * percent → `0[.00…]%` (Excel multiplies by 100, so this pairs with a
41
+ * 0..1 fraction; see `valueForExcel`)
42
+ * date → `yyyy-mm-dd`, datetime → `yyyy-mm-dd hh:mm`
43
+ */
44
+ export declare function toExcelNumFmt(format: CellFormatConfig | undefined): string | undefined;
45
+ /**
46
+ * Turn a grid's data rows + columns into the header-first `{ field: value }`
47
+ * record shape the serializers consume, applying each column's `format` so
48
+ * the export matches what's on screen (unless `rawValues`). Optionally
49
+ * restricts + reorders columns to a `columns` field subset.
50
+ */
51
+ export declare function projectGridRows(dataRows: ReadonlyArray<Record<string, unknown>>, columns: ReadonlyArray<GridExportColumn>, opts?: {
52
+ columns?: ReadonlyArray<string>;
53
+ rawValues?: boolean;
54
+ }): {
55
+ records: Array<Record<string, unknown>>;
56
+ fields: string[];
57
+ align: Record<string, 'left' | 'center' | 'right'>;
58
+ };
59
+ /**
60
+ * The value to write into a native xlsx cell that carries an Excel numFmt.
61
+ * Numbers stay numbers; percent values are divided to the 0..1 fraction Excel
62
+ * expects (unless the config already stores 0..1); dates become real `Date`s.
63
+ * Returns `{ ok: false }` when the value can't be represented natively and the
64
+ * caller should fall back to the formatted string.
65
+ */
66
+ export declare function valueForExcel(value: unknown, format: CellFormatConfig | undefined): {
67
+ ok: true;
68
+ value: number | Date;
69
+ } | {
70
+ ok: false;
71
+ };
72
+ export type GridExportScope = 'displayed' | 'selected' | 'all';
73
+ /** The slice of a grid column an exporter needs. Accepts `api.getColumns()`. */
74
+ export type GridExportColumn = {
75
+ field: string;
76
+ header: string;
77
+ format?: CellFormatConfig | undefined;
78
+ align?: 'left' | 'center' | 'right';
79
+ };
80
+ export type GridExportOptions = {
81
+ /** Base filename (no extension). Default 'grid'. */
82
+ filename?: string;
83
+ /** Which rows to export. Default 'displayed' (current view). */
84
+ rows?: GridExportScope;
85
+ /** Restrict to these fields, in this order. Default: all visible columns. */
86
+ columns?: string[];
87
+ /** Export raw values instead of the on-screen formatted display. Default false. */
88
+ rawValues?: boolean;
89
+ /** Prepend a UTF-8 BOM (csv/tsv) so Excel detects UTF-8. Default true. */
90
+ bom?: boolean;
91
+ /** Cancel a large export. */
92
+ signal?: AbortSignal;
93
+ /** Progress for large exports. */
94
+ onProgress?: (progress: SerializeProgress) => void;
95
+ /** When false, skip the browser download and just return the text. Default true. */
96
+ download?: boolean;
97
+ };
98
+ export type GridClipboardFormat = 'csv' | 'tsv' | 'markdown';
99
+ export type GridClipboardOptions = {
100
+ /** Clipboard payload format. Default 'tsv' (pastes straight into Excel). */
101
+ format?: GridClipboardFormat;
102
+ rows?: GridExportScope;
103
+ columns?: string[];
104
+ rawValues?: boolean;
105
+ };
106
+ export type SerializeProgress = {
107
+ phase: 'serialize';
108
+ /** 0..1 completion of the row walk. */
109
+ ratio: number;
110
+ row: number;
111
+ total: number;
112
+ };
113
+ export type CsvOptions = {
114
+ /** Field delimiter. Default ',' (','→CSV, '\t'→TSV). */
115
+ delimiter?: string;
116
+ /** Line ending between records. Default '\r\n' (Excel-friendly). */
117
+ eol?: string;
118
+ /** Prepend a UTF-8 BOM so Excel detects UTF-8. Default true for csv/tsv. */
119
+ bom?: boolean;
120
+ };
121
+ export type SerializeOptions = {
122
+ onProgress?: (p: SerializeProgress) => void;
123
+ signal?: AbortSignal;
124
+ csv?: CsvOptions;
125
+ /** Rows processed between event-loop yields. Default 5000. */
126
+ chunkRows?: number;
127
+ };
128
+ /**
129
+ * Serialize projected rows to a delimited string (CSV / TSV).
130
+ * `rows[0]` is treated as the header row.
131
+ */
132
+ export declare function serializeDelimited(rows: ReadonlyArray<Record<string, unknown>>, fields: ReadonlyArray<string>, opts?: SerializeOptions): Promise<string>;
133
+ export type ExportCellVisual = {
134
+ fill?: string;
135
+ color?: string;
136
+ bold?: boolean;
137
+ icon?: string;
138
+ };
139
+ /**
140
+ * Serialize projected rows to a standalone HTML `<table>` document.
141
+ * `rows[0]` is the header row (rendered as `<th>`); the rest are `<td>`.
142
+ */
143
+ export declare function serializeHtml(rows: ReadonlyArray<Record<string, unknown>>, fields: ReadonlyArray<string>, opts?: SerializeOptions & {
144
+ title?: string;
145
+ align?: Record<string, 'left' | 'center' | 'right'>;
146
+ /** Per-data-cell conditional-format visual (`rowIdx` is 0-based over data). */
147
+ cellStyle?: (rowIdx: number, colIdx: number) => ExportCellVisual | undefined;
148
+ /** Per-data-cell hyperlink URL. */
149
+ cellLink?: (rowIdx: number, colIdx: number) => string | undefined;
150
+ }): Promise<string>;
151
+ /**
152
+ * Serialize projected rows to a JSON array of `{ field: value }` objects.
153
+ * `rows[0]` (the header row) is dropped - JSON keys are the field names.
154
+ */
155
+ export declare function serializeJson(rows: ReadonlyArray<Record<string, unknown>>, fields: ReadonlyArray<string>, opts?: SerializeOptions): Promise<string>;
156
+ /**
157
+ * Serialize projected rows to a GitHub-flavored Markdown table. `rows[0]` is
158
+ * the header row; `align` sets the `:---`, `:--:`, `---:` markers per column.
159
+ */
160
+ export declare function serializeMarkdown(rows: ReadonlyArray<Record<string, unknown>>, fields: ReadonlyArray<string>, opts?: SerializeOptions & {
161
+ align?: Record<string, 'left' | 'center' | 'right'>;
162
+ }): Promise<string>;
163
+ /**
164
+ * Serialize projected rows to a simple XML document:
165
+ * `<rows><row><field>value</field>…</row>…</rows>`. `rows[0]` (header) is
166
+ * dropped - element names come from the field names.
167
+ */
168
+ export declare function serializeXml(rows: ReadonlyArray<Record<string, unknown>>, fields: ReadonlyArray<string>, opts?: SerializeOptions & {
169
+ rootTag?: string;
170
+ rowTag?: string;
171
+ }): Promise<string>;
172
+ /** Trigger a browser download of an already-built Blob. No-op guard for SSR. */
173
+ export declare function downloadBlobFile(blob: Blob, filename: string): void;
174
+ /** Trigger a browser download of a text blob. No-op guard for SSR. */
175
+ export declare function downloadTextFile(text: string, filename: string, mime: string): void;
176
+ /** Write text to the system clipboard. Throws when the API is unavailable
177
+ * (insecure context / SSR). */
178
+ export declare function copyTextToClipboard(text: string): Promise<void>;