@universal-material/data-grid 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -2
  3. package/custom-elements.json +4624 -0
  4. package/dist/attribute-converters.d.ts +53 -0
  5. package/dist/attribute-converters.js +98 -0
  6. package/dist/attribute-converters.js.map +1 -0
  7. package/dist/change-source.d.ts +3 -0
  8. package/dist/change-source.js +2 -0
  9. package/dist/change-source.js.map +1 -0
  10. package/dist/data/data-source.d.ts +164 -0
  11. package/dist/data/data-source.js +75 -0
  12. package/dist/data/data-source.js.map +1 -0
  13. package/dist/data/local-source.d.ts +20 -0
  14. package/dist/data/local-source.js +94 -0
  15. package/dist/data/local-source.js.map +1 -0
  16. package/dist/data/remote-loader.d.ts +190 -0
  17. package/dist/data/remote-loader.js +608 -0
  18. package/dist/data/remote-loader.js.map +1 -0
  19. package/dist/export/csv.d.ts +28 -0
  20. package/dist/export/csv.js +61 -0
  21. package/dist/export/csv.js.map +1 -0
  22. package/dist/export/download.d.ts +7 -0
  23. package/dist/export/download.js +17 -0
  24. package/dist/export/download.js.map +1 -0
  25. package/dist/export/rows.d.ts +75 -0
  26. package/dist/export/rows.js +134 -0
  27. package/dist/export/rows.js.map +1 -0
  28. package/dist/export/slice.d.ts +15 -0
  29. package/dist/export/slice.js +35 -0
  30. package/dist/export/slice.js.map +1 -0
  31. package/dist/export/types.d.ts +155 -0
  32. package/dist/export/types.js +2 -0
  33. package/dist/export/types.js.map +1 -0
  34. package/dist/export/write.d.ts +38 -0
  35. package/dist/export/write.js +178 -0
  36. package/dist/export/write.js.map +1 -0
  37. package/dist/export-pdf/client.d.ts +75 -0
  38. package/dist/export-pdf/client.js +155 -0
  39. package/dist/export-pdf/client.js.map +1 -0
  40. package/dist/export-pdf/engine.d.ts +73 -0
  41. package/dist/export-pdf/engine.js +131 -0
  42. package/dist/export-pdf/engine.js.map +1 -0
  43. package/dist/export-pdf/grid-pdf.wasm +0 -0
  44. package/dist/export-pdf/index.d.ts +27 -0
  45. package/dist/export-pdf/index.js +566 -0
  46. package/dist/export-pdf/index.js.map +1 -0
  47. package/dist/export-pdf/serialize.d.ts +23 -0
  48. package/dist/export-pdf/serialize.js +127 -0
  49. package/dist/export-pdf/serialize.js.map +1 -0
  50. package/dist/export-pdf/types.d.ts +150 -0
  51. package/dist/export-pdf/types.js +2 -0
  52. package/dist/export-pdf/types.js.map +1 -0
  53. package/dist/export-pdf/worker.d.ts +2 -0
  54. package/dist/export-pdf/worker.js +81 -0
  55. package/dist/export-pdf/worker.js.map +1 -0
  56. package/dist/export-xlsx/formats.d.ts +14 -0
  57. package/dist/export-xlsx/formats.js +40 -0
  58. package/dist/export-xlsx/formats.js.map +1 -0
  59. package/dist/export-xlsx/index.d.ts +74 -0
  60. package/dist/export-xlsx/index.js +137 -0
  61. package/dist/export-xlsx/index.js.map +1 -0
  62. package/dist/features/adaptive.d.ts +25 -0
  63. package/dist/features/adaptive.js +47 -0
  64. package/dist/features/adaptive.js.map +1 -0
  65. package/dist/features/cell-content-focus.d.ts +29 -0
  66. package/dist/features/cell-content-focus.js +95 -0
  67. package/dist/features/cell-content-focus.js.map +1 -0
  68. package/dist/features/cell-range.d.ts +97 -0
  69. package/dist/features/cell-range.js +75 -0
  70. package/dist/features/cell-range.js.map +1 -0
  71. package/dist/features/clipboard.d.ts +28 -0
  72. package/dist/features/clipboard.js +48 -0
  73. package/dist/features/clipboard.js.map +1 -0
  74. package/dist/features/column-chooser.d.ts +91 -0
  75. package/dist/features/column-chooser.js +450 -0
  76. package/dist/features/column-chooser.js.map +1 -0
  77. package/dist/features/column-dnd.d.ts +10 -0
  78. package/dist/features/column-dnd.js +126 -0
  79. package/dist/features/column-dnd.js.map +1 -0
  80. package/dist/features/context-menu.d.ts +122 -0
  81. package/dist/features/context-menu.js +153 -0
  82. package/dist/features/context-menu.js.map +1 -0
  83. package/dist/features/drag-helper.d.ts +39 -0
  84. package/dist/features/drag-helper.js +108 -0
  85. package/dist/features/drag-helper.js.map +1 -0
  86. package/dist/features/drop-position.d.ts +15 -0
  87. package/dist/features/drop-position.js +24 -0
  88. package/dist/features/drop-position.js.map +1 -0
  89. package/dist/features/editing.d.ts +111 -0
  90. package/dist/features/editing.js +244 -0
  91. package/dist/features/editing.js.map +1 -0
  92. package/dist/features/filter-row.d.ts +80 -0
  93. package/dist/features/filter-row.js +537 -0
  94. package/dist/features/filter-row.js.map +1 -0
  95. package/dist/features/filtering.d.ts +55 -0
  96. package/dist/features/filtering.js +209 -0
  97. package/dist/features/filtering.js.map +1 -0
  98. package/dist/features/group-dnd.d.ts +11 -0
  99. package/dist/features/group-dnd.js +119 -0
  100. package/dist/features/group-dnd.js.map +1 -0
  101. package/dist/features/header-filter.d.ts +96 -0
  102. package/dist/features/header-filter.js +579 -0
  103. package/dist/features/header-filter.js.map +1 -0
  104. package/dist/features/host-label.d.ts +36 -0
  105. package/dist/features/host-label.js +184 -0
  106. package/dist/features/host-label.js.map +1 -0
  107. package/dist/features/keyboard.d.ts +59 -0
  108. package/dist/features/keyboard.js +127 -0
  109. package/dist/features/keyboard.js.map +1 -0
  110. package/dist/features/menu.d.ts +113 -0
  111. package/dist/features/menu.js +491 -0
  112. package/dist/features/menu.js.map +1 -0
  113. package/dist/features/resize.d.ts +82 -0
  114. package/dist/features/resize.js +214 -0
  115. package/dist/features/resize.js.map +1 -0
  116. package/dist/features/search.d.ts +45 -0
  117. package/dist/features/search.js +123 -0
  118. package/dist/features/search.js.map +1 -0
  119. package/dist/features/selection.d.ts +37 -0
  120. package/dist/features/selection.js +103 -0
  121. package/dist/features/selection.js.map +1 -0
  122. package/dist/features/sorting.d.ts +39 -0
  123. package/dist/features/sorting.js +53 -0
  124. package/dist/features/sorting.js.map +1 -0
  125. package/dist/features/toolbar.d.ts +125 -0
  126. package/dist/features/toolbar.js +135 -0
  127. package/dist/features/toolbar.js.map +1 -0
  128. package/dist/features/tree.d.ts +53 -0
  129. package/dist/features/tree.js +94 -0
  130. package/dist/features/tree.js.map +1 -0
  131. package/dist/features/validation.d.ts +48 -0
  132. package/dist/features/validation.js +172 -0
  133. package/dist/features/validation.js.map +1 -0
  134. package/dist/grid-column-def.d.ts +509 -0
  135. package/dist/grid-column-def.js +32 -0
  136. package/dist/grid-column-def.js.map +1 -0
  137. package/dist/grid-column.d.ts +167 -0
  138. package/dist/grid-column.js +376 -0
  139. package/dist/grid-column.js.map +1 -0
  140. package/dist/grid-i18n.d.ts +469 -0
  141. package/dist/grid-i18n.js +3222 -0
  142. package/dist/grid-i18n.js.map +1 -0
  143. package/dist/grid.d.ts +1484 -0
  144. package/dist/grid.js +15579 -0
  145. package/dist/grid.js.map +1 -0
  146. package/dist/grid.min.js +3858 -0
  147. package/dist/grid.styles.d.ts +2 -0
  148. package/dist/grid.styles.js +2747 -0
  149. package/dist/grid.styles.js.map +1 -0
  150. package/dist/render/cell.d.ts +16 -0
  151. package/dist/render/cell.js +78 -0
  152. package/dist/render/cell.js.map +1 -0
  153. package/dist/render/column-window.d.ts +18 -0
  154. package/dist/render/column-window.js +50 -0
  155. package/dist/render/column-window.js.map +1 -0
  156. package/dist/render/content.d.ts +45 -0
  157. package/dist/render/content.js +140 -0
  158. package/dist/render/content.js.map +1 -0
  159. package/dist/render/editors.d.ts +28 -0
  160. package/dist/render/editors.js +41 -0
  161. package/dist/render/editors.js.map +1 -0
  162. package/dist/render/footer.d.ts +61 -0
  163. package/dist/render/footer.js +61 -0
  164. package/dist/render/footer.js.map +1 -0
  165. package/dist/render/group-row.d.ts +35 -0
  166. package/dist/render/group-row.js +59 -0
  167. package/dist/render/group-row.js.map +1 -0
  168. package/dist/render/header.d.ts +92 -0
  169. package/dist/render/header.js +103 -0
  170. package/dist/render/header.js.map +1 -0
  171. package/dist/render/keyed-rows.d.ts +25 -0
  172. package/dist/render/keyed-rows.js +98 -0
  173. package/dist/render/keyed-rows.js.map +1 -0
  174. package/dist/render/virtualizer.d.ts +110 -0
  175. package/dist/render/virtualizer.js +509 -0
  176. package/dist/render/virtualizer.js.map +1 -0
  177. package/dist/row-model/added-rows.d.ts +32 -0
  178. package/dist/row-model/added-rows.js +95 -0
  179. package/dist/row-model/added-rows.js.map +1 -0
  180. package/dist/row-model/cell-range.d.ts +71 -0
  181. package/dist/row-model/cell-range.js +187 -0
  182. package/dist/row-model/cell-range.js.map +1 -0
  183. package/dist/row-model/columns.d.ts +80 -0
  184. package/dist/row-model/columns.js +207 -0
  185. package/dist/row-model/columns.js.map +1 -0
  186. package/dist/row-model/compare.d.ts +40 -0
  187. package/dist/row-model/compare.js +590 -0
  188. package/dist/row-model/compare.js.map +1 -0
  189. package/dist/row-model/distinct.d.ts +39 -0
  190. package/dist/row-model/distinct.js +105 -0
  191. package/dist/row-model/distinct.js.map +1 -0
  192. package/dist/row-model/filter.d.ts +80 -0
  193. package/dist/row-model/filter.js +582 -0
  194. package/dist/row-model/filter.js.map +1 -0
  195. package/dist/row-model/flatten.d.ts +129 -0
  196. package/dist/row-model/flatten.js +511 -0
  197. package/dist/row-model/flatten.js.map +1 -0
  198. package/dist/row-model/fold.d.ts +25 -0
  199. package/dist/row-model/fold.js +104 -0
  200. package/dist/row-model/fold.js.map +1 -0
  201. package/dist/row-model/format.d.ts +58 -0
  202. package/dist/row-model/format.js +239 -0
  203. package/dist/row-model/format.js.map +1 -0
  204. package/dist/row-model/group.d.ts +30 -0
  205. package/dist/row-model/group.js +173 -0
  206. package/dist/row-model/group.js.map +1 -0
  207. package/dist/row-model/lru.d.ts +19 -0
  208. package/dist/row-model/lru.js +48 -0
  209. package/dist/row-model/lru.js.map +1 -0
  210. package/dist/row-model/sort.d.ts +30 -0
  211. package/dist/row-model/sort.js +107 -0
  212. package/dist/row-model/sort.js.map +1 -0
  213. package/dist/row-model/summary.d.ts +64 -0
  214. package/dist/row-model/summary.js +213 -0
  215. package/dist/row-model/summary.js.map +1 -0
  216. package/dist/row-model/tree.d.ts +116 -0
  217. package/dist/row-model/tree.js +478 -0
  218. package/dist/row-model/tree.js.map +1 -0
  219. package/dist/row-model/types.d.ts +109 -0
  220. package/dist/row-model/types.js +5 -0
  221. package/dist/row-model/types.js.map +1 -0
  222. package/dist/row-model/value.d.ts +20 -0
  223. package/dist/row-model/value.js +57 -0
  224. package/dist/row-model/value.js.map +1 -0
  225. package/dist/state/grid-state.d.ts +147 -0
  226. package/dist/state/grid-state.js +295 -0
  227. package/dist/state/grid-state.js.map +1 -0
  228. package/dist/state/storage.d.ts +33 -0
  229. package/dist/state/storage.js +62 -0
  230. package/dist/state/storage.js.map +1 -0
  231. package/dist/state/versioned.d.ts +18 -0
  232. package/dist/state/versioned.js +56 -0
  233. package/dist/state/versioned.js.map +1 -0
  234. package/package.json +141 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eric Kono
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,156 @@
1
- # Temporary Holding Version
1
+ # `<u-grid>` — @universal-material/data-grid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/@universal-material/data-grid)](https://www.npmjs.com/package/@universal-material/data-grid)
4
+ [![license](https://img.shields.io/npm/l/@universal-material/data-grid)](https://github.com/universal-material/data-grid/blob/main/LICENSE)
5
+
6
+ **A fast, accessible data grid as a standard Web Component.** `<u-grid>` is built with
7
+ [Lit](https://lit.dev) and belongs to the [Universal Material](https://universal-material.github.io/)
8
+ family. Because it is a native custom element, it works the same in plain HTML, Lit, Angular, React,
9
+ Vue or Svelte.
10
+
11
+ **[Live documentation and examples →](https://universal-material.github.io/data-grid/)**
12
+ &nbsp;·&nbsp; [Full API reference](https://github.com/universal-material/data-grid/blob/main/API.md)
13
+ &nbsp;·&nbsp; [GitHub](https://github.com/universal-material/data-grid)
14
+
15
+ ![A <u-grid> grouped by year](https://raw.githubusercontent.com/universal-material/data-grid/main/.github/readme/overview.webp)
16
+
17
+ ---
18
+
19
+ ## Highlights
20
+
21
+ - **Millions of rows.** Its own row virtualization renders only the visible rows. Sorting,
22
+ grouping and expanding don't add per-row work, and the scroll range scales past the browser's
23
+ maximum element height. Hundreds of columns can be virtualized as well.
24
+ - **Remote data.** A `dataSource` whose server filters, sorts, groups, summarizes and pages. Only the
25
+ visible blocks load, with skeleton rows, a pager or infinite scrolling, a load panel and "Retry".
26
+ - **Shape the data.** Multi-column sorting, a filter row, a search panel, header filters, grouping by
27
+ drag and drop (also by ranges), summaries, tree data and master-detail.
28
+ - **Editing.** Cell, row and batch modes, built-in editors per data type, your own editors, and
29
+ synchronous or server-side validation. The grid never mutates your items: it hands you the
30
+ changes to save.
31
+ - **Real-time updates.** `applyChanges()` patches rows in place and keeps selection, focus and
32
+ expansion. With `reshapeOnChanges`, each batch re-applies filter, sort, groups and summaries, for
33
+ live data that moves.
34
+ - **i18n in 14 languages, plus RTL.** Built-in translations, automatic language detection, `Intl`
35
+ formatting of numbers and dates, global overrides, and full right-to-left layout (Arabic is
36
+ built in).
37
+ - **Accessible.** Follows the WAI-ARIA APG grid (and treegrid) pattern for WCAG 2.2 AA. Full
38
+ keyboard navigation survives virtualization, with screen reader announcements, and is checked
39
+ with `axe-core`.
40
+ - **SSR.** Renders with `@lit-labs/ssr` and hydrates on the client. Templates can be
41
+ server-rendered too.
42
+ - **Theming.** Material `--u-color-*` tokens, `--u-grid-*` custom properties, `::part`s and Lit
43
+ templates for cells, headers, group rows and empty states.
44
+ - **Also included:** cell-range selection with copy and paste, column resize, pin, hide, bands and
45
+ responsive auto-hide, a toolbar and context menus, state persistence, and export to CSV, Excel
46
+ and tagged PDF.
47
+
48
+ ## Install
49
+
50
+ ```bash
51
+ npm i @universal-material/data-grid
52
+ ```
53
+
54
+ The package is modern ESM with TypeScript declarations and a
55
+ [custom elements manifest](https://github.com/custom-elements-manifest/custom-elements-manifest).
56
+ `lit`, `@lit/context` and `interactjs` are regular dependencies, so your bundler shares them with
57
+ the rest of your app. Importing the package registers `<u-grid>` as a side effect.
58
+
59
+ ## Quick start
60
+
61
+ ### Plain HTML (no build step)
62
+
63
+ A self-contained bundle (Lit included) is published for CDNs. An import map lets you write the same
64
+ `import` as with npm:
65
+
66
+ ```html
67
+ <script type="importmap">
68
+ {
69
+ "imports": {
70
+ "@universal-material/data-grid": "https://cdn.jsdelivr.net/npm/@universal-material/data-grid@0.1/dist/grid.min.js"
71
+ }
72
+ }
73
+ </script>
74
+
75
+ <u-grid style="height: 400px"></u-grid>
76
+
77
+ <script type="module">
78
+ import '@universal-material/data-grid';
79
+
80
+ const grid = document.querySelector('u-grid');
81
+ grid.columns = [
82
+ { path: 'country', label: 'Country' },
83
+ { path: 'year', label: 'Year', dataType: 'number', groupIndex: 0 },
84
+ { path: 'population', label: 'Population', dataType: 'number' },
85
+ ];
86
+ grid.items = [
87
+ { country: 'Brazil', year: 2022, population: 215313498 },
88
+ { country: 'Japan', year: 2022, population: 124947000 },
89
+ ];
90
+ </script>
91
+ ```
92
+
93
+ > **Give the grid a height.** It fills its container (`height: 100%`), so the grid or its parent
94
+ > needs a defined height for the scroll area.
95
+
96
+ ### Lit
97
+
98
+ ```ts
99
+ import { LitElement, html } from 'lit';
100
+ import { customElement } from 'lit/decorators.js';
101
+ import '@universal-material/data-grid';
102
+ import type { GridColumnDef } from '@universal-material/data-grid';
103
+
104
+ interface Order { id: number; customer: string; total: number }
105
+
106
+ @customElement('order-list')
107
+ export class OrderList extends LitElement {
108
+ columns: GridColumnDef<Order>[] = [
109
+ { path: 'customer', label: 'Customer' },
110
+ { path: 'total', label: 'Total', dataType: 'number', format: { style: 'currency', currency: 'USD' } },
111
+ ];
112
+
113
+ items: Order[] = [{ id: 1, customer: 'Ana', total: 120 }];
114
+
115
+ render() {
116
+ return html`<u-grid style="height: 400px" key-expr="id" .columns=${this.columns} .items=${this.items}
117
+ @u-grid-selection-change=${(e: CustomEvent) => console.log(e.detail)}></u-grid>`;
118
+ }
119
+ }
120
+ ```
121
+
122
+ ### Other frameworks
123
+
124
+ Set `columns`, `items` and other objects as **properties** (not attributes), and listen to the
125
+ `u-grid-*` events: `[columns]` in Angular (with `CUSTOM_ELEMENTS_SCHEMA`), `columns={…}` in
126
+ React 19+, and `:columns.prop` in Vue. Import the package before the first render. Details are in
127
+ [Using with frameworks](https://github.com/universal-material/data-grid/blob/main/API.md#using-with-frameworks).
128
+
129
+ ## Documentation
130
+
131
+ - **[Live docs](https://universal-material.github.io/data-grid/)** have one runnable example per
132
+ feature, with its source code.
133
+ - **[API.md](https://github.com/universal-material/data-grid/blob/main/API.md)** is the complete
134
+ guide and reference: every property, attribute, method, event, type, CSS custom property and
135
+ part, by feature. Popular sections:
136
+ [columns](https://github.com/universal-material/data-grid/blob/main/API.md#defining-columns),
137
+ [data sources and paging](https://github.com/universal-material/data-grid/blob/main/API.md#data-sources-keys--paging),
138
+ [real-time changes](https://github.com/universal-material/data-grid/blob/main/API.md#refreshing-and-incremental-changes),
139
+ [editing](https://github.com/universal-material/data-grid/blob/main/API.md#editing),
140
+ [i18n](https://github.com/universal-material/data-grid/blob/main/API.md#internationalization-i18n),
141
+ [accessibility](https://github.com/universal-material/data-grid/blob/main/API.md#accessibility),
142
+ [theming](https://github.com/universal-material/data-grid/blob/main/API.md#theming),
143
+ [SSR](https://github.com/universal-material/data-grid/blob/main/API.md#server-side-rendering) and the
144
+ [API tables](https://github.com/universal-material/data-grid/blob/main/API.md#api-reference).
145
+ - `@universal-material/data-grid/custom-elements.json` describes the elements for IDEs and
146
+ tooling.
147
+
148
+ ## Browser support
149
+
150
+ Current evergreen browsers: Chrome and Edge 114+, Firefox 125+, and Safari 17+. The grid relies on
151
+ ES2022, the Popover API and modern CSS (`color-mix()`, `:has()`). Internet Explorer and legacy
152
+ Edge are not supported.
153
+
154
+ ## License
155
+
156
+ [MIT](https://github.com/universal-material/data-grid/blob/main/LICENSE) © Eric Kono