@bryntum/grid-angular-thin 7.2.4 → 7.3.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.
- package/README.md +4 -4
- package/bundles/bryntum-grid-angular-thin.umd.js +761 -230
- package/bundles/bryntum-grid-angular-thin.umd.js.map +1 -1
- package/esm2015/lib/bryntum-a-i-filter-field.component.js +62 -14
- package/esm2015/lib/bryntum-checklist-filter-combo.component.js +62 -14
- package/esm2015/lib/bryntum-grid-base.component.js +78 -35
- package/esm2015/lib/bryntum-grid-chart-designer.component.js +61 -12
- package/esm2015/lib/bryntum-grid-field-filter-picker-group.component.js +65 -21
- package/esm2015/lib/bryntum-grid-field-filter-picker.component.js +65 -21
- package/esm2015/lib/bryntum-grid.component.js +78 -35
- package/esm2015/lib/bryntum-group-bar.component.js +61 -12
- package/esm2015/lib/bryntum-tree-combo.component.js +62 -14
- package/esm2015/lib/bryntum-tree-grid.component.js +78 -35
- package/esm2015/lib/grid.module.js +5 -4
- package/esm2015/lib/shadowdom.helper.js +82 -0
- package/fesm2015/bryntum-grid-angular-thin.js +738 -207
- package/fesm2015/bryntum-grid-angular-thin.js.map +1 -1
- package/lib/bryntum-a-i-filter-field.component.d.ts +87 -133
- package/lib/bryntum-checklist-filter-combo.component.d.ts +106 -166
- package/lib/bryntum-grid-base.component.d.ts +238 -303
- package/lib/bryntum-grid-chart-designer.component.d.ts +71 -108
- package/lib/bryntum-grid-field-filter-picker-group.component.d.ts +93 -143
- package/lib/bryntum-grid-field-filter-picker.component.d.ts +94 -145
- package/lib/bryntum-grid.component.d.ts +238 -303
- package/lib/bryntum-group-bar.component.d.ts +77 -118
- package/lib/bryntum-tree-combo.component.d.ts +107 -168
- package/lib/bryntum-tree-grid.component.d.ts +238 -303
- package/lib/grid.module.d.ts +2 -1
- package/lib/shadowdom.helper.d.ts +3 -0
- package/package.json +1 -1
- package/src/lib/bryntum-a-i-filter-field.component.ts +146 -141
- package/src/lib/bryntum-checklist-filter-combo.component.ts +166 -175
- package/src/lib/bryntum-grid-base.component.ts +275 -319
- package/src/lib/bryntum-grid-chart-designer.component.ts +126 -112
- package/src/lib/bryntum-grid-field-filter-picker-group.component.ts +152 -152
- package/src/lib/bryntum-grid-field-filter-picker.component.ts +152 -153
- package/src/lib/bryntum-grid.component.ts +275 -319
- package/src/lib/bryntum-group-bar.component.ts +132 -122
- package/src/lib/bryntum-theme-combo.component.ts +128 -0
- package/src/lib/bryntum-tree-combo.component.ts +166 -176
- package/src/lib/bryntum-tree-grid.component.ts +275 -319
- package/src/lib/grid.module.ts +2 -1
- package/src/lib/shadowdom.helper.ts +91 -0
package/src/lib/grid.module.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Angular Bryntum Grid Shared module
|
|
3
3
|
*/
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
4
5
|
import { NgModule } from '@angular/core';
|
|
5
6
|
|
|
6
7
|
import { BryntumAIFilterFieldComponent } from './bryntum-a-i-filter-field.component';
|
|
@@ -28,7 +29,7 @@ import { BryntumTreeGridComponent } from './bryntum-tree-grid.component';
|
|
|
28
29
|
BryntumTreeComboComponent,
|
|
29
30
|
BryntumTreeGridComponent
|
|
30
31
|
],
|
|
31
|
-
imports : [],
|
|
32
|
+
imports : [CommonModule],
|
|
32
33
|
exports : [
|
|
33
34
|
|
|
34
35
|
BryntumAIFilterFieldComponent,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { GlobalEvents } from '@bryntum/core-thin';
|
|
2
|
+
|
|
3
|
+
// Module-level registry of all open shadow roots that host Bryntum widgets.
|
|
4
|
+
// Populated lazily by collectOpenShadowRoots() the first time it is called, and
|
|
5
|
+
// kept up to date via registerShadowRoot / unregisterShadowRoot.
|
|
6
|
+
const openShadowRoots = new Set<ShadowRoot>();
|
|
7
|
+
|
|
8
|
+
// Walks the DOM tree starting from `root` and collects every open shadow root found.
|
|
9
|
+
// Results are cached in openShadowRoots after the first traversal so subsequent calls
|
|
10
|
+
// are O(1). Recursive so nested shadow roots are also discovered.
|
|
11
|
+
function collectOpenShadowRoots(root : Document | ShadowRoot = document) : ShadowRoot[] {
|
|
12
|
+
if (openShadowRoots.size > 0) {
|
|
13
|
+
return Array.from(openShadowRoots);
|
|
14
|
+
}
|
|
15
|
+
const roots : ShadowRoot[] = [];
|
|
16
|
+
Array.from(root.querySelectorAll('*')).forEach(el => {
|
|
17
|
+
if ((el as Element & { shadowRoot? : ShadowRoot }).shadowRoot) {
|
|
18
|
+
roots.push((el as any).shadowRoot);
|
|
19
|
+
roots.push(...collectOpenShadowRoots((el as any).shadowRoot));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
roots.forEach(r => openShadowRoots.add(r));
|
|
23
|
+
return roots;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Updates the href and data-bryntum-theme attribute of every theme <link> inside all
|
|
27
|
+
// registered shadow roots to mirror the new head link after a theme change.
|
|
28
|
+
function syncThemeToShadowRoots(headLink : HTMLLinkElement) : void {
|
|
29
|
+
const href = headLink.href;
|
|
30
|
+
const themeAttr = headLink.getAttribute('data-bryntum-theme') ?? '';
|
|
31
|
+
|
|
32
|
+
collectOpenShadowRoots().forEach(shadowRoot => {
|
|
33
|
+
Array.from(shadowRoot.querySelectorAll<HTMLLinkElement>('link[data-bryntum-theme]')).forEach(link => {
|
|
34
|
+
link.setAttribute('data-bryntum-theme', themeAttr);
|
|
35
|
+
link.href = href;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Adds a shadow root to the registry so it is included in theme sync operations.
|
|
41
|
+
// Called by BryntumThemeComboComponent.ngOnInit when it detects it is inside a shadow root.
|
|
42
|
+
export function registerShadowRoot(shadowRoot : ShadowRoot) : void {
|
|
43
|
+
openShadowRoots.add(shadowRoot);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Removes a shadow root from the registry.
|
|
47
|
+
// Called by BryntumThemeComboComponent.ngOnDestroy to clean up on component teardown.
|
|
48
|
+
export function unregisterShadowRoot(shadowRoot : ShadowRoot) : void {
|
|
49
|
+
openShadowRoots.delete(shadowRoot);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Injects a clone of each document.head theme <link> into every registered shadow root
|
|
53
|
+
// that does not already have one. This is required because CSS from document.head does
|
|
54
|
+
// not cascade into shadow DOM, so Bryntum theme styles would be absent without this.
|
|
55
|
+
// Safe to call multiple times — the presence check prevents duplicate injection.
|
|
56
|
+
export function initThemeInShadowRoots() : void {
|
|
57
|
+
const headThemeLinks = Array.from(document.head.querySelectorAll<HTMLLinkElement>('link[data-bryntum-theme]'));
|
|
58
|
+
|
|
59
|
+
if (!headThemeLinks.length) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
collectOpenShadowRoots().forEach(shadowRoot => {
|
|
64
|
+
if (shadowRoot.querySelector('link[data-bryntum-theme]')) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
headThemeLinks.forEach(headLink => {
|
|
69
|
+
if (!headLink.href) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Clone the head link to preserve all attributes, then ensure absolute href
|
|
73
|
+
const clone = headLink.cloneNode() as HTMLLinkElement;
|
|
74
|
+
clone.href = headLink.href;
|
|
75
|
+
shadowRoot.appendChild(clone);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Listens for Bryntum's internal theme-change event and keeps every shadow root's
|
|
81
|
+
// theme link in sync with the new document.head link. Fires after the old <link>s
|
|
82
|
+
// are removed and the new one is fully loaded in document.head.
|
|
83
|
+
// @ts-ignore - ion() is public but not present on GlobalEventsSingleton typings
|
|
84
|
+
GlobalEvents.ion({
|
|
85
|
+
theme() : void {
|
|
86
|
+
const link = document.head.querySelector<HTMLLinkElement>('link[data-bryntum-theme]');
|
|
87
|
+
if (link?.href) {
|
|
88
|
+
syncThemeToShadowRoots(link);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|