@eherve/angular-material-datatable 19.23.2 → 19.23.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.
Files changed (39) hide show
  1. package/fesm2022/{eherve-angular-material-datatable-cell-checkbox-value.component-hAqQu_Xe.mjs → eherve-angular-material-datatable-cell-checkbox-value.component-S50hGDg_.mjs} +2 -2
  2. package/fesm2022/{eherve-angular-material-datatable-cell-checkbox-value.component-hAqQu_Xe.mjs.map → eherve-angular-material-datatable-cell-checkbox-value.component-S50hGDg_.mjs.map} +1 -1
  3. package/fesm2022/{eherve-angular-material-datatable-cell-date-value.component-BAnK6hjI.mjs → eherve-angular-material-datatable-cell-date-value.component-vnUf6Ote.mjs} +2 -2
  4. package/fesm2022/{eherve-angular-material-datatable-cell-date-value.component-BAnK6hjI.mjs.map → eherve-angular-material-datatable-cell-date-value.component-vnUf6Ote.mjs.map} +1 -1
  5. package/fesm2022/{eherve-angular-material-datatable-cell-duration-value.component-BgcvN-ds.mjs → eherve-angular-material-datatable-cell-duration-value.component-D9-H5i7b.mjs} +2 -2
  6. package/fesm2022/{eherve-angular-material-datatable-cell-duration-value.component-BgcvN-ds.mjs.map → eherve-angular-material-datatable-cell-duration-value.component-D9-H5i7b.mjs.map} +1 -1
  7. package/fesm2022/{eherve-angular-material-datatable-cell-number-value.component-Q8jdOixn.mjs → eherve-angular-material-datatable-cell-number-value.component-BQIdn-qP.mjs} +2 -2
  8. package/fesm2022/{eherve-angular-material-datatable-cell-number-value.component-Q8jdOixn.mjs.map → eherve-angular-material-datatable-cell-number-value.component-BQIdn-qP.mjs.map} +1 -1
  9. package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-Jm7hTiyB.mjs +44 -0
  10. package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-Jm7hTiyB.mjs.map +1 -0
  11. package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-Dck-CD4z.mjs +2374 -0
  12. package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-Dck-CD4z.mjs.map +1 -0
  13. package/fesm2022/{eherve-angular-material-datatable-get.pipe-DXh2e-6u.mjs → eherve-angular-material-datatable-get.pipe-DrZTHXsm.mjs} +2 -2
  14. package/fesm2022/{eherve-angular-material-datatable-get.pipe-DXh2e-6u.mjs.map → eherve-angular-material-datatable-get.pipe-DrZTHXsm.mjs.map} +1 -1
  15. package/fesm2022/eherve-angular-material-datatable.mjs +1 -1
  16. package/lib/components/cell-select-value/cell-select-value.component.d.ts +3 -1
  17. package/lib/components/header-autocomplete-filter/header-autocomplete-filter.component.d.ts +7 -5
  18. package/lib/components/header-checkbox-filter/header-checkbox-filter.component.d.ts +6 -4
  19. package/lib/components/header-date-filter/header-date-filter.component.d.ts +9 -4
  20. package/lib/components/header-duration-filter/header-duration-filter.component.d.ts +6 -4
  21. package/lib/components/header-number-filter/header-number-filter.component.d.ts +6 -4
  22. package/lib/components/header-select-filter/header-select-filter.component.d.ts +6 -4
  23. package/lib/components/header-text-filter/header-text-filter.component.d.ts +6 -4
  24. package/lib/datasource.d.ts +5 -2
  25. package/lib/datatable-default-options.d.ts +5 -0
  26. package/lib/datatable.component.d.ts +45 -3
  27. package/lib/datatable.intl.d.ts +2 -0
  28. package/lib/pipes/safe-html.pipe.d.ts +1 -1
  29. package/lib/types/action.type.d.ts +2 -0
  30. package/lib/types/datasource-service.type.d.ts +2 -0
  31. package/lib/types/datatable-column.type.d.ts +1 -1
  32. package/lib/types/datatable-facet.type.d.ts +1 -0
  33. package/lib/types/datatable-options.type.d.ts +34 -0
  34. package/package.json +1 -1
  35. package/public-api.d.ts +1 -0
  36. package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-DRmVwWuY.mjs +0 -42
  37. package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-DRmVwWuY.mjs.map +0 -1
  38. package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-CMCXpnhf.mjs +0 -2013
  39. package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-CMCXpnhf.mjs.map +0 -1
