@ornery/ui-grid-vanilla 1.0.6 → 1.0.8
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.
- package/README.md +75 -11
- package/dist/adopt-styles.d.ts +2 -0
- package/dist/adopt-styles.d.ts.map +1 -0
- package/dist/attribute-bridge.d.ts +39 -0
- package/dist/attribute-bridge.d.ts.map +1 -0
- package/dist/browser/ui-grid-element.js +9586 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/components/grid-body-cell/grid-body-cell.d.ts +19 -0
- package/dist/components/grid-body-cell/grid-body-cell.d.ts.map +1 -0
- package/dist/components/grid-body-cell/index.d.ts +2 -0
- package/dist/components/grid-body-cell/index.d.ts.map +1 -0
- package/dist/components/grid-cell-editor/grid-cell-editor.d.ts +28 -0
- package/dist/components/grid-cell-editor/grid-cell-editor.d.ts.map +1 -0
- package/dist/components/grid-cell-editor/index.d.ts +2 -0
- package/dist/components/grid-cell-editor/index.d.ts.map +1 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.d.ts +32 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.d.ts.map +1 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.template.d.ts +8 -0
- package/dist/components/grid-filter-cell/grid-filter-cell.template.d.ts.map +1 -0
- package/dist/components/grid-filter-cell/index.d.ts +2 -0
- package/dist/components/grid-filter-cell/index.d.ts.map +1 -0
- package/dist/components/grid-group-row/grid-group-row.d.ts +55 -0
- package/dist/components/grid-group-row/grid-group-row.d.ts.map +1 -0
- package/dist/components/grid-group-row/grid-group-row.template.d.ts +12 -0
- package/dist/components/grid-group-row/grid-group-row.template.d.ts.map +1 -0
- package/dist/components/grid-group-row/index.d.ts +2 -0
- package/dist/components/grid-group-row/index.d.ts.map +1 -0
- package/dist/components/grid-header-cell/grid-header-cell.d.ts +13 -0
- package/dist/components/grid-header-cell/grid-header-cell.d.ts.map +1 -0
- package/dist/components/grid-header-cell/index.d.ts +2 -0
- package/dist/components/grid-header-cell/index.d.ts.map +1 -0
- package/dist/components/grid-pagination/grid-pagination.d.ts +45 -0
- package/dist/components/grid-pagination/grid-pagination.d.ts.map +1 -0
- package/dist/components/grid-pagination/grid-pagination.template.d.ts +17 -0
- package/dist/components/grid-pagination/grid-pagination.template.d.ts.map +1 -0
- package/dist/components/grid-pagination/index.d.ts +2 -0
- package/dist/components/grid-pagination/index.d.ts.map +1 -0
- package/dist/components/grid-template/grid-template.d.ts +31 -0
- package/dist/components/grid-template/grid-template.d.ts.map +1 -0
- package/dist/components/grid-template/index.d.ts +2 -0
- package/dist/components/grid-template/index.d.ts.map +1 -0
- package/dist/events.d.ts +43 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/focus.d.ts +100 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/framework-slots.d.ts +170 -0
- package/dist/framework-slots.d.ts.map +1 -0
- package/dist/grid-controller.d.ts +363 -0
- package/dist/grid-controller.d.ts.map +1 -0
- package/dist/icons.d.ts +34 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/index.d.ts +11 -899
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.mjs +20 -0
- package/dist/patch.d.ts +88 -0
- package/dist/patch.d.ts.map +1 -0
- package/dist/render.d.ts +62 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/templates/index.d.ts +24 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/ui-grid-empty.template.d.ts +8 -0
- package/dist/ui-grid-empty.template.d.ts.map +1 -0
- package/dist/ui-grid-shell.template.d.ts +17 -0
- package/dist/ui-grid-shell.template.d.ts.map +1 -0
- package/dist/ui-grid-standalone.element.d.ts +309 -0
- package/dist/ui-grid-standalone.element.d.ts.map +1 -0
- package/dist/utils/cell-class.d.ts +9 -0
- package/dist/utils/cell-class.d.ts.map +1 -0
- package/dist/utils/display-items.d.ts +11 -0
- package/dist/utils/display-items.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +22 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/package.json +18 -11
- package/src/browser.test.ts +9 -0
- package/src/browser.ts +8 -0
- package/src/grid-controller.ts +24 -0
- package/src/index.integration.test.ts +32 -6
- package/tsconfig.dts.json +15 -0
- package/tsconfig.json +0 -1
- package/tsup.config.ts +22 -7
- package/dist/index.d.mts +0 -901
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ class MyComponent extends HTMLElement {
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
The `.html` template uses ES6 template literal syntax:
|
|
48
|
+
|
|
48
49
|
```html
|
|
49
50
|
<div class="my-class">${this.myProp}</div>
|
|
50
51
|
```
|
|
@@ -60,10 +61,10 @@ Templates are compiled at build time by `@ornery/web-components/vite` (or `/webp
|
|
|
60
61
|
|
|
61
62
|
Cell and row slot templates support dual binding syntax:
|
|
62
63
|
|
|
63
|
-
| Syntax
|
|
64
|
-
|
|
65
|
-
| `{{ }}` | `{{value}}`
|
|
66
|
-
| `${ }`
|
|
64
|
+
| Syntax | Example | Description |
|
|
65
|
+
| ------- | --------------- | ----------------------------------------------------- |
|
|
66
|
+
| `{{ }}` | `{{value}}` | Mustache-style, original grid syntax |
|
|
67
|
+
| `${ }` | `${this.value}` | ES6 template literal, `@ornery/web-components` native |
|
|
67
68
|
|
|
68
69
|
Both resolve against the same context: `{ $implicit, value, valueText, row, column, rowIndex }`.
|
|
69
70
|
|
|
@@ -75,6 +76,53 @@ npm install @ornery/ui-grid-vanilla @ornery/ui-grid-core
|
|
|
75
76
|
|
|
76
77
|
## Usage
|
|
77
78
|
|
|
79
|
+
### No-Bundler Browser Usage
|
|
80
|
+
|
|
81
|
+
Use the browser bundle when a static HTML host needs to consume the grid without Vite, Webpack, tsup, or another package-aware build step. The bundle includes `@ornery/ui-grid-core` and registers `<ui-grid-element>` when the module loads.
|
|
82
|
+
|
|
83
|
+
After `npm run build:vanilla` from the repo root, the browser-ready file is written to `projects/ui-grid-vanilla/dist/browser/ui-grid-element.js`.
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<!doctype html>
|
|
87
|
+
<html lang="en">
|
|
88
|
+
<head>
|
|
89
|
+
<meta charset="utf-8" />
|
|
90
|
+
<title>UI Grid Browser Bundle</title>
|
|
91
|
+
<script type="module" src="./ui-grid-element.js"></script>
|
|
92
|
+
</head>
|
|
93
|
+
<body>
|
|
94
|
+
<ui-grid-element
|
|
95
|
+
grid-id="static-grid"
|
|
96
|
+
enable-sorting
|
|
97
|
+
enable-filtering
|
|
98
|
+
column-defs='[{"name":"name"},{"name":"role"},{"name":"salary","type":"number","align":"end"}]'
|
|
99
|
+
data='[{"name":"Alice","role":"Engineer","salary":120000},{"name":"Bob","role":"Designer","salary":95000}]'
|
|
100
|
+
>
|
|
101
|
+
</ui-grid-element>
|
|
102
|
+
</body>
|
|
103
|
+
</html>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For imperative setup in the same no-bundler environment, import from that same file:
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<div id="grid"></div>
|
|
110
|
+
|
|
111
|
+
<script type="module">
|
|
112
|
+
import { mountVanillaUiGrid } from './ui-grid-element.js';
|
|
113
|
+
|
|
114
|
+
await mountVanillaUiGrid(document.querySelector('#grid'), {
|
|
115
|
+
id: 'static-mounted-grid',
|
|
116
|
+
columnDefs: [{ name: 'name' }, { name: 'role' }],
|
|
117
|
+
data: [{ name: 'Alice', role: 'Engineer' }],
|
|
118
|
+
enableSorting: true,
|
|
119
|
+
enableFiltering: true,
|
|
120
|
+
});
|
|
121
|
+
</script>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The package `dist/index.js` file is CommonJS for Node/package consumers, and `dist/index.mjs` is package ESM for bundlers or import-map setups. Use `dist/browser/ui-grid-element.js` for direct browser loading.
|
|
125
|
+
|
|
78
126
|
### Imperative (JavaScript)
|
|
79
127
|
|
|
80
128
|
```js
|
|
@@ -103,7 +151,8 @@ const grid = await mountVanillaUiGrid(document.getElementById('grid'), {
|
|
|
103
151
|
enable-sorting
|
|
104
152
|
enable-filtering
|
|
105
153
|
column-defs='[{"name":"name","field":"name"},{"name":"age","field":"age","align":"end"}]'
|
|
106
|
-
data='[{"name":"Alice","age":30},{"name":"Bob","age":25}]'
|
|
154
|
+
data='[{"name":"Alice","age":30},{"name":"Bob","age":25}]'
|
|
155
|
+
>
|
|
107
156
|
</ui-grid-element>
|
|
108
157
|
```
|
|
109
158
|
|
|
@@ -131,10 +180,21 @@ Define reusable components from HTML alone with `<template is="ui-grid-template"
|
|
|
131
180
|
<!-- Define a badge component -->
|
|
132
181
|
<template is="ui-grid-template" name="ui-status-badge" status="unknown">
|
|
133
182
|
<style>
|
|
134
|
-
:host {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
.badge
|
|
183
|
+
:host {
|
|
184
|
+
display: inline-block;
|
|
185
|
+
}
|
|
186
|
+
.badge {
|
|
187
|
+
padding: 2px 8px;
|
|
188
|
+
border-radius: 4px;
|
|
189
|
+
}
|
|
190
|
+
.badge-active {
|
|
191
|
+
background: #d1fae5;
|
|
192
|
+
color: #065f46;
|
|
193
|
+
}
|
|
194
|
+
.badge-inactive {
|
|
195
|
+
background: #fee2e2;
|
|
196
|
+
color: #991b1b;
|
|
197
|
+
}
|
|
138
198
|
</style>
|
|
139
199
|
<span class="badge badge-${this.status}">${this.status}</span>
|
|
140
200
|
</template>
|
|
@@ -156,7 +216,7 @@ import { defineConfig } from 'vite';
|
|
|
156
216
|
import webComponents from '@ornery/web-components/vite';
|
|
157
217
|
|
|
158
218
|
export default defineConfig({
|
|
159
|
-
plugins: [webComponents()]
|
|
219
|
+
plugins: [webComponents()],
|
|
160
220
|
});
|
|
161
221
|
```
|
|
162
222
|
|
|
@@ -166,7 +226,7 @@ export default defineConfig({
|
|
|
166
226
|
import webComponents from '@ornery/web-components/webpack';
|
|
167
227
|
|
|
168
228
|
export default {
|
|
169
|
-
plugins: [webComponents()]
|
|
229
|
+
plugins: [webComponents()],
|
|
170
230
|
};
|
|
171
231
|
```
|
|
172
232
|
|
|
@@ -184,13 +244,17 @@ export default defineConfig({
|
|
|
184
244
|
## API
|
|
185
245
|
|
|
186
246
|
### `mountVanillaUiGrid(target, options, rustModule?, tagName?)`
|
|
247
|
+
|
|
187
248
|
Mount a grid into a target element. Returns the grid element.
|
|
188
249
|
|
|
189
250
|
### `defineStandaloneUiGridElement(tagName?)`
|
|
251
|
+
|
|
190
252
|
Register the `<ui-grid-element>` custom element (and all sub-components).
|
|
191
253
|
|
|
192
254
|
### `UIGridTemplate`
|
|
255
|
+
|
|
193
256
|
Exported class for the `<template is="ui-grid-template">` element. Auto-registered when the grid is defined.
|
|
194
257
|
|
|
195
258
|
### Grid Element Properties
|
|
259
|
+
|
|
196
260
|
See `VanillaUiGridElement` type — all `GridOptions` fields are available as both HTML attributes and JS properties.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adopt-styles.d.ts","sourceRoot":"","sources":["../src/adopt-styles.ts"],"names":[],"mappings":"AAiBA,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAqBlF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarative attribute bridge.
|
|
3
|
+
*
|
|
4
|
+
* The grid element accepts its full `GridOptions` shape through HTML
|
|
5
|
+
* attributes so it can be driven declaratively from any framework (or
|
|
6
|
+
* plain HTML). This module owns:
|
|
7
|
+
*
|
|
8
|
+
* - `OBSERVED_GRID_ATTRIBUTES`: the list passed to `observedAttributes`
|
|
9
|
+
* - `parseGridAttributeOptions(el)`: reads attributes off an element and
|
|
10
|
+
* returns the `Partial<GridOptions>` they describe
|
|
11
|
+
* - the individual attribute parsers (boolean / tri-state / number / JSON)
|
|
12
|
+
*
|
|
13
|
+
* The element keeps its own `attributeOptions` cache and `buildEffectiveOptions`
|
|
14
|
+
* merge so JS-set properties can override attribute values, but the parsing
|
|
15
|
+
* itself lives here.
|
|
16
|
+
*/
|
|
17
|
+
import type { GridOptions } from '@ornery/ui-grid-core';
|
|
18
|
+
/** The list passed to `static observedAttributes`. Every kebab-case name
|
|
19
|
+
* that corresponds to a GridOptions field lives here. */
|
|
20
|
+
export declare const OBSERVED_GRID_ATTRIBUTES: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Read every supported attribute off the element and produce the
|
|
23
|
+
* corresponding `Partial<GridOptions>`. Missing attributes are simply
|
|
24
|
+
* absent from the result — the element merges this with its imperative
|
|
25
|
+
* `options` setter so JS-set properties win.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseGridAttributeOptions(el: Element): Partial<GridOptions>;
|
|
28
|
+
/** Present attribute → true. Absent → undefined (no override). */
|
|
29
|
+
export declare function parseBoolean(el: Element, name: string): boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Tri-state boolean. Present + empty/"true" → true; "false"/"0"/"off" →
|
|
32
|
+
* false; absent → undefined. Use for flags that default to true in the
|
|
33
|
+
* model so consumers can opt out with `attr="false"` without removing
|
|
34
|
+
* the attribute.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseTriStateBoolean(el: Element, name: string): boolean | undefined;
|
|
37
|
+
export declare function parseNumber(el: Element, name: string): number | undefined;
|
|
38
|
+
export declare function parseJson<T = unknown>(el: Element, name: string): T | undefined;
|
|
39
|
+
//# sourceMappingURL=attribute-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-bridge.d.ts","sourceRoot":"","sources":["../src/attribute-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAiB,WAAW,EAAc,MAAM,sBAAsB,CAAC;AAEnF;yDACyD;AACzD,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAuDrD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAwK3E;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAOnF;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKzE;AAED,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAS/E"}
|