@bryntum/grid-angular-thin 7.2.3 → 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
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular wrapper for Bryntum Theme combo
|
|
3
|
+
*/
|
|
4
|
+
import { Component, ElementRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
5
|
+
import { BrowserHelper, Combo, DomHelper, Store, StoreConfig } from '@bryntum/core-thin';
|
|
6
|
+
import { initThemeInShadowRoots, registerShadowRoot, unregisterShadowRoot } from './shadowdom.helper';
|
|
7
|
+
|
|
8
|
+
const defaultThemes: Record<string, string> = {
|
|
9
|
+
'material3-light' : 'Material3 Light',
|
|
10
|
+
'material3-dark' : 'Material3 Dark',
|
|
11
|
+
'stockholm-light' : 'Stockholm Light',
|
|
12
|
+
'stockholm-dark' : 'Stockholm Dark',
|
|
13
|
+
'svalbard-light' : 'Svalbard Light',
|
|
14
|
+
'svalbard-dark' : 'Svalbard Dark',
|
|
15
|
+
'visby-light' : 'Visby Light',
|
|
16
|
+
'visby-dark' : 'Visby Dark',
|
|
17
|
+
'fluent2-light' : 'Fluent2 Light',
|
|
18
|
+
'fluent2-dark' : 'Fluent2 Dark',
|
|
19
|
+
'high-contrast-light' : 'High Contrast Light',
|
|
20
|
+
'high-contrast-dark' : 'High Contrast Dark'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const syncedProps = ['store', 'label', 'width'] as const;
|
|
24
|
+
|
|
25
|
+
export type BryntumThemeComboProps = {
|
|
26
|
+
store?: Store | StoreConfig | object;
|
|
27
|
+
label?: string;
|
|
28
|
+
width?: string | number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector : 'bryntum-theme-combo',
|
|
33
|
+
template : ''
|
|
34
|
+
})
|
|
35
|
+
export class BryntumThemeComboComponent implements OnInit, OnChanges, OnDestroy {
|
|
36
|
+
|
|
37
|
+
private elementRef: ElementRef;
|
|
38
|
+
private combo!: Combo;
|
|
39
|
+
|
|
40
|
+
@Input() store?: Store | StoreConfig | object;
|
|
41
|
+
@Input() label?: string;
|
|
42
|
+
@Input() width?: string | number;
|
|
43
|
+
|
|
44
|
+
constructor(element: ElementRef) {
|
|
45
|
+
this.elementRef = element;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initializes the component and creates the Bryntum Combo widget
|
|
50
|
+
*/
|
|
51
|
+
ngOnInit(): void {
|
|
52
|
+
const shadowRoot = this.elementRef.nativeElement.getRootNode();
|
|
53
|
+
if (shadowRoot instanceof ShadowRoot) {
|
|
54
|
+
registerShadowRoot(shadowRoot);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.combo = new Combo({
|
|
58
|
+
appendTo : this.elementRef.nativeElement,
|
|
59
|
+
...(this.store ? { store : this.store } : { items : defaultThemes }),
|
|
60
|
+
label : this.label ?? 'Theme',
|
|
61
|
+
width : this.width ?? '16em',
|
|
62
|
+
value : 'material3-light',
|
|
63
|
+
editable : false,
|
|
64
|
+
labelPosition : 'before',
|
|
65
|
+
ref : 'themeCombo',
|
|
66
|
+
listeners : {
|
|
67
|
+
change({ value }) {
|
|
68
|
+
DomHelper.setTheme(value).then(context => {
|
|
69
|
+
if (context) {
|
|
70
|
+
// Remove all b-theme-* classes — don't rely on context.prev which may
|
|
71
|
+
// be stale (CSS vars unreadable in Angular ViewEncapsulation.ShadowDom)
|
|
72
|
+
Array.from(document.body.classList)
|
|
73
|
+
.filter(cls => cls.startsWith('b-theme-'))
|
|
74
|
+
.forEach(cls => document.body.classList.remove(cls));
|
|
75
|
+
document.body.classList.add(`b-theme-${context.theme}`);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Apply theme from URL search param (?theme=xxx), detect from loaded CSS, or read from link href
|
|
83
|
+
const
|
|
84
|
+
themeLink = document.querySelector<HTMLLinkElement>('link[data-bryntum-theme]'),
|
|
85
|
+
themeFromHref = themeLink ? new URL(themeLink.href).pathname.split('/').pop()?.replace('.css', '') : '',
|
|
86
|
+
theme = BrowserHelper.searchParam('theme') || DomHelper.getThemeInfo()?.filename || themeFromHref;
|
|
87
|
+
|
|
88
|
+
if (theme) {
|
|
89
|
+
this.combo.value = theme;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
console.log(`Set: .b-theme-${this.combo.value as string}`);
|
|
93
|
+
// Always set the initial body class — even when theme detection falls back to the
|
|
94
|
+
// combo's default value (CSS vars may be unreadable in shadow DOM contexts)
|
|
95
|
+
document.body.classList.add(`b-theme-${this.combo.value as string}`);
|
|
96
|
+
|
|
97
|
+
initThemeInShadowRoots();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Responds to Input property changes and updates the Combo widget accordingly
|
|
102
|
+
*/
|
|
103
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
104
|
+
const { combo } = this;
|
|
105
|
+
if (!combo) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
for (const prop of syncedProps) {
|
|
109
|
+
if (prop in changes) {
|
|
110
|
+
(combo as any)[prop] = changes[prop].currentValue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Destroys the component and the underlying Combo widget
|
|
117
|
+
*/
|
|
118
|
+
ngOnDestroy(): void {
|
|
119
|
+
const shadowRoot = this.elementRef.nativeElement.getRootNode();
|
|
120
|
+
if (shadowRoot instanceof ShadowRoot) {
|
|
121
|
+
unregisterShadowRoot(shadowRoot);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (this.combo) {
|
|
125
|
+
this.combo.destroy();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|