@@ -0,0 +1,2374 @@
1
+ import * as i0 from '@angular/core';
2
+ import { SecurityContext, Pipe, inject, Injector, ChangeDetectorRef, forwardRef, Component, Input, ViewChild, signal, ChangeDetectionStrategy, LOCALE_ID, Injectable, HostBinding, InjectionToken, Directive, EventEmitter, Output, ContentChildren, NgModule } from '@angular/core';
3
+ import { trigger, transition, style, animate, state } from '@angular/animations';
4
+ import * as i2$1 from '@angular/cdk/drag-drop';
5
+ import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
6
+ import * as i1$1 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+ import * as i2 from '@angular/forms';
9
+ import { FormControl, NgControl, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule, FormGroup, Validators } from '@angular/forms';
10
+ import * as i5$2 from '@angular/material/badge';
11
+ import { MatBadgeModule } from '@angular/material/badge';
12
+ import * as i3$1 from '@angular/material/button';
13
+ import { MatButtonModule } from '@angular/material/button';
14
+ import * as i15 from '@angular/material/card';
15
+ import { MatCardModule } from '@angular/material/card';
16
+ import * as i13 from '@angular/material/chips';
17
+ import { MatChipsModule } from '@angular/material/chips';
18
+ import * as i4$1 from '@angular/material/form-field';
19
+ import { MatFormFieldModule } from '@angular/material/form-field';
20
+ import * as i5$1 from '@angular/material/icon';
21
+ import { MatIconModule } from '@angular/material/icon';
22
+ import * as i9 from '@angular/material/menu';
23
+ import { MatMenuModule } from '@angular/material/menu';
24
+ import * as i10$1 from '@angular/material/paginator';
25
+ import { MatPaginatorIntl, MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
26
+ import * as i1$3 from '@angular/material/progress-spinner';
27
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
28
+ import * as i12 from '@angular/material/table';
29
+ import { MatTable, MatTableModule } from '@angular/material/table';
30
+ import * as i14 from '@angular/material/tooltip';
31
+ import { MatTooltipModule } from '@angular/material/tooltip';
32
+ import * as i3$3 from 'ngx-countup';
33
+ import { CountUpModule } from 'ngx-countup';
34
+ import * as i3 from 'ngx-intersection-observer';
35
+ import { IntersectionObserverModule } from 'ngx-intersection-observer';
36
+ import * as rxjs from 'rxjs';
37
+ import { BehaviorSubject, Subject, Subscription, filter, debounceTime, switchMap, startWith, tap, map } from 'rxjs';
38
+ import * as i4 from '@angular/material/autocomplete';
39
+ import { MatAutocomplete, MatAutocompleteModule } from '@angular/material/autocomplete';
40
+ import * as i6 from '@angular/material/input';
41
+ import { MatInputModule } from '@angular/material/input';
42
+ import * as i10 from '@angular/material/progress-bar';
43
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
44
+ import * as i1 from '@angular/platform-browser';
45
+ import * as i5 from '@angular/material/core';
46
+ import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
47
+ import * as i3$2 from '@angular/material/checkbox';
48
+ import { MatCheckboxModule } from '@angular/material/checkbox';
49
+ import { provideMomentDateAdapter } from '@angular/material-moment-adapter';
50
+ import * as i4$2 from '@angular/material/datepicker';
51
+ import { MatDatepickerIntl, MatDatepickerModule } from '@angular/material/datepicker';
52
+ import moment from 'moment';
53
+ import * as i1$2 from '@angular/cdk/overlay';
54
+ import { OverlayModule } from '@angular/cdk/overlay';
55
+ import * as i6$1 from '@angular/material/select';
56
+ import { MatSelectModule } from '@angular/material/select';
57
+ import { DataSource } from '@angular/cdk/collections';
58
+ import * as lodash from 'lodash-es';
59
+ import humanizeDuration from 'humanize-duration';
60
+
61
+ /** @format */
62
+ class SafeHtmlPipe {
63
+ sanitizer;
64
+ constructor(sanitizer) {
65
+ this.sanitizer = sanitizer;
66
+ }
67
+ transform(html) {
68
+ return this.sanitizer.sanitize(SecurityContext.HTML, html ?? '') ?? '';
69
+ }
70
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
71
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: SafeHtmlPipe, isStandalone: true, name: "safeHtml" });
72
+ }
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SafeHtmlPipe, decorators: [{
74
+ type: Pipe,
75
+ args: [{
76
+ name: 'safeHtml',
77
+ }]
78
+ }], ctorParameters: () => [{ type: i1.DomSanitizer }] });
79
+
80
+ var safeHtml_pipe = /*#__PURE__*/Object.freeze({
81
+ __proto__: null,
82
+ SafeHtmlPipe: SafeHtmlPipe
83
+ });
84
+
85
+ /** @format */
86
+ function stripHtml(value) {
87
+ if (!value)
88
+ return '';
89
+ return value
90
+ .replace(/<[^>]+>/g, ' ') // remove tags
91
+ .replace(/\s+/g, ' ') // collapse spaces
92
+ .trim();
93
+ }
94
+
95
+ /** @format */
96
+ class HeaderAutocompleteFilterComponent {
97
+ column;
98
+ options = [];
99
+ groups = [];
100
+ hasMore = false;
101
+ searching = false;
102
+ input;
103
+ auto;
104
+ control;
105
+ selectControl = new FormControl();
106
+ onChange = () => { };
107
+ onTouched = () => { };
108
+ filter$ = new BehaviorSubject(undefined);
109
+ nextPage$ = new Subject();
110
+ injector = inject(Injector);
111
+ changeDetectorRef = inject(ChangeDetectorRef);
112
+ subsink = new Subscription();
113
+ writeValue(value) {
114
+ if (value?.value !== this.selectControl.value) {
115
+ if (value?.name) {
116
+ if (!this.options.find(o => o.value === value.value)) {
117
+ this.options.push({ value: value.value, name: value.name });
118
+ }
119
+ }
120
+ this.selectControl.setValue(value?.value, { emitEvent: false });
121
+ }
122
+ this.changeDetectorRef.markForCheck();
123
+ }
124
+ setDisabledState(isDisabled) {
125
+ if (isDisabled)
126
+ this.selectControl.disable({ emitEvent: false });
127
+ else
128
+ this.selectControl.enable({ emitEvent: false });
129
+ }
130
+ registerOnChange(onChange) {
131
+ this.onChange = onChange;
132
+ }
133
+ registerOnTouched(onTouched) {
134
+ this.onTouched = onTouched;
135
+ }
136
+ async ngAfterViewInit() {
137
+ const ngControl = this.injector.get(NgControl, null);
138
+ if (!ngControl)
139
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
140
+ this.control = ngControl.control;
141
+ this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
142
+ if (value === undefined) {
143
+ if (this.control.value !== undefined)
144
+ this.onChange(undefined);
145
+ }
146
+ else if (value === null && !this.options.find(o => o.value === null)) {
147
+ if (this.control.value !== undefined)
148
+ this.onChange(undefined);
149
+ }
150
+ else if (this.control.value?.value !== value)
151
+ this.onChange({ value, regex: false });
152
+ }));
153
+ this.buildOptions();
154
+ this.changeDetectorRef.detectChanges();
155
+ }
156
+ ngOnDestroy() {
157
+ this.subsink.unsubscribe();
158
+ }
159
+ loadMore(intersect) {
160
+ if (!intersect)
161
+ return;
162
+ this.nextPage$.next();
163
+ }
164
+ focus() {
165
+ if (this.column.loadOnFocus && this.isEmptyValue(this.selectControl.value)) {
166
+ const search = this.input.nativeElement.value;
167
+ if (!search.length || this.filter$.value !== search)
168
+ this.filter$.next(search);
169
+ }
170
+ }
171
+ filter() {
172
+ const search = this.input.nativeElement.value;
173
+ this.filter$.next(search);
174
+ }
175
+ displayWith = (value) => {
176
+ let val;
177
+ if (!this.options)
178
+ val = value;
179
+ else
180
+ val = this.options.find(o => o.value === value)?.name ?? value;
181
+ return stripHtml(val);
182
+ };
183
+ getGlobalSearchValue() {
184
+ if (!this.control.parent)
185
+ return null;
186
+ let parent = this.control.parent;
187
+ while (parent.parent)
188
+ parent = parent.parent;
189
+ return parent.value;
190
+ }
191
+ buildOptions() {
192
+ this.options = this.column.searchValue !== undefined ? (this.column.searchValueOptions ?? []) : [];
193
+ this.subsink.add(this.filter$
194
+ .pipe(filter(value => typeof value === 'string'), debounceTime(300), switchMap((search) => {
195
+ this.auto.panel;
196
+ this.options = [];
197
+ this.groups = [];
198
+ let skip = 0;
199
+ return this.nextPage$.pipe(startWith(skip), tap(() => (this.searching = true)), switchMap(async () => this.column.options(this.column.limit || 10, skip, search, this.getGlobalSearchValue())), map(data => {
200
+ data.forEach(d => {
201
+ this.options.push(d);
202
+ const name = d.group ?? '';
203
+ const group = this.groups.find(g => g.name === name);
204
+ if (!group)
205
+ this.groups.push({ name, options: [d] });
206
+ else
207
+ group.options.push(d);
208
+ });
209
+ skip += this.column.limit || 10;
210
+ this.hasMore = data?.length === (this.column.limit || 10);
211
+ this.searching = false;
212
+ }));
213
+ }))
214
+ .subscribe());
215
+ }
216
+ isEmptyValue(value) {
217
+ return value === null || value === undefined || value === '';
218
+ }
219
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderAutocompleteFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
220
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderAutocompleteFilterComponent, isStandalone: true, selector: "lib-header-autocomplete-filter", inputs: { column: "column" }, providers: [
221
+ {
222
+ provide: NG_VALUE_ACCESSOR,
223
+ multi: true,
224
+ useExisting: forwardRef(() => HeaderAutocompleteFilterComponent),
225
+ },
226
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }, { propertyName: "auto", first: true, predicate: MatAutocomplete, descendants: true }], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <input\n #input\n type=\"text\"\n [placeholder]=\"column.placeholder!\"\n aria-label=\"Number\"\n matInput\n [formControl]=\"selectControl\"\n [matAutocomplete]=\"auto\"\n (input)=\"filter()\"\n (focus)=\"focus()\"\n (blur)=\"onTouched()\" />\n <mat-autocomplete #auto=\"matAutocomplete\" requireSelection [displayWith]=\"displayWith\">\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"autocompleteOption; context: { option }\"></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option.value) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"autocompleteOption; context: { option }\"></ng-container>\n </mat-option>\n }\n }\n\n <mat-option id=\"searching-option\" disabled>\n @if (searching) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </mat-option>\n\n @if (hasMore && !searching) {\n <mat-option id=\"load-more-options\" disabled intersectionObserver (intersection)=\"loadMore($event.intersect)\">\n </mat-option>\n }\n </mat-autocomplete>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n\n<ng-template #autocompleteOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon [svgIcon]=\"option.icon\" [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}#searching-option{min-height:2px;position:relative}#searching-option mat-progress-bar{position:absolute;inset:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: IntersectionObserverModule }, { kind: "directive", type: i3.IntersectionObserverDirective, selector: "[intersectionObserver]", inputs: ["visitClass", "leaveClass", "removeVisitClass", "removeLeaveClass", "useScroll", "threshold", "autoRemove"], outputs: ["intersection"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i5.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i10.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
227
+ }
228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderAutocompleteFilterComponent, decorators: [{
229
+ type: Component,
230
+ args: [{ selector: 'lib-header-autocomplete-filter', imports: [
231
+ CommonModule,
232
+ FormsModule,
233
+ IntersectionObserverModule,
234
+ MatAutocompleteModule,
235
+ MatButtonModule,
236
+ MatFormFieldModule,
237
+ MatIconModule,
238
+ MatInputModule,
239
+ MatProgressBarModule,
240
+ ReactiveFormsModule,
241
+ SafeHtmlPipe,
242
+ ], providers: [
243
+ {
244
+ provide: NG_VALUE_ACCESSOR,
245
+ multi: true,
246
+ useExisting: forwardRef(() => HeaderAutocompleteFilterComponent),
247
+ },
248
+ ], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <input\n #input\n type=\"text\"\n [placeholder]=\"column.placeholder!\"\n aria-label=\"Number\"\n matInput\n [formControl]=\"selectControl\"\n [matAutocomplete]=\"auto\"\n (input)=\"filter()\"\n (focus)=\"focus()\"\n (blur)=\"onTouched()\" />\n <mat-autocomplete #auto=\"matAutocomplete\" requireSelection [displayWith]=\"displayWith\">\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"autocompleteOption; context: { option }\"></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option.value) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"autocompleteOption; context: { option }\"></ng-container>\n </mat-option>\n }\n }\n\n <mat-option id=\"searching-option\" disabled>\n @if (searching) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </mat-option>\n\n @if (hasMore && !searching) {\n <mat-option id=\"load-more-options\" disabled intersectionObserver (intersection)=\"loadMore($event.intersect)\">\n </mat-option>\n }\n </mat-autocomplete>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n\n<ng-template #autocompleteOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon [svgIcon]=\"option.icon\" [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}#searching-option{min-height:2px;position:relative}#searching-option mat-progress-bar{position:absolute;inset:0}\n"] }]
249
+ }], propDecorators: { column: [{
250
+ type: Input
251
+ }], input: [{
252
+ type: ViewChild,
253
+ args: ['input']
254
+ }], auto: [{
255
+ type: ViewChild,
256
+ args: [MatAutocomplete]
257
+ }] } });
258
+
259
+ /** @format */
260
+ class HeaderCheckboxFilterComponent {
261
+ column;
262
+ control;
263
+ selectControl = new FormControl();
264
+ onChange = () => { };
265
+ onTouched = () => { };
266
+ injector = inject(Injector);
267
+ changeDetectorRef = inject(ChangeDetectorRef);
268
+ previousValue;
269
+ subsink = new Subscription();
270
+ writeValue(value) {
271
+ const nextValue = value?.value;
272
+ this.previousValue = nextValue;
273
+ if (nextValue !== this.selectControl.value)
274
+ this.selectControl.setValue(nextValue, { emitEvent: false });
275
+ this.changeDetectorRef.markForCheck();
276
+ }
277
+ setDisabledState(isDisabled) {
278
+ if (isDisabled)
279
+ this.selectControl.disable({ emitEvent: false });
280
+ else
281
+ this.selectControl.enable({ emitEvent: false });
282
+ }
283
+ registerOnChange(onChange) {
284
+ this.onChange = onChange;
285
+ }
286
+ registerOnTouched(onTouched) {
287
+ this.onTouched = onTouched;
288
+ }
289
+ async ngAfterViewInit() {
290
+ const ngControl = this.injector.get(NgControl, null);
291
+ if (!ngControl)
292
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
293
+ this.control = ngControl.control;
294
+ this.previousValue = this.control.value?.value;
295
+ this.subsink.add(this.selectControl.valueChanges
296
+ .pipe(filter(value => {
297
+ if (value === true && this.previousValue === false) {
298
+ this.selectControl.setValue(undefined, { emitEvent: false });
299
+ this.previousValue = undefined;
300
+ this.onChange(undefined);
301
+ return false;
302
+ }
303
+ return true;
304
+ }), tap(value => (this.previousValue = value)))
305
+ .subscribe((value) => {
306
+ if (value === undefined)
307
+ this.onChange(undefined);
308
+ else
309
+ this.onChange({ value, regex: false });
310
+ }));
311
+ this.changeDetectorRef.detectChanges();
312
+ }
313
+ ngOnDestroy() {
314
+ this.subsink.unsubscribe();
315
+ }
316
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderCheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
317
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderCheckboxFilterComponent, isStandalone: true, selector: "lib-header-checkbox-filter", inputs: { column: "column" }, providers: [
318
+ {
319
+ provide: NG_VALUE_ACCESSOR,
320
+ multi: true,
321
+ useExisting: forwardRef(() => HeaderCheckboxFilterComponent),
322
+ },
323
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-checkbox [formControl]=\"selectControl\" [indeterminate]=\"selectControl.value === undefined\" (blur)=\"onTouched()\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n </mat-checkbox>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
324
+ }
325
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderCheckboxFilterComponent, decorators: [{
326
+ type: Component,
327
+ args: [{ selector: 'lib-header-checkbox-filter', imports: [
328
+ CommonModule,
329
+ FormsModule,
330
+ MatButtonModule,
331
+ MatFormFieldModule,
332
+ MatIconModule,
333
+ MatCheckboxModule,
334
+ ReactiveFormsModule,
335
+ SafeHtmlPipe,
336
+ ], providers: [
337
+ {
338
+ provide: NG_VALUE_ACCESSOR,
339
+ multi: true,
340
+ useExisting: forwardRef(() => HeaderCheckboxFilterComponent),
341
+ },
342
+ ], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-checkbox [formControl]=\"selectControl\" [indeterminate]=\"selectControl.value === undefined\" (blur)=\"onTouched()\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n </mat-checkbox>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"] }]
343
+ }], propDecorators: { column: [{
344
+ type: Input
345
+ }] } });
346
+
347
+ /** @format */
348
+ const OPERATORS = ['=', '>', '≥', '<', '≤', '<>', '≤≥'];
349
+ class OperatorSelectComponent {
350
+ set setDisableRange(disableRange) {
351
+ this.disableRange = disableRange !== false;
352
+ if (this.disableRange)
353
+ this.operators = OPERATORS.slice(0, 5);
354
+ else
355
+ this.operators = OPERATORS;
356
+ }
357
+ disableRange = false;
358
+ operators = OPERATORS;
359
+ isOpen = false;
360
+ control;
361
+ onChange = () => { };
362
+ onTouched = () => { };
363
+ injector = inject(Injector);
364
+ changeDetectorRef = inject(ChangeDetectorRef);
365
+ writeValue = () => { };
366
+ registerOnChange(onChange) {
367
+ this.onChange = onChange;
368
+ }
369
+ registerOnTouched(onTouched) {
370
+ this.onTouched = onTouched;
371
+ }
372
+ async ngAfterViewInit() {
373
+ const ngControl = this.injector.get(NgControl, null);
374
+ if (!ngControl)
375
+ throw new Error(`${this.constructor.name} missing control`);
376
+ this.control = ngControl.control;
377
+ this.changeDetectorRef.detectChanges();
378
+ }
379
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OperatorSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
380
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: OperatorSelectComponent, isStandalone: true, selector: "lib-operator-select", inputs: { setDisableRange: ["disableRange", "setDisableRange"] }, providers: [
381
+ {
382
+ provide: NG_VALUE_ACCESSOR,
383
+ multi: true,
384
+ useExisting: forwardRef(() => OperatorSelectComponent),
385
+ },
386
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-mini-fab\n color=\"primary\"\n class=\"ngx-mat-datatable-operator-button\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"$event.stopPropagation(); isOpen = !isOpen\">\n {{ control.value }}\n </button>\n\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen\">\n <div class=\"ngx-mat-datatable-operator-column\" @fade>\n @for (operator of operators; track operator) {\n @if (operator !== control.value) {\n <button\n mat-mini-fab\n color=\"primary\"\n class=\"ngx-mat-datatable-operator-button\"\n (click)=\"control.setValue(operator); isOpen = !isOpen\">\n {{ operator }}\n </button>\n }\n }\n </div>\n </ng-template>\n}\n", styles: [".ngx-mat-datatable-operator-button{--mdc-fab-small-container-elevation-shadow: none;--mdc-fab-small-hover-container-elevation-shadow: none;--mdc-fab-small-focus-container-elevation-shadow: none;--mdc-fab-small-container-shape: 50%;--mdc-fab-small-container-color: var(--mat-sys-primary);--mat-fab-small-foreground-color: var(--mat-sys-on-primary);font-size:16px;width:26px;height:26px;padding:6px}.ngx-mat-datatable-operator-button ::ng-deep .mat-mdc-button-touch-target{height:36px;width:36px}.ngx-mat-datatable-operator-column{display:flex;box-sizing:border-box;flex-direction:column}.ngx-mat-datatable-operator-column .ngx-mat-datatable-operator-button{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatMiniFabButton, selector: "button[mat-mini-fab]", exportAs: ["matButton"] }], animations: [
387
+ trigger('fade', [
388
+ transition(':enter', [
389
+ style({ opacity: 0 }), // initial
390
+ animate('0.2s', style({ opacity: 1 })), // final
391
+ ]),
392
+ transition(':leave', [
393
+ style({ opacity: 1 }), // initial
394
+ animate('0.2s', style({ opacity: 0 })), // final
395
+ ]),
396
+ ]),
397
+ ] });
398
+ }
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OperatorSelectComponent, decorators: [{
400
+ type: Component,
401
+ args: [{ selector: 'lib-operator-select', imports: [CommonModule, OverlayModule, MatIconModule, MatButtonModule], animations: [
402
+ trigger('fade', [
403
+ transition(':enter', [
404
+ style({ opacity: 0 }), // initial
405
+ animate('0.2s', style({ opacity: 1 })), // final
406
+ ]),
407
+ transition(':leave', [
408
+ style({ opacity: 1 }), // initial
409
+ animate('0.2s', style({ opacity: 0 })), // final
410
+ ]),
411
+ ]),
412
+ ], providers: [
413
+ {
414
+ provide: NG_VALUE_ACCESSOR,
415
+ multi: true,
416
+ useExisting: forwardRef(() => OperatorSelectComponent),
417
+ },
418
+ ], template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-mini-fab\n color=\"primary\"\n class=\"ngx-mat-datatable-operator-button\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"$event.stopPropagation(); isOpen = !isOpen\">\n {{ control.value }}\n </button>\n\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen\">\n <div class=\"ngx-mat-datatable-operator-column\" @fade>\n @for (operator of operators; track operator) {\n @if (operator !== control.value) {\n <button\n mat-mini-fab\n color=\"primary\"\n class=\"ngx-mat-datatable-operator-button\"\n (click)=\"control.setValue(operator); isOpen = !isOpen\">\n {{ operator }}\n </button>\n }\n }\n </div>\n </ng-template>\n}\n", styles: [".ngx-mat-datatable-operator-button{--mdc-fab-small-container-elevation-shadow: none;--mdc-fab-small-hover-container-elevation-shadow: none;--mdc-fab-small-focus-container-elevation-shadow: none;--mdc-fab-small-container-shape: 50%;--mdc-fab-small-container-color: var(--mat-sys-primary);--mat-fab-small-foreground-color: var(--mat-sys-on-primary);font-size:16px;width:26px;height:26px;padding:6px}.ngx-mat-datatable-operator-button ::ng-deep .mat-mdc-button-touch-target{height:36px;width:36px}.ngx-mat-datatable-operator-column{display:flex;box-sizing:border-box;flex-direction:column}.ngx-mat-datatable-operator-column .ngx-mat-datatable-operator-button{margin-top:8px}\n"] }]
419
+ }], propDecorators: { setDisableRange: [{
420
+ type: Input,
421
+ args: ['disableRange']
422
+ }] } });
423
+
424
+ /** @format */
425
+ class HeaderDateFilterComponent {
426
+ column;
427
+ control;
428
+ selectControl = new FormControl(undefined);
429
+ rangeGroup = new FormGroup({
430
+ from: new FormControl(undefined, Validators.required),
431
+ to: new FormControl(undefined, Validators.required),
432
+ });
433
+ operatorControl = new FormControl('=');
434
+ onChange = () => { };
435
+ onTouched = () => { };
436
+ _adapter = inject(DateAdapter);
437
+ _intl = inject(MatDatepickerIntl);
438
+ _locale = signal(inject(MAT_DATE_LOCALE));
439
+ injector = inject(Injector);
440
+ changeDetectorRef = inject(ChangeDetectorRef);
441
+ subsink = new Subscription();
442
+ writeValue(value) {
443
+ const operator = (value?.operator ?? '=');
444
+ this.operatorControl.setValue(operator, { emitEvent: false });
445
+ if (this.isRangeOperator(operator)) {
446
+ this.selectControl.setValue(undefined, { emitEvent: false });
447
+ this.rangeGroup.setValue({
448
+ from: value?.value?.from ?? undefined,
449
+ to: value?.value?.to ?? undefined,
450
+ }, { emitEvent: false });
451
+ }
452
+ else {
453
+ this.rangeGroup.reset({ from: undefined, to: undefined }, { emitEvent: false });
454
+ this.selectControl.setValue(value?.value ?? undefined, { emitEvent: false });
455
+ }
456
+ this.changeDetectorRef.markForCheck();
457
+ }
458
+ setDisabledState(isDisabled) {
459
+ const controls = [this.selectControl, this.rangeGroup, this.operatorControl];
460
+ controls.forEach(control => {
461
+ if (isDisabled)
462
+ control.disable({ emitEvent: false });
463
+ else
464
+ control.enable({ emitEvent: false });
465
+ });
466
+ }
467
+ registerOnChange(onChange) {
468
+ this.onChange = onChange;
469
+ }
470
+ registerOnTouched(onTouched) {
471
+ this.onTouched = onTouched;
472
+ }
473
+ ngOnInit() {
474
+ if (this.column.locale) {
475
+ this._locale.set(this.column.locale);
476
+ this._adapter.setLocale(this._locale());
477
+ this._intl.changes.next();
478
+ }
479
+ }
480
+ async ngAfterViewInit() {
481
+ const ngControl = this.injector.get(NgControl, null);
482
+ if (!ngControl)
483
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
484
+ this.control = ngControl.control;
485
+ this.subsink.add(this.selectControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
486
+ if (this.control.invalid)
487
+ return;
488
+ else if (this.isEmptyValue(value))
489
+ this.onChange(undefined);
490
+ else
491
+ this.onChange(this.buildValue(this.operatorControl.value, value));
492
+ }));
493
+ this.subsink.add(this.rangeGroup.valueChanges.pipe(debounceTime(500)).subscribe(value => {
494
+ if (!this.hasRangeValue(value))
495
+ this.onChange(undefined);
496
+ else if (this.rangeGroup.invalid)
497
+ return;
498
+ else
499
+ this.onChange(this.buildValue(this.operatorControl.value, value));
500
+ }));
501
+ this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
502
+ if (this.isRangeOperator(value)) {
503
+ if (!this.hasRangeValue(this.rangeGroup.value))
504
+ this.onChange(undefined);
505
+ else if (!this.rangeGroup.invalid)
506
+ this.onChange(this.buildValue(value, this.rangeGroup.value));
507
+ }
508
+ else {
509
+ if (this.isEmptyValue(this.selectControl.value))
510
+ this.onChange(undefined);
511
+ else
512
+ this.onChange(this.buildValue(value, this.selectControl.value));
513
+ }
514
+ this.changeDetectorRef.markForCheck();
515
+ }));
516
+ this.changeDetectorRef.detectChanges();
517
+ }
518
+ ngOnDestroy() {
519
+ this.subsink.unsubscribe();
520
+ }
521
+ clearRange() {
522
+ this.rangeGroup.reset();
523
+ this.onChange(undefined);
524
+ this.onTouched();
525
+ this.changeDetectorRef.markForCheck();
526
+ }
527
+ buildValue(operator, value) {
528
+ switch (operator) {
529
+ case '=':
530
+ return {
531
+ operator: '≤≥',
532
+ value: { from: moment(value).startOf('day'), to: moment(value).endOf('day') },
533
+ };
534
+ case '>':
535
+ return { operator, value: moment(value).endOf('day') };
536
+ case '≥':
537
+ return { operator, value: moment(value).startOf('day') };
538
+ case '<':
539
+ return { operator, value: moment(value).startOf('day') };
540
+ case '≤':
541
+ return { operator, value: moment(value).endOf('day') };
542
+ case '<>':
543
+ return { operator, value: { from: moment(value.from).endOf('day'), to: moment(value.to).startOf('day') } };
544
+ case '≤≥':
545
+ return { operator, value: { from: moment(value.from).startOf('day'), to: moment(value.to).endOf('day') } };
546
+ }
547
+ }
548
+ hasRangeValue(value) {
549
+ return !this.isEmptyValue(value?.from) || !this.isEmptyValue(value?.to);
550
+ }
551
+ isEmptyValue(value) {
552
+ return value === null || value === undefined || value === '';
553
+ }
554
+ isRangeOperator(operator) {
555
+ return operator === '<>' || operator === '≤≥';
556
+ }
557
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDateFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
558
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderDateFilterComponent, isStandalone: true, selector: "lib-header-date-filter", inputs: { column: "column" }, providers: [
559
+ {
560
+ provide: NG_VALUE_ACCESSOR,
561
+ multi: true,
562
+ useExisting: forwardRef(() => HeaderDateFilterComponent),
563
+ },
564
+ provideMomentDateAdapter(),
565
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n @if (['<>', '\u2264\u2265'].includes(operatorControl.value!)) {\n <mat-form-field\n class=\"ngx-datatable-date-filter\"\n appearance=\"fill\"\n [class.has-value]=\"\n (rangeGroup.value.from !== null && rangeGroup.value.from !== undefined) ||\n (rangeGroup.value.to !== null && rangeGroup.value.to !== undefined)\n \">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <mat-date-range-input [formGroup]=\"rangeGroup\" [rangePicker]=\"rangePicker\">\n <input matStartDate formControlName=\"from\" [placeholder]=\"column.placeholder!\" (blur)=\"onTouched()\" />\n <input matEndDate formControlName=\"to\" [placeholder]=\"column.placeholder!\" (blur)=\"onTouched()\" />\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"rangePicker\"></mat-datepicker-toggle>\n <mat-date-range-picker #rangePicker></mat-date-range-picker>\n\n <button\n *ngIf=\"\n (rangeGroup.value.from !== null && rangeGroup.value.from !== undefined) ||\n (rangeGroup.value.to !== null && rangeGroup.value.to !== undefined)\n \"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"clearRange()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n } @else {\n <mat-form-field\n class=\"ngx-datatable-date-filter\"\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input\n matInput\n [matDatepicker]=\"datePicker\"\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n (blur)=\"onTouched()\" />\n <mat-datepicker-toggle matIconSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\n <mat-datepicker #datePicker></mat-datepicker>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n }\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}mat-form-field ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i4$2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i4$2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i4$2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i4$2.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i4$2.MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i4$2.MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: i4$2.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: OperatorSelectComponent, selector: "lib-operator-select", inputs: ["disableRange"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
566
+ }
567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDateFilterComponent, decorators: [{
568
+ type: Component,
569
+ args: [{ selector: 'lib-header-date-filter', imports: [
570
+ CommonModule,
571
+ FormsModule,
572
+ MatButtonModule,
573
+ MatDatepickerModule,
574
+ MatFormFieldModule,
575
+ MatIconModule,
576
+ MatInputModule,
577
+ ReactiveFormsModule,
578
+ OperatorSelectComponent,
579
+ SafeHtmlPipe,
580
+ ], providers: [
581
+ {
582
+ provide: NG_VALUE_ACCESSOR,
583
+ multi: true,
584
+ useExisting: forwardRef(() => HeaderDateFilterComponent),
585
+ },
586
+ provideMomentDateAdapter(),
587
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- @format -->\n\n@if (selectControl) {\n @if (['<>', '\u2264\u2265'].includes(operatorControl.value!)) {\n <mat-form-field\n class=\"ngx-datatable-date-filter\"\n appearance=\"fill\"\n [class.has-value]=\"\n (rangeGroup.value.from !== null && rangeGroup.value.from !== undefined) ||\n (rangeGroup.value.to !== null && rangeGroup.value.to !== undefined)\n \">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <mat-date-range-input [formGroup]=\"rangeGroup\" [rangePicker]=\"rangePicker\">\n <input matStartDate formControlName=\"from\" [placeholder]=\"column.placeholder!\" (blur)=\"onTouched()\" />\n <input matEndDate formControlName=\"to\" [placeholder]=\"column.placeholder!\" (blur)=\"onTouched()\" />\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"rangePicker\"></mat-datepicker-toggle>\n <mat-date-range-picker #rangePicker></mat-date-range-picker>\n\n <button\n *ngIf=\"\n (rangeGroup.value.from !== null && rangeGroup.value.from !== undefined) ||\n (rangeGroup.value.to !== null && rangeGroup.value.to !== undefined)\n \"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"clearRange()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n } @else {\n <mat-form-field\n class=\"ngx-datatable-date-filter\"\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input\n matInput\n [matDatepicker]=\"datePicker\"\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n (blur)=\"onTouched()\" />\n <mat-datepicker-toggle matIconSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\n <mat-datepicker #datePicker></mat-datepicker>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n }\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}mat-form-field ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"] }]
588
+ }], propDecorators: { column: [{
589
+ type: Input
590
+ }] } });
591
+
592
+ /** @format */
593
+ const TIME_UNITS = ['second', 'minute', 'hour', 'day', 'month', 'year'];
594
+ const MOMENT_RELATIVE_TIME_KEY = ['ss', 'mm', 'hh', 'dd', 'MM', 'yy'];
595
+ class TimeUnitSelectComponent {
596
+ static toMilliseconds(value, unit) {
597
+ return moment.duration(value, unit).as('milliseconds');
598
+ }
599
+ static convert(value, from, to) {
600
+ if (to === undefined)
601
+ (to = from), (from = 'millisecond');
602
+ return moment.duration(value, from).as(to);
603
+ }
604
+ set setLocale(locale) {
605
+ this.locale = locale || moment.locale();
606
+ this.loadUnitNames();
607
+ }
608
+ locale = moment.locale();
609
+ units = TIME_UNITS;
610
+ unitNames = {};
611
+ isOpen = false;
612
+ control;
613
+ onChange = () => { };
614
+ onTouched = () => { };
615
+ injector = inject(Injector);
616
+ changeDetectorRef = inject(ChangeDetectorRef);
617
+ writeValue = () => { };
618
+ registerOnChange(onChange) {
619
+ this.onChange = onChange;
620
+ }
621
+ registerOnTouched(onTouched) {
622
+ this.onTouched = onTouched;
623
+ }
624
+ ngOnInit() {
625
+ this.loadUnitNames();
626
+ }
627
+ async ngAfterViewInit() {
628
+ const ngControl = this.injector.get(NgControl, null);
629
+ if (!ngControl)
630
+ throw new Error(`${this.constructor.name} missing control`);
631
+ this.control = ngControl.control;
632
+ this.changeDetectorRef.detectChanges();
633
+ }
634
+ loadUnitNames() {
635
+ this.unitNames = this.units.reduce((pv, cv, i) => ((pv[cv] = moment
636
+ .localeData(this.locale)
637
+ .relativeTime('', true, MOMENT_RELATIVE_TIME_KEY[i], false)
638
+ .trim()),
639
+ pv), {});
640
+ }
641
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: TimeUnitSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
642
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: TimeUnitSelectComponent, isStandalone: true, selector: "lib-time-unit-select", inputs: { setLocale: ["locale", "setLocale"] }, providers: [
643
+ {
644
+ provide: NG_VALUE_ACCESSOR,
645
+ multi: true,
646
+ useExisting: forwardRef(() => TimeUnitSelectComponent),
647
+ },
648
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-flat-button\n color=\"primary\"\n class=\"ngx-mat-datatable-time-unit-button\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"$event.stopPropagation(); isOpen = !isOpen\">\n <span>\n {{ unitNames[control.value] }}\n </span>\n </button>\n\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen\">\n <div class=\"ngx-mat-datatable-time-unit-column\" @fade>\n @for (unit of units; track unit) {\n @if (unit !== control.value) {\n <button\n mat-flat-button\n color=\"primary\"\n class=\"ngx-mat-datatable-time-unit-button\"\n (click)=\"control.setValue(unit); isOpen = !isOpen\">\n <span>\n {{ unitNames[unit] }}\n </span>\n </button>\n }\n }\n </div>\n </ng-template>\n}\n", styles: [".ngx-mat-datatable-time-unit-button{font-size:12px;height:26px;padding:6px}.ngx-mat-datatable-time-unit-button ::ng-deep .mat-mdc-button-touch-target{height:36px;width:36px}.ngx-mat-datatable-time-unit-column{display:flex;box-sizing:border-box;flex-direction:column}.ngx-mat-datatable-time-unit-column .ngx-mat-datatable-time-unit-button{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }], animations: [
649
+ trigger('fade', [
650
+ transition(':enter', [
651
+ style({ opacity: 0 }), // initial
652
+ animate('0.2s', style({ opacity: 1 })), // final
653
+ ]),
654
+ transition(':leave', [
655
+ style({ opacity: 1 }), // initial
656
+ animate('0.2s', style({ opacity: 0 })), // final
657
+ ]),
658
+ ]),
659
+ ] });
660
+ }
661
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: TimeUnitSelectComponent, decorators: [{
662
+ type: Component,
663
+ args: [{ selector: 'lib-time-unit-select', imports: [CommonModule, OverlayModule, MatIconModule, MatButtonModule], animations: [
664
+ trigger('fade', [
665
+ transition(':enter', [
666
+ style({ opacity: 0 }), // initial
667
+ animate('0.2s', style({ opacity: 1 })), // final
668
+ ]),
669
+ transition(':leave', [
670
+ style({ opacity: 1 }), // initial
671
+ animate('0.2s', style({ opacity: 0 })), // final
672
+ ]),
673
+ ]),
674
+ ], providers: [
675
+ {
676
+ provide: NG_VALUE_ACCESSOR,
677
+ multi: true,
678
+ useExisting: forwardRef(() => TimeUnitSelectComponent),
679
+ },
680
+ ], template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-flat-button\n color=\"primary\"\n class=\"ngx-mat-datatable-time-unit-button\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n (click)=\"$event.stopPropagation(); isOpen = !isOpen\">\n <span>\n {{ unitNames[control.value] }}\n </span>\n </button>\n\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen\">\n <div class=\"ngx-mat-datatable-time-unit-column\" @fade>\n @for (unit of units; track unit) {\n @if (unit !== control.value) {\n <button\n mat-flat-button\n color=\"primary\"\n class=\"ngx-mat-datatable-time-unit-button\"\n (click)=\"control.setValue(unit); isOpen = !isOpen\">\n <span>\n {{ unitNames[unit] }}\n </span>\n </button>\n }\n }\n </div>\n </ng-template>\n}\n", styles: [".ngx-mat-datatable-time-unit-button{font-size:12px;height:26px;padding:6px}.ngx-mat-datatable-time-unit-button ::ng-deep .mat-mdc-button-touch-target{height:36px;width:36px}.ngx-mat-datatable-time-unit-column{display:flex;box-sizing:border-box;flex-direction:column}.ngx-mat-datatable-time-unit-column .ngx-mat-datatable-time-unit-button{margin-top:8px}\n"] }]
681
+ }], propDecorators: { setLocale: [{
682
+ type: Input,
683
+ args: ['locale']
684
+ }] } });
685
+
686
+ /** @format */
687
+ class HeaderDurationFilterComponent {
688
+ column;
689
+ control;
690
+ selectControl = new FormControl(undefined);
691
+ rangeGroup = new FormGroup({
692
+ start: new FormControl(undefined, Validators.required),
693
+ end: new FormControl(undefined, Validators.required),
694
+ });
695
+ operatorControl = new FormControl('=');
696
+ timeUnitControl = new FormControl('second');
697
+ onChange = () => { };
698
+ onTouched = () => { };
699
+ injector = inject(Injector);
700
+ changeDetectorRef = inject(ChangeDetectorRef);
701
+ subsink = new Subscription();
702
+ writeValue(value) {
703
+ if (value?.unitOfTime)
704
+ this.timeUnitControl.setValue(value.unitOfTime, { emitEvent: false });
705
+ if (value?.operator)
706
+ this.operatorControl.setValue(value.operator, { emitEvent: false });
707
+ if (value?.value !== null && value?.value !== undefined) {
708
+ let selectValue = TimeUnitSelectComponent.convert(value.value, this.timeUnitControl.value);
709
+ if (this.selectControl.value !== selectValue)
710
+ this.selectControl.setValue(selectValue, { emitEvent: false });
711
+ }
712
+ else
713
+ this.selectControl.setValue(null, { emitEvent: false });
714
+ this.changeDetectorRef.markForCheck();
715
+ }
716
+ setDisabledState(isDisabled) {
717
+ const controls = [this.selectControl, this.operatorControl, this.timeUnitControl];
718
+ controls.forEach(control => {
719
+ if (isDisabled)
720
+ control.disable({ emitEvent: false });
721
+ else
722
+ control.enable({ emitEvent: false });
723
+ });
724
+ }
725
+ registerOnChange(onChange) {
726
+ this.onChange = onChange;
727
+ }
728
+ registerOnTouched(onTouched) {
729
+ this.onTouched = onTouched;
730
+ }
731
+ ngOnInit() { }
732
+ async ngAfterViewInit() {
733
+ const ngControl = this.injector.get(NgControl, null);
734
+ if (!ngControl)
735
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
736
+ this.control = ngControl.control;
737
+ this.subsink.add(this.selectControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
738
+ if (this.control.invalid)
739
+ return;
740
+ else if (this.isEmptyValue(value))
741
+ this.onChange(undefined);
742
+ else {
743
+ const unitOfTimeValue = value;
744
+ this.onChange({
745
+ unitOfTimeValue,
746
+ value: TimeUnitSelectComponent.toMilliseconds(unitOfTimeValue, this.timeUnitControl.value),
747
+ regex: false,
748
+ operator: this.operatorControl.value,
749
+ unitOfTime: this.timeUnitControl.value,
750
+ });
751
+ }
752
+ }));
753
+ this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
754
+ if (this.isEmptyValue(this.selectControl.value))
755
+ return;
756
+ const unitOfTimeValue = this.selectControl.value;
757
+ this.onChange({
758
+ unitOfTimeValue,
759
+ value: TimeUnitSelectComponent.toMilliseconds(unitOfTimeValue, this.timeUnitControl.value),
760
+ regex: false,
761
+ operator: value,
762
+ unitOfTime: this.timeUnitControl.value,
763
+ });
764
+ }));
765
+ this.subsink.add(this.timeUnitControl.valueChanges.subscribe((value) => {
766
+ if (this.isEmptyValue(this.selectControl.value) || !this.control.value?.unitOfTime)
767
+ return;
768
+ const unitOfTimeValue = TimeUnitSelectComponent.convert(this.selectControl.value, this.control.value.unitOfTime, value);
769
+ this.selectControl.setValue(unitOfTimeValue, { emitEvent: false });
770
+ this.onChange({
771
+ unitOfTimeValue,
772
+ value: TimeUnitSelectComponent.toMilliseconds(unitOfTimeValue, value),
773
+ regex: false,
774
+ operator: this.operatorControl.value,
775
+ unitOfTime: value,
776
+ });
777
+ }));
778
+ this.changeDetectorRef.detectChanges();
779
+ }
780
+ ngOnDestroy() {
781
+ this.subsink.unsubscribe();
782
+ }
783
+ isEmptyValue(value) {
784
+ return value === null || value === undefined || value === '';
785
+ }
786
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDurationFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
787
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderDurationFilterComponent, isStandalone: true, selector: "lib-header-duration-filter", inputs: { column: "column" }, providers: [
788
+ {
789
+ provide: NG_VALUE_ACCESSOR,
790
+ multi: true,
791
+ useExisting: forwardRef(() => HeaderDurationFilterComponent),
792
+ },
793
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n class=\"ngx-datatable-duration-filter\"\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select disableRange matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput type=\"number\" [formControl]=\"selectControl\" [placeholder]=\"column.placeholder!\" (blur)=\"onTouched()\" />\n\n <lib-time-unit-select [locale]=\"column.locale\" matSuffix [formControl]=\"timeUnitControl\"></lib-time-unit-select>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}mat-form-field ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: OperatorSelectComponent, selector: "lib-operator-select", inputs: ["disableRange"] }, { kind: "component", type: TimeUnitSelectComponent, selector: "lib-time-unit-select", inputs: ["locale"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
794
+ }
795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDurationFilterComponent, decorators: [{
796
+ type: Component,
797
+ args: [{ selector: 'lib-header-duration-filter', imports: [
798
+ CommonModule,
799
+ FormsModule,
800
+ MatButtonModule,
801
+ MatFormFieldModule,
802
+ MatIconModule,
803
+ MatInputModule,
804
+ ReactiveFormsModule,
805
+ OperatorSelectComponent,
806
+ TimeUnitSelectComponent,
807
+ SafeHtmlPipe,
808
+ ], providers: [
809
+ {
810
+ provide: NG_VALUE_ACCESSOR,
811
+ multi: true,
812
+ useExisting: forwardRef(() => HeaderDurationFilterComponent),
813
+ },
814
+ ], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n class=\"ngx-datatable-duration-filter\"\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select disableRange matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput type=\"number\" [formControl]=\"selectControl\" [placeholder]=\"column.placeholder!\" (blur)=\"onTouched()\" />\n\n <lib-time-unit-select [locale]=\"column.locale\" matSuffix [formControl]=\"timeUnitControl\"></lib-time-unit-select>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}mat-form-field ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"] }]
815
+ }], propDecorators: { column: [{
816
+ type: Input
817
+ }] } });
818
+
819
+ /** @format */
820
+ class HeaderNumberFilterComponent {
821
+ column;
822
+ control;
823
+ selectControl = new FormControl();
824
+ operatorControl = new FormControl('=');
825
+ onChange = () => { };
826
+ onTouched = () => { };
827
+ injector = inject(Injector);
828
+ changeDetectorRef = inject(ChangeDetectorRef);
829
+ subsink = new Subscription();
830
+ writeValue(value) {
831
+ if (value?.operator && value.operator !== this.operatorControl.value) {
832
+ this.operatorControl.setValue(value.operator, { emitEvent: false });
833
+ }
834
+ if (value?.value !== this.selectControl.value)
835
+ this.selectControl.setValue(value?.value, { emitEvent: false });
836
+ this.changeDetectorRef.markForCheck();
837
+ }
838
+ setDisabledState(isDisabled) {
839
+ if (isDisabled) {
840
+ this.selectControl.disable({ emitEvent: false });
841
+ this.operatorControl.disable({ emitEvent: false });
842
+ }
843
+ else {
844
+ this.selectControl.enable({ emitEvent: false });
845
+ this.operatorControl.enable({ emitEvent: false });
846
+ }
847
+ }
848
+ registerOnChange(onChange) {
849
+ this.onChange = onChange;
850
+ }
851
+ registerOnTouched(onTouched) {
852
+ this.onTouched = onTouched;
853
+ }
854
+ async ngAfterViewInit() {
855
+ const ngControl = this.injector.get(NgControl, null);
856
+ if (!ngControl)
857
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
858
+ this.control = ngControl.control;
859
+ this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
860
+ if (this.control.invalid)
861
+ return;
862
+ else if (this.isEmptyValue(value))
863
+ this.onChange(undefined);
864
+ else
865
+ this.onChange({ value, regex: false, operator: this.operatorControl.value });
866
+ }));
867
+ this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
868
+ if (this.isEmptyValue(this.selectControl.value))
869
+ return;
870
+ this.onChange({ value: this.selectControl.value, regex: false, operator: value });
871
+ }));
872
+ this.changeDetectorRef.detectChanges();
873
+ }
874
+ ngOnDestroy() {
875
+ this.subsink.unsubscribe();
876
+ }
877
+ isEmptyValue(value) {
878
+ return value === null || value === undefined || value === '';
879
+ }
880
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderNumberFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
881
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderNumberFilterComponent, isStandalone: true, selector: "lib-header-number-filter", inputs: { column: "column" }, providers: [
882
+ {
883
+ provide: NG_VALUE_ACCESSOR,
884
+ multi: true,
885
+ useExisting: forwardRef(() => HeaderNumberFilterComponent),
886
+ },
887
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n class=\"ngx-datatable-number-filter\"\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select disableRange matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput [formControl]=\"selectControl\" type=\"number\" (blur)=\"onTouched()\" />\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: OperatorSelectComponent, selector: "lib-operator-select", inputs: ["disableRange"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
888
+ }
889
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderNumberFilterComponent, decorators: [{
890
+ type: Component,
891
+ args: [{ selector: 'lib-header-number-filter', imports: [
892
+ CommonModule,
893
+ FormsModule,
894
+ MatButtonModule,
895
+ MatFormFieldModule,
896
+ MatIconModule,
897
+ MatInputModule,
898
+ MatMenuModule,
899
+ ReactiveFormsModule,
900
+ OperatorSelectComponent,
901
+ SafeHtmlPipe,
902
+ ], providers: [
903
+ {
904
+ provide: NG_VALUE_ACCESSOR,
905
+ multi: true,
906
+ useExisting: forwardRef(() => HeaderNumberFilterComponent),
907
+ },
908
+ ], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n class=\"ngx-datatable-number-filter\"\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n\n <lib-operator-select disableRange matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput [formControl]=\"selectControl\" type=\"number\" (blur)=\"onTouched()\" />\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}\n"] }]
909
+ }], propDecorators: { column: [{
910
+ type: Input
911
+ }] } });
912
+
913
+ /** @format */
914
+ class IsArrayPipe {
915
+ transform(obj) {
916
+ return Array.isArray(obj);
917
+ }
918
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: IsArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
919
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: IsArrayPipe, isStandalone: true, name: "isArray" });
920
+ }
921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: IsArrayPipe, decorators: [{
922
+ type: Pipe,
923
+ args: [{ name: 'isArray' }]
924
+ }] });
925
+
926
+ /** @format */
927
+ class SelectOptionPipe {
928
+ transform(value, options) {
929
+ if (!options)
930
+ return null;
931
+ return options.find((option) => option.value === value) || null;
932
+ }
933
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
934
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, isStandalone: true, name: "selectOption" });
935
+ }
936
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, decorators: [{
937
+ type: Pipe,
938
+ args: [{ name: 'selectOption' }]
939
+ }] });
940
+
941
+ /** @format */
942
+ class HeaderSelectFilterComponent {
943
+ column;
944
+ options = [];
945
+ groups = [];
946
+ control;
947
+ selectControl = new FormControl();
948
+ onChange = () => { };
949
+ onTouched = () => { };
950
+ injector = inject(Injector);
951
+ changeDetectorRef = inject(ChangeDetectorRef);
952
+ subsink = new Subscription();
953
+ writeValue(controlValue) {
954
+ if (controlValue?.value !== this.selectControl.value) {
955
+ const value = controlValue?.value;
956
+ if (!this.isEmptyValue(value) && !Array.isArray(value) && this.column.multiple) {
957
+ this.selectControl.setValue([value], { emitEvent: false });
958
+ }
959
+ else
960
+ this.selectControl.setValue(value, { emitEvent: false });
961
+ }
962
+ this.changeDetectorRef.markForCheck();
963
+ }
964
+ setDisabledState(isDisabled) {
965
+ if (isDisabled)
966
+ this.selectControl.disable({ emitEvent: false });
967
+ else
968
+ this.selectControl.enable({ emitEvent: false });
969
+ }
970
+ registerOnChange(onChange) {
971
+ this.onChange = onChange;
972
+ }
973
+ registerOnTouched(onTouched) {
974
+ this.onTouched = onTouched;
975
+ }
976
+ async ngAfterViewInit() {
977
+ const ngControl = this.injector.get(NgControl, null);
978
+ if (!ngControl)
979
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
980
+ this.control = ngControl.control;
981
+ this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
982
+ if (this.isEmptyValue(value))
983
+ this.onChange(undefined);
984
+ else
985
+ this.onChange({ value, operator: this.column.multiple ? '$in' : undefined, regex: false });
986
+ }));
987
+ if (Array.isArray(this.column.options))
988
+ this.buildOptions(this.column.options);
989
+ else
990
+ this.subsink.add(this.column.options.subscribe(data => {
991
+ this.options = [];
992
+ this.groups = [];
993
+ this.buildOptions(data);
994
+ }));
995
+ this.changeDetectorRef.detectChanges();
996
+ }
997
+ ngOnDestroy() {
998
+ this.subsink.unsubscribe();
999
+ }
1000
+ buildOptions(data) {
1001
+ data.forEach(d => {
1002
+ this.options.push(d);
1003
+ const name = d.group ?? '';
1004
+ const group = this.groups.find(g => g.name === name);
1005
+ if (!group)
1006
+ this.groups.push({ name, options: [d] });
1007
+ else
1008
+ group.options.push(d);
1009
+ });
1010
+ }
1011
+ isEmptyValue(value) {
1012
+ return value === null || value === undefined || value === '' || (Array.isArray(value) && !value.length);
1013
+ }
1014
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderSelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1015
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderSelectFilterComponent, isStandalone: true, selector: "lib-header-select-filter", inputs: { column: "column" }, providers: [
1016
+ {
1017
+ provide: NG_VALUE_ACCESSOR,
1018
+ multi: true,
1019
+ useExisting: forwardRef(() => HeaderSelectFilterComponent),
1020
+ },
1021
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <mat-select\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n [multiple]=\"column.multiple\"\n (closed)=\"onTouched()\">\n <mat-select-trigger>\n @if (column.multiple && selectControl.value | isArray) {\n <div class=\"options\">\n @for (v of selectControl.value; track v) {\n @let option = v | selectOption: options;\n @if (option) {\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n } @else {\n <mat-label [innerHTML]=\"v | safeHtml\"></mat-label>\n }\n }\n </div>\n } @else {\n @let option = selectControl.value | selectOption: options;\n @if (option) {\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n } @else {\n <mat-label [innerHTML]=\"selectControl.value | safeHtml\"></mat-label>\n }\n }\n </mat-select-trigger>\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n </mat-option>\n }\n }\n </mat-select>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n\n<ng-template #selectOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon\n [svgIcon]=\"option.icon\"\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.options{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;flex-wrap:wrap}.options .option:not(:last-child){margin-right:8px}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6$1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i6$1.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i5.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: SelectOptionPipe, name: "selectOption" }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }, { kind: "pipe", type: IsArrayPipe, name: "isArray" }] });
1022
+ }
1023
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderSelectFilterComponent, decorators: [{
1024
+ type: Component,
1025
+ args: [{ selector: 'lib-header-select-filter', imports: [
1026
+ CommonModule,
1027
+ FormsModule,
1028
+ MatButtonModule,
1029
+ MatFormFieldModule,
1030
+ MatIconModule,
1031
+ MatSelectModule,
1032
+ ReactiveFormsModule,
1033
+ SelectOptionPipe,
1034
+ SafeHtmlPipe,
1035
+ IsArrayPipe,
1036
+ ], providers: [
1037
+ {
1038
+ provide: NG_VALUE_ACCESSOR,
1039
+ multi: true,
1040
+ useExisting: forwardRef(() => HeaderSelectFilterComponent),
1041
+ },
1042
+ ], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <mat-select\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n [multiple]=\"column.multiple\"\n (closed)=\"onTouched()\">\n <mat-select-trigger>\n @if (column.multiple && selectControl.value | isArray) {\n <div class=\"options\">\n @for (v of selectControl.value; track v) {\n @let option = v | selectOption: options;\n @if (option) {\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n } @else {\n <mat-label [innerHTML]=\"v | safeHtml\"></mat-label>\n }\n }\n </div>\n } @else {\n @let option = selectControl.value | selectOption: options;\n @if (option) {\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n } @else {\n <mat-label [innerHTML]=\"selectControl.value | safeHtml\"></mat-label>\n }\n }\n </mat-select-trigger>\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"selectOption; context: { option }\"></ng-container>\n </mat-option>\n }\n }\n </mat-select>\n\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n\n<ng-template #selectOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon\n [svgIcon]=\"option.icon\"\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.options{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;flex-wrap:wrap}.options .option:not(:last-child){margin-right:8px}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"] }]
1043
+ }], propDecorators: { column: [{
1044
+ type: Input
1045
+ }] } });
1046
+
1047
+ /** @format */
1048
+ class HeaderTextFilterComponent {
1049
+ column;
1050
+ control;
1051
+ selectControl = new FormControl();
1052
+ onChange = () => { };
1053
+ onTouched = () => { };
1054
+ injector = inject(Injector);
1055
+ changeDetectorRef = inject(ChangeDetectorRef);
1056
+ subsink = new Subscription();
1057
+ writeValue(value) {
1058
+ const nextValue = value?.value ?? '';
1059
+ if (nextValue !== this.selectControl.value)
1060
+ this.selectControl.setValue(nextValue, { emitEvent: false });
1061
+ this.changeDetectorRef.markForCheck();
1062
+ }
1063
+ setDisabledState(isDisabled) {
1064
+ if (isDisabled)
1065
+ this.selectControl.disable({ emitEvent: false });
1066
+ else
1067
+ this.selectControl.enable({ emitEvent: false });
1068
+ }
1069
+ registerOnChange(onChange) {
1070
+ this.onChange = onChange;
1071
+ }
1072
+ registerOnTouched(onTouched) {
1073
+ this.onTouched = onTouched;
1074
+ }
1075
+ async ngAfterViewInit() {
1076
+ const ngControl = this.injector.get(NgControl, null);
1077
+ if (!ngControl)
1078
+ throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
1079
+ this.control = ngControl.control;
1080
+ this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
1081
+ if (this.isEmptyValue(value))
1082
+ this.onChange(undefined);
1083
+ else {
1084
+ if (this.column.regex)
1085
+ this.onChange({ value, regex: true });
1086
+ else
1087
+ this.onChange({ value: this.escapeRegExp(value), regex: true });
1088
+ }
1089
+ }));
1090
+ this.changeDetectorRef.detectChanges();
1091
+ }
1092
+ ngOnDestroy() {
1093
+ this.subsink.unsubscribe();
1094
+ }
1095
+ escapeRegExp(value) {
1096
+ if (!value)
1097
+ return '';
1098
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1099
+ }
1100
+ isEmptyValue(value) {
1101
+ return value === null || value === undefined || value === '';
1102
+ }
1103
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderTextFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1104
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: HeaderTextFilterComponent, isStandalone: true, selector: "lib-header-text-filter", inputs: { column: "column" }, providers: [
1105
+ {
1106
+ provide: NG_VALUE_ACCESSOR,
1107
+ multi: true,
1108
+ useExisting: forwardRef(() => HeaderTextFilterComponent),
1109
+ },
1110
+ ], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <input matInput [formControl]=\"selectControl\" (blur)=\"onTouched()\" />\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
1111
+ }
1112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderTextFilterComponent, decorators: [{
1113
+ type: Component,
1114
+ args: [{ selector: 'lib-header-text-filter', imports: [
1115
+ CommonModule,
1116
+ FormsModule,
1117
+ MatButtonModule,
1118
+ MatFormFieldModule,
1119
+ MatIconModule,
1120
+ MatInputModule,
1121
+ ReactiveFormsModule,
1122
+ SafeHtmlPipe,
1123
+ ], providers: [
1124
+ {
1125
+ provide: NG_VALUE_ACCESSOR,
1126
+ multi: true,
1127
+ useExisting: forwardRef(() => HeaderTextFilterComponent),
1128
+ },
1129
+ ], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n appearance=\"fill\"\n [class.has-value]=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\">\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <input matInput [formControl]=\"selectControl\" (blur)=\"onTouched()\" />\n <button\n *ngIf=\"selectControl.value !== null && selectControl.value !== undefined && selectControl.value !== ''\"\n mat-icon-button\n matSuffix\n size=\"small\"\n (click)=\"selectControl.setValue(undefined)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n}\n", styles: [":host{display:flex;flex:1 1 100%}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mdc-filled-text-field-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mdc-filled-text-field-container-shape: 0;--mdc-filled-text-field-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}\n"] }]
1130
+ }], propDecorators: { column: [{
1131
+ type: Input
1132
+ }] } });
1133
+
1134
+ /** @format */
1135
+ const DEFAULT_LABELS = {
1136
+ noDateLabel: 'No data',
1137
+ itemsPerPageLabel: `Items per page:`,
1138
+ nextPageLabel: `Next page`,
1139
+ lastPageLabel: `Last page`,
1140
+ previousPageLabel: `Previous page`,
1141
+ firstPageLabel: `First page`,
1142
+ onLabel: `on`,
1143
+ incrementalLoadingLabel: 'Loading...',
1144
+ incrementalLoadMoreLabel: 'Load more',
1145
+ };
1146
+ const LABELS = {
1147
+ fr: {
1148
+ noDateLabel: 'Aucune donnée',
1149
+ itemsPerPageLabel: `Éléments par page :`,
1150
+ nextPageLabel: `Page suivante`,
1151
+ lastPageLabel: `Dernière page`,
1152
+ previousPageLabel: `Page précédente`,
1153
+ firstPageLabel: `Première page`,
1154
+ onLabel: `sur`,
1155
+ incrementalLoadingLabel: 'Chargement...',
1156
+ incrementalLoadMoreLabel: 'Charger plus',
1157
+ },
1158
+ };
1159
+ const DEFAULT_NUMBER_OPTIONS = {
1160
+ separator: ',',
1161
+ decimal: '.',
1162
+ duration: 0.3,
1163
+ useEasing: false,
1164
+ };
1165
+ const NUMBER_OPTIONS = {
1166
+ fr: {
1167
+ separator: ' ',
1168
+ decimal: ',',
1169
+ },
1170
+ };
1171
+ class NgxMatDatatableIntl {
1172
+ locale = inject(LOCALE_ID);
1173
+ noDateLabel;
1174
+ itemsPerPageLabel;
1175
+ nextPageLabel;
1176
+ lastPageLabel;
1177
+ previousPageLabel;
1178
+ firstPageLabel;
1179
+ onLabel;
1180
+ incrementalLoadingLabel;
1181
+ incrementalLoadMoreLabel;
1182
+ numberOptions;
1183
+ getRangeLabel = (page, pageSize, length) => {
1184
+ if (length === 0 || pageSize === 0)
1185
+ return `0 ${this.onLabel} ${length}`;
1186
+ length = Math.max(length, 0);
1187
+ const startIndex = page * pageSize;
1188
+ const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;
1189
+ return `${startIndex + 1} - ${endIndex} ${this.onLabel} ${length}`;
1190
+ };
1191
+ constructor() {
1192
+ this.setLabels(LABELS[this.locale] ?? DEFAULT_LABELS);
1193
+ this.numberOptions = NUMBER_OPTIONS[this.locale] ?? DEFAULT_NUMBER_OPTIONS;
1194
+ }
1195
+ setLabels(labels) {
1196
+ this.noDateLabel = labels.noDateLabel;
1197
+ this.itemsPerPageLabel = labels.itemsPerPageLabel;
1198
+ this.nextPageLabel = labels.nextPageLabel;
1199
+ this.lastPageLabel = labels.lastPageLabel;
1200
+ this.previousPageLabel = labels.previousPageLabel;
1201
+ this.firstPageLabel = labels.firstPageLabel;
1202
+ this.onLabel = labels.onLabel;
1203
+ this.incrementalLoadingLabel = labels.incrementalLoadingLabel;
1204
+ this.incrementalLoadMoreLabel = labels.incrementalLoadMoreLabel;
1205
+ }
1206
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1207
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableIntl });
1208
+ }
1209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableIntl, decorators: [{
1210
+ type: Injectable
1211
+ }], ctorParameters: () => [] });
1212
+
1213
+ /** @format */
1214
+ class MergePipe {
1215
+ transform(obj, src) {
1216
+ return src ? { ...obj, ...src } : { ...obj };
1217
+ }
1218
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MergePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1219
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: MergePipe, isStandalone: true, name: "merge" });
1220
+ }
1221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MergePipe, decorators: [{
1222
+ type: Pipe,
1223
+ args: [{ name: 'merge' }]
1224
+ }] });
1225
+
1226
+ /** @format */
1227
+ class ProgressSpinnerComponent {
1228
+ datatableIntl = inject(NgxMatDatatableIntl);
1229
+ diameter = 100;
1230
+ set setValue(value) {
1231
+ if (typeof value === 'string')
1232
+ this._value = parseFloat(value);
1233
+ else
1234
+ this._value = value;
1235
+ if (this.animateInView)
1236
+ this.load(this.isInView);
1237
+ }
1238
+ _value = 0;
1239
+ value = 0;
1240
+ color;
1241
+ set setDisplayValue(displayValue) {
1242
+ this.displayValue = displayValue !== false;
1243
+ }
1244
+ displayValue = true;
1245
+ get getColor() {
1246
+ return this.color;
1247
+ }
1248
+ fontSize = `${this.diameter / 5}px`;
1249
+ set setAnimateInView(animateInView) {
1250
+ this.animateInView = animateInView !== false;
1251
+ }
1252
+ animateInView = true;
1253
+ set setDelay(delay) {
1254
+ if (typeof delay === 'string')
1255
+ this.delay = parseInt(delay);
1256
+ else
1257
+ this.delay = delay;
1258
+ }
1259
+ delay;
1260
+ isInView = false;
1261
+ load(intersect) {
1262
+ this.isInView = intersect;
1263
+ if (this.isInView) {
1264
+ if (this.delay)
1265
+ setTimeout(() => (this.value = this._value), this.delay);
1266
+ else
1267
+ this.value = this._value;
1268
+ }
1269
+ }
1270
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ProgressSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1271
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: ProgressSpinnerComponent, isStandalone: true, selector: "lib-progress-spinner", inputs: { diameter: "diameter", setValue: ["value", "setValue"], color: "color", setDisplayValue: ["displayValue", "setDisplayValue"], fontSize: "fontSize", setAnimateInView: ["animateInView", "setAnimateInView"], setDelay: ["delay", "setDelay"] }, host: { properties: { "style.--progress-spinner-color": "this.getColor" } }, ngImport: i0, template: "<!-- @format -->\n\n<div id=\"container\" [style.font-size]=\"fontSize\" [style.width.px]=\"diameter\" [style.height.px]=\"diameter\">\n <mat-progress-spinner id=\"background\" [diameter]=\"diameter\" mode=\"determinate\" [value]=\"100\"> </mat-progress-spinner>\n <mat-progress-spinner\n id=\"foreground\"\n [diameter]=\"diameter\"\n mode=\"determinate\"\n [value]=\"value\"\n intersectionObserver\n (intersection)=\"load($event.intersect)\">\n </mat-progress-spinner>\n <div id=\"inner-block\">\n <mat-label\n [countUp]=\"value\"\n [options]=\"datatableIntl.numberOptions | merge: { suffix: '%', duration: 0.6 }\"\n [reanimateOnClick]=\"false\"></mat-label>\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["#container{position:relative}#container #foreground{--mdc-circular-progress-active-indicator-color: var(--progress-spinner-color, varvar(--mat-sys-primary))}#container #foreground ::ng-deep .mdc-circular-progress__determinate-circle{stroke-width:var(--progress-spinner-stroke-width, 5%)!important}#container #background{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);--mdc-circular-progress-active-indicator-color: var(--progress-spinner-color, var(--mat-sys-primary))}#container #background ::ng-deep .mdc-circular-progress__determinate-circle{stroke-width:var(--progress-spinner-stroke-width, calc(5% + 2px) )!important;stroke-opacity:var(--progress-spinner-background-opacity, .2)}#container #inner-block{position:absolute;inset:0;box-sizing:content-box;display:flex;flex-direction:column;place-content:center center;align-items:center;overflow:hidden;border-radius:50%;margin:calc(var(--progress-spinner-stroke-width, calc(5% + 2px) ) + 2px);line-height:1em}#container:hover #foreground ::ng-deep .mdc-circular-progress__determinate-circle{stroke-width:var(--progress-spinner-stroke-width, calc(5% + 2px) )!important}#container:hover #background ::ng-deep .mdc-circular-progress__determinate-circle{stroke-opacity:var(--progress-spinner-background-opacity, .33)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1$3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: IntersectionObserverModule }, { kind: "directive", type: i3.IntersectionObserverDirective, selector: "[intersectionObserver]", inputs: ["visitClass", "leaveClass", "removeVisitClass", "removeLeaveClass", "useScroll", "threshold", "autoRemove"], outputs: ["intersection"] }, { kind: "ngmodule", type: CountUpModule }, { kind: "directive", type: i3$3.CountUpDirective, selector: "[countUp]", inputs: ["countUp", "options", "reanimateOnClick"], outputs: ["complete"] }, { kind: "pipe", type: MergePipe, name: "merge" }] });
1272
+ }
1273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ProgressSpinnerComponent, decorators: [{
1274
+ type: Component,
1275
+ args: [{ selector: 'lib-progress-spinner', imports: [CommonModule, MatProgressSpinnerModule, IntersectionObserverModule, CountUpModule, MergePipe], template: "<!-- @format -->\n\n<div id=\"container\" [style.font-size]=\"fontSize\" [style.width.px]=\"diameter\" [style.height.px]=\"diameter\">\n <mat-progress-spinner id=\"background\" [diameter]=\"diameter\" mode=\"determinate\" [value]=\"100\"> </mat-progress-spinner>\n <mat-progress-spinner\n id=\"foreground\"\n [diameter]=\"diameter\"\n mode=\"determinate\"\n [value]=\"value\"\n intersectionObserver\n (intersection)=\"load($event.intersect)\">\n </mat-progress-spinner>\n <div id=\"inner-block\">\n <mat-label\n [countUp]=\"value\"\n [options]=\"datatableIntl.numberOptions | merge: { suffix: '%', duration: 0.6 }\"\n [reanimateOnClick]=\"false\"></mat-label>\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["#container{position:relative}#container #foreground{--mdc-circular-progress-active-indicator-color: var(--progress-spinner-color, varvar(--mat-sys-primary))}#container #foreground ::ng-deep .mdc-circular-progress__determinate-circle{stroke-width:var(--progress-spinner-stroke-width, 5%)!important}#container #background{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);--mdc-circular-progress-active-indicator-color: var(--progress-spinner-color, var(--mat-sys-primary))}#container #background ::ng-deep .mdc-circular-progress__determinate-circle{stroke-width:var(--progress-spinner-stroke-width, calc(5% + 2px) )!important;stroke-opacity:var(--progress-spinner-background-opacity, .2)}#container #inner-block{position:absolute;inset:0;box-sizing:content-box;display:flex;flex-direction:column;place-content:center center;align-items:center;overflow:hidden;border-radius:50%;margin:calc(var(--progress-spinner-stroke-width, calc(5% + 2px) ) + 2px);line-height:1em}#container:hover #foreground ::ng-deep .mdc-circular-progress__determinate-circle{stroke-width:var(--progress-spinner-stroke-width, calc(5% + 2px) )!important}#container:hover #background ::ng-deep .mdc-circular-progress__determinate-circle{stroke-opacity:var(--progress-spinner-background-opacity, .33)}\n"] }]
1276
+ }], propDecorators: { diameter: [{
1277
+ type: Input
1278
+ }], setValue: [{
1279
+ type: Input,
1280
+ args: ['value']
1281
+ }], color: [{
1282
+ type: Input
1283
+ }], setDisplayValue: [{
1284
+ type: Input,
1285
+ args: ['displayValue']
1286
+ }], getColor: [{
1287
+ type: HostBinding,
1288
+ args: ['style.--progress-spinner-color']
1289
+ }], fontSize: [{
1290
+ type: Input
1291
+ }], setAnimateInView: [{
1292
+ type: Input,
1293
+ args: ['animateInView']
1294
+ }], setDelay: [{
1295
+ type: Input,
1296
+ args: ['delay']
1297
+ }] } });
1298
+
1299
+ /** @format */
1300
+ class DatagridDataSource extends DataSource {
1301
+ service;
1302
+ loading$ = new BehaviorSubject(true);
1303
+ data = [];
1304
+ recordsFiltered = 0;
1305
+ recordsTotal;
1306
+ facets;
1307
+ rowSize = 0; // row size in kb
1308
+ options;
1309
+ latestRequestId = 0;
1310
+ disconnected = false;
1311
+ dataStream = new BehaviorSubject([]);
1312
+ constructor(service) {
1313
+ super();
1314
+ this.service = service;
1315
+ }
1316
+ connect() {
1317
+ return this.dataStream;
1318
+ }
1319
+ disconnect() {
1320
+ this.disconnected = true;
1321
+ this.latestRequestId++;
1322
+ this.loading$.complete();
1323
+ this.dataStream.complete();
1324
+ }
1325
+ async loadData(options, append = false) {
1326
+ if (this.disconnected)
1327
+ return;
1328
+ const requestId = ++this.latestRequestId;
1329
+ this.options = options;
1330
+ if (!append)
1331
+ this.loading$.next(true);
1332
+ try {
1333
+ const result = await this.service(options);
1334
+ if (this.disconnected || requestId !== this.latestRequestId || options.draw !== result.draw)
1335
+ return;
1336
+ this.recordsTotal = result.recordsTotal;
1337
+ this.recordsFiltered = result.recordsFiltered;
1338
+ this.facets = result.facets;
1339
+ this.setData(result.data, append);
1340
+ this.calculateRowSize(this.data);
1341
+ }
1342
+ finally {
1343
+ if (!append && !this.disconnected && requestId === this.latestRequestId)
1344
+ this.loading$.next(false);
1345
+ }
1346
+ }
1347
+ refresh() {
1348
+ if (this.options)
1349
+ void this.loadData(this.options);
1350
+ }
1351
+ redraw(match) {
1352
+ const data = [];
1353
+ this.data.forEach((d) => {
1354
+ if (match) {
1355
+ if (match(d))
1356
+ data.push({ ...d });
1357
+ else
1358
+ data.push(d);
1359
+ }
1360
+ else
1361
+ data.push({ ...d });
1362
+ });
1363
+ this.setData(data, false);
1364
+ }
1365
+ setData(data, append) {
1366
+ this.data = append ? [...this.data, ...data] : data;
1367
+ this.dataStream.next(this.data);
1368
+ }
1369
+ calculateRowSize(data) {
1370
+ let total = 0;
1371
+ for (let row of data) {
1372
+ const size = new TextEncoder().encode(JSON.stringify(row)).length;
1373
+ const kiloBytes = size / 1024;
1374
+ total += kiloBytes / 1024;
1375
+ }
1376
+ this.rowSize = total && data.length ? total / data.length : 0;
1377
+ }
1378
+ }
1379
+
1380
+ /** @format */
1381
+ const NGX_MAT_DATATABLE_DEFAULT_OPTIONS = new InjectionToken('NGX_MAT_DATATABLE_DEFAULT_OPTIONS', {
1382
+ providedIn: 'root',
1383
+ factory: () => ({
1384
+ loadMode: 'pagination',
1385
+ showRecordsCount: true,
1386
+ pageSizeOptions: [20, 50, 100],
1387
+ pageSizeOptionsIndex: 1,
1388
+ incremental: {
1389
+ trigger: 'inView',
1390
+ },
1391
+ }),
1392
+ });
1393
+ function provideNgxMatDatatableDefaultOptions(options) {
1394
+ return {
1395
+ provide: NGX_MAT_DATATABLE_DEFAULT_OPTIONS,
1396
+ useValue: options,
1397
+ };
1398
+ }
1399
+
1400
+ /** @format */
1401
+ class NgxMatDatatableContentDirective {
1402
+ templateRef;
1403
+ id;
1404
+ constructor(templateRef) {
1405
+ this.templateRef = templateRef;
1406
+ }
1407
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableContentDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1408
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: NgxMatDatatableContentDirective, isStandalone: true, selector: "[ngxMatDatatableContent]", inputs: { id: ["ngxMatDatatableContent", "id"] }, ngImport: i0 });
1409
+ }
1410
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableContentDirective, decorators: [{
1411
+ type: Directive,
1412
+ args: [{
1413
+ selector: '[ngxMatDatatableContent]',
1414
+ }]
1415
+ }], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { id: [{
1416
+ type: Input,
1417
+ args: ['ngxMatDatatableContent']
1418
+ }] } });
1419
+
1420
+ /** @format */
1421
+ class BackgroundColorPipe {
1422
+ transform(row, column, options) {
1423
+ if (typeof column.backgroundColor === 'string')
1424
+ return column.backgroundColor;
1425
+ if (typeof column.backgroundColor === 'function')
1426
+ return column.backgroundColor(row);
1427
+ if (typeof options.rowBackgroundColor === 'string')
1428
+ return options.rowBackgroundColor;
1429
+ if (typeof options.rowBackgroundColor === 'function')
1430
+ return options.rowBackgroundColor(column, row);
1431
+ }
1432
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BackgroundColorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1433
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: BackgroundColorPipe, isStandalone: true, name: "backgroundColor" });
1434
+ }
1435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BackgroundColorPipe, decorators: [{
1436
+ type: Pipe,
1437
+ args: [{ name: 'backgroundColor' }]
1438
+ }] });
1439
+
1440
+ /** @format */
1441
+ class CellColorPipe {
1442
+ transform(row, column, options) {
1443
+ if (typeof column.color === 'string')
1444
+ return column.color;
1445
+ if (typeof column.color === 'function')
1446
+ return column.color(row);
1447
+ if (typeof options.rowColor === 'string')
1448
+ return options.rowColor;
1449
+ if (typeof options.rowColor === 'function')
1450
+ return options.rowColor(column, row);
1451
+ }
1452
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellColorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1453
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: CellColorPipe, isStandalone: true, name: "cellColor" });
1454
+ }
1455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellColorPipe, decorators: [{
1456
+ type: Pipe,
1457
+ args: [{ name: 'cellColor' }]
1458
+ }] });
1459
+
1460
+ /** @format */
1461
+ class CellOpacityPipe {
1462
+ transform(row, column, options) {
1463
+ if (typeof options.rowOpacity === 'string')
1464
+ return options.rowOpacity;
1465
+ if (typeof options.rowOpacity === 'function')
1466
+ return options.rowOpacity(column, row);
1467
+ }
1468
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellOpacityPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1469
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: CellOpacityPipe, isStandalone: true, name: "cellOpacity" });
1470
+ }
1471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellOpacityPipe, decorators: [{
1472
+ type: Pipe,
1473
+ args: [{ name: 'cellOpacity' }]
1474
+ }] });
1475
+
1476
+ /** @format */
1477
+ class FilterPipe {
1478
+ transform(obj, filter) {
1479
+ return (obj ?? []).filter(o => {
1480
+ for (let key of Object.keys(filter)) {
1481
+ if (o[key] !== filter[key])
1482
+ return false;
1483
+ }
1484
+ return true;
1485
+ });
1486
+ }
1487
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1488
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: FilterPipe, isStandalone: true, name: "filter" });
1489
+ }
1490
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FilterPipe, decorators: [{
1491
+ type: Pipe,
1492
+ args: [{ name: 'filter' }]
1493
+ }] });
1494
+
1495
+ /** @format */
1496
+ class FindContentPipe {
1497
+ transform(contentRefs, id) {
1498
+ return contentRefs?.find(ref => ref.id === id);
1499
+ }
1500
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FindContentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1501
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: FindContentPipe, isStandalone: true, name: "findContent" });
1502
+ }
1503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FindContentPipe, decorators: [{
1504
+ type: Pipe,
1505
+ args: [{ name: 'findContent' }]
1506
+ }] });
1507
+
1508
+ /** @format */
1509
+ class FindPipe {
1510
+ transform(obj, filter) {
1511
+ return (obj ?? []).find(o => {
1512
+ for (let key of Object.keys(filter)) {
1513
+ if (o[key] !== filter[key])
1514
+ return false;
1515
+ }
1516
+ return true;
1517
+ });
1518
+ }
1519
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FindPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1520
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: FindPipe, isStandalone: true, name: "find" });
1521
+ }
1522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FindPipe, decorators: [{
1523
+ type: Pipe,
1524
+ args: [{ name: 'find' }]
1525
+ }] });
1526
+
1527
+ /** @format */
1528
+ class IncludedInPipe {
1529
+ transform(elmt, obj) {
1530
+ return (obj ?? []).includes(elmt);
1531
+ }
1532
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: IncludedInPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1533
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: IncludedInPipe, isStandalone: true, name: "includedIn" });
1534
+ }
1535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: IncludedInPipe, decorators: [{
1536
+ type: Pipe,
1537
+ args: [{ name: 'includedIn' }]
1538
+ }] });
1539
+
1540
+ /** @format */
1541
+ class OrderByPipe {
1542
+ transform(data, keys, dirs) {
1543
+ return lodash.orderBy(data, typeof keys === 'string' ? [keys] : keys, typeof dirs === 'string' ? [dirs] : dirs);
1544
+ }
1545
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OrderByPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1546
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: OrderByPipe, isStandalone: true, name: "orderBy" });
1547
+ }
1548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OrderByPipe, decorators: [{
1549
+ type: Pipe,
1550
+ args: [{
1551
+ name: 'orderBy',
1552
+ }]
1553
+ }] });
1554
+
1555
+ /** @format */
1556
+ class SortFacetEntriesPipe {
1557
+ transform(entries, options) {
1558
+ if (!entries || !options)
1559
+ return entries;
1560
+ return entries.sort((e1, e2) => {
1561
+ const ie1 = options.findIndex(o => o.value === e1._id);
1562
+ if (ie1 === -1)
1563
+ return 1;
1564
+ const ie2 = options.findIndex(o => o.value === e2._id);
1565
+ if (ie2 === -1)
1566
+ return -1;
1567
+ return ie1 - ie2;
1568
+ });
1569
+ }
1570
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SortFacetEntriesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1571
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: SortFacetEntriesPipe, isStandalone: true, name: "sortFacetEntries" });
1572
+ }
1573
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SortFacetEntriesPipe, decorators: [{
1574
+ type: Pipe,
1575
+ args: [{ name: 'sortFacetEntries' }]
1576
+ }] });
1577
+
1578
+ /** @format */
1579
+ class SumPipe {
1580
+ transform(obj, by) {
1581
+ if (!obj || !obj.length)
1582
+ return 0;
1583
+ if (by)
1584
+ return obj.reduce((pv, cv) => (pv += cv[by]), 0);
1585
+ return obj.reduce((pv, cv) => (pv += cv), 0);
1586
+ }
1587
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SumPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1588
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: SumPipe, isStandalone: true, name: "sum" });
1589
+ }
1590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SumPipe, decorators: [{
1591
+ type: Pipe,
1592
+ args: [{ name: 'sum' }]
1593
+ }] });
1594
+
1595
+ /** @format */
1596
+ function duration(data, options) {
1597
+ const durationOption = { maxDecimalPoints: 0, largest: 1, fallbacks: ['en'] };
1598
+ if (options?.locale)
1599
+ durationOption.language = options.locale;
1600
+ if (options?.largest)
1601
+ durationOption.largest = options.largest;
1602
+ let value;
1603
+ if (typeof data === 'number')
1604
+ value = data;
1605
+ else if (typeof data === 'string') {
1606
+ const date = new Date(data);
1607
+ if (isNaN(date.valueOf()))
1608
+ return null;
1609
+ value = Date.now() - date.valueOf();
1610
+ }
1611
+ else if (typeof data?.valueOf === 'function')
1612
+ value = Date.now() - data.valueOf();
1613
+ if (value === undefined || value === null)
1614
+ return null;
1615
+ return humanizeDuration(value, durationOption);
1616
+ }
1617
+
1618
+ /** @format */
1619
+ function get(obj, path) {
1620
+ const chunks = path.split('.');
1621
+ let value = obj;
1622
+ for (let i = 0; i < chunks.length; ++i) {
1623
+ value = value[chunks[i]];
1624
+ if (value === undefined || value === null)
1625
+ return null;
1626
+ }
1627
+ return value;
1628
+ }
1629
+
1630
+ /** @format */
1631
+ class NgxMatDatatablePaginatorIntl extends MatPaginatorIntl {
1632
+ datatableIntl = inject(NgxMatDatatableIntl);
1633
+ itemsPerPageLabel = this.datatableIntl.itemsPerPageLabel;
1634
+ nextPageLabel = this.datatableIntl.nextPageLabel;
1635
+ lastPageLabel = this.datatableIntl.lastPageLabel;
1636
+ previousPageLabel = this.datatableIntl.previousPageLabel;
1637
+ firstPageLabel = this.datatableIntl.firstPageLabel;
1638
+ onLabel = this.datatableIntl.onLabel;
1639
+ getRangeLabel = (page, pageSize, length) => {
1640
+ return this.datatableIntl.getRangeLabel(page, pageSize, length);
1641
+ };
1642
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatablePaginatorIntl, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1643
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatablePaginatorIntl });
1644
+ }
1645
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatablePaginatorIntl, decorators: [{
1646
+ type: Injectable
1647
+ }] });
1648
+ class NgxMatDatatableComponent {
1649
+ options;
1650
+ config;
1651
+ rowClicked = new EventEmitter();
1652
+ configUpdated = new EventEmitter();
1653
+ searchUpdated = new EventEmitter();
1654
+ ready = new EventEmitter();
1655
+ paginator;
1656
+ contentRefs;
1657
+ displayedColumns = [];
1658
+ visibleColumnsColspan = 1;
1659
+ disabledRows = [];
1660
+ dataSource;
1661
+ expandedRow = null;
1662
+ loaded = false;
1663
+ datatableIntl = inject(NgxMatDatatableIntl);
1664
+ loadMode = 'pagination';
1665
+ incrementalTrigger = 'inView';
1666
+ incrementalPageSize = 30;
1667
+ incrementalPageIndex = 0;
1668
+ displayedRecordsCount = 0;
1669
+ totalRecordsCount = 0;
1670
+ hasMoreRecords = false;
1671
+ loadingNextRecords = false;
1672
+ showRecordsCount = true;
1673
+ incrementalLoadingLabel = this.datatableIntl.incrementalLoadingLabel;
1674
+ incrementalLoadMoreLabel = this.datatableIntl.incrementalLoadMoreLabel;
1675
+ incrementalRowColumns = ['_incrementalLoad'];
1676
+ showIncrementalRow = false;
1677
+ showIncrementalInViewTrigger = false;
1678
+ showIncrementalButtonTrigger = false;
1679
+ paginationPageSizeOptions = [];
1680
+ paginationPageSize = 30;
1681
+ searchFormGroup;
1682
+ subscriptions = new rxjs.Subscription();
1683
+ changeDetectorRef = inject(ChangeDetectorRef);
1684
+ defaultOptions = inject(NGX_MAT_DATATABLE_DEFAULT_OPTIONS);
1685
+ incrementalLoadToken = 0;
1686
+ get data() {
1687
+ return this._data;
1688
+ }
1689
+ _data;
1690
+ container;
1691
+ head;
1692
+ matTable;
1693
+ observer = new ResizeObserver(entries => {
1694
+ entries.forEach(entry => {
1695
+ const containerHeight = this.container?.nativeElement.clientHeight ?? 0;
1696
+ const containerWidth = this.container?.nativeElement.clientWidth ?? 0;
1697
+ const headerHeight = this.head?.nativeElement.clientHeight ?? 0;
1698
+ const headerWidth = this.head?.nativeElement.clientWidth ?? 0;
1699
+ const contentHeight = entry.contentRect.height;
1700
+ const contentWidth = entry.contentRect.width;
1701
+ this.tableContainerOverflowY = containerHeight - headerHeight - contentHeight < 0 ? 'auto' : 'inherit';
1702
+ this.tableContainerOverflowX = containerWidth - headerWidth - contentWidth < 0 ? 'auto' : 'inherit';
1703
+ this.tableContainerWidth = containerWidth;
1704
+ this.changeDetectorRef.markForCheck();
1705
+ });
1706
+ });
1707
+ tableContainerOverflowY = 'inherit';
1708
+ tableContainerOverflowX = 'inherit';
1709
+ tableContainerWidth = 0;
1710
+ async ngOnInit() {
1711
+ if (!this.options?.service)
1712
+ throw new Error(`missing mongoose datatable component service`);
1713
+ if (!this.options?.columns)
1714
+ throw new Error(`missing mongoose datatable component columns`);
1715
+ this.options = this.resolveOptions(this.options);
1716
+ await this.applyConfig();
1717
+ this.prepareLoadModeOptions();
1718
+ this.buildDisplayColumns();
1719
+ this.buildSearchFormGroup();
1720
+ this.dataSource = new DatagridDataSource(this.options.service);
1721
+ this.ready.emit(this);
1722
+ this.changeDetectorRef.detectChanges();
1723
+ }
1724
+ ngOnDestroy() {
1725
+ if (this.matTable)
1726
+ this.observer.unobserve(this.matTable._elementRef.nativeElement);
1727
+ this.subscriptions.unsubscribe();
1728
+ }
1729
+ load(intersect) {
1730
+ if (!intersect || this.loaded)
1731
+ return;
1732
+ this.loaded = true;
1733
+ if (this.matTable)
1734
+ this.observer.observe(this.matTable?._elementRef.nativeElement);
1735
+ if (this.loadMode === 'pagination') {
1736
+ this.subscriptions.add(this.paginator?.page.subscribe(() => {
1737
+ this.updateConfig();
1738
+ void this.loadPage();
1739
+ }));
1740
+ }
1741
+ void this.loadPage();
1742
+ }
1743
+ sortColumn(column) {
1744
+ if (column.sortable === false)
1745
+ return;
1746
+ if (!column.order)
1747
+ column.order = {
1748
+ index: this.options.columns.filter(c => !!c.order).length,
1749
+ dir: 'asc',
1750
+ };
1751
+ else if (column.order.dir === 'asc')
1752
+ column.order.dir = 'desc';
1753
+ else {
1754
+ delete column.order;
1755
+ this.consolidateOrderIndex();
1756
+ }
1757
+ this.loadFirstPage();
1758
+ }
1759
+ redraw(match) {
1760
+ this.dataSource.redraw(match);
1761
+ this.changeDetectorRef.detectChanges();
1762
+ }
1763
+ refreshColumns() {
1764
+ this.buildDisplayColumns();
1765
+ }
1766
+ exporting = false;
1767
+ async export() {
1768
+ this.exporting = true;
1769
+ try {
1770
+ const XLSX = await import('xlsx');
1771
+ const columns = this.buildRequestColumns();
1772
+ const order = this.buildOrder(columns);
1773
+ const chunkLength = this.getExportChunkLength(this.dataSource.recordsFiltered);
1774
+ const chunks = this.buildExportChunks(this.dataSource.recordsFiltered, chunkLength);
1775
+ const data = [];
1776
+ for (let chunk of chunks) {
1777
+ const result = await this.options.service({
1778
+ draw: Date.now().toString(),
1779
+ columns,
1780
+ order,
1781
+ start: chunk.start,
1782
+ length: chunk.length,
1783
+ });
1784
+ data.push(...result.data);
1785
+ }
1786
+ const rows = [];
1787
+ for (let d of data) {
1788
+ const row = {};
1789
+ for (let c of this.options.columns) {
1790
+ if (c.hidden || c.disabled)
1791
+ continue;
1792
+ let value = get(d, c.property);
1793
+ if (c.export)
1794
+ c.export(row, value, d);
1795
+ else {
1796
+ if (c.transform)
1797
+ value = c.transform(value, d);
1798
+ switch (c.type) {
1799
+ case 'select':
1800
+ await this.buildExportSelectColumn(c, row, value);
1801
+ break;
1802
+ case 'duration':
1803
+ await this.buildExportDurationColumn(c, row, value);
1804
+ break;
1805
+ default:
1806
+ row[c.header] = value;
1807
+ }
1808
+ }
1809
+ }
1810
+ rows.push(row);
1811
+ }
1812
+ const workbook = XLSX.utils.book_new();
1813
+ const worksheet = XLSX.utils.json_to_sheet(rows);
1814
+ XLSX.utils.book_append_sheet(workbook, worksheet, 'export');
1815
+ const filename = typeof this.options.actions?.export === 'string' ? this.options.actions.export : 'export';
1816
+ await XLSX.writeFile(workbook, `${filename}-${Date.now()}.xlsx`);
1817
+ }
1818
+ finally {
1819
+ this.exporting = false;
1820
+ }
1821
+ }
1822
+ async buildExportSelectColumn(column, row, value) {
1823
+ if (Array.isArray(column.options)) {
1824
+ row[column.header] = column.options.find(option => option.value === value)?.name ?? value;
1825
+ }
1826
+ else if (column.__options) {
1827
+ row[column.header] = column.__options.find(option => option.value === value)?.name ?? value;
1828
+ }
1829
+ else {
1830
+ const options = await rxjs.lastValueFrom(column.options);
1831
+ row[column.header] = options.find(option => option.value === value)?.name ?? value;
1832
+ }
1833
+ }
1834
+ async buildExportDurationColumn(column, row, value) {
1835
+ row[`${column.header} ms`] = value;
1836
+ row[column.header] = duration(value, column);
1837
+ }
1838
+ getExportChunkLength(recordsFiltered) {
1839
+ if (recordsFiltered <= 0)
1840
+ return 0;
1841
+ if (!Number.isFinite(this.dataSource.rowSize) || this.dataSource.rowSize <= 0)
1842
+ return recordsFiltered;
1843
+ return Math.max(1, Math.min(Math.floor(5 / this.dataSource.rowSize), recordsFiltered));
1844
+ }
1845
+ buildExportChunks(recordsFiltered, chunkLength) {
1846
+ if (recordsFiltered <= 0 || chunkLength <= 0)
1847
+ return [];
1848
+ const chunks = [];
1849
+ for (let i = 0; i < Math.ceil(recordsFiltered / chunkLength); ++i) {
1850
+ chunks.push({ start: i, length: chunkLength });
1851
+ }
1852
+ return chunks;
1853
+ }
1854
+ async loadPage() {
1855
+ if (!this.dataSource)
1856
+ return;
1857
+ if (this.loadMode === 'incremental') {
1858
+ await this.loadInitialPage();
1859
+ return;
1860
+ }
1861
+ await this.loadPaginationPage();
1862
+ }
1863
+ async loadNextIncrementalPage() {
1864
+ if (this.loadMode !== 'incremental')
1865
+ return;
1866
+ if (!this.dataSource || this.dataSource.loading$.value || this.loadingNextRecords || !this.hasMoreRecords)
1867
+ return;
1868
+ this.loadingNextRecords = true;
1869
+ this.updateIncrementalRowState();
1870
+ const loadToken = this.incrementalLoadToken;
1871
+ try {
1872
+ const columns = this.buildRequestColumns();
1873
+ const order = this.buildOrder(columns);
1874
+ const nextPageIndex = this.incrementalPageIndex + 1;
1875
+ await this.dataSource.loadData(this.buildRequestOptions(columns, order, nextPageIndex, this.incrementalPageSize), true);
1876
+ if (loadToken !== this.incrementalLoadToken)
1877
+ return;
1878
+ this.incrementalPageIndex = nextPageIndex;
1879
+ this.updateLoadedDataState();
1880
+ }
1881
+ finally {
1882
+ if (loadToken === this.incrementalLoadToken) {
1883
+ this.loadingNextRecords = false;
1884
+ this.updateIncrementalRowState();
1885
+ this.changeDetectorRef.detectChanges();
1886
+ }
1887
+ }
1888
+ }
1889
+ onIncrementalIntersection(intersect) {
1890
+ if (!intersect)
1891
+ return;
1892
+ void this.loadNextIncrementalPage();
1893
+ }
1894
+ async loadPaginationPage() {
1895
+ const columns = this.buildRequestColumns();
1896
+ const order = this.buildOrder(columns);
1897
+ await this.dataSource.loadData(this.buildRequestOptions(columns, order, this.paginator.pageIndex, this.paginator.pageSize));
1898
+ this.updateLoadedDataState();
1899
+ }
1900
+ async loadInitialPage() {
1901
+ this.resetIncrementalLoading();
1902
+ const columns = this.buildRequestColumns();
1903
+ const order = this.buildOrder(columns);
1904
+ await this.dataSource.loadData(this.buildRequestOptions(columns, order, 0, this.incrementalPageSize));
1905
+ this.updateLoadedDataState();
1906
+ }
1907
+ buildRequestOptions(columns, order, start, length) {
1908
+ return {
1909
+ draw: Date.now().toString(),
1910
+ columns,
1911
+ start,
1912
+ length,
1913
+ order,
1914
+ facets: this.options.facets,
1915
+ };
1916
+ }
1917
+ loadFirstPage() {
1918
+ if (this.loadMode === 'pagination' && this.paginator)
1919
+ this.paginator.pageIndex = 0;
1920
+ void this.loadPage();
1921
+ }
1922
+ updateLoadedDataState() {
1923
+ this._data = this.dataSource.data;
1924
+ this.buildDisabledRows();
1925
+ this.updateRecordsCountState();
1926
+ this.updateHasMoreRecordsState();
1927
+ }
1928
+ buildDisabledRows() {
1929
+ this.disabledRows = [];
1930
+ if (this.options.rowDisabled) {
1931
+ this.dataSource.data?.forEach(d => {
1932
+ if (typeof this.options.rowDisabled === 'string') {
1933
+ if (get(d, this.options.rowDisabled) === true)
1934
+ this.disabledRows.push(d);
1935
+ }
1936
+ else if (typeof this.options.rowDisabled === 'function') {
1937
+ if (this.options.rowDisabled(d))
1938
+ this.disabledRows.push(d);
1939
+ }
1940
+ });
1941
+ }
1942
+ }
1943
+ buildOrder(columns) {
1944
+ const order = [];
1945
+ this.options.columns
1946
+ .filter(c => !!c.order)
1947
+ .sort((c1, c2) => c1.order.index - c2.order.index)
1948
+ .forEach(c => {
1949
+ const index = columns.findIndex(column => column.data === (c.sortProperty || c.property));
1950
+ if (index !== -1)
1951
+ order.push({ column: index, dir: c.order.dir });
1952
+ });
1953
+ return order;
1954
+ }
1955
+ updateColumns = [];
1956
+ openUpdateColumnDisplay() {
1957
+ this.updateColumns = this.options.columns.map(column => ({
1958
+ columnDef: column.columnDef,
1959
+ header: column.header,
1960
+ sticky: column.sticky,
1961
+ hidden: column.hidden,
1962
+ }));
1963
+ }
1964
+ reorderColumns(event) {
1965
+ moveItemInArray(this.updateColumns, event.previousIndex, event.currentIndex);
1966
+ }
1967
+ closeUpdateColumnDisplay() {
1968
+ let reload = false;
1969
+ this.updateColumns.forEach((updated, index) => {
1970
+ const columnIndex = this.options.columns.findIndex(c => c.columnDef === updated.columnDef);
1971
+ if (columnIndex == -1)
1972
+ return;
1973
+ if (columnIndex !== index)
1974
+ moveItemInArray(this.options.columns, columnIndex, index);
1975
+ const column = this.options.columns[index];
1976
+ if (updated.sticky !== column.sticky)
1977
+ column.sticky = updated.sticky;
1978
+ if (updated.hidden !== column.hidden) {
1979
+ column.hidden = updated.hidden;
1980
+ reload = reload || !updated.hidden;
1981
+ }
1982
+ });
1983
+ this.buildDisplayColumns();
1984
+ this.updateConfig();
1985
+ if (reload)
1986
+ void this.loadPage();
1987
+ }
1988
+ rowClick(row) {
1989
+ if (this.disabledRows.includes(row))
1990
+ return;
1991
+ if (typeof this.options.actions?.rowClick === 'boolean') {
1992
+ this.rowClicked.emit(row);
1993
+ }
1994
+ else if (typeof this.options.actions?.rowClick === 'function') {
1995
+ this.options.actions.rowClick(row);
1996
+ this.rowClicked.emit(row);
1997
+ }
1998
+ }
1999
+ facetClick(column, result, option) {
2000
+ if (!column)
2001
+ return;
2002
+ const control = this.searchFormGroup?.controls[column.columnDef];
2003
+ if (!control)
2004
+ return;
2005
+ if (option && option.value !== control.value?.value)
2006
+ control.setValue({ value: option.value, name: option.name });
2007
+ else if (result._id !== control.value?.value)
2008
+ control.setValue({ value: result._id });
2009
+ }
2010
+ buildRequestColumns() {
2011
+ const columns = [];
2012
+ const additionalColumns = [];
2013
+ if (this.options.additionalProperties) {
2014
+ this.options.additionalProperties.forEach(property => this.addAdditionalColumn(additionalColumns, property));
2015
+ }
2016
+ this.options.columns.forEach(c => {
2017
+ if (c.hidden)
2018
+ return;
2019
+ const column = {
2020
+ data: c.property,
2021
+ projection: c.projection,
2022
+ name: c.columnDef,
2023
+ searchable: c.searchable,
2024
+ };
2025
+ if (c.sortProperty && c.order)
2026
+ this.addAdditionalColumn(additionalColumns, c.sortProperty);
2027
+ if (c.searchable) {
2028
+ const control = this.searchFormGroup.controls[c.columnDef];
2029
+ if (control.value) {
2030
+ if (c.searchProperty)
2031
+ this.addAdditionalColumn(additionalColumns, c.searchProperty, control.value);
2032
+ else
2033
+ column.search = control.value;
2034
+ }
2035
+ }
2036
+ if (c.additionalProperties) {
2037
+ c.additionalProperties.forEach(property => this.addAdditionalColumn(additionalColumns, property));
2038
+ }
2039
+ columns.push(column);
2040
+ });
2041
+ for (let additionalColumn of additionalColumns) {
2042
+ const c = columns.find(c => c.data === additionalColumn.data);
2043
+ if (!c)
2044
+ columns.push(additionalColumn);
2045
+ else if (additionalColumn.search && !c.search)
2046
+ c.search = additionalColumn.search;
2047
+ }
2048
+ return columns;
2049
+ }
2050
+ addAdditionalColumn(additionalColumns, data, search) {
2051
+ let column = additionalColumns.find(c => c.data === data);
2052
+ if (!column)
2053
+ additionalColumns.push((column = { data }));
2054
+ if (search) {
2055
+ column.search = search;
2056
+ column.searchable = true;
2057
+ }
2058
+ return column;
2059
+ }
2060
+ buildDisplayColumns() {
2061
+ const displayedColumns = [];
2062
+ this.options.columns.forEach(column => {
2063
+ if (column.hidden || column.disabled)
2064
+ return;
2065
+ displayedColumns.push(column.columnDef);
2066
+ if (column.type && ['number', 'date', 'duration'].includes(column.type)) {
2067
+ if (!column.locale)
2068
+ column.locale = this.datatableIntl.locale;
2069
+ }
2070
+ });
2071
+ this.displayedColumns = displayedColumns;
2072
+ this.visibleColumnsColspan = Math.max(displayedColumns.length, 1);
2073
+ }
2074
+ prepareLoadModeOptions() {
2075
+ this.loadMode = this.options.loadMode ?? 'pagination';
2076
+ this.incrementalTrigger = this.options.incremental?.trigger ?? 'inView';
2077
+ this.preparePaginationOptions();
2078
+ this.incrementalPageSize = this.getDefaultIncrementalPageSize();
2079
+ this.showRecordsCount = this.options.showRecordsCount ?? true;
2080
+ this.incrementalLoadingLabel = this.datatableIntl.incrementalLoadingLabel;
2081
+ this.incrementalLoadMoreLabel = this.datatableIntl.incrementalLoadMoreLabel;
2082
+ this.updateRecordsCountState();
2083
+ this.updateHasMoreRecordsState();
2084
+ }
2085
+ preparePaginationOptions() {
2086
+ this.paginationPageSizeOptions = this.options.pageSizeOptions || [20, 50, 100];
2087
+ this.paginationPageSize =
2088
+ this.options.pageSize || this.paginationPageSizeOptions[this.options.pageSizeOptionsIndex ?? 1] || 30;
2089
+ }
2090
+ getDefaultIncrementalPageSize() {
2091
+ return this.options.incremental?.pageSize || this.options.pageSize || this.paginationPageSize || 30;
2092
+ }
2093
+ resolveOptions(options) {
2094
+ const actions = this.resolveActions(options);
2095
+ const incremental = this.resolveIncrementalOptions(options);
2096
+ return {
2097
+ ...this.defaultOptions,
2098
+ ...options,
2099
+ service: options.service,
2100
+ columns: options.columns,
2101
+ ...(actions ? { actions } : {}),
2102
+ ...(incremental ? { incremental } : {}),
2103
+ };
2104
+ }
2105
+ resolveActions(options) {
2106
+ if (!this.defaultOptions.actions && !options.actions)
2107
+ return undefined;
2108
+ const columns = this.resolveActionColumns(options);
2109
+ return {
2110
+ ...this.defaultOptions.actions,
2111
+ ...options.actions,
2112
+ ...(columns ? { columns } : {}),
2113
+ };
2114
+ }
2115
+ resolveActionColumns(options) {
2116
+ if (!this.defaultOptions.actions?.columns && !options.actions?.columns)
2117
+ return undefined;
2118
+ return {
2119
+ ...this.defaultOptions.actions?.columns,
2120
+ ...options.actions?.columns,
2121
+ };
2122
+ }
2123
+ resolveIncrementalOptions(options) {
2124
+ if (!this.defaultOptions.incremental && !options.incremental)
2125
+ return undefined;
2126
+ return {
2127
+ ...this.defaultOptions.incremental,
2128
+ ...options.incremental,
2129
+ };
2130
+ }
2131
+ resetIncrementalLoading() {
2132
+ this.incrementalLoadToken++;
2133
+ this.incrementalPageIndex = 0;
2134
+ this.loadingNextRecords = false;
2135
+ this.updateIncrementalRowState();
2136
+ }
2137
+ updateRecordsCountState() {
2138
+ this.displayedRecordsCount = this.dataSource?.data.length ?? 0;
2139
+ this.totalRecordsCount = this.dataSource?.recordsFiltered ?? 0;
2140
+ }
2141
+ updateHasMoreRecordsState() {
2142
+ this.hasMoreRecords = this.loadMode === 'incremental' && this.displayedRecordsCount < this.totalRecordsCount;
2143
+ this.updateIncrementalRowState();
2144
+ }
2145
+ updateIncrementalRowState() {
2146
+ this.showIncrementalRow = this.loadMode === 'incremental' && (this.hasMoreRecords || this.loadingNextRecords);
2147
+ this.showIncrementalInViewTrigger = this.showIncrementalRow && this.incrementalTrigger === 'inView';
2148
+ this.showIncrementalButtonTrigger = this.showIncrementalRow && this.incrementalTrigger === 'button';
2149
+ this.changeDetectorRef.markForCheck();
2150
+ queueMicrotask(() => this.matTable?.renderRows());
2151
+ }
2152
+ buildSearchFormGroup() {
2153
+ this.searchFormGroup = new FormGroup(this.options.columns.reduce((controls, column) => {
2154
+ if (column.searchable) {
2155
+ const control = new FormControl({
2156
+ value: column.searchValue !== undefined ? { value: column.searchValue } : undefined,
2157
+ disabled: false,
2158
+ });
2159
+ controls[column.columnDef] = control;
2160
+ if (typeof column.searchUpdated === 'function') {
2161
+ this.subscriptions.add(control.valueChanges.pipe(rxjs.debounceTime(500)).subscribe(value => column.searchUpdated(value)));
2162
+ }
2163
+ }
2164
+ return controls;
2165
+ }, {}));
2166
+ this.subscriptions.add(this.searchFormGroup.valueChanges.pipe(rxjs.debounceTime(500)).subscribe(value => {
2167
+ this.searchUpdated.next(value);
2168
+ this.loadFirstPage();
2169
+ }));
2170
+ }
2171
+ consolidateOrderIndex() {
2172
+ let index = 0;
2173
+ this.options.columns
2174
+ .filter(c => !!c.order)
2175
+ .sort((c1, c2) => c1.order.index - c2.order.index)
2176
+ .forEach(c => (c.order.index = index++));
2177
+ }
2178
+ async applyConfig() {
2179
+ if (this.options?.configService?.get) {
2180
+ const config = await this.options.configService.get();
2181
+ this.config = config ?? this.config;
2182
+ }
2183
+ if (this.options?.columns && this.config?.columns) {
2184
+ this.config.columns.forEach((updated, index) => {
2185
+ const columnIndex = this.options.columns.findIndex(c => c.columnDef === updated.columnDef);
2186
+ if (columnIndex == -1)
2187
+ return;
2188
+ if (columnIndex !== index)
2189
+ moveItemInArray(this.options.columns, columnIndex, index);
2190
+ const column = this.options.columns[index];
2191
+ if (column && updated.sticky !== column.sticky)
2192
+ column.sticky = updated.sticky;
2193
+ if (column && updated.hidden !== column.hidden)
2194
+ column.hidden = updated.hidden;
2195
+ });
2196
+ this.buildDisplayColumns();
2197
+ }
2198
+ if (this.options && typeof this.config?.pageSizeOptionsIndex === 'number') {
2199
+ this.options.pageSizeOptionsIndex = this.config.pageSizeOptionsIndex;
2200
+ }
2201
+ }
2202
+ updateConfig() {
2203
+ const pageSizeOptions = this.paginationPageSizeOptions;
2204
+ const fallbackPageSize = this.paginationPageSize;
2205
+ const pageSizeOptionsIndex = pageSizeOptions.indexOf(this.paginator?.pageSize ?? fallbackPageSize);
2206
+ const columns = this.options.columns.map(c => ({
2207
+ columnDef: c.columnDef,
2208
+ sticky: c.sticky,
2209
+ hidden: c.hidden,
2210
+ }));
2211
+ this.config = { columns, pageSizeOptionsIndex };
2212
+ this.configUpdated.next(this.config);
2213
+ if (this.options?.configService?.set)
2214
+ this.options.configService.set(this.config);
2215
+ }
2216
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2217
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: NgxMatDatatableComponent, isStandalone: true, selector: "ngx-mat-datatable", inputs: { options: "options", config: "config" }, outputs: { rowClicked: "rowClicked", configUpdated: "configUpdated", searchUpdated: "searchUpdated", ready: "ready" }, host: { properties: { "style.--datatable-container-overflow-y": "this.tableContainerOverflowY", "style.--datatable-container-overflow-x": "this.tableContainerOverflowX", "style.--datatable-container-width.px": "this.tableContainerWidth" } }, providers: [{ provide: MatPaginatorIntl, useClass: NgxMatDatatablePaginatorIntl }], queries: [{ propertyName: "contentRefs", predicate: NgxMatDatatableContentDirective }], viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "head", first: true, predicate: ["head"], descendants: true }, { propertyName: "matTable", first: true, predicate: MatTable, descendants: true }], ngImport: i0, template: "<!-- @format -->\n\n@if (dataSource) {\n <div #container id=\"container\">\n <ng-container *ngTemplateOutlet=\"headTmpl\"></ng-container>\n\n <div id=\"table-container\" intersectionObserver (intersection)=\"load($event.intersect)\">\n <table id=\"table\" #table mat-table [fixedLayout]=\"false\" [dataSource]=\"dataSource\" multiTemplateDataRows>\n @for (column of options.columns; track column) {\n <ng-container [matColumnDef]=\"column.columnDef\" [sticky]=\"column.sticky\">\n <th\n mat-header-cell\n *matHeaderCellDef\n [class.searchable]=\"column.searchable\"\n [style.min-width.px]=\"column.minWidth || options.columnMinWith\">\n <ng-container *ngTemplateOutlet=\"headerTmpl; context: { column }\"></ng-container>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n [style.min-width.px]=\"column.minWidth || options.columnMinWith\"\n [style.color]=\"row | cellColor: column : options\"\n [style.opacity]=\"row | cellOpacity: column : options\"\n [style.background-color]=\"row | backgroundColor: column : options\">\n <ng-container *ngTemplateOutlet=\"cellTmpl; context: { column, row }\"></ng-container>\n </td>\n </ng-container>\n }\n\n <ng-container *ngIf=\"options.expandedDetailContentId\" matColumnDef=\"expandedDetail\">\n <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"options.columns.length\">\n @let content = contentRefs | findContent: options.expandedDetailContentId;\n <div *ngIf=\"content\" class=\"element-detail\" [@detailExpand]=\"row == expandedRow ? 'expanded' : 'collapsed'\">\n <ng-container *ngTemplateOutlet=\"content.templateRef; context: { row }\"> </ng-container>\n </div>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"_incrementalLoad\">\n <td mat-footer-cell *matFooterCellDef [attr.colspan]=\"visibleColumnsColspan\">\n <div class=\"incremental-load-row\">\n @if (showIncrementalInViewTrigger) {\n <div\n class=\"incremental-sentinel\"\n intersectionObserver\n (intersection)=\"onIncrementalIntersection($event.intersect)\">\n @if (loadingNextRecords) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n <span>{{ incrementalLoadingLabel }}</span>\n }\n </div>\n }\n\n @if (showIncrementalButtonTrigger) {\n <button mat-button color=\"primary\" [disabled]=\"loadingNextRecords\" (click)=\"loadNextIncrementalPage()\">\n @if (loadingNextRecords) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n <span>{{ incrementalLoadingLabel }}</span>\n } @else {\n <span>{{ incrementalLoadMoreLabel }}</span>\n }\n </button>\n }\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: true\"></tr>\n\n <tr\n mat-row\n *matRowDef=\"let row; columns: displayedColumns\"\n [class.has-click]=\"options.actions?.rowClick\"\n [class.is-disabled]=\"row | includedIn: disabledRows\"\n (click)=\"rowClick(row)\"></tr>\n\n <ng-container *ngIf=\"options.expandedDetailContentId\">\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"detail-row\"></tr>\n </ng-container>\n\n <tr\n mat-footer-row\n *matFooterRowDef=\"incrementalRowColumns\"\n class=\"incremental-row\"\n [class.is-hidden]=\"!showIncrementalRow\"></tr>\n\n <tr class=\"mat-row\" *matNoDataRow>\n <td [attr.colspan]=\"displayedColumns.length\">\n <div id=\"no-data\">\n <span id=\"no-data-label\"> {{ datatableIntl.noDateLabel }}</span>\n </div>\n </td>\n </tr>\n </table>\n </div>\n\n <mat-paginator\n *ngIf=\"loadMode === 'pagination'\"\n id=\"paginator\"\n [length]=\"dataSource.recordsFiltered\"\n [pageSizeOptions]=\"paginationPageSizeOptions\"\n [pageSize]=\"paginationPageSize\"\n [showFirstLastButtons]=\"true\">\n </mat-paginator>\n </div>\n}\n\n<div id=\"loading\" *ngIf=\"!dataSource || (dataSource.loading$ | async)\" @fade>\n <ng-content select=\"[loader-spinner]\">\n <mat-spinner loader-spinner></mat-spinner>\n </ng-content>\n</div>\n\n<ng-template #headTmpl>\n @let hasColumnDisplay =\n options.actions?.columns?.hideAndShow || options.actions?.columns?.sticky || options.actions?.columns?.reorder;\n @let hasHead =\n !!options.title ||\n !!options.facets?.length ||\n !!options.actions?.user?.length ||\n hasColumnDisplay ||\n options.actions?.export ||\n options.actions?.refresh ||\n showRecordsCount;\n <div *ngIf=\"hasHead\" id=\"head\" #head>\n <div id=\"head-start\">\n <span *ngIf=\"options.title\" id=\"title\" [innerHTML]=\"options.title\"></span>\n\n @for (facetOptions of options.facets | filter: { position: 'start' }; track facetOptions) {\n <ng-container *ngTemplateOutlet=\"facetsTmpl; context: { facetOptions }\"></ng-container>\n }\n @for (action of options.actions?.user | filter: { position: 'start' }; track action) {\n <ng-container *ngTemplateOutlet=\"actionTmpl; context: { action }\"></ng-container>\n }\n </div>\n\n <div id=\"head-center\">\n @for (facetOptions of options.facets | filter: { position: 'center' }; track facetOptions) {\n <ng-container *ngTemplateOutlet=\"facetsTmpl; context: { facetOptions }\"></ng-container>\n }\n @for (action of options.actions?.user | filter: { position: 'center' }; track action) {\n <ng-container *ngTemplateOutlet=\"actionTmpl; context: { action }\"></ng-container>\n }\n </div>\n\n <div id=\"head-end\">\n @for (facetOptions of options.facets | filter: { position: 'end' }; track facetOptions) {\n <ng-container *ngTemplateOutlet=\"facetsTmpl; context: { facetOptions }\"></ng-container>\n }\n @for (action of options.actions?.user | filter: { position: 'end' }; track action) {\n <ng-container *ngTemplateOutlet=\"actionTmpl; context: { action }\"></ng-container>\n }\n\n @if (hasColumnDisplay) {\n <div class=\"action\">\n <button\n mat-icon-button\n color=\"primary\"\n class=\"icon-only action\"\n [matTooltip]=\"options.actions?.columns?.tooltip || 'Afficher / masquer des colonnes'\"\n [matMenuTriggerFor]=\"columnsMenu\"\n (menuOpened)=\"openUpdateColumnDisplay()\"\n (menuClosed)=\"closeUpdateColumnDisplay()\">\n <mat-icon>view_column</mat-icon>\n </button>\n </div>\n }\n\n @if (options.actions?.export) {\n <div class=\"action\">\n <button mat-icon-button color=\"primary\" [disabled]=\"exporting\" (click)=\"export()\">\n <mat-icon>download</mat-icon>\n </button>\n <div class=\"action-loader\" *ngIf=\"exporting\" @fade>\n <mat-spinner [diameter]=\"32\"></mat-spinner>\n </div>\n </div>\n }\n\n @if (options.actions?.refresh) {\n <div class=\"action\">\n <button mat-icon-button color=\"primary\" [disabled]=\"dataSource.loading$ | async\" (click)=\"loadPage()\">\n <mat-icon>sync</mat-icon>\n </button>\n <div class=\"action-loader\" *ngIf=\"dataSource.loading$ | async\" @fade>\n <mat-spinner [diameter]=\"32\"></mat-spinner>\n </div>\n </div>\n }\n\n @if (showRecordsCount) {\n <div id=\"records-count\">\n <span\n [countUp]=\"displayedRecordsCount\"\n [options]=\"datatableIntl.numberOptions\"\n [reanimateOnClick]=\"false\"></span>\n / {{ totalRecordsCount }}\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n<mat-menu #columnsMenu=\"matMenu\" class=\"datatable-columns-menu\">\n <div\n id=\"column-options\"\n cdkDropList\n has-handle\n [cdkDropListDisabled]=\"!options.actions?.columns?.reorder\"\n (cdkDropListDropped)=\"reorderColumns($event)\">\n @for (column of updateColumns; track column) {\n @if (['_select', '_rownumber'].includes(column.header)) {\n <div mat-list-item cdkDrag></div>\n } @else {\n <div class=\"column-options-item\" mat-list-item cdkDrag (click)=\"$event.stopPropagation()\">\n <button\n *ngIf=\"options.actions?.columns?.hideAndShow\"\n mat-icon-button\n size=\"small\"\n color=\"primary\"\n [class]=\"column.hidden ? 'toggle-off' : 'toggle-on'\"\n (click)=\"column.hidden = !column.hidden\"\n [style.margin-right.px]=\"8\">\n <mat-icon>\n @if (!column.hidden) {\n visibility\n } @else {\n visibility_off\n }\n </mat-icon>\n </button>\n <button\n *ngIf=\"options.actions?.columns?.sticky\"\n mat-icon-button\n size=\"small\"\n color=\"primary\"\n [class]=\"column.sticky ? 'toggle-on' : 'toggle-off'\"\n (click)=\"column.sticky = !column.sticky\"\n [style.margin-right.px]=\"8\">\n <mat-icon>push_pin </mat-icon>\n </button>\n <span [style.margin-right.px]=\"8\" [innerHTML]=\"column.header\"></span>\n <mat-icon\n *ngIf=\"options.actions?.columns?.reorder\"\n size=\"small\"\n class=\"handle\"\n cdkDragHandle\n [style.margin]=\"'0 8px 0 auto'\">\n open_with\n </mat-icon>\n </div>\n }\n }\n </div>\n</mat-menu>\n\n<ng-template #headerTmpl let-column=\"column\">\n <div class=\"header-container\" [matTooltip]=\"column.tooltip\">\n <div class=\"header\" [formGroup]=\"searchFormGroup\">\n @if (column.searchable) {\n @switch (column.type) {\n @case ('text') {\n <lib-header-text-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-text-filter>\n }\n @case ('number') {\n <lib-header-number-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-number-filter>\n }\n @case ('select') {\n <lib-header-select-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-select-filter>\n }\n @case ('autocomplete') {\n <lib-header-autocomplete-filter\n [column]=\"column\"\n [formControlName]=\"column.columnDef\"></lib-header-autocomplete-filter>\n }\n @case ('checkbox') {\n <lib-header-checkbox-filter\n [column]=\"column\"\n [formControlName]=\"column.columnDef\"></lib-header-checkbox-filter>\n }\n @case ('date') {\n <lib-header-date-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-date-filter>\n }\n @case ('duration') {\n <lib-header-duration-filter\n [column]=\"column\"\n [formControlName]=\"column.columnDef\"></lib-header-duration-filter>\n }\n @default {\n <span>{{ column.header }}</span>\n }\n }\n } @else {\n <span>{{ column.header }}</span>\n }\n <ng-container *ngTemplateOutlet=\"headerActionsTmpl; context: { column }\"></ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #headerActionsTmpl let-column=\"column\">\n <div class=\"header-actions\">\n <ng-container *ngIf=\"column.sortable\">\n <button\n class=\"sort-btn\"\n mat-icon-button\n size=\"small\"\n (click)=\"sortColumn(column)\"\n [matBadgeHidden]=\"!column.order\"\n [matBadge]=\"column.order?.index + 1\">\n @switch (column.order?.dir) {\n @case ('asc') {\n <mat-icon size=\"small\">arrow_upward</mat-icon>\n }\n @case ('desc') {\n <mat-icon size=\"small\">arrow_downward</mat-icon>\n }\n @default {\n <mat-icon size=\"small\">sort</mat-icon>\n }\n }\n </button>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #cellTmpl let-column=\"column\" let-row=\"row\">\n @defer (on viewport) {\n <div\n class=\"cell\"\n [@.disabled]=\"!!options.disableRowAnimation\"\n @fade\n [style.place-content]=\"column.align\"\n [style.max-height.px]=\"options.rowMaxHeight\">\n @let value = row | get: column.property;\n @if (column.cellComponent) {\n <ng-container *ngComponentOutlet=\"column.cellComponent; inputs: { column, row, value }\" />\n } @else if (column.cellContentId) {\n @let cell = contentRefs | findContent: column.cellContentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else {\n @if (column.prefixContentId) {\n @let cell = contentRefs | findContent: column.prefixContentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else if (column.prefixComponent) {\n <ng-container *ngComponentOutlet=\"column.prefixComponent; inputs: { column, row, value }\" />\n } @else if (column.prefixFunction) {\n <span [outerHTML]=\"value | valueFunction: column.prefixFunction : row : column | safeHtml\"></span>\n } @else if (column.prefix) {\n <span [outerHTML]=\"column.prefix | safeHtml\"></span>\n }\n\n @switch (column.type) {\n @case ('number') {\n <lib-cell-number-value [column]=\"column\" [row]=\"row\"></lib-cell-number-value>\n }\n @case ('select') {\n <lib-cell-select-value [column]=\"column\" [row]=\"row\"></lib-cell-select-value>\n }\n @case ('checkbox') {\n <lib-cell-checkbox-value [column]=\"column\" [row]=\"row\"></lib-cell-checkbox-value>\n }\n @case ('date') {\n <lib-cell-date-value [column]=\"column\" [row]=\"row\"></lib-cell-date-value>\n }\n @case ('duration') {\n <lib-cell-duration-value [column]=\"column\" [row]=\"row\"></lib-cell-duration-value>\n }\n @default {\n <span [outerHTML]=\"(value | transform: row : column) ?? '' | safeHtml\"></span>\n }\n }\n\n @if (column.suffixContentId) {\n @let cell = contentRefs | findContent: column.suffixContentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else if (column.suffixComponent) {\n <ng-container *ngComponentOutlet=\"column.suffixComponent; inputs: { column, row, value }\" />\n } @else if (column.suffixFunction) {\n <span [outerHTML]=\"value | valueFunction: column.suffixFunction : row : column | safeHtml\"></span>\n } @else if (column.suffix) {\n <span [outerHTML]=\"column.suffix | safeHtml\"></span>\n }\n }\n </div>\n } @placeholder {\n <div class=\"cell\"></div>\n }\n</ng-template>\n\n<ng-template #actionTmpl let-action=\"action\">\n @if (!action.isHidden) {\n @switch (action.kind) {\n @case ('icon') {\n <div class=\"action user-action\" [matTooltip]=\"action.tooltip\">\n <button\n [style.--action-color]=\"action.color\"\n mat-icon-button\n (click)=\"action.onclick(this)\"\n [disabled]=\"!!action.isDisabled\">\n <mat-icon>{{ action.icon }}</mat-icon>\n </button>\n </div>\n }\n @case ('template') {\n <div class=\"action user-action\">\n @let content = contentRefs | findContent: action.contentId;\n @if (content) {\n <ng-container *ngTemplateOutlet=\"content.templateRef; context: { datatable: this, action }\" />\n }\n </div>\n }\n }\n }\n</ng-template>\n\n<ng-template #facetsTmpl let-facetOptions=\"facetOptions\">\n @let column = options.columns | find: { columnDef: facetOptions.columnDef };\n @let data = (dataSource.facets ?? {})[facetOptions.id] | sortFacetEntries: facetOptions.options;\n @if (data) {\n @if (facetOptions.contentId) {\n @let cell = contentRefs | findContent: facetOptions.contentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, facetOptions, data }\" />\n }\n } @else {\n @switch (facetOptions.display) {\n @case ('chips') {\n <ng-container *ngTemplateOutlet=\"facetsChipsTmpl; context: { column, data, facetOptions }\"></ng-container>\n }\n @default {\n <ng-container\n *ngTemplateOutlet=\"facetsProgressSpinnersTmpl; context: { column, data, facetOptions }\"></ng-container>\n }\n }\n }\n }\n</ng-template>\n\n<ng-template #facetsChipsTmpl let-column=\"column\" let-data=\"data\" let-facetOptions=\"facetOptions\">\n @let size = facetOptions.size;\n @let fontSize = facetOptions.fontSize ?? '1em';\n <!-- @let total = (data | sum: 'value') || 1; -->\n <mat-chip-set class=\"chips-facet\">\n @for (d of data | orderBy: '_id'; track d) {\n @let option = facetOptions?.option ? facetOptions.option(d) : (facetOptions.options | find: { value: d._id });\n @let name = option?.name ?? d._id;\n @let color = option?.color ?? 'var(--mat-sys-primary)';\n @let labelColor = option?.labelColor;\n <!-- @let percent = (d.value / total) * 100; -->\n <mat-chip\n class=\"chip-facet\"\n [class.has-action]=\"column?.searchable !== false\"\n (click)=\"facetClick(column, d, option)\"\n [style.--facet-color]=\"color\"\n [style.--facet-label-color]=\"labelColor ?? 'var(--mat-sys-on-primary)'\"\n [style.--facet-value-color]=\"labelColor ?? color\"\n [style.width.px]=\"size\">\n <div class=\"chip-facet-content\" [style.font-size.px]=\"fontSize\">\n <div class=\"chip-facet-key\">{{ name }}</div>\n <div class=\"chip-facet-value\">{{ d.value | number: '0.0-2' }}</div>\n </div>\n </mat-chip>\n }\n </mat-chip-set>\n</ng-template>\n\n<ng-template #facetsProgressSpinnersTmpl let-column=\"column\" let-data=\"data\" let-facetOptions=\"facetOptions\">\n @let size = facetOptions.size ?? 80;\n @let fontSize = facetOptions.fontSize ?? '1em';\n @let total = (data | sum: 'value') || 1;\n <mat-card class=\"facet\">\n @if (facetOptions.name) {\n <mat-card-header>\n <mat-card-title>{{ facetOptions.name }}</mat-card-title>\n </mat-card-header>\n }\n <mat-card-content>\n @for (d of data; track d) {\n @let option = facetOptions?.option ? facetOptions.option(d) : (facetOptions.options | find: { value: d._id });\n @let name = option?.name ?? d._id;\n @let color = option?.color ?? 'var(--mat-sys-primary)';\n @let percent = (d.value / total) * 100;\n <div\n class=\"facet-indicator\"\n [class.has-action]=\"column?.searchable !== false\"\n (click)=\"facetClick(column, d, option)\">\n <lib-progress-spinner [diameter]=\"size\" [color]=\"color\" [fontSize]=\"fontSize\" [value]=\"percent\">\n <mat-label>{{ name }}</mat-label>\n </lib-progress-spinner>\n <mat-label\n class=\"facet-indicator-label\"\n [style.font-size]=\"fontSize\"\n [countUp]=\"d.value\"\n [options]=\"datatableIntl.numberOptions\"\n [reanimateOnClick]=\"false\">\n {{ d.value | number: '0.0-2' }}\n </mat-label>\n </div>\n }\n </mat-card-content>\n </mat-card>\n</ng-template>\n", styles: [":host{display:flex;position:relative;max-height:100%;--datatable-background: var(--ngx-mat-datatable-background, #ffffff);--datatable-color: var(--ngx-mat-datatable-color, var(--mat-sys-primary,));--datatable-border-color: var(--ngx-mat-datatable-border-color, #ccc);--datatable-sticky-top: var(--ngx-mat-datatable-sticky-top, 0);--datatable-sticky-background: var(--ngx-mat-datatable-sticky-background, var(--datatable-background));--datatable-sticky-border: var(--ngx-mat-datatable-sticky-border, 1px dashed #e6a93a)}:host{--mat-table-background-color: var(--datatable-background)}:host{--mat-table-header-headline-color: var(--datatable-color)}:host{--mat-table-row-item-label-text-color: var(--datatable-color)}#container{display:flex;flex:1 1 100%;box-sizing:border-box;flex-direction:column;position:relative;width:100%;background-color:var(--datatable-background)}#head{width:100%;display:flex;box-sizing:border-box;place-content:end space-between;align-items:end;flex-direction:row;border-bottom:1px solid var(--datatable-border-color)}#head #head-start,#head #head-center,#head #head-end{display:flex;box-sizing:border-box;align-items:end;flex-direction:row}#head #head-start{place-content:end start}#head #head-center{place-content:end center}#head #head-end{place-content:end end}#head .action{position:relative}#head .action .action-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#head .action.user-action .mat-mdc-icon-button{--mdc-icon-button-icon-color: var(--action-color, var(--mat-sys-primary))}#head #records-count{min-width:72px;padding:0 8px;color:var(--datatable-color);font-size:14px;line-height:48px;text-align:right;white-space:nowrap}#column-options .column-options-item{overflow:hidden;display:flex;box-sizing:border-box;align-items:center;flex-direction:row;place-content:center start}#column-options .column-options-item button.toggle-off{--mdc-icon-button-icon-color: var(--mdc-icon-button-disabled-icon-color)}#column-options .column-options-item mat-icon.handle{color:var(--mdc-icon-button-disabled-icon-color)}#table-container{flex:1 1 100%;overflow-y:var(--datatable-container-overflow-y, \"inherit\");overflow-x:var(--datatable-container-overflow-x, \"inherit\");width:100%;scrollbar-width:thin}#table{width:100%;max-height:100%;--mat-table-background-color: var(--datatable-background);--mat-table-row-item-outline-color: var(--datatable-border-color)}#table ::ng-deep .mat-mdc-table-sticky{top:var(--datatable-sticky-top)!important;opacity:1;background:var(--datatable-sticky-background, var(--datatable-background, #ffffff))}#table ::ng-deep .mat-mdc-table-sticky.mat-mdc-table-sticky-border-elem-left{border-right:var(--datatable-sticky-border)}#table ::ng-deep .mat-mdc-header-cell{padding:0 8px}#table ::ng-deep .mat-mdc-header-cell mat-form-field{min-width:auto;flex:1 1 100%}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mat-form-field-state-layer-color: var(--datatable-background)}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mdc-filled-text-field-container-color: var(--datatable-background)}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mdc-filled-text-field-container-shape: 0}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mat-form-field-hover-state-layer-opacity: 0}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mdc-filled-text-field-active-indicator-color: #999}#table ::ng-deep .mat-mdc-header-cell mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}#table ::ng-deep .mat-mdc-header-cell mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}#table ::ng-deep .mat-mdc-cell{padding:0 8px}#table ::ng-deep .mat-mdc-footer-row.incremental-row{height:44px}#table ::ng-deep .mat-mdc-footer-row.incremental-row.is-hidden{display:none}#table ::ng-deep .mat-mdc-footer-row.incremental-row .mat-mdc-footer-cell{padding:0;border-bottom-color:var(--mat-table-row-item-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .12)));border-bottom-width:var(--mat-table-row-item-outline-width, 1px);border-bottom-style:solid}#table ::ng-deep .mat-mdc-row.has-click:not(.is-disabled){cursor:pointer}#table ::ng-deep .mat-mdc-row.has-click:not(.is-disabled):hover .mat-mdc-cell{--datatable-hover-color: var(--ngx-mat-datatable-hover-color, var(--mat-sys-on-primary));--datatable-hover-bgcolor: var(--ngx-mat-datatable-hover-bgcolor, var(--mat-sys-primary));color:var(--datatable-hover-color)!important;background-color:var(--datatable-hover-bgcolor)!important}#table ::ng-deep .mat-mdc-row.is-disabled .mat-mdc-cell{opacity:.2}#table ::ng-deep .mat-mdc-row:last-child .mat-mdc-cell{border-bottom-color:var(--mat-table-row-item-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .12)));border-bottom-width:var(--mat-table-row-item-outline-width, 1px);border-bottom-style:solid}#table .header-container{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;width:100%;min-height:var(--mat-form-field-container-height, 56px);margin:6px 0}#table .header{width:100%;display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row}#table .header .header-actions .sort-btn{--mat-badge-container-size: 12px;--mat-badge-line-height: 16px;--mat-badge-text-size: 10px;--mat-badge-legacy-container-size: 18px}#table .cell{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;width:100%}#table .cell>*{display:inline-flex}#table .incremental-load-row{position:sticky;left:0;display:flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row;gap:8px;min-height:44px;width:var(--datatable-container-width, 100%);max-width:var(--datatable-container-width, 100%);color:var(--datatable-color);pointer-events:none}#table .incremental-sentinel,#table .incremental-load-row button{pointer-events:auto}#table .incremental-sentinel{display:inline-flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row;gap:8px;min-height:44px}#table .incremental-load-row button{display:inline-flex;align-items:center;gap:8px}#paginator{--mat-paginator-container-background-color: var(--datatable-background);--mat-form-field-container-height: 24px;--mat-form-field-container-vertical-padding: 4px;--mat-paginator-container-size: 46px;border-top:1px solid var(--datatable-border-color)}#paginator ::ng-deep .mat-mdc-select{display:flex;height:24px}#paginator ::ng-deep .mat-mdc-paginator-touch-target{height:24px}#paginator ::ng-deep .mat-mdc-paginator-range-actions button{--mdc-icon-button-state-layer-size: 36px;padding:6px}#loading{position:absolute;z-index:200;inset:0;background-color:#00000029;display:flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row}::ng-deep .mat-mdc-icon-button[mat-icon-button][size=small]{--mdc-icon-button-state-layer-size: 30px;--mdc-icon-button-icon-size: 18px}::ng-deep .mat-mdc-icon-button[mat-icon-button][size=small] .mat-mdc-button-touch-target{height:36px;width:36px}::ng-deep .mat-mdc-icon-button[mat-icon-button][size=small] mat-icon{height:18px;width:18px;font-size:18px}.row{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}.element-detail{background:#f5f5f5;overflow:hidden;display:flex}#no-data{position:sticky;width:fit-content;left:50%}#no-data #no-data-label{position:relative;margin-left:-50%}.facet{margin:8px;--mdc-elevated-card-container-color: transparent}.facet mat-card-content{display:flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row;flex-wrap:wrap;padding:4px}.facet .facet-indicator{display:flex;box-sizing:border-box;flex-direction:column;place-content:center center;align-items:center;position:relative;margin:4px}.facet .facet-indicator.has-action{cursor:pointer}.facet .facet-indicator .facet-indicator-label{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1em;padding:2px}.chips-facet{margin-right:8px}.chips-facet .chip-facet{overflow:hidden}.chips-facet .chip-facet{--mdc-chip-label-text-color: var(--facet-color)}.chips-facet .chip-facet{--mdc-chip-outline-color: var(--facet-color)}.chips-facet .chip-facet{--mdc-chip-elevated-container-color: var(--facet-color)}.chips-facet .chip-facet.has-action{cursor:pointer}.chips-facet .chip-facet ::ng-deep .mat-mdc-chip-action,.chips-facet .chip-facet ::ng-deep .mat-mdc-standard-chip{cursor:inherit;padding:0}.chips-facet .chip-facet ::ng-deep .mat-mdc-chip-action-label{height:100%;width:100%}.chips-facet .chip-facet .chip-facet-content{display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row;height:100%;width:100%}.chips-facet .chip-facet .chip-facet-content .chip-facet-key,.chips-facet .chip-facet .chip-facet-content .chip-facet-value{height:100%;padding-left:8px;padding-right:8px;display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row}.chips-facet .chip-facet .chip-facet-content .chip-facet-key{background-color:var(--mdc-chip-label-text-color);color:var(--facet-label-color, var(--mdc-chip-elevated-container-color))}.chips-facet .chip-facet .chip-facet-content .chip-facet-value{color:var(--facet-value-color, var(--mdc-chip-label-text-color))}\n"], dependencies: [{ kind: "pipe", type: CellColorPipe, name: "cellColor" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "pipe", type: FindContentPipe, name: "findContent" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "component", type: HeaderAutocompleteFilterComponent, selector: "lib-header-autocomplete-filter", inputs: ["column"] }, { kind: "component", type: HeaderCheckboxFilterComponent, selector: "lib-header-checkbox-filter", inputs: ["column"] }, { kind: "component", type: HeaderDateFilterComponent, selector: "lib-header-date-filter", inputs: ["column"] }, { kind: "component", type: HeaderDurationFilterComponent, selector: "lib-header-duration-filter", inputs: ["column"] }, { kind: "component", type: HeaderNumberFilterComponent, selector: "lib-header-number-filter", inputs: ["column"] }, { kind: "component", type: HeaderSelectFilterComponent, selector: "lib-header-select-filter", inputs: ["column"] }, { kind: "component", type: HeaderTextFilterComponent, selector: "lib-header-text-filter", inputs: ["column"] }, { kind: "ngmodule", type: IntersectionObserverModule }, { kind: "directive", type: i3.IntersectionObserverDirective, selector: "[intersectionObserver]", inputs: ["visitClass", "leaveClass", "removeVisitClass", "removeLeaveClass", "useScroll", "threshold", "autoRemove"], outputs: ["intersection"] }, { kind: "ngmodule", type: MatBadgeModule }, { kind: "directive", type: i5$2.MatBadge, selector: "[matBadge]", inputs: ["matBadgeColor", "matBadgeOverlap", "matBadgeDisabled", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i9.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i9.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i10$1.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1$3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i12.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i12.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i12.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i12.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i12.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i12.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i12.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i12.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i12.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i12.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i12.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i12.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i12.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i12.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i12.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i13.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "component", type: i13.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i14.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: BackgroundColorPipe, name: "backgroundColor" }, { kind: "pipe", type: FilterPipe, name: "filter" }, { kind: "pipe", type: SumPipe, name: "sum" }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i15.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i15.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i15.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i15.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "ngmodule", type: CountUpModule }, { kind: "directive", type: i3$3.CountUpDirective, selector: "[countUp]", inputs: ["countUp", "options", "reanimateOnClick"], outputs: ["complete"] }, { kind: "component", type: ProgressSpinnerComponent, selector: "lib-progress-spinner", inputs: ["diameter", "value", "color", "displayValue", "fontSize", "animateInView", "delay"] }, { kind: "pipe", type: FindPipe, name: "find" }, { kind: "pipe", type: OrderByPipe, name: "orderBy" }, { kind: "pipe", type: SortFacetEntriesPipe, name: "sortFacetEntries" }, { kind: "pipe", type: IncludedInPipe, name: "includedIn" }, { kind: "pipe", type: CellOpacityPipe, name: "cellOpacity" }], animations: [
2218
+ trigger('fade', [
2219
+ transition(':enter', [
2220
+ style({ opacity: 0 }), // initial
2221
+ animate('0.2s', style({ opacity: 1 })), // final
2222
+ ]),
2223
+ transition(':leave', [
2224
+ style({ opacity: 1 }), // initial
2225
+ animate('0.2s', style({ opacity: 0 })), // final
2226
+ ]),
2227
+ ]),
2228
+ trigger('detailExpand', [
2229
+ state('collapsed', style({ height: '0px', minHeight: '0' })),
2230
+ state('expanded', style({ height: '*' })),
2231
+ transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
2232
+ ]),
2233
+ ], deferBlockDependencies: [() => [import('./eherve-angular-material-datatable-cell-checkbox-value.component-S50hGDg_.mjs').then(m => m.CellCheckboxValueComponent), import('./eherve-angular-material-datatable-cell-date-value.component-vnUf6Ote.mjs').then(m => m.CellDateValueComponent), import('./eherve-angular-material-datatable-cell-duration-value.component-D9-H5i7b.mjs').then(m => m.CellDurationValueComponent), import('./eherve-angular-material-datatable-cell-number-value.component-BQIdn-qP.mjs').then(m => m.CellNumberValueComponent), import('./eherve-angular-material-datatable-cell-select-value.component-Jm7hTiyB.mjs').then(m => m.CellSelectValueComponent), i1$1.NgComponentOutlet, i1$1.NgTemplateOutlet, import('./eherve-angular-material-datatable-transform.pipe-BOmcXXZU.mjs').then(m => m.TransformPipe), FindContentPipe, import('./eherve-angular-material-datatable-get.pipe-DrZTHXsm.mjs').then(m => m.GetPipe), Promise.resolve().then(function () { return safeHtml_pipe; }).then(m => m.SafeHtmlPipe), import('./eherve-angular-material-datatable-suffix-function.pipe-CQO-ghpR.mjs').then(m => m.ValueFunctionPipe)]] });
2234
+ }
2235
+ i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableComponent, resolveDeferredDeps: () => [import('./eherve-angular-material-datatable-cell-checkbox-value.component-S50hGDg_.mjs').then(m => m.CellCheckboxValueComponent), import('./eherve-angular-material-datatable-cell-date-value.component-vnUf6Ote.mjs').then(m => m.CellDateValueComponent), import('./eherve-angular-material-datatable-cell-duration-value.component-D9-H5i7b.mjs').then(m => m.CellDurationValueComponent), import('./eherve-angular-material-datatable-cell-number-value.component-BQIdn-qP.mjs').then(m => m.CellNumberValueComponent), import('./eherve-angular-material-datatable-cell-select-value.component-Jm7hTiyB.mjs').then(m => m.CellSelectValueComponent), import('./eherve-angular-material-datatable-transform.pipe-BOmcXXZU.mjs').then(m => m.TransformPipe), import('./eherve-angular-material-datatable-get.pipe-DrZTHXsm.mjs').then(m => m.GetPipe), Promise.resolve().then(function () { return safeHtml_pipe; }).then(m => m.SafeHtmlPipe), import('./eherve-angular-material-datatable-suffix-function.pipe-CQO-ghpR.mjs').then(m => m.ValueFunctionPipe)], resolveMetadata: (CellCheckboxValueComponent, CellDateValueComponent, CellDurationValueComponent, CellNumberValueComponent, CellSelectValueComponent, TransformPipe, GetPipe, SafeHtmlPipe, ValueFunctionPipe) => ({ decorators: [{
2236
+ type: Component,
2237
+ args: [{ imports: [
2238
+ CellCheckboxValueComponent,
2239
+ CellDateValueComponent,
2240
+ CellDurationValueComponent,
2241
+ CellNumberValueComponent,
2242
+ CellSelectValueComponent,
2243
+ CellColorPipe,
2244
+ CommonModule,
2245
+ TransformPipe,
2246
+ DragDropModule,
2247
+ FindContentPipe,
2248
+ FormsModule,
2249
+ GetPipe,
2250
+ HeaderAutocompleteFilterComponent,
2251
+ HeaderCheckboxFilterComponent,
2252
+ HeaderDateFilterComponent,
2253
+ HeaderDurationFilterComponent,
2254
+ HeaderNumberFilterComponent,
2255
+ HeaderSelectFilterComponent,
2256
+ HeaderTextFilterComponent,
2257
+ IntersectionObserverModule,
2258
+ MatBadgeModule,
2259
+ MatButtonModule,
2260
+ MatFormFieldModule,
2261
+ MatIconModule,
2262
+ MatMenuModule,
2263
+ MatPaginatorModule,
2264
+ MatProgressSpinnerModule,
2265
+ MatTableModule,
2266
+ MatChipsModule,
2267
+ ReactiveFormsModule,
2268
+ SafeHtmlPipe,
2269
+ MatTooltipModule,
2270
+ BackgroundColorPipe,
2271
+ FilterPipe,
2272
+ SumPipe,
2273
+ MatCardModule,
2274
+ CountUpModule,
2275
+ ProgressSpinnerComponent,
2276
+ FindPipe,
2277
+ OrderByPipe,
2278
+ SortFacetEntriesPipe,
2279
+ ValueFunctionPipe,
2280
+ IncludedInPipe,
2281
+ CellOpacityPipe,
2282
+ ], providers: [{ provide: MatPaginatorIntl, useClass: NgxMatDatatablePaginatorIntl }], selector: 'ngx-mat-datatable', animations: [
2283
+ trigger('fade', [
2284
+ transition(':enter', [
2285
+ style({ opacity: 0 }), // initial
2286
+ animate('0.2s', style({ opacity: 1 })), // final
2287
+ ]),
2288
+ transition(':leave', [
2289
+ style({ opacity: 1 }), // initial
2290
+ animate('0.2s', style({ opacity: 0 })), // final
2291
+ ]),
2292
+ ]),
2293
+ trigger('detailExpand', [
2294
+ state('collapsed', style({ height: '0px', minHeight: '0' })),
2295
+ state('expanded', style({ height: '*' })),
2296
+ transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
2297
+ ]),
2298
+ ], template: "<!-- @format -->\n\n@if (dataSource) {\n <div #container id=\"container\">\n <ng-container *ngTemplateOutlet=\"headTmpl\"></ng-container>\n\n <div id=\"table-container\" intersectionObserver (intersection)=\"load($event.intersect)\">\n <table id=\"table\" #table mat-table [fixedLayout]=\"false\" [dataSource]=\"dataSource\" multiTemplateDataRows>\n @for (column of options.columns; track column) {\n <ng-container [matColumnDef]=\"column.columnDef\" [sticky]=\"column.sticky\">\n <th\n mat-header-cell\n *matHeaderCellDef\n [class.searchable]=\"column.searchable\"\n [style.min-width.px]=\"column.minWidth || options.columnMinWith\">\n <ng-container *ngTemplateOutlet=\"headerTmpl; context: { column }\"></ng-container>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n [style.min-width.px]=\"column.minWidth || options.columnMinWith\"\n [style.color]=\"row | cellColor: column : options\"\n [style.opacity]=\"row | cellOpacity: column : options\"\n [style.background-color]=\"row | backgroundColor: column : options\">\n <ng-container *ngTemplateOutlet=\"cellTmpl; context: { column, row }\"></ng-container>\n </td>\n </ng-container>\n }\n\n <ng-container *ngIf=\"options.expandedDetailContentId\" matColumnDef=\"expandedDetail\">\n <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"options.columns.length\">\n @let content = contentRefs | findContent: options.expandedDetailContentId;\n <div *ngIf=\"content\" class=\"element-detail\" [@detailExpand]=\"row == expandedRow ? 'expanded' : 'collapsed'\">\n <ng-container *ngTemplateOutlet=\"content.templateRef; context: { row }\"> </ng-container>\n </div>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"_incrementalLoad\">\n <td mat-footer-cell *matFooterCellDef [attr.colspan]=\"visibleColumnsColspan\">\n <div class=\"incremental-load-row\">\n @if (showIncrementalInViewTrigger) {\n <div\n class=\"incremental-sentinel\"\n intersectionObserver\n (intersection)=\"onIncrementalIntersection($event.intersect)\">\n @if (loadingNextRecords) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n <span>{{ incrementalLoadingLabel }}</span>\n }\n </div>\n }\n\n @if (showIncrementalButtonTrigger) {\n <button mat-button color=\"primary\" [disabled]=\"loadingNextRecords\" (click)=\"loadNextIncrementalPage()\">\n @if (loadingNextRecords) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n <span>{{ incrementalLoadingLabel }}</span>\n } @else {\n <span>{{ incrementalLoadMoreLabel }}</span>\n }\n </button>\n }\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: true\"></tr>\n\n <tr\n mat-row\n *matRowDef=\"let row; columns: displayedColumns\"\n [class.has-click]=\"options.actions?.rowClick\"\n [class.is-disabled]=\"row | includedIn: disabledRows\"\n (click)=\"rowClick(row)\"></tr>\n\n <ng-container *ngIf=\"options.expandedDetailContentId\">\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"detail-row\"></tr>\n </ng-container>\n\n <tr\n mat-footer-row\n *matFooterRowDef=\"incrementalRowColumns\"\n class=\"incremental-row\"\n [class.is-hidden]=\"!showIncrementalRow\"></tr>\n\n <tr class=\"mat-row\" *matNoDataRow>\n <td [attr.colspan]=\"displayedColumns.length\">\n <div id=\"no-data\">\n <span id=\"no-data-label\"> {{ datatableIntl.noDateLabel }}</span>\n </div>\n </td>\n </tr>\n </table>\n </div>\n\n <mat-paginator\n *ngIf=\"loadMode === 'pagination'\"\n id=\"paginator\"\n [length]=\"dataSource.recordsFiltered\"\n [pageSizeOptions]=\"paginationPageSizeOptions\"\n [pageSize]=\"paginationPageSize\"\n [showFirstLastButtons]=\"true\">\n </mat-paginator>\n </div>\n}\n\n<div id=\"loading\" *ngIf=\"!dataSource || (dataSource.loading$ | async)\" @fade>\n <ng-content select=\"[loader-spinner]\">\n <mat-spinner loader-spinner></mat-spinner>\n </ng-content>\n</div>\n\n<ng-template #headTmpl>\n @let hasColumnDisplay =\n options.actions?.columns?.hideAndShow || options.actions?.columns?.sticky || options.actions?.columns?.reorder;\n @let hasHead =\n !!options.title ||\n !!options.facets?.length ||\n !!options.actions?.user?.length ||\n hasColumnDisplay ||\n options.actions?.export ||\n options.actions?.refresh ||\n showRecordsCount;\n <div *ngIf=\"hasHead\" id=\"head\" #head>\n <div id=\"head-start\">\n <span *ngIf=\"options.title\" id=\"title\" [innerHTML]=\"options.title\"></span>\n\n @for (facetOptions of options.facets | filter: { position: 'start' }; track facetOptions) {\n <ng-container *ngTemplateOutlet=\"facetsTmpl; context: { facetOptions }\"></ng-container>\n }\n @for (action of options.actions?.user | filter: { position: 'start' }; track action) {\n <ng-container *ngTemplateOutlet=\"actionTmpl; context: { action }\"></ng-container>\n }\n </div>\n\n <div id=\"head-center\">\n @for (facetOptions of options.facets | filter: { position: 'center' }; track facetOptions) {\n <ng-container *ngTemplateOutlet=\"facetsTmpl; context: { facetOptions }\"></ng-container>\n }\n @for (action of options.actions?.user | filter: { position: 'center' }; track action) {\n <ng-container *ngTemplateOutlet=\"actionTmpl; context: { action }\"></ng-container>\n }\n </div>\n\n <div id=\"head-end\">\n @for (facetOptions of options.facets | filter: { position: 'end' }; track facetOptions) {\n <ng-container *ngTemplateOutlet=\"facetsTmpl; context: { facetOptions }\"></ng-container>\n }\n @for (action of options.actions?.user | filter: { position: 'end' }; track action) {\n <ng-container *ngTemplateOutlet=\"actionTmpl; context: { action }\"></ng-container>\n }\n\n @if (hasColumnDisplay) {\n <div class=\"action\">\n <button\n mat-icon-button\n color=\"primary\"\n class=\"icon-only action\"\n [matTooltip]=\"options.actions?.columns?.tooltip || 'Afficher / masquer des colonnes'\"\n [matMenuTriggerFor]=\"columnsMenu\"\n (menuOpened)=\"openUpdateColumnDisplay()\"\n (menuClosed)=\"closeUpdateColumnDisplay()\">\n <mat-icon>view_column</mat-icon>\n </button>\n </div>\n }\n\n @if (options.actions?.export) {\n <div class=\"action\">\n <button mat-icon-button color=\"primary\" [disabled]=\"exporting\" (click)=\"export()\">\n <mat-icon>download</mat-icon>\n </button>\n <div class=\"action-loader\" *ngIf=\"exporting\" @fade>\n <mat-spinner [diameter]=\"32\"></mat-spinner>\n </div>\n </div>\n }\n\n @if (options.actions?.refresh) {\n <div class=\"action\">\n <button mat-icon-button color=\"primary\" [disabled]=\"dataSource.loading$ | async\" (click)=\"loadPage()\">\n <mat-icon>sync</mat-icon>\n </button>\n <div class=\"action-loader\" *ngIf=\"dataSource.loading$ | async\" @fade>\n <mat-spinner [diameter]=\"32\"></mat-spinner>\n </div>\n </div>\n }\n\n @if (showRecordsCount) {\n <div id=\"records-count\">\n <span\n [countUp]=\"displayedRecordsCount\"\n [options]=\"datatableIntl.numberOptions\"\n [reanimateOnClick]=\"false\"></span>\n / {{ totalRecordsCount }}\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n<mat-menu #columnsMenu=\"matMenu\" class=\"datatable-columns-menu\">\n <div\n id=\"column-options\"\n cdkDropList\n has-handle\n [cdkDropListDisabled]=\"!options.actions?.columns?.reorder\"\n (cdkDropListDropped)=\"reorderColumns($event)\">\n @for (column of updateColumns; track column) {\n @if (['_select', '_rownumber'].includes(column.header)) {\n <div mat-list-item cdkDrag></div>\n } @else {\n <div class=\"column-options-item\" mat-list-item cdkDrag (click)=\"$event.stopPropagation()\">\n <button\n *ngIf=\"options.actions?.columns?.hideAndShow\"\n mat-icon-button\n size=\"small\"\n color=\"primary\"\n [class]=\"column.hidden ? 'toggle-off' : 'toggle-on'\"\n (click)=\"column.hidden = !column.hidden\"\n [style.margin-right.px]=\"8\">\n <mat-icon>\n @if (!column.hidden) {\n visibility\n } @else {\n visibility_off\n }\n </mat-icon>\n </button>\n <button\n *ngIf=\"options.actions?.columns?.sticky\"\n mat-icon-button\n size=\"small\"\n color=\"primary\"\n [class]=\"column.sticky ? 'toggle-on' : 'toggle-off'\"\n (click)=\"column.sticky = !column.sticky\"\n [style.margin-right.px]=\"8\">\n <mat-icon>push_pin </mat-icon>\n </button>\n <span [style.margin-right.px]=\"8\" [innerHTML]=\"column.header\"></span>\n <mat-icon\n *ngIf=\"options.actions?.columns?.reorder\"\n size=\"small\"\n class=\"handle\"\n cdkDragHandle\n [style.margin]=\"'0 8px 0 auto'\">\n open_with\n </mat-icon>\n </div>\n }\n }\n </div>\n</mat-menu>\n\n<ng-template #headerTmpl let-column=\"column\">\n <div class=\"header-container\" [matTooltip]=\"column.tooltip\">\n <div class=\"header\" [formGroup]=\"searchFormGroup\">\n @if (column.searchable) {\n @switch (column.type) {\n @case ('text') {\n <lib-header-text-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-text-filter>\n }\n @case ('number') {\n <lib-header-number-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-number-filter>\n }\n @case ('select') {\n <lib-header-select-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-select-filter>\n }\n @case ('autocomplete') {\n <lib-header-autocomplete-filter\n [column]=\"column\"\n [formControlName]=\"column.columnDef\"></lib-header-autocomplete-filter>\n }\n @case ('checkbox') {\n <lib-header-checkbox-filter\n [column]=\"column\"\n [formControlName]=\"column.columnDef\"></lib-header-checkbox-filter>\n }\n @case ('date') {\n <lib-header-date-filter [column]=\"column\" [formControlName]=\"column.columnDef\"></lib-header-date-filter>\n }\n @case ('duration') {\n <lib-header-duration-filter\n [column]=\"column\"\n [formControlName]=\"column.columnDef\"></lib-header-duration-filter>\n }\n @default {\n <span>{{ column.header }}</span>\n }\n }\n } @else {\n <span>{{ column.header }}</span>\n }\n <ng-container *ngTemplateOutlet=\"headerActionsTmpl; context: { column }\"></ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #headerActionsTmpl let-column=\"column\">\n <div class=\"header-actions\">\n <ng-container *ngIf=\"column.sortable\">\n <button\n class=\"sort-btn\"\n mat-icon-button\n size=\"small\"\n (click)=\"sortColumn(column)\"\n [matBadgeHidden]=\"!column.order\"\n [matBadge]=\"column.order?.index + 1\">\n @switch (column.order?.dir) {\n @case ('asc') {\n <mat-icon size=\"small\">arrow_upward</mat-icon>\n }\n @case ('desc') {\n <mat-icon size=\"small\">arrow_downward</mat-icon>\n }\n @default {\n <mat-icon size=\"small\">sort</mat-icon>\n }\n }\n </button>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #cellTmpl let-column=\"column\" let-row=\"row\">\n @defer (on viewport) {\n <div\n class=\"cell\"\n [@.disabled]=\"!!options.disableRowAnimation\"\n @fade\n [style.place-content]=\"column.align\"\n [style.max-height.px]=\"options.rowMaxHeight\">\n @let value = row | get: column.property;\n @if (column.cellComponent) {\n <ng-container *ngComponentOutlet=\"column.cellComponent; inputs: { column, row, value }\" />\n } @else if (column.cellContentId) {\n @let cell = contentRefs | findContent: column.cellContentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else {\n @if (column.prefixContentId) {\n @let cell = contentRefs | findContent: column.prefixContentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else if (column.prefixComponent) {\n <ng-container *ngComponentOutlet=\"column.prefixComponent; inputs: { column, row, value }\" />\n } @else if (column.prefixFunction) {\n <span [outerHTML]=\"value | valueFunction: column.prefixFunction : row : column | safeHtml\"></span>\n } @else if (column.prefix) {\n <span [outerHTML]=\"column.prefix | safeHtml\"></span>\n }\n\n @switch (column.type) {\n @case ('number') {\n <lib-cell-number-value [column]=\"column\" [row]=\"row\"></lib-cell-number-value>\n }\n @case ('select') {\n <lib-cell-select-value [column]=\"column\" [row]=\"row\"></lib-cell-select-value>\n }\n @case ('checkbox') {\n <lib-cell-checkbox-value [column]=\"column\" [row]=\"row\"></lib-cell-checkbox-value>\n }\n @case ('date') {\n <lib-cell-date-value [column]=\"column\" [row]=\"row\"></lib-cell-date-value>\n }\n @case ('duration') {\n <lib-cell-duration-value [column]=\"column\" [row]=\"row\"></lib-cell-duration-value>\n }\n @default {\n <span [outerHTML]=\"(value | transform: row : column) ?? '' | safeHtml\"></span>\n }\n }\n\n @if (column.suffixContentId) {\n @let cell = contentRefs | findContent: column.suffixContentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else if (column.suffixComponent) {\n <ng-container *ngComponentOutlet=\"column.suffixComponent; inputs: { column, row, value }\" />\n } @else if (column.suffixFunction) {\n <span [outerHTML]=\"value | valueFunction: column.suffixFunction : row : column | safeHtml\"></span>\n } @else if (column.suffix) {\n <span [outerHTML]=\"column.suffix | safeHtml\"></span>\n }\n }\n </div>\n } @placeholder {\n <div class=\"cell\"></div>\n }\n</ng-template>\n\n<ng-template #actionTmpl let-action=\"action\">\n @if (!action.isHidden) {\n @switch (action.kind) {\n @case ('icon') {\n <div class=\"action user-action\" [matTooltip]=\"action.tooltip\">\n <button\n [style.--action-color]=\"action.color\"\n mat-icon-button\n (click)=\"action.onclick(this)\"\n [disabled]=\"!!action.isDisabled\">\n <mat-icon>{{ action.icon }}</mat-icon>\n </button>\n </div>\n }\n @case ('template') {\n <div class=\"action user-action\">\n @let content = contentRefs | findContent: action.contentId;\n @if (content) {\n <ng-container *ngTemplateOutlet=\"content.templateRef; context: { datatable: this, action }\" />\n }\n </div>\n }\n }\n }\n</ng-template>\n\n<ng-template #facetsTmpl let-facetOptions=\"facetOptions\">\n @let column = options.columns | find: { columnDef: facetOptions.columnDef };\n @let data = (dataSource.facets ?? {})[facetOptions.id] | sortFacetEntries: facetOptions.options;\n @if (data) {\n @if (facetOptions.contentId) {\n @let cell = contentRefs | findContent: facetOptions.contentId;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, facetOptions, data }\" />\n }\n } @else {\n @switch (facetOptions.display) {\n @case ('chips') {\n <ng-container *ngTemplateOutlet=\"facetsChipsTmpl; context: { column, data, facetOptions }\"></ng-container>\n }\n @default {\n <ng-container\n *ngTemplateOutlet=\"facetsProgressSpinnersTmpl; context: { column, data, facetOptions }\"></ng-container>\n }\n }\n }\n }\n</ng-template>\n\n<ng-template #facetsChipsTmpl let-column=\"column\" let-data=\"data\" let-facetOptions=\"facetOptions\">\n @let size = facetOptions.size;\n @let fontSize = facetOptions.fontSize ?? '1em';\n <!-- @let total = (data | sum: 'value') || 1; -->\n <mat-chip-set class=\"chips-facet\">\n @for (d of data | orderBy: '_id'; track d) {\n @let option = facetOptions?.option ? facetOptions.option(d) : (facetOptions.options | find: { value: d._id });\n @let name = option?.name ?? d._id;\n @let color = option?.color ?? 'var(--mat-sys-primary)';\n @let labelColor = option?.labelColor;\n <!-- @let percent = (d.value / total) * 100; -->\n <mat-chip\n class=\"chip-facet\"\n [class.has-action]=\"column?.searchable !== false\"\n (click)=\"facetClick(column, d, option)\"\n [style.--facet-color]=\"color\"\n [style.--facet-label-color]=\"labelColor ?? 'var(--mat-sys-on-primary)'\"\n [style.--facet-value-color]=\"labelColor ?? color\"\n [style.width.px]=\"size\">\n <div class=\"chip-facet-content\" [style.font-size.px]=\"fontSize\">\n <div class=\"chip-facet-key\">{{ name }}</div>\n <div class=\"chip-facet-value\">{{ d.value | number: '0.0-2' }}</div>\n </div>\n </mat-chip>\n }\n </mat-chip-set>\n</ng-template>\n\n<ng-template #facetsProgressSpinnersTmpl let-column=\"column\" let-data=\"data\" let-facetOptions=\"facetOptions\">\n @let size = facetOptions.size ?? 80;\n @let fontSize = facetOptions.fontSize ?? '1em';\n @let total = (data | sum: 'value') || 1;\n <mat-card class=\"facet\">\n @if (facetOptions.name) {\n <mat-card-header>\n <mat-card-title>{{ facetOptions.name }}</mat-card-title>\n </mat-card-header>\n }\n <mat-card-content>\n @for (d of data; track d) {\n @let option = facetOptions?.option ? facetOptions.option(d) : (facetOptions.options | find: { value: d._id });\n @let name = option?.name ?? d._id;\n @let color = option?.color ?? 'var(--mat-sys-primary)';\n @let percent = (d.value / total) * 100;\n <div\n class=\"facet-indicator\"\n [class.has-action]=\"column?.searchable !== false\"\n (click)=\"facetClick(column, d, option)\">\n <lib-progress-spinner [diameter]=\"size\" [color]=\"color\" [fontSize]=\"fontSize\" [value]=\"percent\">\n <mat-label>{{ name }}</mat-label>\n </lib-progress-spinner>\n <mat-label\n class=\"facet-indicator-label\"\n [style.font-size]=\"fontSize\"\n [countUp]=\"d.value\"\n [options]=\"datatableIntl.numberOptions\"\n [reanimateOnClick]=\"false\">\n {{ d.value | number: '0.0-2' }}\n </mat-label>\n </div>\n }\n </mat-card-content>\n </mat-card>\n</ng-template>\n", styles: [":host{display:flex;position:relative;max-height:100%;--datatable-background: var(--ngx-mat-datatable-background, #ffffff);--datatable-color: var(--ngx-mat-datatable-color, var(--mat-sys-primary,));--datatable-border-color: var(--ngx-mat-datatable-border-color, #ccc);--datatable-sticky-top: var(--ngx-mat-datatable-sticky-top, 0);--datatable-sticky-background: var(--ngx-mat-datatable-sticky-background, var(--datatable-background));--datatable-sticky-border: var(--ngx-mat-datatable-sticky-border, 1px dashed #e6a93a)}:host{--mat-table-background-color: var(--datatable-background)}:host{--mat-table-header-headline-color: var(--datatable-color)}:host{--mat-table-row-item-label-text-color: var(--datatable-color)}#container{display:flex;flex:1 1 100%;box-sizing:border-box;flex-direction:column;position:relative;width:100%;background-color:var(--datatable-background)}#head{width:100%;display:flex;box-sizing:border-box;place-content:end space-between;align-items:end;flex-direction:row;border-bottom:1px solid var(--datatable-border-color)}#head #head-start,#head #head-center,#head #head-end{display:flex;box-sizing:border-box;align-items:end;flex-direction:row}#head #head-start{place-content:end start}#head #head-center{place-content:end center}#head #head-end{place-content:end end}#head .action{position:relative}#head .action .action-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#head .action.user-action .mat-mdc-icon-button{--mdc-icon-button-icon-color: var(--action-color, var(--mat-sys-primary))}#head #records-count{min-width:72px;padding:0 8px;color:var(--datatable-color);font-size:14px;line-height:48px;text-align:right;white-space:nowrap}#column-options .column-options-item{overflow:hidden;display:flex;box-sizing:border-box;align-items:center;flex-direction:row;place-content:center start}#column-options .column-options-item button.toggle-off{--mdc-icon-button-icon-color: var(--mdc-icon-button-disabled-icon-color)}#column-options .column-options-item mat-icon.handle{color:var(--mdc-icon-button-disabled-icon-color)}#table-container{flex:1 1 100%;overflow-y:var(--datatable-container-overflow-y, \"inherit\");overflow-x:var(--datatable-container-overflow-x, \"inherit\");width:100%;scrollbar-width:thin}#table{width:100%;max-height:100%;--mat-table-background-color: var(--datatable-background);--mat-table-row-item-outline-color: var(--datatable-border-color)}#table ::ng-deep .mat-mdc-table-sticky{top:var(--datatable-sticky-top)!important;opacity:1;background:var(--datatable-sticky-background, var(--datatable-background, #ffffff))}#table ::ng-deep .mat-mdc-table-sticky.mat-mdc-table-sticky-border-elem-left{border-right:var(--datatable-sticky-border)}#table ::ng-deep .mat-mdc-header-cell{padding:0 8px}#table ::ng-deep .mat-mdc-header-cell mat-form-field{min-width:auto;flex:1 1 100%}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mat-form-field-state-layer-color: var(--datatable-background)}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mdc-filled-text-field-container-color: var(--datatable-background)}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mdc-filled-text-field-container-shape: 0}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mat-form-field-hover-state-layer-opacity: 0}#table ::ng-deep .mat-mdc-header-cell mat-form-field{--mdc-filled-text-field-active-indicator-color: #999}#table ::ng-deep .mat-mdc-header-cell mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}#table ::ng-deep .mat-mdc-header-cell mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}#table ::ng-deep .mat-mdc-cell{padding:0 8px}#table ::ng-deep .mat-mdc-footer-row.incremental-row{height:44px}#table ::ng-deep .mat-mdc-footer-row.incremental-row.is-hidden{display:none}#table ::ng-deep .mat-mdc-footer-row.incremental-row .mat-mdc-footer-cell{padding:0;border-bottom-color:var(--mat-table-row-item-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .12)));border-bottom-width:var(--mat-table-row-item-outline-width, 1px);border-bottom-style:solid}#table ::ng-deep .mat-mdc-row.has-click:not(.is-disabled){cursor:pointer}#table ::ng-deep .mat-mdc-row.has-click:not(.is-disabled):hover .mat-mdc-cell{--datatable-hover-color: var(--ngx-mat-datatable-hover-color, var(--mat-sys-on-primary));--datatable-hover-bgcolor: var(--ngx-mat-datatable-hover-bgcolor, var(--mat-sys-primary));color:var(--datatable-hover-color)!important;background-color:var(--datatable-hover-bgcolor)!important}#table ::ng-deep .mat-mdc-row.is-disabled .mat-mdc-cell{opacity:.2}#table ::ng-deep .mat-mdc-row:last-child .mat-mdc-cell{border-bottom-color:var(--mat-table-row-item-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, .12)));border-bottom-width:var(--mat-table-row-item-outline-width, 1px);border-bottom-style:solid}#table .header-container{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;width:100%;min-height:var(--mat-form-field-container-height, 56px);margin:6px 0}#table .header{width:100%;display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row}#table .header .header-actions .sort-btn{--mat-badge-container-size: 12px;--mat-badge-line-height: 16px;--mat-badge-text-size: 10px;--mat-badge-legacy-container-size: 18px}#table .cell{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;width:100%}#table .cell>*{display:inline-flex}#table .incremental-load-row{position:sticky;left:0;display:flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row;gap:8px;min-height:44px;width:var(--datatable-container-width, 100%);max-width:var(--datatable-container-width, 100%);color:var(--datatable-color);pointer-events:none}#table .incremental-sentinel,#table .incremental-load-row button{pointer-events:auto}#table .incremental-sentinel{display:inline-flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row;gap:8px;min-height:44px}#table .incremental-load-row button{display:inline-flex;align-items:center;gap:8px}#paginator{--mat-paginator-container-background-color: var(--datatable-background);--mat-form-field-container-height: 24px;--mat-form-field-container-vertical-padding: 4px;--mat-paginator-container-size: 46px;border-top:1px solid var(--datatable-border-color)}#paginator ::ng-deep .mat-mdc-select{display:flex;height:24px}#paginator ::ng-deep .mat-mdc-paginator-touch-target{height:24px}#paginator ::ng-deep .mat-mdc-paginator-range-actions button{--mdc-icon-button-state-layer-size: 36px;padding:6px}#loading{position:absolute;z-index:200;inset:0;background-color:#00000029;display:flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row}::ng-deep .mat-mdc-icon-button[mat-icon-button][size=small]{--mdc-icon-button-state-layer-size: 30px;--mdc-icon-button-icon-size: 18px}::ng-deep .mat-mdc-icon-button[mat-icon-button][size=small] .mat-mdc-button-touch-target{height:36px;width:36px}::ng-deep .mat-mdc-icon-button[mat-icon-button][size=small] mat-icon{height:18px;width:18px;font-size:18px}.row{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}.element-detail{background:#f5f5f5;overflow:hidden;display:flex}#no-data{position:sticky;width:fit-content;left:50%}#no-data #no-data-label{position:relative;margin-left:-50%}.facet{margin:8px;--mdc-elevated-card-container-color: transparent}.facet mat-card-content{display:flex;box-sizing:border-box;place-content:center center;align-items:center;flex-direction:row;flex-wrap:wrap;padding:4px}.facet .facet-indicator{display:flex;box-sizing:border-box;flex-direction:column;place-content:center center;align-items:center;position:relative;margin:4px}.facet .facet-indicator.has-action{cursor:pointer}.facet .facet-indicator .facet-indicator-label{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1em;padding:2px}.chips-facet{margin-right:8px}.chips-facet .chip-facet{overflow:hidden}.chips-facet .chip-facet{--mdc-chip-label-text-color: var(--facet-color)}.chips-facet .chip-facet{--mdc-chip-outline-color: var(--facet-color)}.chips-facet .chip-facet{--mdc-chip-elevated-container-color: var(--facet-color)}.chips-facet .chip-facet.has-action{cursor:pointer}.chips-facet .chip-facet ::ng-deep .mat-mdc-chip-action,.chips-facet .chip-facet ::ng-deep .mat-mdc-standard-chip{cursor:inherit;padding:0}.chips-facet .chip-facet ::ng-deep .mat-mdc-chip-action-label{height:100%;width:100%}.chips-facet .chip-facet .chip-facet-content{display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row;height:100%;width:100%}.chips-facet .chip-facet .chip-facet-content .chip-facet-key,.chips-facet .chip-facet .chip-facet-content .chip-facet-value{height:100%;padding-left:8px;padding-right:8px;display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row}.chips-facet .chip-facet .chip-facet-content .chip-facet-key{background-color:var(--mdc-chip-label-text-color);color:var(--facet-label-color, var(--mdc-chip-elevated-container-color))}.chips-facet .chip-facet .chip-facet-content .chip-facet-value{color:var(--facet-value-color, var(--mdc-chip-label-text-color))}\n"] }]
2299
+ }], ctorParameters: null, propDecorators: { options: [{
2300
+ type: Input,
2301
+ args: ['options']
2302
+ }], config: [{
2303
+ type: Input
2304
+ }], rowClicked: [{
2305
+ type: Output
2306
+ }], configUpdated: [{
2307
+ type: Output
2308
+ }], searchUpdated: [{
2309
+ type: Output
2310
+ }], ready: [{
2311
+ type: Output
2312
+ }], paginator: [{
2313
+ type: ViewChild,
2314
+ args: [MatPaginator]
2315
+ }], contentRefs: [{
2316
+ type: ContentChildren,
2317
+ args: [NgxMatDatatableContentDirective]
2318
+ }], container: [{
2319
+ type: ViewChild,
2320
+ args: ['container']
2321
+ }], head: [{
2322
+ type: ViewChild,
2323
+ args: ['head']
2324
+ }], matTable: [{
2325
+ type: ViewChild,
2326
+ args: [MatTable]
2327
+ }], tableContainerOverflowY: [{
2328
+ type: HostBinding,
2329
+ args: ['style.--datatable-container-overflow-y']
2330
+ }], tableContainerOverflowX: [{
2331
+ type: HostBinding,
2332
+ args: ['style.--datatable-container-overflow-x']
2333
+ }], tableContainerWidth: [{
2334
+ type: HostBinding,
2335
+ args: ['style.--datatable-container-width.px']
2336
+ }] } }) });
2337
+
2338
+ /** @format */
2339
+ class NgxMatDatatableModule {
2340
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2341
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, imports: [NgxMatDatatableComponent, NgxMatDatatableContentDirective], exports: [NgxMatDatatableComponent, NgxMatDatatableContentDirective] });
2342
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, providers: [NgxMatDatatableIntl], imports: [NgxMatDatatableComponent] });
2343
+ }
2344
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, decorators: [{
2345
+ type: NgModule,
2346
+ args: [{
2347
+ imports: [NgxMatDatatableComponent, NgxMatDatatableContentDirective],
2348
+ exports: [NgxMatDatatableComponent, NgxMatDatatableContentDirective],
2349
+ providers: [NgxMatDatatableIntl],
2350
+ }]
2351
+ }] });
2352
+
2353
+ /** @format */
2354
+
2355
+ /** @format */
2356
+
2357
+ /** @format */
2358
+
2359
+ /** @format */
2360
+
2361
+ /** @format */
2362
+
2363
+ /**
2364
+ * Public API Surface of mongoose-datatable
2365
+ *
2366
+ * @format
2367
+ */
2368
+
2369
+ /**
2370
+ * Generated bundle index. Do not edit.
2371
+ */
2372
+
2373
+ export { IsArrayPipe as I, NgxMatDatatableModule as N, SelectOptionPipe as S, SafeHtmlPipe as a, NgxMatDatatableComponent as b, NGX_MAT_DATATABLE_DEFAULT_OPTIONS as c, duration as d, NgxMatDatatableContentDirective as e, NgxMatDatatableIntl as f, get as g, provideNgxMatDatatableDefaultOptions as p };
2374
+ //# sourceMappingURL=eherve-angular-material-datatable-eherve-angular-material-datatable-Dck-CD4z.mjs.map