@svgrid/grid 1.0.2 → 1.1.1

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 (216) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +137 -39
  3. package/dist/GridFooter.svelte +164 -0
  4. package/dist/GridFooter.svelte.d.ts +29 -0
  5. package/dist/GridMenus.svelte +648 -0
  6. package/dist/GridMenus.svelte.d.ts +31 -0
  7. package/dist/SvGrid.controller.svelte.d.ts +472 -0
  8. package/dist/SvGrid.controller.svelte.js +1917 -0
  9. package/dist/SvGrid.css +2012 -0
  10. package/dist/SvGrid.helpers.d.ts +35 -0
  11. package/dist/SvGrid.helpers.js +160 -0
  12. package/dist/SvGrid.helpers.test.d.ts +1 -0
  13. package/dist/SvGrid.helpers.test.js +298 -0
  14. package/dist/SvGrid.svelte +2346 -8742
  15. package/dist/SvGrid.svelte.d.ts +4 -357
  16. package/dist/SvGrid.types.d.ts +523 -0
  17. package/dist/SvGrid.types.js +1 -0
  18. package/dist/SvGridChart.svelte +1060 -23
  19. package/dist/SvGridChart.svelte.d.ts +17 -0
  20. package/dist/aligned-grids.d.ts +6 -0
  21. package/dist/aligned-grids.js +84 -0
  22. package/dist/aligned-grids.test.d.ts +1 -0
  23. package/dist/aligned-grids.test.js +75 -0
  24. package/dist/build-api.coverage.test.d.ts +20 -0
  25. package/dist/build-api.coverage.test.js +505 -0
  26. package/dist/build-api.d.ts +5 -0
  27. package/dist/build-api.js +557 -0
  28. package/dist/cell-render.d.ts +15 -0
  29. package/dist/cell-render.js +246 -0
  30. package/dist/cell-render.test.d.ts +1 -0
  31. package/dist/cell-render.test.js +338 -0
  32. package/dist/cell-values.d.ts +28 -0
  33. package/dist/cell-values.js +89 -0
  34. package/dist/chart-export.test.d.ts +1 -0
  35. package/dist/chart-export.test.js +302 -0
  36. package/dist/chart.coverage.test.d.ts +1 -0
  37. package/dist/chart.coverage.test.js +748 -0
  38. package/dist/chart.d.ts +370 -3
  39. package/dist/chart.js +1135 -42
  40. package/dist/clipboard.d.ts +15 -0
  41. package/dist/clipboard.js +420 -0
  42. package/dist/clipboard.test.d.ts +1 -0
  43. package/dist/clipboard.test.js +700 -0
  44. package/dist/collaboration.coverage.test.d.ts +1 -0
  45. package/dist/collaboration.coverage.test.js +200 -0
  46. package/dist/column-groups.d.ts +19 -0
  47. package/dist/column-groups.js +62 -0
  48. package/dist/column-groups.test.d.ts +1 -0
  49. package/dist/column-groups.test.js +56 -0
  50. package/dist/column-types.d.ts +10 -0
  51. package/dist/column-types.js +63 -0
  52. package/dist/column-types.test.d.ts +1 -0
  53. package/dist/column-types.test.js +62 -0
  54. package/dist/columns.d.ts +30 -0
  55. package/dist/columns.js +277 -0
  56. package/dist/columns.test.d.ts +1 -0
  57. package/dist/columns.test.js +625 -0
  58. package/dist/core.d.ts +86 -1
  59. package/dist/css.d.ts +3 -0
  60. package/dist/editing.d.ts +31 -0
  61. package/dist/editing.js +529 -0
  62. package/dist/editing.test.d.ts +1 -0
  63. package/dist/editing.test.js +732 -0
  64. package/dist/editors/cell-editors.coverage.test.d.ts +1 -0
  65. package/dist/editors/cell-editors.coverage.test.js +139 -0
  66. package/dist/editors/cell-editors.d.ts +1 -1
  67. package/dist/facet-buckets.d.ts +13 -0
  68. package/dist/facet-buckets.js +54 -0
  69. package/dist/facet-buckets.test.d.ts +1 -0
  70. package/dist/facet-buckets.test.js +296 -0
  71. package/dist/features.d.ts +5 -0
  72. package/dist/features.js +30 -0
  73. package/dist/filter-operators.d.ts +16 -0
  74. package/dist/filter-operators.js +69 -0
  75. package/dist/filter-operators.test.d.ts +1 -0
  76. package/dist/filter-operators.test.js +135 -0
  77. package/dist/hyperformula-adapter.d.ts +82 -0
  78. package/dist/hyperformula-adapter.js +73 -0
  79. package/dist/hyperformula-adapter.test.d.ts +1 -0
  80. package/dist/hyperformula-adapter.test.js +205 -0
  81. package/dist/index.d.ts +9 -3
  82. package/dist/index.js +8 -2
  83. package/dist/keyboard-handlers.coverage.test.d.ts +1 -0
  84. package/dist/keyboard-handlers.coverage.test.js +495 -0
  85. package/dist/keyboard-handlers.d.ts +7 -0
  86. package/dist/keyboard-handlers.js +202 -0
  87. package/dist/menus.d.ts +40 -0
  88. package/dist/menus.js +390 -0
  89. package/dist/menus.test.d.ts +1 -0
  90. package/dist/menus.test.js +560 -0
  91. package/dist/named-views.coverage.test.d.ts +1 -0
  92. package/dist/named-views.coverage.test.js +180 -0
  93. package/dist/named-views.d.ts +27 -0
  94. package/dist/named-views.js +39 -0
  95. package/dist/row-drag.d.ts +49 -0
  96. package/dist/row-drag.js +221 -0
  97. package/dist/row-drag.test.d.ts +1 -0
  98. package/dist/row-drag.test.js +142 -0
  99. package/dist/row-resize.d.ts +43 -0
  100. package/dist/row-resize.js +158 -0
  101. package/dist/row-resize.test.d.ts +1 -0
  102. package/dist/row-resize.test.js +329 -0
  103. package/dist/scroll-sync.d.ts +9 -0
  104. package/dist/scroll-sync.js +89 -0
  105. package/dist/scroll-sync.test.d.ts +1 -0
  106. package/dist/scroll-sync.test.js +290 -0
  107. package/dist/selection.d.ts +32 -0
  108. package/dist/selection.js +427 -0
  109. package/dist/selection.multi-range.test.d.ts +1 -0
  110. package/dist/selection.multi-range.test.js +55 -0
  111. package/dist/selection.test.d.ts +1 -0
  112. package/dist/selection.test.js +647 -0
  113. package/dist/server-data-source.coverage.test.d.ts +1 -0
  114. package/dist/server-data-source.coverage.test.js +154 -0
  115. package/dist/spreadsheet.d.ts +110 -0
  116. package/dist/spreadsheet.js +242 -0
  117. package/dist/spreadsheet.test.d.ts +1 -0
  118. package/dist/spreadsheet.test.js +446 -0
  119. package/dist/summaries.d.ts +12 -0
  120. package/dist/summaries.js +65 -0
  121. package/dist/sv-grid-scrollbar.js +13 -1
  122. package/dist/svgrid-wrapper.types.d.ts +31 -1
  123. package/dist/svgrid.behavior.test.js +20 -0
  124. package/dist/svgrid.comments-autocomplete.test.d.ts +1 -0
  125. package/dist/svgrid.comments-autocomplete.test.js +96 -0
  126. package/dist/svgrid.context-menu.test.d.ts +1 -0
  127. package/dist/svgrid.context-menu.test.js +102 -0
  128. package/dist/svgrid.interaction.test.js +31 -0
  129. package/dist/svgrid.new-features.wrapper.test.js +64 -6
  130. package/dist/svgrid.wrapper.test.js +27 -1
  131. package/dist/test-setup.js +9 -3
  132. package/dist/virtualization/column-virtualizer.d.ts +2 -0
  133. package/dist/virtualization/scroll-scaling.d.ts +45 -0
  134. package/dist/virtualization/scroll-scaling.js +99 -0
  135. package/dist/virtualization/scroll-scaling.test.d.ts +1 -0
  136. package/dist/virtualization/scroll-scaling.test.js +127 -0
  137. package/dist/virtualization/svelte-virtualizer.svelte.d.ts +2 -0
  138. package/dist/virtualization/svelte-virtualizer.svelte.js +2 -0
  139. package/dist/virtualization/virtualizer.d.ts +7 -0
  140. package/dist/virtualization/virtualizer.js +30 -0
  141. package/package.json +2 -1
  142. package/src/GridFooter.svelte +164 -0
  143. package/src/GridMenus.svelte +648 -0
  144. package/src/SvGrid.controller.svelte.ts +2352 -0
  145. package/src/SvGrid.css +2012 -0
  146. package/src/SvGrid.helpers.test.ts +415 -0
  147. package/src/SvGrid.helpers.ts +185 -0
  148. package/src/SvGrid.svelte +2346 -8742
  149. package/src/SvGrid.types.ts +537 -0
  150. package/src/SvGridChart.svelte +1060 -23
  151. package/src/aligned-grids.test.ts +80 -0
  152. package/src/aligned-grids.ts +87 -0
  153. package/src/build-api.coverage.test.ts +532 -0
  154. package/src/build-api.ts +683 -0
  155. package/src/cell-render.test.ts +451 -0
  156. package/src/cell-render.ts +426 -0
  157. package/src/cell-values.ts +114 -0
  158. package/src/chart-export.test.ts +370 -0
  159. package/src/chart.coverage.test.ts +814 -0
  160. package/src/chart.ts +1352 -47
  161. package/src/clipboard.test.ts +780 -0
  162. package/src/clipboard.ts +552 -0
  163. package/src/collaboration.coverage.test.ts +220 -0
  164. package/src/column-groups.test.ts +59 -0
  165. package/src/column-groups.ts +80 -0
  166. package/src/column-types.test.ts +68 -0
  167. package/src/column-types.ts +82 -0
  168. package/src/columns.test.ts +702 -0
  169. package/src/columns.ts +419 -0
  170. package/src/core.ts +86 -0
  171. package/src/css.d.ts +3 -0
  172. package/src/editing.test.ts +837 -0
  173. package/src/editing.ts +669 -0
  174. package/src/editors/cell-editors.coverage.test.ts +156 -0
  175. package/src/editors/cell-editors.ts +1 -0
  176. package/src/facet-buckets.test.ts +353 -0
  177. package/src/facet-buckets.ts +67 -0
  178. package/src/features.ts +128 -0
  179. package/src/filter-operators.test.ts +174 -0
  180. package/src/filter-operators.ts +87 -0
  181. package/src/hyperformula-adapter.test.ts +256 -0
  182. package/src/hyperformula-adapter.ts +124 -0
  183. package/src/index.ts +49 -0
  184. package/src/keyboard-handlers.coverage.test.ts +560 -0
  185. package/src/keyboard-handlers.ts +353 -0
  186. package/src/keyboard.ts +97 -97
  187. package/src/menus.test.ts +620 -0
  188. package/src/menus.ts +555 -0
  189. package/src/named-views.coverage.test.ts +210 -0
  190. package/src/named-views.ts +48 -0
  191. package/src/row-drag.test.ts +168 -0
  192. package/src/row-drag.ts +255 -0
  193. package/src/row-resize.test.ts +369 -0
  194. package/src/row-resize.ts +171 -0
  195. package/src/scroll-sync.test.ts +330 -0
  196. package/src/scroll-sync.ts +218 -0
  197. package/src/selection.multi-range.test.ts +61 -0
  198. package/src/selection.test.ts +722 -0
  199. package/src/selection.ts +579 -0
  200. package/src/server-data-source.coverage.test.ts +180 -0
  201. package/src/spreadsheet.test.ts +489 -0
  202. package/src/spreadsheet.ts +304 -0
  203. package/src/summaries.ts +204 -0
  204. package/src/sv-grid-scrollbar.ts +13 -1
  205. package/src/svgrid-wrapper.types.ts +31 -1
  206. package/src/svgrid.behavior.test.ts +22 -0
  207. package/src/svgrid.comments-autocomplete.test.ts +112 -0
  208. package/src/svgrid.context-menu.test.ts +126 -0
  209. package/src/svgrid.interaction.test.ts +30 -0
  210. package/src/svgrid.new-features.wrapper.test.ts +67 -6
  211. package/src/svgrid.wrapper.test.ts +27 -1
  212. package/src/test-setup.ts +9 -6
  213. package/src/virtualization/scroll-scaling.test.ts +148 -0
  214. package/src/virtualization/scroll-scaling.ts +121 -0
  215. package/src/virtualization/svelte-virtualizer.svelte.ts +2 -0
  216. package/src/virtualization/virtualizer.ts +26 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Boyko Markov <boikom@jqwidgets.com>
