@dontdrinkandroot/ngx-material-extensions 0.5.2 → 0.5.4

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.
@@ -1,83 +1,38 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Output, Input, ViewChild, Injectable, Inject, Directive, HostBinding, ContentChildren, HostListener, NgModule } from '@angular/core';
3
- import * as i6 from '@angular/forms';
4
- import { FormControl, ReactiveFormsModule } from '@angular/forms';
5
- import { interval, BehaviorSubject } from 'rxjs';
6
- import { debounce, map } from 'rxjs/operators';
7
- import * as i1 from '@angular/material/card';
8
- import { MatCardModule } from '@angular/material/card';
9
- import * as i2 from '@angular/material/icon';
10
- import { MatIconModule } from '@angular/material/icon';
11
- import * as i3 from '@angular/material/input';
12
- import { MatInputModule } from '@angular/material/input';
13
- import * as i4 from '@angular/material/form-field';
14
- import { MatFormFieldModule } from '@angular/material/form-field';
15
- import * as i5 from '@angular/material/button';
16
- import { MatButtonModule } from '@angular/material/button';
17
- import * as i1$1 from '@angular/cdk/layout';
2
+ import { Injectable, Inject, Component, Directive, Input, HostBinding, ContentChildren, HostListener, ViewChild, EventEmitter, Output, InjectionToken, ENVIRONMENT_INITIALIZER, inject, NgModule } from '@angular/core';
3
+ import { toSignal } from '@angular/core/rxjs-interop';
4
+ import * as i1 from '@angular/cdk/layout';
18
5
  import { Breakpoints } from '@angular/cdk/layout';
19
- import * as i2$1 from '@angular/router';
6
+ import { BehaviorSubject, interval, fromEvent, distinctUntilChanged } from 'rxjs';
7
+ import { map, debounce } from 'rxjs/operators';
8
+ import * as i2 from '@angular/router';
20
9
  import { NavigationStart } from '@angular/router';
21
10
  import * as i2$2 from '@angular/common';
22
11
  import { DOCUMENT, CommonModule } from '@angular/common';
12
+ import * as i2$1 from '@angular/material/icon';
13
+ import { MatIconModule } from '@angular/material/icon';
14
+ import * as i3 from '@angular/material/button';
15
+ import { MatButtonModule } from '@angular/material/button';
23
16
  import * as i3$1 from '@angular/material/sidenav';
24
17
  import { MatSidenavModule } from '@angular/material/sidenav';
25
- import { toSignal } from '@angular/core/rxjs-interop';
26
18
  import { __decorate } from 'tslib';
27
19
  import { NumberUtils, StringUtils, Debounce, Limit } from '@dontdrinkandroot/ngx-extensions';
20
+ import * as i6 from '@angular/forms';
21
+ import { FormControl, ReactiveFormsModule } from '@angular/forms';
22
+ import * as i1$1 from '@angular/material/card';
23
+ import { MatCardModule } from '@angular/material/card';
24
+ import * as i3$2 from '@angular/material/input';
25
+ import { MatInputModule } from '@angular/material/input';
26
+ import * as i4 from '@angular/material/form-field';
27
+ import { MatFormFieldModule } from '@angular/material/form-field';
28
28
  import { MatToolbarModule } from '@angular/material/toolbar';
29
29
 
