@ornery/ui-grid-vanilla 5.0.2 → 5.0.3
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/dist/adopt-styles.d.ts +1 -0
- package/dist/adopt-styles.d.ts.map +1 -1
- package/dist/browser/ui-grid-element.js +254 -73
- package/dist/components/grid-filter-cell/grid-filter-cell.template.d.ts.map +1 -1
- package/dist/components/grid-group-row/grid-group-row.d.ts +3 -0
- package/dist/components/grid-group-row/grid-group-row.d.ts.map +1 -1
- package/dist/components/grid-group-row/grid-group-row.template.d.ts +1 -0
- package/dist/components/grid-group-row/grid-group-row.template.d.ts.map +1 -1
- package/dist/framework-slots.d.ts +2 -0
- package/dist/framework-slots.d.ts.map +1 -1
- package/dist/grid-controller.d.ts +7 -0
- package/dist/grid-controller.d.ts.map +1 -1
- package/dist/index.js +234 -65
- package/dist/index.mjs +236 -66
- package/dist/pagination-range-label.d.ts +8 -0
- package/dist/pagination-range-label.d.ts.map +1 -0
- package/dist/patch.d.ts +1 -1
- package/dist/patch.d.ts.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/templates/index.d.ts +2 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/ui-grid-standalone.element.d.ts +10 -0
- package/dist/ui-grid-standalone.element.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adopt-styles.ts +31 -1
- package/src/auto-resize.test.ts +4 -2
- package/src/components/grid-filter-cell/grid-filter-cell.template.ts +4 -3
- package/src/components/grid-group-row/grid-group-row.template.ts +6 -4
- package/src/components/grid-group-row/grid-group-row.ts +5 -1
- package/src/framework-slots.ts +38 -17
- package/src/grid-controller.ts +79 -12
- package/src/group-row.test.ts +66 -0
- package/src/index.integration.test.ts +32 -13
- package/src/pagination-range-label.test.ts +85 -0
- package/src/pagination-range-label.ts +10 -0
- package/src/pagination-range.test.ts +60 -0
- package/src/patch.ts +31 -9
- package/src/render.pagination.test.ts +37 -0
- package/src/render.ts +34 -10
- package/src/row-height.test.ts +52 -0
- package/src/scrollbar-compensation.test.ts +52 -0
- package/src/selection-pinning.test.ts +39 -0
- package/src/slot-updates.test.ts +137 -0
- package/src/templates/index.ts +8 -4
- package/src/theming-hooks.test.ts +66 -0
- package/src/ui-grid-empty.template.ts +1 -1
- package/src/ui-grid-shell.template.ts +2 -2
- package/src/ui-grid-standalone.element.ts +41 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Pager range label ("1-10 of 42"). Shared by the initial render and the
|
|
2
|
+
* patch path so both show the same text for empty results ("0 of 0"). */
|
|
3
|
+
export declare function formatPaginationRangeLabel(range: {
|
|
4
|
+
firstRowIndex: number;
|
|
5
|
+
lastRowIndex: number;
|
|
6
|
+
totalItems: number;
|
|
7
|
+
}): string;
|
|
8
|
+
//# sourceMappingURL=pagination-range-label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-range-label.d.ts","sourceRoot":"","sources":["../src/pagination-range-label.ts"],"names":[],"mappings":"AAAA;yEACyE;AACzE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAGT"}
|
package/dist/patch.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare function renderPatch(el: UiGridStandaloneElement, plan: {
|
|
|
47
47
|
* node where possible. Returns the body container the caller should
|
|
48
48
|
* patch into, or null for the empty state.
|
|
49
49
|
*/
|
|
50
|
-
export declare function reconcileBodyRoot(el: UiGridStandaloneElement, root: ShadowRoot, kind: 'empty' | 'virtual' | 'static', options: GridOptions, labels: GridControllerSnapshot['labels'], templateColumns: string, virtualOffset: number, totalVirtualHeight: number): HTMLElement | null;
|
|
50
|
+
export declare function reconcileBodyRoot(el: UiGridStandaloneElement, root: ShadowRoot, kind: 'empty' | 'virtual' | 'static', options: GridOptions, labels: GridControllerSnapshot['labels'], templateColumns: string, virtualOffset: number, totalVirtualHeight: number, rowSize: number): HTMLElement | null;
|
|
51
51
|
/**
|
|
52
52
|
* Pagination reconciliation: mount, patch, or remove the `<ui-grid-pagination>`
|
|
53
53
|
* based on whether the snapshot should show it. Lives inside `.grid-table`
|
package/dist/patch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../src/patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,OAAO,EACP,SAAS,EACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../src/patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,OAAO,EACP,SAAS,EACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAgBhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAa5E;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,uBAAuB,EAC3B,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAClC,IAAI,CAsDN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,uBAAuB,EAC3B,IAAI,EAAE;IACJ,QAAQ,EAAE,sBAAsB,CAAC;IACjC,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,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AAE,EACrC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB,IAAI,CAuFN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CActE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,uBAAuB,EAC3B,aAAa,EAAE,WAAW,EAC1B,QAAQ,EAAE,sBAAsB,EAChC,aAAa,EAAE,SAAS,WAAW,EAAE,EACrC,UAAU,EAAE,MAAM,GACjB,IAAI,CA6IN;AAsCD,8CAA8C;AAC9C,wBAAgB,aAAa,CAC3B,EAAE,EAAE,uBAAuB,EAC3B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,SAAS,GACf,IAAI,CAcN;AAED;gDACgD;AAChD,wBAAgB,aAAa,CAC3B,EAAE,EAAE,uBAAuB,EAC3B,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAC5C,IAAI,CAwFN;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAC7B,EAAE,EAAE,uBAAuB,EAC3B,YAAY,EAAE,WAAW,EACzB,QAAQ,EAAE,sBAAsB,GAC/B,IAAI,CA4BN"}
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3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AC3B,QAAQ,EAAE,sBAAsB,GAC/B,MAAM,CAUR;AAED;;4DAE4D;AAC5D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAK5E;AAED;gEACgE;AAChE,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,uBAAuB,EAC3B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,GACnB,MAAM,CAGR;AAED;;8CAE8C;AAC9C,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,uBAAuB,EAC3B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAkCR;AAED;yEACyE;AACzE,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,uBAAuB,EAC3B,GAAG,EAAE,OAAO,GACX,MAAM,CAkBR;AAED;qEACqE;AACrE,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,uBAAuB,EAC3B,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,MAAM,CAQR;AAED;sEACsE;AACtE,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,uBAAuB,EAC3B,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CAGf;AAED;mEACmE;AACnE,wBAAgB,WAAW,CACzB,EAAE,EAAE,uBAAuB,EAC3B,GAAG,EAAE,OAAO,EACZ,QAAQ,SAAI,GACX,MAAM,CAIR"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
export declare function iconMarkup(svgClass: string, viewBox: string, path: string): string;
|
|
12
12
|
export declare function slotRegistryMarkup(cellSlots: string): string;
|
|
13
13
|
export declare function filterRowMarkup(templateColumns: string, filterCells: string): string;
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function virtualSpacerStyle(totalVirtualHeight: number, rowSize: number): string;
|
|
15
|
+
export declare function bodyVirtualMarkup(templateColumns: string, totalVirtualHeight: number, virtualOffset: number, bodyContent: string, rowSize: number): string;
|
|
15
16
|
export declare function bodyStaticMarkup(templateColumns: string, bodyContent: string): string;
|
|
16
17
|
export declare function emptyDataMarkup(heading: string, description: string): string;
|
|
17
18
|
export declare function expandableRowMarkup(expandableContent: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,wBAAgB,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1J;AAED,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAErF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElH;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpH;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEnH;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAE7E"}
|
|
@@ -20,6 +20,11 @@ export type VanillaUiGridElement = HTMLElement & {
|
|
|
20
20
|
* full contract.
|
|
21
21
|
*/
|
|
22
22
|
setFrameworkRenderedSlots(config: FrameworkRenderedSlotsConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* Add CSS to the grid's shadow root, after the grid's own styles so it wins
|
|
25
|
+
* at equal specificity. Returns a function that removes it.
|
|
26
|
+
*/
|
|
27
|
+
addStyles(cssText: string): () => void;
|
|
23
28
|
};
|
|
24
29
|
type VanillaGridOptions = GridOptions & {
|
|
25
30
|
iconOverrides?: UiGridIconOverrides;
|
|
@@ -90,6 +95,8 @@ export declare class UiGridStandaloneElement extends HTMLElement {
|
|
|
90
95
|
static get observedAttributes(): string[];
|
|
91
96
|
get options(): GridOptions;
|
|
92
97
|
set options(value: GridOptions);
|
|
98
|
+
/** Append application CSS after the grid styles; return a removal callback. */
|
|
99
|
+
addStyles(cssText: string): () => void;
|
|
93
100
|
/**
|
|
94
101
|
* Declare which slots are framework-rendered. When a slot is flagged, the
|
|
95
102
|
* element renders a `<slot name="…">` placeholder at the usual site instead
|
|
@@ -241,6 +248,9 @@ export declare class UiGridStandaloneElement extends HTMLElement {
|
|
|
241
248
|
renderVirtualBody(): void;
|
|
242
249
|
/** @internal */
|
|
243
250
|
render(): void;
|
|
251
|
+
private scrollbarObserver;
|
|
252
|
+
private observedBodyViewport;
|
|
253
|
+
private syncScrollbarCompensation;
|
|
244
254
|
/** @internal */
|
|
245
255
|
private inAutoAdjust;
|
|
246
256
|
private lastAutoHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-grid-standalone.element.d.ts","sourceRoot":"","sources":["../src/ui-grid-standalone.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,KAAK,4BAA4B,EAClC,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAmD3B,OAAO,EACL,YAAY,EAGZ,KAAK,mBAAmB,EACzB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,o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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornery/ui-grid-vanilla",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Vanilla DOM wrapper for the Rust/WASM-backed @ornery/ui-grid-core custom element",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"./browser/ui-grid-element.js": "./dist/browser/ui-grid-element.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ornery/ui-grid-core": "5.0.
|
|
29
|
+
"@ornery/ui-grid-core": "^5.0.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@ornery/ui-grid-core": "file:../ui-grid-core",
|
package/src/adopt-styles.ts
CHANGED
|
@@ -34,6 +34,36 @@ export function adoptStyles(shadowRoot: ShadowRoot, css: string, key: object): v
|
|
|
34
34
|
sheetCache.set(key, sheet);
|
|
35
35
|
}
|
|
36
36
|
if (!shadowRoot.adoptedStyleSheets.includes(sheet)) {
|
|
37
|
-
shadowRoot.adoptedStyleSheets
|
|
37
|
+
const own = shadowRoot.adoptedStyleSheets.filter((s) => !isUserSheet(shadowRoot, s));
|
|
38
|
+
shadowRoot.adoptedStyleSheets = [...own, sheet, ...userSheetsOf(shadowRoot)];
|
|
38
39
|
}
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
// App sheets from addStyles stay after the grid's own sheets so they win at
|
|
43
|
+
// equal specificity, even when the grid adopts a sheet later.
|
|
44
|
+
const userSheets = new WeakMap<ShadowRoot, CSSStyleSheet[]>();
|
|
45
|
+
|
|
46
|
+
function userSheetsOf(shadowRoot: ShadowRoot): CSSStyleSheet[] {
|
|
47
|
+
return userSheets.get(shadowRoot) ?? [];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isUserSheet(shadowRoot: ShadowRoot, sheet: CSSStyleSheet): boolean {
|
|
51
|
+
return userSheetsOf(shadowRoot).includes(sheet);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function addUserStyles(shadowRoot: ShadowRoot, css: string): () => void {
|
|
55
|
+
if (!supportsAdoptedStyleSheets()) {
|
|
56
|
+
const styleEl = document.createElement('style');
|
|
57
|
+
styleEl.textContent = css;
|
|
58
|
+
shadowRoot.append(styleEl);
|
|
59
|
+
return () => styleEl.remove();
|
|
60
|
+
}
|
|
61
|
+
const sheet = new CSSStyleSheet();
|
|
62
|
+
sheet.replaceSync(css);
|
|
63
|
+
userSheets.set(shadowRoot, [...userSheetsOf(shadowRoot), sheet]);
|
|
64
|
+
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, sheet];
|
|
65
|
+
return () => {
|
|
66
|
+
userSheets.set(shadowRoot, userSheetsOf(shadowRoot).filter((s) => s !== sheet));
|
|
67
|
+
shadowRoot.adoptedStyleSheets = shadowRoot.adoptedStyleSheets.filter((s) => s !== sheet);
|
|
68
|
+
};
|
|
69
|
+
}
|
package/src/auto-resize.test.ts
CHANGED
|
@@ -15,9 +15,11 @@ class MockResizeObserver {
|
|
|
15
15
|
callback: ResizeObserverCallback;
|
|
16
16
|
constructor(callback: ResizeObserverCallback) {
|
|
17
17
|
this.callback = callback;
|
|
18
|
-
resizeObserverCallback = callback;
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
// Keep the host's observer; the element also observes its body viewport.
|
|
20
|
+
observe = vi.fn((target: Element) => {
|
|
21
|
+
if (target.tagName.toLowerCase().startsWith('ui-grid-element')) resizeObserverCallback = this.callback;
|
|
22
|
+
});
|
|
21
23
|
unobserve = vi.fn();
|
|
22
24
|
disconnect = mockResizeObserverDisconnect;
|
|
23
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import css from './grid-filter-cell.scss';
|
|
2
2
|
import { adoptStyles } from '../../adopt-styles';
|
|
3
|
+
import { escapeHtml } from '../../utils/dom';
|
|
3
4
|
|
|
4
5
|
const STYLE_KEY = {};
|
|
5
6
|
|
|
@@ -14,7 +15,7 @@ export function renderFilterCell(ctx: FilterCellContext, shadowRoot: ShadowRoot)
|
|
|
14
15
|
shadowRoot.innerHTML =
|
|
15
16
|
`<input class="ui-grid-filter-input"` +
|
|
16
17
|
` data-role="filter"` +
|
|
17
|
-
` data-column="${ctx.columnName}"` +
|
|
18
|
-
` placeholder="${ctx.placeholder}"` +
|
|
19
|
-
` value="${ctx.value}">`;
|
|
18
|
+
` data-column="${escapeHtml(ctx.columnName)}"` +
|
|
19
|
+
` placeholder="${escapeHtml(ctx.placeholder)}"` +
|
|
20
|
+
` value="${escapeHtml(ctx.value)}">`;
|
|
20
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import css from './grid-group-row.scss';
|
|
2
2
|
import { adoptStyles } from '../../adopt-styles';
|
|
3
|
+
import { escapeHtml } from '../../utils/dom';
|
|
3
4
|
|
|
4
5
|
const STYLE_KEY = {};
|
|
5
6
|
|
|
@@ -8,6 +9,7 @@ interface GroupRowContext {
|
|
|
8
9
|
iconPath: string;
|
|
9
10
|
disclosureLabel: string;
|
|
10
11
|
field: string;
|
|
12
|
+
columnLabel: string;
|
|
11
13
|
label: string;
|
|
12
14
|
count: string;
|
|
13
15
|
rowsSuffix: string;
|
|
@@ -16,8 +18,8 @@ interface GroupRowContext {
|
|
|
16
18
|
export function renderGroupRow(ctx: GroupRowContext, shadowRoot: ShadowRoot): void {
|
|
17
19
|
adoptStyles(shadowRoot, css, STYLE_KEY);
|
|
18
20
|
shadowRoot.innerHTML =
|
|
19
|
-
`<svg class="toggle-icon group-disclosure-icon" viewBox="${ctx.iconViewBox}" aria-hidden="true" focusable="false"><path d="${ctx.iconPath}"></path></svg>` +
|
|
20
|
-
`<span class="sr-only">${ctx.disclosureLabel}</span>` +
|
|
21
|
-
`<strong>${ctx.field}: ${ctx.label}</strong>` +
|
|
22
|
-
`<span>${ctx.count} ${ctx.rowsSuffix}</span>`;
|
|
21
|
+
`<svg class="toggle-icon group-disclosure-icon" viewBox="${escapeHtml(ctx.iconViewBox)}" aria-hidden="true" focusable="false"><path d="${escapeHtml(ctx.iconPath)}"></path></svg>` +
|
|
22
|
+
`<span class="sr-only">${escapeHtml(ctx.disclosureLabel)}</span>` +
|
|
23
|
+
`<strong>${escapeHtml(ctx.columnLabel || ctx.field)}: ${escapeHtml(ctx.label)}</strong>` +
|
|
24
|
+
`<span>${escapeHtml(ctx.count)} ${escapeHtml(ctx.rowsSuffix)}</span>`;
|
|
23
25
|
}
|
|
@@ -24,6 +24,7 @@ import { renderGroupRow } from './grid-group-row.template';
|
|
|
24
24
|
* data-group="category:Fruit"
|
|
25
25
|
* data-collapsed="false"
|
|
26
26
|
* data-field="category"
|
|
27
|
+
* data-column-label="Category"
|
|
27
28
|
* data-label="Fruit"
|
|
28
29
|
* data-count="5"
|
|
29
30
|
* data-depth="0"
|
|
@@ -36,6 +37,8 @@ export class UIGridGroupRow extends HTMLElement {
|
|
|
36
37
|
|
|
37
38
|
/** The grouping field name (e.g. "category"). */
|
|
38
39
|
field = '';
|
|
40
|
+
/** The grouped column's header (e.g. "Category"); falls back to `field`. */
|
|
41
|
+
columnLabel = '';
|
|
39
42
|
/** The group value label (e.g. "Fruit"). */
|
|
40
43
|
label = '';
|
|
41
44
|
/** Number of rows in this group. */
|
|
@@ -55,7 +58,7 @@ export class UIGridGroupRow extends HTMLElement {
|
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
static get observedAttributes(): string[] {
|
|
58
|
-
return ['data-group', 'data-collapsed', 'data-field', 'data-label',
|
|
61
|
+
return ['data-group', 'data-collapsed', 'data-field', 'data-column-label', 'data-label',
|
|
59
62
|
'data-count', 'data-depth', 'data-disclosure-label',
|
|
60
63
|
'data-icon-path', 'data-icon-view-box', 'data-rows-suffix'];
|
|
61
64
|
}
|
|
@@ -73,6 +76,7 @@ export class UIGridGroupRow extends HTMLElement {
|
|
|
73
76
|
private render(): void {
|
|
74
77
|
const depth = parseInt(this.getAttribute('data-depth') ?? '0', 10);
|
|
75
78
|
this.field = this.getAttribute('data-field') ?? '';
|
|
79
|
+
this.columnLabel = this.getAttribute('data-column-label') ?? '';
|
|
76
80
|
this.label = this.getAttribute('data-label') ?? '';
|
|
77
81
|
this.count = this.getAttribute('data-count') ?? '0';
|
|
78
82
|
this.disclosureLabel = this.getAttribute('data-disclosure-label') ?? '';
|
package/src/framework-slots.ts
CHANGED
|
@@ -104,6 +104,8 @@ export interface FrameworkEmptyStateSlot {
|
|
|
104
104
|
export interface FrameworkSlotDelta<TSlot> {
|
|
105
105
|
added: TSlot[];
|
|
106
106
|
removed: TSlot[];
|
|
107
|
+
/** Slots kept since the last render whose payload changed (filter slots: value, placeholder, disabled). */
|
|
108
|
+
updated?: TSlot[];
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
export function cellSlotName(column: GridColumnDef): string {
|
|
@@ -356,6 +358,8 @@ export class FrameworkSlotBridge {
|
|
|
356
358
|
this.lastExpandableRowSlots,
|
|
357
359
|
this.pendingExpandableRowSlots,
|
|
358
360
|
'expandableRowSlotsChanged',
|
|
361
|
+
(previous, current) => previous.context.row !== current.context.row ||
|
|
362
|
+
previous.rowIndex !== current.rowIndex || previous.context.expanded !== current.context.expanded,
|
|
359
363
|
);
|
|
360
364
|
this.lastExpandableRowSlots = this.pendingExpandableRowSlots;
|
|
361
365
|
this.pendingExpandableRowSlots = new Map();
|
|
@@ -368,19 +372,30 @@ export class FrameworkSlotBridge {
|
|
|
368
372
|
this.lastGroupRowSlots = this.pendingGroupRowSlots;
|
|
369
373
|
this.pendingGroupRowSlots = new Map();
|
|
370
374
|
|
|
371
|
-
this.diffAndEmit(this.lastHeaderSlots, this.pendingHeaderSlots, 'headerSlotsChanged'
|
|
375
|
+
this.diffAndEmit(this.lastHeaderSlots, this.pendingHeaderSlots, 'headerSlotsChanged',
|
|
376
|
+
(previous, current) => previous.context.column !== current.context.column);
|
|
372
377
|
this.lastHeaderSlots = this.pendingHeaderSlots;
|
|
373
378
|
this.pendingHeaderSlots = new Map();
|
|
374
379
|
|
|
375
|
-
this.diffAndEmit(
|
|
380
|
+
this.diffAndEmit(
|
|
381
|
+
this.lastFilterSlots,
|
|
382
|
+
this.pendingFilterSlots,
|
|
383
|
+
'filterSlotsChanged',
|
|
384
|
+
(previous, current) =>
|
|
385
|
+
previous.value !== current.value ||
|
|
386
|
+
previous.placeholder !== current.placeholder ||
|
|
387
|
+
previous.disabled !== current.disabled ||
|
|
388
|
+
previous.column !== current.column,
|
|
389
|
+
);
|
|
376
390
|
this.lastFilterSlots = this.pendingFilterSlots;
|
|
377
391
|
this.pendingFilterSlots = new Map();
|
|
378
392
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
393
|
+
// emptyStateSlotChanged is the original (singular) name, kept for
|
|
394
|
+
// existing wrappers; emptyStateSlotsChanged matches the other kinds.
|
|
395
|
+
this.diffAndEmitSingleton(this.lastEmptyStateSlot, this.pendingEmptyStateSlot, [
|
|
396
|
+
'emptyStateSlotsChanged',
|
|
382
397
|
'emptyStateSlotChanged',
|
|
383
|
-
);
|
|
398
|
+
]);
|
|
384
399
|
this.lastEmptyStateSlot = this.pendingEmptyStateSlot;
|
|
385
400
|
this.pendingEmptyStateSlot = null;
|
|
386
401
|
}
|
|
@@ -413,19 +428,23 @@ export class FrameworkSlotBridge {
|
|
|
413
428
|
previous: Map<string, TSlot>,
|
|
414
429
|
current: Map<string, TSlot>,
|
|
415
430
|
eventName: string,
|
|
431
|
+
changed?: (previous: TSlot, current: TSlot) => boolean,
|
|
416
432
|
): void {
|
|
417
433
|
const added: TSlot[] = [];
|
|
418
434
|
const removed: TSlot[] = [];
|
|
435
|
+
const updated: TSlot[] = [];
|
|
419
436
|
for (const [key, slot] of current) {
|
|
420
|
-
|
|
437
|
+
const before = previous.get(key);
|
|
438
|
+
if (!before) added.push(slot);
|
|
439
|
+
else if (changed?.(before, slot)) updated.push(slot);
|
|
421
440
|
}
|
|
422
441
|
for (const [key, slot] of previous) {
|
|
423
442
|
if (!current.has(key)) removed.push(slot);
|
|
424
443
|
}
|
|
425
|
-
if (added.length === 0 && removed.length === 0) return;
|
|
444
|
+
if (added.length === 0 && removed.length === 0 && updated.length === 0) return;
|
|
426
445
|
this.host.dispatchEvent(
|
|
427
446
|
new CustomEvent<FrameworkSlotDelta<TSlot>>(eventName, {
|
|
428
|
-
detail: { added, removed },
|
|
447
|
+
detail: { added, removed, updated },
|
|
429
448
|
bubbles: false,
|
|
430
449
|
composed: false,
|
|
431
450
|
}),
|
|
@@ -435,19 +454,21 @@ export class FrameworkSlotBridge {
|
|
|
435
454
|
private diffAndEmitSingleton<TSlot>(
|
|
436
455
|
previous: TSlot | null,
|
|
437
456
|
current: TSlot | null,
|
|
438
|
-
|
|
457
|
+
eventNames: readonly string[],
|
|
439
458
|
): void {
|
|
440
459
|
if (previous === current) return;
|
|
441
460
|
if (!previous && !current) return;
|
|
442
461
|
const added: TSlot[] = current ? [current] : [];
|
|
443
462
|
const removed: TSlot[] = previous ? [previous] : [];
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
463
|
+
for (const eventName of eventNames) {
|
|
464
|
+
this.host.dispatchEvent(
|
|
465
|
+
new CustomEvent<FrameworkSlotDelta<TSlot>>(eventName, {
|
|
466
|
+
detail: { added, removed, updated: [] },
|
|
467
|
+
bubbles: false,
|
|
468
|
+
composed: false,
|
|
469
|
+
}),
|
|
470
|
+
);
|
|
471
|
+
}
|
|
451
472
|
}
|
|
452
473
|
}
|
|
453
474
|
|
package/src/grid-controller.ts
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
defaultGridEngine,
|
|
16
16
|
expandAllGridRowsCommand,
|
|
17
17
|
expandAllGridTreeRowsCommand,
|
|
18
|
-
|
|
18
|
+
initWasmCore,
|
|
19
|
+
getConfiguredUiGridWasmAssetBase,
|
|
19
20
|
getWasmCoreInitializationState,
|
|
20
21
|
findGridRowById as coreFindGridRowById,
|
|
21
22
|
formatGridCellDisplayValue,
|
|
@@ -318,6 +319,7 @@ export class VanillaGridController {
|
|
|
318
319
|
private columnWidthOverrides: Record<string, string> = {};
|
|
319
320
|
private viewportWidth = 0;
|
|
320
321
|
private currentPage = 1;
|
|
322
|
+
private lastOptionsCurrentPage: number | undefined;
|
|
321
323
|
private pageSize = 0;
|
|
322
324
|
private editingCell: GridCellPosition | null = null;
|
|
323
325
|
private editingValue = '';
|
|
@@ -352,6 +354,7 @@ export class VanillaGridController {
|
|
|
352
354
|
readonly gridApi: UiGridApi;
|
|
353
355
|
|
|
354
356
|
constructor(options: GridOptions) {
|
|
357
|
+
this.syncPaginationCurrentPage(options);
|
|
355
358
|
this.options = options;
|
|
356
359
|
this.labels = resolveGridLabels(options.labels);
|
|
357
360
|
// Validator registry is built from the resolved labels so default
|
|
@@ -600,7 +603,16 @@ export class VanillaGridController {
|
|
|
600
603
|
this.subscribers.clear();
|
|
601
604
|
}
|
|
602
605
|
|
|
606
|
+
private syncPaginationCurrentPage(options: GridOptions): void {
|
|
607
|
+
const page = options.paginationCurrentPage;
|
|
608
|
+
if (page !== undefined && page !== this.lastOptionsCurrentPage) {
|
|
609
|
+
this.currentPage = Number.isFinite(page) ? Math.max(1, Math.floor(page)) : 1;
|
|
610
|
+
}
|
|
611
|
+
this.lastOptionsCurrentPage = page;
|
|
612
|
+
}
|
|
613
|
+
|
|
603
614
|
setOptions(options: GridOptions): void {
|
|
615
|
+
this.syncPaginationCurrentPage(options);
|
|
604
616
|
this.options = options;
|
|
605
617
|
this.labels = resolveGridLabels(options.labels);
|
|
606
618
|
// Re-register the built-in validators so their messages track the
|
|
@@ -1532,8 +1544,10 @@ export class VanillaGridController {
|
|
|
1532
1544
|
|
|
1533
1545
|
setColumnWidthOverride(columnName: string, widthPx: number): void {
|
|
1534
1546
|
const nextWidth = `${Math.max(88, Math.round(widthPx))}px`;
|
|
1547
|
+
if (this.columnWidthOverrides[columnName] === nextWidth) return;
|
|
1535
1548
|
this.columnWidthOverrides = { ...this.columnWidthOverrides, [columnName]: nextWidth };
|
|
1536
1549
|
this.refresh();
|
|
1550
|
+
this.gridApi.core.raise.columnSizeChanged(columnName, nextWidth);
|
|
1537
1551
|
}
|
|
1538
1552
|
|
|
1539
1553
|
/** Returns the grid-template-columns string as if `columnName` had the given width,
|
|
@@ -1627,17 +1641,29 @@ export class VanillaGridController {
|
|
|
1627
1641
|
return condition({ row: row.entity, column, rowIndex: row.index });
|
|
1628
1642
|
}
|
|
1629
1643
|
|
|
1644
|
+
// Pin state as laid out: the selection row-header column sits in front of
|
|
1645
|
+
// the left-pinned columns, so it is pinned with them (#7399).
|
|
1646
|
+
private layoutPinnedColumns(): PinnedColumnState {
|
|
1647
|
+
const pinned = this.pinnedColumns;
|
|
1648
|
+
if (pinned[SELECTION_COLUMN] !== undefined) return pinned;
|
|
1649
|
+
if (!Object.values(pinned).includes('left')) return pinned;
|
|
1650
|
+
if (this.visibleColumns[0]?.name !== SELECTION_COLUMN) return pinned;
|
|
1651
|
+
return { [SELECTION_COLUMN]: 'left', ...pinned };
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1630
1654
|
isPinned(column: GridColumnDef): boolean {
|
|
1631
|
-
return this.
|
|
1655
|
+
return this.layoutPinnedColumns()[column.name] !== undefined;
|
|
1632
1656
|
}
|
|
1633
1657
|
|
|
1634
1658
|
isPinnedLeftLast(column: GridColumnDef): boolean {
|
|
1635
|
-
const
|
|
1659
|
+
const pinned = this.layoutPinnedColumns();
|
|
1660
|
+
const leftPinned = this.visibleColumns.filter((c) => pinned[c.name] === 'left');
|
|
1636
1661
|
return leftPinned.length > 0 && leftPinned[leftPinned.length - 1].name === column.name;
|
|
1637
1662
|
}
|
|
1638
1663
|
|
|
1639
1664
|
isPinnedRightFirst(column: GridColumnDef): boolean {
|
|
1640
|
-
const
|
|
1665
|
+
const pinned = this.layoutPinnedColumns();
|
|
1666
|
+
const rightPinned = this.visibleColumns.filter((c) => pinned[c.name] === 'right');
|
|
1641
1667
|
return rightPinned.length > 0 && rightPinned[0].name === column.name;
|
|
1642
1668
|
}
|
|
1643
1669
|
|
|
@@ -1645,8 +1671,19 @@ export class VanillaGridController {
|
|
|
1645
1671
|
return gridGroupDisclosureLabel(group.collapsed, this.labels);
|
|
1646
1672
|
}
|
|
1647
1673
|
|
|
1674
|
+
groupColumnLabel(group: GroupItem): string {
|
|
1675
|
+
const column = this.options.columnDefs.find((candidate) => candidate.name === group.field);
|
|
1676
|
+
return column ? headerLabel(column) : group.field;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
groupRowsSuffix(group: GroupItem): string {
|
|
1680
|
+
const plural = this.labels.groupRowsSuffix;
|
|
1681
|
+
if (group.count !== 1) return plural;
|
|
1682
|
+
return this.labels.groupRowSuffixOne ?? GROUP_ROW_SUFFIX_ONE[plural] ?? plural;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1648
1685
|
pinnedOffset(column: GridColumnDef): { side: 'left' | 'right'; offset: string } | null {
|
|
1649
|
-
return computePinnedOffset(this.visibleColumns, this.
|
|
1686
|
+
return computePinnedOffset(this.visibleColumns, this.layoutPinnedColumns(), column);
|
|
1650
1687
|
}
|
|
1651
1688
|
|
|
1652
1689
|
displayValue(row: GridRow, column: GridColumnDef): unknown {
|
|
@@ -1903,18 +1940,29 @@ export class VanillaGridController {
|
|
|
1903
1940
|
this.emit();
|
|
1904
1941
|
}
|
|
1905
1942
|
|
|
1943
|
+
private awaitingWasmEngine = false;
|
|
1944
|
+
|
|
1945
|
+
// WASM is opt-in (#7396). The grid starts a load only when the app set a
|
|
1946
|
+
// WASM asset base; otherwise it waits for a load the app started. Either
|
|
1947
|
+
// way it refreshes once WASM is ready so it switches engines.
|
|
1906
1948
|
private maybeEnableWasmEngine(): void {
|
|
1907
|
-
|
|
1949
|
+
const state = getWasmCoreInitializationState();
|
|
1950
|
+
const optedIn = state === 'loading' || (state === 'idle' && getConfiguredUiGridWasmAssetBase() !== null);
|
|
1951
|
+
if (this.awaitingWasmEngine || !optedIn) {
|
|
1908
1952
|
return;
|
|
1909
1953
|
}
|
|
1910
1954
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1955
|
+
this.awaitingWasmEngine = true;
|
|
1956
|
+
void initWasmCore()
|
|
1957
|
+
.then((ready) => {
|
|
1958
|
+
this.awaitingWasmEngine = false;
|
|
1959
|
+
if (ready && !this.disposed) {
|
|
1914
1960
|
this.refresh();
|
|
1915
1961
|
}
|
|
1916
1962
|
})
|
|
1917
|
-
.catch(() =>
|
|
1963
|
+
.catch(() => {
|
|
1964
|
+
this.awaitingWasmEngine = false;
|
|
1965
|
+
});
|
|
1918
1966
|
}
|
|
1919
1967
|
|
|
1920
1968
|
private emit(): void {
|
|
@@ -1972,9 +2020,17 @@ export class VanillaGridController {
|
|
|
1972
2020
|
);
|
|
1973
2021
|
}
|
|
1974
2022
|
|
|
2023
|
+
// Core's index helpers describe the slice, which external paging skips; the
|
|
2024
|
+
// range shown and returned by the API is where this page sits in totalItems.
|
|
2025
|
+
private rangeOptions(): GridOptions {
|
|
2026
|
+
return this.options.useExternalPagination === true
|
|
2027
|
+
? { ...this.options, useExternalPagination: false }
|
|
2028
|
+
: this.options;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
1975
2031
|
private getFirstRowIndex(): number {
|
|
1976
2032
|
return getFirstRowIndexValue(
|
|
1977
|
-
this.
|
|
2033
|
+
this.rangeOptions(),
|
|
1978
2034
|
this.currentPage,
|
|
1979
2035
|
this.pipeline.totalItems,
|
|
1980
2036
|
this.pageSize,
|
|
@@ -1983,7 +2039,7 @@ export class VanillaGridController {
|
|
|
1983
2039
|
|
|
1984
2040
|
private getLastRowIndex(): number {
|
|
1985
2041
|
return getLastRowIndexValue(
|
|
1986
|
-
this.
|
|
2042
|
+
this.rangeOptions(),
|
|
1987
2043
|
this.currentPage,
|
|
1988
2044
|
this.pipeline.totalItems,
|
|
1989
2045
|
this.pageSize,
|
|
@@ -2530,6 +2586,17 @@ export class VanillaGridController {
|
|
|
2530
2586
|
}
|
|
2531
2587
|
}
|
|
2532
2588
|
|
|
2589
|
+
// Singular group-row suffixes for the bundled locales' plurals, kept out of the
|
|
2590
|
+
// locale label set so it matches the WASM engine's.
|
|
2591
|
+
const SELECTION_COLUMN = 'selectionRowHeaderCol';
|
|
2592
|
+
|
|
2593
|
+
const GROUP_ROW_SUFFIX_ONE: Readonly<Record<string, string>> = {
|
|
2594
|
+
rows: 'row',
|
|
2595
|
+
lignes: 'ligne',
|
|
2596
|
+
Zeilen: 'Zeile',
|
|
2597
|
+
filas: 'fila',
|
|
2598
|
+
};
|
|
2599
|
+
|
|
2533
2600
|
export function createVanillaGridController(options: GridOptions): VanillaGridController {
|
|
2534
2601
|
return new VanillaGridController(options);
|
|
2535
2602
|
}
|