@ornery/ui-grid-vanilla 0.1.7 → 0.1.8-hotfix-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.
- package/demo/index.html +145 -1
- package/demo/main.ts +53 -2
- package/dist/index.d.mts +114 -1
- package/dist/index.d.ts +114 -1
- package/dist/index.js +595 -16
- package/dist/index.mjs +597 -16
- package/package.json +2 -2
- package/src/grid-controller.ts +24 -0
- package/src/index.integration.test.ts +32 -0
- package/src/ui-grid-standalone.element.ts +702 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornery/ui-grid-vanilla",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8-hotfix-1",
|
|
4
4
|
"description": "Vanilla DOM wrapper for the Rust/WASM-backed @ornery/ui-grid-core custom element",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ornery/ui-grid-core": "
|
|
19
|
+
"@ornery/ui-grid-core": "0.1.8-hotfix-1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"typescript": "~5.8.0",
|
package/src/grid-controller.ts
CHANGED
|
@@ -248,6 +248,30 @@ export class VanillaGridController {
|
|
|
248
248
|
this.refresh();
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Fast-path: swap only the row data and rebuild the pipeline without
|
|
253
|
+
* touching column state. Emits the new snapshot. The element uses this to
|
|
254
|
+
* patch cell content in-place without rebuilding the full shadow DOM.
|
|
255
|
+
*/
|
|
256
|
+
refreshData(data: readonly GridRecord[]): void {
|
|
257
|
+
this.options = { ...this.options, data };
|
|
258
|
+
this.pipeline = defaultGridEngine.buildPipeline({
|
|
259
|
+
options: this.options,
|
|
260
|
+
columns: this.visibleColumns,
|
|
261
|
+
activeFilters: this.activeFilters,
|
|
262
|
+
sortState: this.sortState,
|
|
263
|
+
groupByColumns: this.groupByColumns,
|
|
264
|
+
collapsedGroups: this.collapsedGroups,
|
|
265
|
+
hiddenRowReasons: this.hiddenRowReasons,
|
|
266
|
+
expandedRows: this.expandedRows,
|
|
267
|
+
expandedTreeRows: this.expandedTreeRows,
|
|
268
|
+
currentPage: this.currentPage,
|
|
269
|
+
pageSize: this.pageSize,
|
|
270
|
+
rowSize: this.getRowSize(),
|
|
271
|
+
});
|
|
272
|
+
this.emit();
|
|
273
|
+
}
|
|
274
|
+
|
|
251
275
|
subscribe(subscriber: GridControllerSubscriber): () => void {
|
|
252
276
|
this.subscribers.add(subscriber);
|
|
253
277
|
subscriber(this.getSnapshot());
|
|
@@ -107,6 +107,38 @@ describe('mountVanillaUiGrid integration', () => {
|
|
|
107
107
|
]);
|
|
108
108
|
}, 15000);
|
|
109
109
|
|
|
110
|
+
it('renders custom header content from column headerRenderer', async () => {
|
|
111
|
+
const target = document.getElementById('app');
|
|
112
|
+
if (!target) {
|
|
113
|
+
throw new Error('Expected test root element');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const grid = await mountVanillaUiGrid(
|
|
117
|
+
target,
|
|
118
|
+
{
|
|
119
|
+
id: 'vanilla-header-render-grid',
|
|
120
|
+
data: [{ id: 'row-1', name: 'Gamma', status: 'Pilot' }],
|
|
121
|
+
columnDefs: [
|
|
122
|
+
{
|
|
123
|
+
name: 'name',
|
|
124
|
+
displayName: 'Customer',
|
|
125
|
+
headerRenderer: ({ value, column }) => `${value}:${column.name}`,
|
|
126
|
+
},
|
|
127
|
+
{ name: 'status' },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
undefined,
|
|
131
|
+
'ui-grid-element-vanilla-test',
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const shadowRoot = await waitFor(() => grid.shadowRoot);
|
|
135
|
+
const headers = Array.from(shadowRoot.querySelectorAll('.header-label')).map((node) =>
|
|
136
|
+
node.textContent?.trim(),
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
expect(headers).toEqual(['Customer:name', 'Status']);
|
|
140
|
+
});
|
|
141
|
+
|
|
110
142
|
it('registers Rust/WASM bindings through the vanilla API', async () => {
|
|
111
143
|
const module: UiGridRustWebModule = {
|
|
112
144
|
default: vi.fn(async () => undefined),
|