30
- class FilterComponent {
31
- constructor() {
32
- this.formControl = new FormControl();
33
- this.onFilterChanged = new EventEmitter();
34
- this.bouncePeriod = 500;
35
- }
36
- /**
37
- * @override
38
- */
39
- ngOnInit() {
40
- this.valueChangesSubscription = this.formControl.valueChanges
41
- .pipe(debounce(() => interval(this.bouncePeriod)))
42
- .subscribe((value => this.onFilterChanged.emit(value)));
43
- }
44
- /**
45
- * @override
46
- */
47
- ngOnDestroy() {
48
- this.valueChangesSubscription.unsubscribe();
49
- }
50
- /**
51
- * @override
52
- */
53
- ngAfterContentInit() {
54
- this.inputElement.nativeElement.focus();
55
- }
56
- clear() {
57
- this.formControl.setValue(null);
58
- this.onFilterChanged.emit(undefined);
59
- }
60
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
61
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: FilterComponent, selector: "ddr-filter", inputs: { bouncePeriod: "bouncePeriod" }, outputs: { onFilterChanged: "onFilterChanged" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <input matInput type=\"text\" [formControl]=\"formControl\" #input />\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</mat-card>\n", dependencies: [{ kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
62
- }
63
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: FilterComponent, decorators: [{
64
- type: Component,
65
- args: [{ selector: 'ddr-filter', template: "<mat-card appearance=\"outlined\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <input matInput type=\"text\" [formControl]=\"formControl\" #input />\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</mat-card>\n" }]
66
- }], propDecorators: { onFilterChanged: [{
67
- type: Output
68
- }], bouncePeriod: [{
69
- type: Input
70
- }], inputElement: [{
71
- type: ViewChild,
72
- args: ['input', { static: true }]
73
- }] } });
74
-
75
30
  class SidenavService {
76
31
  constructor(breakpointObserver, router, document) {
77
32
  this.breakpointObserver = breakpointObserver;
78
33
  this.router = router;
79
34
  this.document = document;
80
- this.stayOpenOnLargeScreen = false;
35
+ this.stayOpenOnLargeScreen = true;
81
36
  this.largeBreakpoints = [
82
37
  Breakpoints.Medium,
83
38
  Breakpoints.Large,
@@ -96,13 +51,6 @@ class SidenavService {
96
51
  setSidenav(sidenav) {
97
52
  this.sidenav = sidenav;
98
53
  }
99
- setSidenavContent(sidenavContent) {
100
- this.sidenavContent = sidenavContent;
101
- this.sidenavContent.elementScrolled().pipe(map(() => this.sidenavContent.measureScrollOffset('top') > 0)).subscribe(scrolled => {
102
- this.document.body.classList.toggle('scrolled', scrolled);
103
- this.sidenavContentScrolled$.next(scrolled);
104
- });
105
- }
106
54
  getStayOpenOnLargeScreen() {
107
55
  return this.stayOpenOnLargeScreen;
108
56
  }
@@ -135,7 +83,7 @@ class SidenavService {
135
83
  watchContentScrolled() {
136
84
  return this.sidenavContentScrolled$.asObservable();
137
85
  }
138
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavService, deps: [{ token: i1$1.BreakpointObserver }, { token: i2$1.Router }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
86
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavService, deps: [{ token: i1.BreakpointObserver }, { token: i2.Router }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
139
87
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavService, providedIn: 'root' }); }
140
88
  }
141
89
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavService, decorators: [{
@@ -143,53 +91,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImpor
143
91
  args: [{
144
92
  providedIn: 'root'
145
93
  }]
146
- }], ctorParameters: () => [{ type: i1$1.BreakpointObserver }, { type: i2$1.Router }, { type: Document, decorators: [{
94
+ }], ctorParameters: () => [{ type: i1.BreakpointObserver }, { type: i2.Router }, { type: Document, decorators: [{
147
95
  type: Inject,
148
96
  args: [DOCUMENT]
149
97
  }] }] });
150
98
 
151
- class SidenavContainerComponent {
152
- constructor(sidenavService) {
153
- this.sidenavService = sidenavService;
154
- this.stayOpenOnLargeScreen = false;
155
- this.mode$ = this.sidenavService.getModeObservable();
156
- this.opened$ = this.sidenavService.getOpenedObservable();
157
- }
158
- /**
159
- * @override
160
- */
161
- ngOnChanges(changes) {
162
- this.sidenavService.setStayOpenOnLargeScreen(changes['stayOpenOnLargeScreen'].currentValue);
163
- }
164
- /**
165
- * @override
166
- */
167
- ngOnInit() {
168
- this.sidenavService.setSidenav(this.sidenav);
169
- this.sidenavService.setSidenavContent(this.sidenavContent);
170
- }
171
- /**
172
- * @override
173
- */
174
- ngOnDestroy() {
175
- this.scrollSubscription.unsubscribe();
176
- }
177
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavContainerComponent, deps: [{ token: SidenavService }], target: i0.ɵɵFactoryTarget.Component }); }
178
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: SidenavContainerComponent, selector: "ddr-mat-sidenav-container", inputs: { stayOpenOnLargeScreen: "stayOpenOnLargeScreen" }, viewQueries: [{ propertyName: "sidenav", first: true, predicate: ["sidenav"], descendants: true, static: true }, { propertyName: "sidenavContent", first: true, predicate: ["sidenavContent"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<mat-sidenav-container [ngClass]=\"(mode$|async)\">\n <mat-sidenav\n #sidenav\n [mode]=\"(mode$|async) ?? 'over'\"\n [opened]=\"(opened$|async)\">\n <ng-content select=\"[slot=mat-sidenav]\"></ng-content>\n </mat-sidenav>\n <mat-sidenav-content #sidenavContent>\n <ng-content select=\"[slot=mat-sidenav-content]\"></ng-content>\n </mat-sidenav-content>\n</mat-sidenav-container>\n", dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i3$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i3$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i3$1.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "pipe", type: i2$2.AsyncPipe, name: "async" }] }); }
179
- }
180
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavContainerComponent, decorators: [{
181
- type: Component,
182
- args: [{ selector: 'ddr-mat-sidenav-container', template: "<mat-sidenav-container [ngClass]=\"(mode$|async)\">\n <mat-sidenav\n #sidenav\n [mode]=\"(mode$|async) ?? 'over'\"\n [opened]=\"(opened$|async)\">\n <ng-content select=\"[slot=mat-sidenav]\"></ng-content>\n </mat-sidenav>\n <mat-sidenav-content #sidenavContent>\n <ng-content select=\"[slot=mat-sidenav-content]\"></ng-content>\n </mat-sidenav-content>\n</mat-sidenav-container>\n" }]
183
- }], ctorParameters: () => [{ type: SidenavService }], propDecorators: { sidenav: [{
184
- type: ViewChild,
185
- args: ['sidenav', { static: true }]
186
- }], sidenavContent: [{
187
- type: ViewChild,
188
- args: ['sidenavContent', { static: true }]
189
- }], stayOpenOnLargeScreen: [{
190
- type: Input
191
- }] } });
192
-
193
99
  class SidenavToggleComponent {
194
100
  constructor(sidenavService) {
195
101
  this.sidenavService = sidenavService;
@@ -202,7 +108,7 @@ class SidenavToggleComponent {
202
108
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: SidenavToggleComponent, selector: "ddr-mat-sidenav-toggle", host: { properties: { "style.display": "visible() ? \"block\" : \"none\"" } }, ngImport: i0, template: `
203
109
  <button mat-icon-button (click)="toggleSidenav()">
204
110
  <mat-icon>menu</mat-icon>
205
- </button>`, isInline: true, dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
111
+ </button>`, isInline: true, dependencies: [{ kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
206
112
  }
207
113
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavToggleComponent, decorators: [{
208
114
  type: Component,
@@ -380,13 +286,195 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImpor
380
286
  args: ['window:scroll', ['$event']]
381
287
  }] } });
382
288
 
289
+ class SidenavContainerComponent {
290
+ constructor(sidenavService) {
291
+ this.sidenavService = sidenavService;
292
+ this.stayOpenOnLargeScreen = true;
293
+ this.mode$ = this.sidenavService.getModeObservable();
294
+ this.opened$ = this.sidenavService.getOpenedObservable();
295
+ }
296
+ /**
297
+ * @override
298
+ */
299
+ ngOnChanges(changes) {
300
+ this.sidenavService.setStayOpenOnLargeScreen(changes['stayOpenOnLargeScreen'].currentValue);
301
+ }
302
+ /**
303
+ * @override
304
+ */
305
+ ngOnInit() {
306
+ this.sidenavService.setSidenav(this.sidenav);
307
+ }
308
+ /**
309
+ * @override
310
+ */
311
+ ngOnDestroy() {
312
+ this.scrollSubscription.unsubscribe();
313
+ }
314
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavContainerComponent, deps: [{ token: SidenavService }], target: i0.ɵɵFactoryTarget.Component }); }
315
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: SidenavContainerComponent, selector: "ddr-mat-sidenav-container", inputs: { stayOpenOnLargeScreen: "stayOpenOnLargeScreen" }, viewQueries: [{ propertyName: "sidenav", first: true, predicate: ["sidenav"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<mat-sidenav-container [ngClass]=\"(mode$|async)\">\n <mat-sidenav\n #sidenav\n [mode]=\"(mode$|async) ?? 'over'\"\n [opened]=\"(opened$|async)\"\n [fixedInViewport]=\"true\"\n >\n <ng-content select=\"[slot=mat-sidenav]\"></ng-content>\n </mat-sidenav>\n <mat-sidenav-content #sidenavContent>\n <ng-content select=\"[slot=mat-sidenav-content]\"></ng-content>\n </mat-sidenav-content>\n</mat-sidenav-container>\n", dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i3$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i3$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i3$1.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "pipe", type: i2$2.AsyncPipe, name: "async" }] }); }
316
+ }
317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: SidenavContainerComponent, decorators: [{
318
+ type: Component,
319
+ args: [{ selector: 'ddr-mat-sidenav-container', template: "<mat-sidenav-container [ngClass]=\"(mode$|async)\">\n <mat-sidenav\n #sidenav\n [mode]=\"(mode$|async) ?? 'over'\"\n [opened]=\"(opened$|async)\"\n [fixedInViewport]=\"true\"\n >\n <ng-content select=\"[slot=mat-sidenav]\"></ng-content>\n </mat-sidenav>\n <mat-sidenav-content #sidenavContent>\n <ng-content select=\"[slot=mat-sidenav-content]\"></ng-content>\n </mat-sidenav-content>\n</mat-sidenav-container>\n" }]
320
+ }], ctorParameters: () => [{ type: SidenavService }], propDecorators: { sidenav: [{
321
+ type: ViewChild,
322
+ args: ['sidenav', { static: true }]
323
+ }], stayOpenOnLargeScreen: [{
324
+ type: Input
325
+ }] } });
326
+
327
+ class FilterComponent {
328
+ constructor() {
329
+ this.formControl = new FormControl();
330
+ this.onFilterChanged = new EventEmitter();
331
+ this.bouncePeriod = 500;
332
+ }
333
+ /**
334
+ * @override
335
+ */
336
+ ngOnInit() {
337
+ this.valueChangesSubscription = this.formControl.valueChanges
338
+ .pipe(debounce(() => interval(this.bouncePeriod)))
339
+ .subscribe((value => this.onFilterChanged.emit(value)));
340
+ }
341
+ /**
342
+ * @override
343
+ */
344
+ ngOnDestroy() {
345
+ this.valueChangesSubscription.unsubscribe();
346
+ }
347
+ /**
348
+ * @override
349
+ */
350
+ ngAfterContentInit() {
351
+ this.inputElement.nativeElement.focus();
352
+ }
353
+ clear() {
354
+ this.formControl.setValue(null);
355
+ this.onFilterChanged.emit(undefined);
356
+ }
357
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
358
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: FilterComponent, selector: "ddr-filter", inputs: { bouncePeriod: "bouncePeriod" }, outputs: { onFilterChanged: "onFilterChanged" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <input matInput type=\"text\" [formControl]=\"formControl\" #input />\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</mat-card>\n", dependencies: [{ kind: "component", type: i1$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
359
+ }
360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: FilterComponent, decorators: [{
361
+ type: Component,
362
+ args: [{ selector: 'ddr-filter', template: "<mat-card appearance=\"outlined\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <input matInput type=\"text\" [formControl]=\"formControl\" #input />\n <button mat-icon-button matSuffix (click)=\"clear()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</mat-card>\n" }]
363
+ }], propDecorators: { onFilterChanged: [{
364
+ type: Output
365
+ }], bouncePeriod: [{
366
+ type: Input
367
+ }], inputElement: [{
368
+ type: ViewChild,
369
+ args: ['input', { static: true }]
370
+ }] } });
371
+
372
+ const DDR_MATERIAL_EXTENSIONS_THEME = new InjectionToken('DDR_MATERIAL_EXTENSIONS_THEME');
373
+
374
+ class ThemeScrollService {
375
+ constructor(document, themeConfig) {
376
+ this.document = document;
377
+ this.themeConfig = themeConfig;
378
+ }
379
+ init() {
380
+ const lightMetaElement = this.findOrCreateThemeColorMetaElement('(prefers-color-scheme: light)', this.themeConfig.themeColorLight);
381
+ const darkMetaElement = this.findOrCreateThemeColorMetaElement('(prefers-color-scheme: dark)', this.themeConfig.themeColorDark);
382
+ fromEvent(this.document, 'scroll')
383
+ .pipe(map(() => this.document.documentElement.scrollTop > 0), distinctUntilChanged()).subscribe((scrolled) => {
384
+ scrolled ? this.document.body.classList.add('ddr-mat-scrolled') : this.document.body.classList.remove('ddr-mat-scrolled');
385
+ lightMetaElement.content = scrolled ? this.themeConfig.themeColorLightScrolled : this.themeConfig.themeColorLight;
386
+ darkMetaElement.content = scrolled ? this.themeConfig.themeColorDarkScrolled : this.themeConfig.themeColorDark;
387
+ });
388
+ }
389
+ findOrCreateThemeColorMetaElement(media, content) {
390
+ let metaElement = this.document.head.querySelector(`meta[name="theme-color"][media="${media}"]`);
391
+ if (null == metaElement) {
392
+ metaElement = this.createThemeColorMetaElement(media, content);
393
+ }
394
+ return metaElement;
395
+ }
396
+ createThemeColorMetaElement(media, content) {
397
+ const metaElement = this.document.createElement('meta');
398
+ metaElement.name = 'theme-color';
399
+ metaElement.media = media;
400
+ metaElement.content = content;
401
+ this.document.head.appendChild(metaElement);
402
+ return metaElement;
403
+ }
404
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ThemeScrollService, deps: [{ token: DOCUMENT }, { token: DDR_MATERIAL_EXTENSIONS_THEME }], target: i0.ɵɵFactoryTarget.Injectable }); }
405
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ThemeScrollService }); }
406
+ }
407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ThemeScrollService, decorators: [{
408
+ type: Injectable
409
+ }], ctorParameters: () => [{ type: Document, decorators: [{
410
+ type: Inject,
411
+ args: [DOCUMENT]
412
+ }] }, { type: undefined, decorators: [{
413
+ type: Inject,
414
+ args: [DDR_MATERIAL_EXTENSIONS_THEME]
415
+ }] }] });
416
+
417
+ class ToolbarFixedTopDirective {
418
+ constructor(el) {
419
+ this.el = el;
420
+ this.ddrMatToolbarFixedTop = undefined;
421
+ }
422
+ /**
423
+ * @override
424
+ */
425
+ ngOnInit() {
426
+ const container = document.createElement('div');
427
+ container.classList.add('ddr-mat-toolbar-fixed-top-container');
428
+ this.el.nativeElement.parentElement.insertBefore(container, this.el.nativeElement);
429
+ container.appendChild(this.el.nativeElement);
430
+ if (this.ddrMatToolbarFixedTop != null && '' !== this.ddrMatToolbarFixedTop) {
431
+ container.classList.add(this.ddrMatToolbarFixedTop);
432
+ }
433
+ }
434
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ToolbarFixedTopDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
435
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.9", type: ToolbarFixedTopDirective, selector: "[ddrMatToolbarFixedTop]", inputs: { ddrMatToolbarFixedTop: "ddrMatToolbarFixedTop" }, ngImport: i0 }); }
436
+ }
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: ToolbarFixedTopDirective, decorators: [{
438
+ type: Directive,
439
+ args: [{
440
+ selector: '[ddrMatToolbarFixedTop]'
441
+ }]
442
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { ddrMatToolbarFixedTop: [{
443
+ type: Input
444
+ }] } });
445
+
446
+ class FabFixedDirective {
447
+ constructor(el) {
448
+ this.el = el;
449
+ }
450
+ /**
451
+ * @override
452
+ */
453
+ ngOnInit() {
454
+ const container = document.createElement('div');
455
+ container.classList.add('ddr-mat-fab-fixed-container');
456
+ this.el.nativeElement.parentElement.insertBefore(container, this.el.nativeElement);
457
+ container.appendChild(this.el.nativeElement);
458
+ }
459
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: FabFixedDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
460
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.9", type: FabFixedDirective, selector: "[ddrMatFabFixed]", ngImport: i0 }); }
461
+ }
462
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: FabFixedDirective, decorators: [{
463
+ type: Directive,
464
+ args: [{
465
+ selector: '[ddrMatFabFixed]'
466
+ }]
467
+ }], ctorParameters: () => [{ type: i0.ElementRef }] });
468
+
383
469
  class DdrMaterialExtensionsModule {
384
470
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DdrMaterialExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
385
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: DdrMaterialExtensionsModule, declarations: [FilterComponent,
471
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: DdrMaterialExtensionsModule, declarations: [FabFixedDirective,
472
+ FilterComponent,
386
473
  SidenavToggleComponent,
387
474
  GridTileLazyImageContainerDirective,
388
475
  GridTileLazyImgDirective,
389
- SidenavContainerComponent], imports: [CommonModule,
476
+ SidenavContainerComponent,
477
+ ToolbarFixedTopDirective], imports: [CommonModule,
390
478
  MatCardModule,
391
479
  MatSidenavModule,
392
480
  MatIconModule,
@@ -394,12 +482,33 @@ class DdrMaterialExtensionsModule {
394
482
  MatButtonModule,
395
483
  MatFormFieldModule,
396
484
  MatToolbarModule,
397
- ReactiveFormsModule], exports: [FilterComponent,
485
+ ReactiveFormsModule], exports: [FabFixedDirective,
486
+ FilterComponent,
398
487
  SidenavToggleComponent,
399
488
  GridTileLazyImageContainerDirective,
400
489
  GridTileLazyImgDirective,
401
- SidenavContainerComponent] }); }
402
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DdrMaterialExtensionsModule, imports: [CommonModule,
490
+ SidenavContainerComponent,
491
+ ToolbarFixedTopDirective] }); }
492
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: DdrMaterialExtensionsModule, providers: [
493
+ ThemeScrollService,
494
+ {
495
+ provide: ENVIRONMENT_INITIALIZER,
496
+ multi: true,
497
+ useValue() {
498
+ inject(ThemeScrollService).init();
499
+ }
500
+ },
501
+ {
502
+ provide: DDR_MATERIAL_EXTENSIONS_THEME,
503
+ multi: false,
504
+ useValue: {
505
+ themeColorLight: '#fdfbff',
506
+ themeColorDark: '#1a1b1f',
507
+ themeColorLightScrolled: '#efedf1',
508
+ themeColorDarkScrolled: '#1e1f23',
509
+ }
510
+ }
511
+ ], imports: [CommonModule,
403
512
  MatCardModule,
404
513
  MatSidenavModule,
405
514
  MatIconModule,
@@ -413,11 +522,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImpor
413
522
  type: NgModule,
414
523
  args: [{
415
524
  declarations: [
525
+ FabFixedDirective,
416
526
  FilterComponent,
417
527
  SidenavToggleComponent,
418
528
  GridTileLazyImageContainerDirective,
419
529
  GridTileLazyImgDirective,
420
530
  SidenavContainerComponent,
531
+ ToolbarFixedTopDirective
421
532
  ],
422
533
  imports: [
423
534
  CommonModule,
@@ -431,11 +542,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImpor
431
542
  ReactiveFormsModule
432
543
  ],
433
544
  exports: [
545
+ FabFixedDirective,
434
546
  FilterComponent,
435
547
  SidenavToggleComponent,
436
548
  GridTileLazyImageContainerDirective,
437
549
  GridTileLazyImgDirective,
438
550
  SidenavContainerComponent,
551
+ ToolbarFixedTopDirective
552
+ ],
553
+ providers: [
554
+ ThemeScrollService,
555
+ {
556
+ provide: ENVIRONMENT_INITIALIZER,
557
+ multi: true,
558
+ useValue() {
559
+ inject(ThemeScrollService).init();
560
+ }
561
+ },
562
+ {
563
+ provide: DDR_MATERIAL_EXTENSIONS_THEME,
564
+ multi: false,
565
+ useValue: {
566
+ themeColorLight: '#fdfbff',
567
+ themeColorDark: '#1a1b1f',
568
+ themeColorLightScrolled: '#efedf1',
569
+ themeColorDarkScrolled: '#1e1f23',
570
+ }
571
+ }
439
572
  ]
440
573
  }]
441
574
  }] });
@@ -448,5 +581,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImpor
448
581
  * Generated bundle index. Do not edit.
449
582
  */
450
583
 
451
- export { DdrMaterialExtensionsModule, FilterComponent, GridTileLazyImageContainerDirective, GridTileLazyImgDirective, SidenavContainerComponent, SidenavService, SidenavToggleComponent };
584
+ export { DDR_MATERIAL_EXTENSIONS_THEME, DdrMaterialExtensionsModule, FabFixedDirective, FilterComponent, GridTileLazyImageContainerDirective, GridTileLazyImgDirective, SidenavContainerComponent, SidenavService, SidenavToggleComponent, ToolbarFixedTopDirective };
452
585
  //# sourceMappingURL=dontdrinkandroot-ngx-material-extensions.mjs.map