3
+ Copyright (c) 2026 jQWidgets Ltd
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,39 +1,137 @@
1
- # @svgrid/grid
2
-
3
- Headless-first independent Svelte-native grid engine and render utilities.
4
-
5
- ## Install
6
-
7
- ```bash
8
- pnpm add @svgrid/grid
9
- ```
10
-
11
- ## Quick start
12
-
13
- ```ts
14
- import {
15
- createCoreRowModel,
16
- createSvGrid,
17
- tableFeatures,
18
- } from '@svgrid/grid'
19
- ```
20
-
21
- Primary API:
22
-
23
- - `createSvGrid` (with `createGrid` compatibility alias)
24
- - `createSvGridState` (with `createGridState` compatibility alias)
25
- - `subscribeSvGrid` (with `subscribeGrid` compatibility alias)
26
- - `getGrid*A11yProps` helpers for accessible headless markup
27
-
28
- ## Production checklist
29
-
30
- - Bring your own semantic table/grid markup and styling
31
- - Add keyboard interactions appropriate for your UX
32
- - Use server-side controlled state for large datasets
33
- - Add virtualization strategy when rendering large lists
34
-
35
- ## License & trademark
36
-
37
- The source code is **MIT-licensed** - see [LICENSE](./LICENSE). SvGrid&trade;
38
- and sv-grid&trade; are trademarks of jQWidgets Ltd; the license covers the
39
- code only, not the name or logo.
1
+ <p align="center">
2
+ <img src="https://svgrid.com/brand/svgrid-logo-icon-1200.png" alt="SvGrid" width="100" height="100" />
3
+ </p>
4
+
5
+ <h1 align="center">@svgrid/grid</h1>
6
+
7
+ <p align="center"><strong>The Svelte 5 native data grid. Headless-first. Render-ready.</strong></p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@svgrid/grid"><img src="https://img.shields.io/npm/v/%40svgrid%2Fgrid.svg?label=%40svgrid%2Fgrid" alt="npm version" /></a>
11
+ <a href="https://www.npmjs.com/package/@svgrid/grid"><img src="https://img.shields.io/npm/dm/%40svgrid%2Fgrid.svg" alt="npm downloads" /></a>
12
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT License" /></a>
13
+ <a href="./dist"><img src="https://img.shields.io/badge/types-included-blue.svg" alt="TypeScript" /></a>
14
+ <a href="https://svelte.dev"><img src="https://img.shields.io/badge/svelte-5-ff3e00.svg" alt="Svelte 5" /></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://svgrid.com">Website</a> ·
19
+ <a href="https://svgrid.com/docs">Docs</a> ·
20
+ <a href="https://svgrid.com/demos">150+ Demos</a> ·
21
+ <a href="https://svgrid.com/pricing">Pricing</a> ·
22
+ <a href="https://svgrid.com/roadmap">Roadmap</a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ A production-grade data grid built from the first line for **Svelte 5 runes** - not a React grid wrapped in a Svelte shim. Compose the headless engine yourself, or drop in the full `<SvGrid />` render component and ship. The MIT core has **zero feature gating**: no license key, no watermark, no row-count cap.
28
+
29
+ ## Install
30
+
31
+ Scaffold a working Vite + Svelte 5 app with SvGrid wired up:
32
+
33
+ ```bash
34
+ npm create @svgrid@latest
35
+ ```
36
+
37
+ Or add it to an existing app:
38
+
39
+ ```bash
40
+ npm install @svgrid/grid
41
+ ```
42
+
43
+ ## Quick start
44
+
45
+ ```svelte
46
+ <script lang="ts">
47
+ import { SvGrid, type ColumnDef } from '@svgrid/grid'
48
+
49
+ const rows = [
50
+ { firstName: 'Ada', age: 36, status: 'active' },
51
+ { firstName: 'Linus', age: 54, status: 'active' },
52
+ { firstName: 'Grace', age: 85, status: 'inactive' },
53
+ ]
54
+ const columns: ColumnDef<{}, (typeof rows)[number]>[] = [
55
+ { field: 'firstName', header: 'First name' },
56
+ { field: 'age', header: 'Age' },
57
+ { field: 'status', header: 'Status' },
58
+ ]
59
+ </script>
60
+
61
+ <SvGrid data={rows} columns={columns} />
62
+ ```
63
+
64
+ That is a real, accessible grid. Sorting, filtering, virtualization, cell selection, and inline editing all wire up the moment you turn on the matching prop.
65
+
66
+ ## Capabilities
67
+
68
+ - **Virtualization** - row + column windowing; 100k x 100 stays smooth, with a 1M-row demo.
69
+ - **Filtering** - Excel-style filter menu, inline filter row, set / value-list filter, locale-aware matching, between operators.
70
+ - **Editing** - 14 built-in `editorType`s (text, number, date, datetime, time, select, rich-select with typeahead, textarea, color, checkbox, list, chips, rating, password) plus a `cellEditor` snippet slot for anything custom.
71
+ - **Selection** - cell-range click+drag and Shift+arrows, copy/paste as TSV, Excel-style fill handle, row selection.
72
+ - **Hierarchy** - row grouping with aggregation, tree data, master/detail, full-width detail rows.
73
+ - **Layout** - row + column pinning, sticky header + first column, header drag-to-reorder, autosize, column sizing API, zebra rows.
74
+ - **Data operations** - find in grid (Ctrl+F), undo / redo, transaction API, optimistic updates, server-side row model with sort / filter / group pushdown.
75
+ - **Accessibility** - WAI-ARIA grid roles, full keyboard navigation, RTL, high-contrast theme.
76
+ - **Engineered for production** - first-class TypeScript types, CSP / Trusted-Types safe rendering, SSR-friendly, themeable via `--sg-*` CSS tokens.
77
+ - **Lean** - ~7.5 KB gzipped headless core, ~42 KB gzipped full render component; Svelte stays a peer dependency.
78
+
79
+ ## Headless or render-ready
80
+
81
+ SvGrid ships two layers from one package, so you can choose how much control you want:
82
+
83
+ ```ts
84
+ import {
85
+ // Drop-in render component
86
+ SvGrid,
87
+ // Headless engine + row-model factories
88
+ createSvGrid,
89
+ createCoreRowModel,
90
+ createFilteredRowModel,
91
+ createSortedRowModel,
92
+ createGroupedRowModel,
93
+ createExpandedRowModel,
94
+ createPaginatedRowModel,
95
+ // Feature modules
96
+ tableFeatures,
97
+ rowSortingFeature,
98
+ columnFilteringFeature,
99
+ columnGroupingFeature,
100
+ rowExpandingFeature,
101
+ rowPaginationFeature,
102
+ rowSelectionFeature,
103
+ // Cell renderers
104
+ renderSnippet,
105
+ renderComponent,
106
+ type ColumnDef,
107
+ type SvGridApi,
108
+ } from '@svgrid/grid'
109
+ ```
110
+
111
+ - **Headless** - drive `createSvGrid` and the row-model factories, render your own markup. `getGrid*A11yProps` helpers keep custom markup accessible.
112
+ - **Render-ready** - `<SvGrid />` is a complete, accessible, themeable grid you configure with props.
113
+
114
+ Compatibility aliases are provided for the framework-neutral names: `createGrid`, `createGridState`, `subscribeGrid`.
115
+
116
+ ## AI-native
117
+
118
+ SvGrid publishes an [MCP server](https://www.npmjs.com/package/@svgrid/mcp) and `llms.txt` / `llms-full.txt`, so Claude, Cursor, and Zed answer with accurate, version-pinned APIs and all 150+ demo sources as context - not hallucinated methods.
119
+
120
+ ## Enterprise
121
+
122
+ The MIT core is free for any use, including commercial. The optional [`@svgrid/enterprise`](https://www.npmjs.com/package/@svgrid/enterprise) pack adds Excel / PDF / CSV / TSV / HTML export, paginated print, pivot tables with a drag-and-drop Designer, and AI helpers. OSS projects receive an Enterprise key free. See [Pricing](https://svgrid.com/pricing).
123
+
124
+ ## Documentation
125
+
126
+ - [Getting started](https://svgrid.com/docs) - end-to-end walkthrough.
127
+ - [150+ live demos](https://svgrid.com/demos) - copy-paste recipes for every feature.
128
+ - [Why headless?](https://svgrid.com/docs) - when to compose vs. drop in.
129
+ - [Theming](https://svgrid.com/docs) - re-skin via `--sg-*` tokens and dark mode.
130
+
131
+ ## Who's behind it
132
+
133
+ SvGrid is built by [jQWidgets](https://www.jqwidgets.com), shipping UI components since 2011 to 5,000+ companies including Samsung, Boeing, NVIDIA, Microsoft, Nokia, and Intel. SvGrid is our Svelte 5 native effort.
134
+
135
+ ## License & trademark
136
+
137
+ The source code is **MIT-licensed** - see [LICENSE](./LICENSE). It is free for commercial use. SvGrid&trade; and sv-grid&trade; are trademarks of jQWidgets Ltd; the license covers the code only, not the name or logo.
@@ -0,0 +1,164 @@
1
+ <script lang="ts" generics="TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData">
2
+ import {
3
+ getGridCellA11yProps,
4
+ getGridCellDomId,
5
+ getGridHeaderA11yProps,
6
+ getGridRootA11yProps,
7
+ getGridRowA11yProps,
8
+ type EditorContext,
9
+ type CellEditorOption,
10
+ type Column,
11
+ type Row,
12
+ type RowData,
13
+ type TableFeatures,
14
+ } from "./index";
15
+ import "./sv-grid-scrollbar";
16
+ import type { Snippet } from "svelte";
17
+ import {
18
+ RenderSnippetConfig,
19
+ RenderComponentConfig,
20
+ } from "./render-component";
21
+ import {
22
+ buildSparkline,
23
+ toSparklineValues,
24
+ } from "./sparkline";
25
+ import SvGridDropdown from "./SvGridDropdown.svelte";
26
+ import type {
27
+ Props,
28
+ SelectionPoint,
29
+ SelectionRange,
30
+ CellEditState,
31
+ FilterOperator,
32
+ FilterOption,
33
+ MenuPosition,
34
+ } from "./SvGrid.types";
35
+ import {
36
+ cfTextStyle,
37
+ fmtStat,
38
+ getEditableInputValue,
39
+ getEditorInputType,
40
+ toValueArray,
41
+ getOptionLabel,
42
+ getOptionColor,
43
+ colorfulChipStyle,
44
+ getEditorClass,
45
+ } from "./SvGrid.helpers";
46
+ import {
47
+ } from "./SvGrid.controller.svelte";
48
+ import type { SvGridController } from "./SvGrid.controller.svelte";
49
+
50
+ let { ctrl }: { ctrl: SvGridController<TFeatures, TData> } = $props();
51
+
52
+ // View facade: re-bind the controller's reactive members so the markup
53
+ // (moved verbatim from SvGrid.svelte) stays identical.
54
+ const paginationEnabled = $derived(ctrl.paginationEnabled);
55
+ const grid = $derived(ctrl.grid);
56
+ const paginationState = $derived(ctrl.paginationState);
57
+ const allRowsBeforePagination = $derived(ctrl.allRowsBeforePagination);
58
+ const statusBarEnabled = $derived(ctrl.statusBarEnabled);
59
+ const statusBarAggregates = $derived(ctrl.statusBarAggregates);
60
+ const statusBarStats = $derived(ctrl.statusBarStats);
61
+ const changePage = $derived(ctrl.changePage);
62
+ const goToPage = $derived(ctrl.goToPage);
63
+ const setPageSize = $derived(ctrl.setPageSize);
64
+ </script>
65
+
66
+ {#if statusBarEnabled && statusBarStats}
67
+ {@const s = statusBarStats}
68
+ <div class="sv-grid-status-bar" role="status" aria-live="polite">
69
+ {#each statusBarAggregates as agg (agg)}
70
+ {#if agg === "count"}
71
+ <span class="sv-grid-status-item"
72
+ ><span class="sv-grid-status-label">Count</span>{fmtStat(s.count)}</span
73
+ >
74
+ {:else if agg === "numericCount"}
75
+ <span class="sv-grid-status-item"
76
+ ><span class="sv-grid-status-label">Numeric</span>{fmtStat(s.numericCount)}</span
77
+ >
78
+ {:else if s.numericCount > 0 && agg === "sum"}
79
+ <span class="sv-grid-status-item"
80
+ ><span class="sv-grid-status-label">Sum</span>{fmtStat(s.sum)}</span
81
+ >
82
+ {:else if s.numericCount > 0 && agg === "avg"}
83
+ <span class="sv-grid-status-item"
84
+ ><span class="sv-grid-status-label">Avg</span>{fmtStat(s.avg)}</span
85
+ >
86
+ {:else if s.numericCount > 0 && agg === "min"}
87
+ <span class="sv-grid-status-item"
88
+ ><span class="sv-grid-status-label">Min</span>{fmtStat(s.min)}</span
89
+ >
90
+ {:else if s.numericCount > 0 && agg === "max"}
91
+ <span class="sv-grid-status-item"
92
+ ><span class="sv-grid-status-label">Max</span>{fmtStat(s.max)}</span
93
+ >
94
+ {/if}
95
+ {/each}
96
+ </div>
97
+ {/if}
98
+
99
+ {#if paginationEnabled}
100
+ {@const totalRows = allRowsBeforePagination.length}
101
+ {@const pageSize = paginationState.pageSize}
102
+ {@const pageCount = Math.max(1, Math.ceil(totalRows / pageSize))}
103
+ {@const currentPage = Math.min(paginationState.pageIndex + 1, pageCount)}
104
+ {@const rangeStart =
105
+ totalRows === 0 ? 0 : (currentPage - 1) * pageSize + 1}
106
+ {@const rangeEnd = Math.min(totalRows, currentPage * pageSize)}
107
+ {@const onFirst = currentPage <= 1}
108
+ {@const onLast = currentPage >= pageCount}
109
+ <div class="sv-grid-pagination" role="navigation" aria-label="Pagination">
110
+ <label class="sv-grid-pagination-pagesize">
111
+ <span>Page Size:</span>
112
+ <select
113
+ onchange={(event) =>
114
+ setPageSize(
115
+ parseInt((event.currentTarget as HTMLSelectElement).value, 10),
116
+ )}
117
+ >
118
+ <option value="10" selected={pageSize === 10}>10</option>
119
+ <option value="25" selected={pageSize === 25}>25</option>
120
+ <option value="50" selected={pageSize === 50}>50</option>
121
+ <option value="100" selected={pageSize === 100}>100</option>
122
+ </select>
123
+ </label>
124
+ <span class="sv-grid-pagination-range">
125
+ <strong>{rangeStart.toLocaleString()}</strong> to
126
+ <strong>{rangeEnd.toLocaleString()}</strong> of
127
+ <strong>{totalRows.toLocaleString()}</strong>
128
+ </span>
129
+ <div class="sv-grid-pagination-nav">
130
+ <button
131
+ type="button"
132
+ class="sv-grid-pagination-btn"
133
+ disabled={onFirst}
134
+ onclick={() => goToPage(0)}
135
+ aria-label="First page">⇤</button
136
+ >
137
+ <button
138
+ type="button"
139
+ class="sv-grid-pagination-btn"
140
+ disabled={onFirst}
141
+ onclick={() => changePage(-1)}
142
+ aria-label="Previous page">‹</button
143
+ >
144
+ <span class="sv-grid-pagination-label">
145
+ Page <strong>{currentPage.toLocaleString()}</strong> of
146
+ <strong>{pageCount.toLocaleString()}</strong>
147
+ </span>
148
+ <button
149
+ type="button"
150
+ class="sv-grid-pagination-btn"
151
+ disabled={onLast}
152
+ onclick={() => changePage(1)}
153
+ aria-label="Next page">›</button
154
+ >
155
+ <button
156
+ type="button"
157
+ class="sv-grid-pagination-btn"
158
+ disabled={onLast}
159
+ onclick={() => goToPage(pageCount - 1)}
160
+ aria-label="Last page">⇥</button
161
+ >
162
+ </div>
163
+ </div>
164
+ {/if}
@@ -0,0 +1,29 @@
1
+ import { type RowData, type TableFeatures } from "./index";
2
+ import "./sv-grid-scrollbar";
3
+ import type { SvGridController } from "./SvGrid.controller.svelte";
4
+ declare function $$render<TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData>(): {
5
+ props: {
6
+ ctrl: SvGridController<TFeatures, TData>;
7
+ };
8
+ exports: {};
9
+ bindings: "";
10
+ slots: {};
11
+ events: {};
12
+ };
13
+ declare class __sveltets_Render<TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData> {
14
+ props(): ReturnType<typeof $$render<TFeatures, TData>>['props'];
15
+ events(): ReturnType<typeof $$render<TFeatures, TData>>['events'];
16
+ slots(): ReturnType<typeof $$render<TFeatures, TData>>['slots'];
17
+ bindings(): "";
18
+ exports(): {};
19
+ }
20
+ interface $$IsomorphicComponent {
21
+ new <TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TFeatures, TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TFeatures, TData>['props']>, ReturnType<__sveltets_Render<TFeatures, TData>['events']>, ReturnType<__sveltets_Render<TFeatures, TData>['slots']>> & {
22
+ $$bindings?: ReturnType<__sveltets_Render<TFeatures, TData>['bindings']>;
23
+ } & ReturnType<__sveltets_Render<TFeatures, TData>['exports']>;
24
+ <TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData>(internal: unknown, props: ReturnType<__sveltets_Render<TFeatures, TData>['props']> & {}): ReturnType<__sveltets_Render<TFeatures, TData>['exports']>;
25
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
26
+ }
27
+ declare const GridFooter: $$IsomorphicComponent;
28
+ type GridFooter<TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData> = InstanceType<typeof GridFooter<TFeatures, TData>>;
29
+ export default GridFooter;