@eherve/angular-material-datatable 19.0.1 → 19.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/eherve-angular-material-datatable-cell-checkbox-value.component-BsEd3gO0.mjs +25 -0
- package/fesm2022/eherve-angular-material-datatable-cell-checkbox-value.component-BsEd3gO0.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-cell-date-value.component-CDzvdmYI.mjs +25 -0
- package/fesm2022/eherve-angular-material-datatable-cell-date-value.component-CDzvdmYI.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-CxBvtvVx.mjs +28 -0
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-CxBvtvVx.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-CjmrdtGO.mjs +962 -0
- package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-CjmrdtGO.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-find-cell-content.pipe-Cco9XewC.mjs +18 -0
- package/fesm2022/eherve-angular-material-datatable-find-cell-content.pipe-Cco9XewC.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-get.pipe--ODBMh1N.mjs +23 -0
- package/fesm2022/eherve-angular-material-datatable-get.pipe--ODBMh1N.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable.mjs +1 -1030
- package/fesm2022/eherve-angular-material-datatable.mjs.map +1 -1
- package/lib/types/datatable-column.type.d.ts +9 -3
- package/package.json +1 -1
package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-CjmrdtGO.mjs
ADDED
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
import { trigger, transition, style, animate } from '@angular/animations';
|
|
2
|
+
import * as i2$1 from '@angular/cdk/drag-drop';
|
|
3
|
+
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
4
|
+
import * as i1 from '@angular/common';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, Injector, ChangeDetectorRef, forwardRef, Component, Input, ViewChild, signal, ChangeDetectionStrategy, Pipe, Directive, EventEmitter, Output, ContentChildren, NgModule } from '@angular/core';
|
|
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 i4$1 from '@angular/material/form-field';
|
|
15
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
16
|
+
import * as i5$1 from '@angular/material/icon';
|
|
17
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
18
|
+
import * as i8 from '@angular/material/menu';
|
|
19
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
20
|
+
import * as i9 from '@angular/material/paginator';
|
|
21
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
22
|
+
import * as i10$1 from '@angular/material/progress-spinner';
|
|
23
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
24
|
+
import * as i11 from '@angular/material/table';
|
|
25
|
+
import { MatTableModule } from '@angular/material/table';
|
|
26
|
+
import * as i12 from '@angular/material/tooltip';
|
|
27
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
28
|
+
import * as i3 from 'ngx-intersection-observer';
|
|
29
|
+
import { IntersectionObserverModule } from 'ngx-intersection-observer';
|
|
30
|
+
import { BehaviorSubject, Subject, Subscription, filter, debounceTime, switchMap, startWith, tap, map } from 'rxjs';
|
|
31
|
+
import * as i4 from '@angular/material/autocomplete';
|
|
32
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
33
|
+
import * as i6 from '@angular/material/input';
|
|
34
|
+
import { MatInputModule } from '@angular/material/input';
|
|
35
|
+
import * as i10 from '@angular/material/progress-bar';
|
|
36
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
37
|
+
import * as i5 from '@angular/material/core';
|
|
38
|
+
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
|
|
39
|
+
import * as i3$2 from '@angular/material/checkbox';
|
|
40
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
41
|
+
import { provideMomentDateAdapter } from '@angular/material-moment-adapter';
|
|
42
|
+
import * as i4$2 from '@angular/material/datepicker';
|
|
43
|
+
import { MatDatepickerIntl, MatDatepickerModule } from '@angular/material/datepicker';
|
|
44
|
+
import * as i1$1 from '@angular/cdk/overlay';
|
|
45
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
46
|
+
import * as i6$1 from '@angular/material/select';
|
|
47
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
48
|
+
import { DataSource } from '@angular/cdk/collections';
|
|
49
|
+
|
|
50
|
+
/** @format */
|
|
51
|
+
class HeaderAutocompleteFilterComponent {
|
|
52
|
+
column;
|
|
53
|
+
options = [];
|
|
54
|
+
hasMore = false;
|
|
55
|
+
searching = false;
|
|
56
|
+
input;
|
|
57
|
+
control;
|
|
58
|
+
selectControl = new FormControl();
|
|
59
|
+
onChange = () => { };
|
|
60
|
+
onTouched = () => { };
|
|
61
|
+
filter$ = new BehaviorSubject(undefined);
|
|
62
|
+
nextPage$ = new Subject();
|
|
63
|
+
injector = inject(Injector);
|
|
64
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
65
|
+
subsink = new Subscription();
|
|
66
|
+
writeValue = (value) => {
|
|
67
|
+
if (value?.value !== this.selectControl.value)
|
|
68
|
+
this.selectControl.setValue(value?.value);
|
|
69
|
+
};
|
|
70
|
+
registerOnChange(onChange) {
|
|
71
|
+
this.onChange = onChange;
|
|
72
|
+
}
|
|
73
|
+
registerOnTouched(onTouched) {
|
|
74
|
+
this.onTouched = onTouched;
|
|
75
|
+
}
|
|
76
|
+
async ngAfterViewInit() {
|
|
77
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
78
|
+
if (!ngControl)
|
|
79
|
+
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
80
|
+
this.control = ngControl.control;
|
|
81
|
+
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
82
|
+
if (value === undefined) {
|
|
83
|
+
if (this.control.value !== undefined)
|
|
84
|
+
this.control.setValue(undefined);
|
|
85
|
+
}
|
|
86
|
+
if (value === null && !this.options.find(o => o.value === null)) {
|
|
87
|
+
if (this.control.value !== undefined)
|
|
88
|
+
this.control.setValue(undefined);
|
|
89
|
+
}
|
|
90
|
+
else if (this.control.value?.value !== value)
|
|
91
|
+
this.control.setValue({ value, regex: false });
|
|
92
|
+
}));
|
|
93
|
+
this.buildOptions();
|
|
94
|
+
this.changeDetectorRef.detectChanges();
|
|
95
|
+
}
|
|
96
|
+
ngOnDestroy() {
|
|
97
|
+
this.subsink.unsubscribe();
|
|
98
|
+
}
|
|
99
|
+
loadMore(intersect) {
|
|
100
|
+
if (!intersect)
|
|
101
|
+
return;
|
|
102
|
+
this.nextPage$.next();
|
|
103
|
+
}
|
|
104
|
+
focus() {
|
|
105
|
+
if (this.column.loadOnFocus) {
|
|
106
|
+
const search = this.input.nativeElement.value;
|
|
107
|
+
if (this.filter$.value !== search)
|
|
108
|
+
this.filter$.next(search);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
filter() {
|
|
112
|
+
const search = this.input.nativeElement.value;
|
|
113
|
+
this.filter$.next(search);
|
|
114
|
+
}
|
|
115
|
+
buildOptions() {
|
|
116
|
+
this.subsink.add(this.filter$
|
|
117
|
+
.pipe(filter(value => typeof value === 'string'), debounceTime(300), switchMap((search) => {
|
|
118
|
+
this.options = [];
|
|
119
|
+
let skip = 0;
|
|
120
|
+
return this.nextPage$.pipe(startWith(skip), tap(() => (this.searching = true)), switchMap(async () => this.column.options(this.column.limit || 10, skip, search)), map(data => {
|
|
121
|
+
this.options.push(...data);
|
|
122
|
+
skip += this.column.limit || 10;
|
|
123
|
+
this.hasMore = data?.length === (this.column.limit || 10);
|
|
124
|
+
this.searching = false;
|
|
125
|
+
}));
|
|
126
|
+
}))
|
|
127
|
+
.subscribe());
|
|
128
|
+
}
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderAutocompleteFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
+
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: [
|
|
131
|
+
{
|
|
132
|
+
provide: NG_VALUE_ACCESSOR,
|
|
133
|
+
multi: true,
|
|
134
|
+
useExisting: forwardRef(() => HeaderAutocompleteFilterComponent),
|
|
135
|
+
},
|
|
136
|
+
], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header\"></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 <mat-autocomplete #auto=\"matAutocomplete\" requireSelection>\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"autocompleteOption; context: { option }\"></ng-container>\n </mat-option>\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\"\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 <mat-icon [style.color]=\"option.iconColor\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name\"></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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.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: "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"] }] });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderAutocompleteFilterComponent, decorators: [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{ selector: 'lib-header-autocomplete-filter', imports: [
|
|
141
|
+
CommonModule,
|
|
142
|
+
FormsModule,
|
|
143
|
+
IntersectionObserverModule,
|
|
144
|
+
MatAutocompleteModule,
|
|
145
|
+
MatButtonModule,
|
|
146
|
+
MatFormFieldModule,
|
|
147
|
+
MatIconModule,
|
|
148
|
+
MatInputModule,
|
|
149
|
+
MatProgressBarModule,
|
|
150
|
+
ReactiveFormsModule,
|
|
151
|
+
], providers: [
|
|
152
|
+
{
|
|
153
|
+
provide: NG_VALUE_ACCESSOR,
|
|
154
|
+
multi: true,
|
|
155
|
+
useExisting: forwardRef(() => HeaderAutocompleteFilterComponent),
|
|
156
|
+
},
|
|
157
|
+
], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header\"></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 <mat-autocomplete #auto=\"matAutocomplete\" requireSelection>\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container *ngTemplateOutlet=\"autocompleteOption; context: { option }\"></ng-container>\n </mat-option>\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\"\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 <mat-icon [style.color]=\"option.iconColor\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name\"></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"] }]
|
|
158
|
+
}], propDecorators: { column: [{
|
|
159
|
+
type: Input
|
|
160
|
+
}], input: [{
|
|
161
|
+
type: ViewChild,
|
|
162
|
+
args: ['input']
|
|
163
|
+
}] } });
|
|
164
|
+
|
|
165
|
+
/** @format */
|
|
166
|
+
class HeaderCheckboxFilterComponent {
|
|
167
|
+
column;
|
|
168
|
+
control;
|
|
169
|
+
selectControl = new FormControl();
|
|
170
|
+
onChange = () => { };
|
|
171
|
+
onTouched = () => { };
|
|
172
|
+
injector = inject(Injector);
|
|
173
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
174
|
+
subsink = new Subscription();
|
|
175
|
+
writeValue = (value) => {
|
|
176
|
+
if (value?.value !== this.selectControl.value)
|
|
177
|
+
this.selectControl.setValue(value?.value);
|
|
178
|
+
};
|
|
179
|
+
registerOnChange(onChange) {
|
|
180
|
+
this.onChange = onChange;
|
|
181
|
+
}
|
|
182
|
+
registerOnTouched(onTouched) {
|
|
183
|
+
this.onTouched = onTouched;
|
|
184
|
+
}
|
|
185
|
+
async ngAfterViewInit() {
|
|
186
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
187
|
+
if (!ngControl)
|
|
188
|
+
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
189
|
+
this.control = ngControl.control;
|
|
190
|
+
let previousValue = this.control.value;
|
|
191
|
+
this.subsink.add(this.selectControl.valueChanges
|
|
192
|
+
.pipe(filter(value => {
|
|
193
|
+
if (value === true && previousValue === false) {
|
|
194
|
+
this.selectControl.setValue(undefined);
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}), tap(value => (previousValue = value)))
|
|
199
|
+
.subscribe((value) => {
|
|
200
|
+
if (value === undefined)
|
|
201
|
+
this.control.setValue(undefined);
|
|
202
|
+
else
|
|
203
|
+
this.control.setValue({ value, regex: false });
|
|
204
|
+
}));
|
|
205
|
+
this.changeDetectorRef.detectChanges();
|
|
206
|
+
}
|
|
207
|
+
ngOnDestroy() {
|
|
208
|
+
this.subsink.unsubscribe();
|
|
209
|
+
}
|
|
210
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderCheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
211
|
+
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: [
|
|
212
|
+
{
|
|
213
|
+
provide: NG_VALUE_ACCESSOR,
|
|
214
|
+
multi: true,
|
|
215
|
+
useExisting: forwardRef(() => HeaderCheckboxFilterComponent),
|
|
216
|
+
},
|
|
217
|
+
], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-checkbox [formControl]=\"selectControl\" [indeterminate]=\"selectControl.value === undefined\">\n <mat-label [innerHTML]=\"column.header\"></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"] }] });
|
|
218
|
+
}
|
|
219
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderCheckboxFilterComponent, decorators: [{
|
|
220
|
+
type: Component,
|
|
221
|
+
args: [{ selector: 'lib-header-checkbox-filter', imports: [
|
|
222
|
+
CommonModule,
|
|
223
|
+
FormsModule,
|
|
224
|
+
MatButtonModule,
|
|
225
|
+
MatFormFieldModule,
|
|
226
|
+
MatIconModule,
|
|
227
|
+
MatCheckboxModule,
|
|
228
|
+
ReactiveFormsModule,
|
|
229
|
+
], providers: [
|
|
230
|
+
{
|
|
231
|
+
provide: NG_VALUE_ACCESSOR,
|
|
232
|
+
multi: true,
|
|
233
|
+
useExisting: forwardRef(() => HeaderCheckboxFilterComponent),
|
|
234
|
+
},
|
|
235
|
+
], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-checkbox [formControl]=\"selectControl\" [indeterminate]=\"selectControl.value === undefined\">\n <mat-label [innerHTML]=\"column.header\"></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"] }]
|
|
236
|
+
}], propDecorators: { column: [{
|
|
237
|
+
type: Input
|
|
238
|
+
}] } });
|
|
239
|
+
|
|
240
|
+
/** @format */
|
|
241
|
+
class OperatorSelectComponent {
|
|
242
|
+
operators = ['=', '>', '≥', '<', '≤', '<>', '≤≥'];
|
|
243
|
+
isOpen = false;
|
|
244
|
+
control;
|
|
245
|
+
onChange = () => { };
|
|
246
|
+
onTouched = () => { };
|
|
247
|
+
injector = inject(Injector);
|
|
248
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
249
|
+
writeValue = () => { };
|
|
250
|
+
registerOnChange(onChange) {
|
|
251
|
+
this.onChange = onChange;
|
|
252
|
+
}
|
|
253
|
+
registerOnTouched(onTouched) {
|
|
254
|
+
this.onTouched = onTouched;
|
|
255
|
+
}
|
|
256
|
+
async ngAfterViewInit() {
|
|
257
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
258
|
+
if (!ngControl)
|
|
259
|
+
throw new Error(`${this.constructor.name} missing control`);
|
|
260
|
+
this.control = ngControl.control;
|
|
261
|
+
this.changeDetectorRef.detectChanges();
|
|
262
|
+
}
|
|
263
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OperatorSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
264
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: OperatorSelectComponent, isStandalone: true, selector: "lib-operator-select", providers: [
|
|
265
|
+
{
|
|
266
|
+
provide: NG_VALUE_ACCESSOR,
|
|
267
|
+
multi: true,
|
|
268
|
+
useExisting: forwardRef(() => OperatorSelectComponent),
|
|
269
|
+
},
|
|
270
|
+
], ngImport: i0, template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-mini-fab\n color=\"primary\"\n class=\"operator-button operator-button-value\"\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=\"operator-column\" @fade>\n @for (operator of operators; track operator) {\n @if (operator !== control.value) {\n <button mat-mini-fab color=\"primary\" class=\"operator-button\" (click)=\"control.setValue(operator); isOpen = !isOpen\">\n {{ operator }}\n </button>\n }\n }\n </div>\n </ng-template>\n}\n", styles: [".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%;font-size:18px;width:30px;height:30px;padding:6px}.operator-button ::ng-deep .mat-mdc-button-touch-target{height:36px;width:36px}.operator-button-value{--mdc-fab-small-container-color: transparent}.operator-column{display:flex;box-sizing:border-box;flex-direction:column}.operator-column .operator-button{margin-top:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$1.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$1.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: [
|
|
271
|
+
trigger('fade', [
|
|
272
|
+
transition(':enter', [
|
|
273
|
+
style({ opacity: 0 }), // initial
|
|
274
|
+
animate('0.2s', style({ opacity: 1 })), // final
|
|
275
|
+
]),
|
|
276
|
+
transition(':leave', [
|
|
277
|
+
style({ opacity: 1 }), // initial
|
|
278
|
+
animate('0.2s', style({ opacity: 0 })), // final
|
|
279
|
+
]),
|
|
280
|
+
]),
|
|
281
|
+
] });
|
|
282
|
+
}
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OperatorSelectComponent, decorators: [{
|
|
284
|
+
type: Component,
|
|
285
|
+
args: [{ selector: 'lib-operator-select', imports: [CommonModule, OverlayModule, MatIconModule, MatButtonModule], animations: [
|
|
286
|
+
trigger('fade', [
|
|
287
|
+
transition(':enter', [
|
|
288
|
+
style({ opacity: 0 }), // initial
|
|
289
|
+
animate('0.2s', style({ opacity: 1 })), // final
|
|
290
|
+
]),
|
|
291
|
+
transition(':leave', [
|
|
292
|
+
style({ opacity: 1 }), // initial
|
|
293
|
+
animate('0.2s', style({ opacity: 0 })), // final
|
|
294
|
+
]),
|
|
295
|
+
]),
|
|
296
|
+
], providers: [
|
|
297
|
+
{
|
|
298
|
+
provide: NG_VALUE_ACCESSOR,
|
|
299
|
+
multi: true,
|
|
300
|
+
useExisting: forwardRef(() => OperatorSelectComponent),
|
|
301
|
+
},
|
|
302
|
+
], template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-mini-fab\n color=\"primary\"\n class=\"operator-button operator-button-value\"\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=\"operator-column\" @fade>\n @for (operator of operators; track operator) {\n @if (operator !== control.value) {\n <button mat-mini-fab color=\"primary\" class=\"operator-button\" (click)=\"control.setValue(operator); isOpen = !isOpen\">\n {{ operator }}\n </button>\n }\n }\n </div>\n </ng-template>\n}\n", styles: [".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%;font-size:18px;width:30px;height:30px;padding:6px}.operator-button ::ng-deep .mat-mdc-button-touch-target{height:36px;width:36px}.operator-button-value{--mdc-fab-small-container-color: transparent}.operator-column{display:flex;box-sizing:border-box;flex-direction:column}.operator-column .operator-button{margin-top:8px}\n"] }]
|
|
303
|
+
}] });
|
|
304
|
+
|
|
305
|
+
/** @format */
|
|
306
|
+
class HeaderDateFilterComponent {
|
|
307
|
+
column;
|
|
308
|
+
control;
|
|
309
|
+
selectControl = new FormControl(undefined);
|
|
310
|
+
rangeGroup = new FormGroup({
|
|
311
|
+
start: new FormControl(undefined, Validators.required),
|
|
312
|
+
end: new FormControl(undefined, Validators.required),
|
|
313
|
+
});
|
|
314
|
+
operatorControl = new FormControl('=');
|
|
315
|
+
onChange = () => { };
|
|
316
|
+
onTouched = () => { };
|
|
317
|
+
_adapter = inject(DateAdapter);
|
|
318
|
+
_intl = inject(MatDatepickerIntl);
|
|
319
|
+
_locale = signal(inject(MAT_DATE_LOCALE));
|
|
320
|
+
injector = inject(Injector);
|
|
321
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
322
|
+
subsink = new Subscription();
|
|
323
|
+
writeValue = (value) => {
|
|
324
|
+
if (value?.value !== this.selectControl.value)
|
|
325
|
+
this.selectControl.setValue(value?.value);
|
|
326
|
+
};
|
|
327
|
+
registerOnChange(onChange) {
|
|
328
|
+
this.onChange = onChange;
|
|
329
|
+
}
|
|
330
|
+
registerOnTouched(onTouched) {
|
|
331
|
+
this.onTouched = onTouched;
|
|
332
|
+
}
|
|
333
|
+
ngOnInit() {
|
|
334
|
+
if (this.column.locale) {
|
|
335
|
+
this._locale.set(this.column.locale);
|
|
336
|
+
this._adapter.setLocale(this._locale());
|
|
337
|
+
this._intl.changes.next();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
async ngAfterViewInit() {
|
|
341
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
342
|
+
if (!ngControl)
|
|
343
|
+
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
344
|
+
this.control = ngControl.control;
|
|
345
|
+
this.subsink.add(this.selectControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
|
346
|
+
if (this.control.invalid)
|
|
347
|
+
return;
|
|
348
|
+
else if (!value)
|
|
349
|
+
this.control.setValue(undefined);
|
|
350
|
+
else
|
|
351
|
+
this.control.setValue({ value, regex: false, operator: this.operatorControl.value });
|
|
352
|
+
}));
|
|
353
|
+
this.subsink.add(this.rangeGroup.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
|
354
|
+
if (this.rangeGroup.invalid)
|
|
355
|
+
return;
|
|
356
|
+
else if (!value)
|
|
357
|
+
this.control.setValue(undefined);
|
|
358
|
+
else
|
|
359
|
+
this.control.setValue({
|
|
360
|
+
start: value.start,
|
|
361
|
+
end: value.end,
|
|
362
|
+
regex: false,
|
|
363
|
+
operator: this.operatorControl.value,
|
|
364
|
+
});
|
|
365
|
+
}));
|
|
366
|
+
this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
|
|
367
|
+
if (['<>', '≤≥'].includes(this.operatorControl.value)) {
|
|
368
|
+
if (!this.rangeGroup.value || this.rangeGroup.invalid)
|
|
369
|
+
return;
|
|
370
|
+
this.control.setValue({
|
|
371
|
+
start: this.rangeGroup.value.start,
|
|
372
|
+
end: this.rangeGroup.value.end,
|
|
373
|
+
regex: false,
|
|
374
|
+
operator: value,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
if (!this.selectControl.value)
|
|
379
|
+
return;
|
|
380
|
+
this.control.setValue({ value: this.selectControl.value, regex: false, operator: value });
|
|
381
|
+
}
|
|
382
|
+
}));
|
|
383
|
+
this.changeDetectorRef.detectChanges();
|
|
384
|
+
}
|
|
385
|
+
ngOnDestroy() {
|
|
386
|
+
this.subsink.unsubscribe();
|
|
387
|
+
}
|
|
388
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDateFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
389
|
+
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: [
|
|
390
|
+
{
|
|
391
|
+
provide: NG_VALUE_ACCESSOR,
|
|
392
|
+
multi: true,
|
|
393
|
+
useExisting: forwardRef(() => HeaderDateFilterComponent),
|
|
394
|
+
},
|
|
395
|
+
provideMomentDateAdapter(),
|
|
396
|
+
], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n @if (['<>', '\u2264\u2265'].includes(operatorControl.value!)) {\n <mat-form-field class=\"ngx-datatable-number-filter\" appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></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=\"start\" [placeholder]=\"column.placeholder!\" />\n <input matEndDate formControlName=\"end\" [placeholder]=\"column.placeholder!\" />\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 *ngIf=\"selectControl.value\" mat-icon-button matSuffix size=\"small\" (click)=\"rangeGroup.reset()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n } @else {\n <mat-form-field class=\"ngx-datatable-number-filter\" appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput [matDatepicker]=\"datePicker\" [formControl]=\"selectControl\" [placeholder]=\"column.placeholder!\" />\n <mat-datepicker-toggle matIconSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\n <mat-datepicker #datePicker></mat-datepicker>\n\n <button\n *ngIf=\"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\n<ng-template #operatorTmpl let-operator=\"operator\">\n @switch (operator) {\n @case ('=') {\n <mat-icon>equal</mat-icon>\n }\n @case ('>') {\n <mat-icon>equal</mat-icon>\n }\n }\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}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.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: MatMenuModule }, { 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" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
397
|
+
}
|
|
398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDateFilterComponent, decorators: [{
|
|
399
|
+
type: Component,
|
|
400
|
+
args: [{ selector: 'lib-header-date-filter', imports: [
|
|
401
|
+
CommonModule,
|
|
402
|
+
FormsModule,
|
|
403
|
+
MatButtonModule,
|
|
404
|
+
MatDatepickerModule,
|
|
405
|
+
MatFormFieldModule,
|
|
406
|
+
MatIconModule,
|
|
407
|
+
MatInputModule,
|
|
408
|
+
MatMenuModule,
|
|
409
|
+
ReactiveFormsModule,
|
|
410
|
+
OperatorSelectComponent,
|
|
411
|
+
], providers: [
|
|
412
|
+
{
|
|
413
|
+
provide: NG_VALUE_ACCESSOR,
|
|
414
|
+
multi: true,
|
|
415
|
+
useExisting: forwardRef(() => HeaderDateFilterComponent),
|
|
416
|
+
},
|
|
417
|
+
provideMomentDateAdapter(),
|
|
418
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- @format -->\n\n@if (selectControl) {\n @if (['<>', '\u2264\u2265'].includes(operatorControl.value!)) {\n <mat-form-field class=\"ngx-datatable-number-filter\" appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></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=\"start\" [placeholder]=\"column.placeholder!\" />\n <input matEndDate formControlName=\"end\" [placeholder]=\"column.placeholder!\" />\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 *ngIf=\"selectControl.value\" mat-icon-button matSuffix size=\"small\" (click)=\"rangeGroup.reset()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n } @else {\n <mat-form-field class=\"ngx-datatable-number-filter\" appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput [matDatepicker]=\"datePicker\" [formControl]=\"selectControl\" [placeholder]=\"column.placeholder!\" />\n <mat-datepicker-toggle matIconSuffix [for]=\"datePicker\"></mat-datepicker-toggle>\n <mat-datepicker #datePicker></mat-datepicker>\n\n <button\n *ngIf=\"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\n<ng-template #operatorTmpl let-operator=\"operator\">\n @switch (operator) {\n @case ('=') {\n <mat-icon>equal</mat-icon>\n }\n @case ('>') {\n <mat-icon>equal</mat-icon>\n }\n }\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}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"] }]
|
|
419
|
+
}], propDecorators: { column: [{
|
|
420
|
+
type: Input
|
|
421
|
+
}] } });
|
|
422
|
+
|
|
423
|
+
/** @format */
|
|
424
|
+
class HeaderNumberFilterComponent {
|
|
425
|
+
column;
|
|
426
|
+
control;
|
|
427
|
+
selectControl = new FormControl();
|
|
428
|
+
operatorControl = new FormControl('=');
|
|
429
|
+
onChange = () => { };
|
|
430
|
+
onTouched = () => { };
|
|
431
|
+
injector = inject(Injector);
|
|
432
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
433
|
+
subsink = new Subscription();
|
|
434
|
+
writeValue = (value) => {
|
|
435
|
+
if (value?.value !== this.selectControl.value)
|
|
436
|
+
this.selectControl.setValue(value?.value);
|
|
437
|
+
};
|
|
438
|
+
registerOnChange(onChange) {
|
|
439
|
+
this.onChange = onChange;
|
|
440
|
+
}
|
|
441
|
+
registerOnTouched(onTouched) {
|
|
442
|
+
this.onTouched = onTouched;
|
|
443
|
+
}
|
|
444
|
+
async ngAfterViewInit() {
|
|
445
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
446
|
+
if (!ngControl)
|
|
447
|
+
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
448
|
+
this.control = ngControl.control;
|
|
449
|
+
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
450
|
+
if (!value)
|
|
451
|
+
this.control.setValue(undefined);
|
|
452
|
+
else
|
|
453
|
+
this.control.setValue({ value, regex: false, operator: this.operatorControl.value });
|
|
454
|
+
}));
|
|
455
|
+
this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
|
|
456
|
+
if (this.control.value === null || this.control.value === undefined)
|
|
457
|
+
return;
|
|
458
|
+
this.control.setValue({ value: this.selectControl.value, regex: false, operator: value });
|
|
459
|
+
}));
|
|
460
|
+
this.changeDetectorRef.detectChanges();
|
|
461
|
+
}
|
|
462
|
+
ngOnDestroy() {
|
|
463
|
+
this.subsink.unsubscribe();
|
|
464
|
+
}
|
|
465
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderNumberFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
466
|
+
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: [
|
|
467
|
+
{
|
|
468
|
+
provide: NG_VALUE_ACCESSOR,
|
|
469
|
+
multi: true,
|
|
470
|
+
useExisting: forwardRef(() => HeaderNumberFilterComponent),
|
|
471
|
+
},
|
|
472
|
+
], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field class=\"ngx-datatable-number-filter\" appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput [formControl]=\"selectControl\" type=\"number\" />\n\n <button\n *ngIf=\"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 #operatorTmpl let-operator=\"operator\">\n @switch (operator) {\n @case ('=') {\n <mat-icon>equal</mat-icon>\n }\n @case ('>') {\n <mat-icon>equal</mat-icon>\n }\n }\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}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.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" }] });
|
|
473
|
+
}
|
|
474
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderNumberFilterComponent, decorators: [{
|
|
475
|
+
type: Component,
|
|
476
|
+
args: [{ selector: 'lib-header-number-filter', imports: [
|
|
477
|
+
CommonModule,
|
|
478
|
+
FormsModule,
|
|
479
|
+
MatButtonModule,
|
|
480
|
+
MatFormFieldModule,
|
|
481
|
+
MatIconModule,
|
|
482
|
+
MatInputModule,
|
|
483
|
+
MatMenuModule,
|
|
484
|
+
ReactiveFormsModule,
|
|
485
|
+
OperatorSelectComponent,
|
|
486
|
+
], providers: [
|
|
487
|
+
{
|
|
488
|
+
provide: NG_VALUE_ACCESSOR,
|
|
489
|
+
multi: true,
|
|
490
|
+
useExisting: forwardRef(() => HeaderNumberFilterComponent),
|
|
491
|
+
},
|
|
492
|
+
], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field class=\"ngx-datatable-number-filter\" appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n\n <lib-operator-select matPrefix [formControl]=\"operatorControl\"></lib-operator-select>\n\n <input matInput [formControl]=\"selectControl\" type=\"number\" />\n\n <button\n *ngIf=\"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 #operatorTmpl let-operator=\"operator\">\n @switch (operator) {\n @case ('=') {\n <mat-icon>equal</mat-icon>\n }\n @case ('>') {\n <mat-icon>equal</mat-icon>\n }\n }\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}\n"] }]
|
|
493
|
+
}], propDecorators: { column: [{
|
|
494
|
+
type: Input
|
|
495
|
+
}] } });
|
|
496
|
+
|
|
497
|
+
/** @format */
|
|
498
|
+
class SelectOptionPipe {
|
|
499
|
+
transform(value, options) {
|
|
500
|
+
if (!options)
|
|
501
|
+
return null;
|
|
502
|
+
return options.find((option) => option.value === value) || null;
|
|
503
|
+
}
|
|
504
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
505
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, isStandalone: true, name: "selectOption" });
|
|
506
|
+
}
|
|
507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, decorators: [{
|
|
508
|
+
type: Pipe,
|
|
509
|
+
args: [{ name: 'selectOption' }]
|
|
510
|
+
}] });
|
|
511
|
+
|
|
512
|
+
/** @format */
|
|
513
|
+
class HeaderSelectFilterComponent {
|
|
514
|
+
column;
|
|
515
|
+
control;
|
|
516
|
+
selectControl = new FormControl();
|
|
517
|
+
onChange = () => { };
|
|
518
|
+
onTouched = () => { };
|
|
519
|
+
injector = inject(Injector);
|
|
520
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
521
|
+
subsink = new Subscription();
|
|
522
|
+
writeValue = (value) => {
|
|
523
|
+
if (value?.value !== this.selectControl.value)
|
|
524
|
+
this.selectControl.setValue(value?.value);
|
|
525
|
+
};
|
|
526
|
+
registerOnChange(onChange) {
|
|
527
|
+
this.onChange = onChange;
|
|
528
|
+
}
|
|
529
|
+
registerOnTouched(onTouched) {
|
|
530
|
+
this.onTouched = onTouched;
|
|
531
|
+
}
|
|
532
|
+
async ngAfterViewInit() {
|
|
533
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
534
|
+
if (!ngControl)
|
|
535
|
+
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
536
|
+
this.control = ngControl.control;
|
|
537
|
+
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
538
|
+
if (value === undefined)
|
|
539
|
+
this.control.setValue(undefined);
|
|
540
|
+
else
|
|
541
|
+
this.control.setValue({ value, regex: false });
|
|
542
|
+
}));
|
|
543
|
+
this.changeDetectorRef.detectChanges();
|
|
544
|
+
}
|
|
545
|
+
ngOnDestroy() {
|
|
546
|
+
this.subsink.unsubscribe();
|
|
547
|
+
}
|
|
548
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderSelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
549
|
+
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: [
|
|
550
|
+
{
|
|
551
|
+
provide: NG_VALUE_ACCESSOR,
|
|
552
|
+
multi: true,
|
|
553
|
+
useExisting: forwardRef(() => HeaderSelectFilterComponent),
|
|
554
|
+
},
|
|
555
|
+
], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n <mat-select [formControl]=\"selectControl\" [placeholder]=\"column.placeholder!\">\n @let options = column.options | async;\n\n <mat-select-trigger>\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\"></mat-label>\n }\n </mat-select-trigger>\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 </mat-select>\n\n <button\n *ngIf=\"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 <mat-icon [style.color]=\"option.iconColor\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name\"></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}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { 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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: SelectOptionPipe, name: "selectOption" }] });
|
|
556
|
+
}
|
|
557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderSelectFilterComponent, decorators: [{
|
|
558
|
+
type: Component,
|
|
559
|
+
args: [{ selector: 'lib-header-select-filter', imports: [
|
|
560
|
+
CommonModule,
|
|
561
|
+
FormsModule,
|
|
562
|
+
MatButtonModule,
|
|
563
|
+
MatFormFieldModule,
|
|
564
|
+
MatIconModule,
|
|
565
|
+
MatSelectModule,
|
|
566
|
+
ReactiveFormsModule,
|
|
567
|
+
SelectOptionPipe,
|
|
568
|
+
], providers: [
|
|
569
|
+
{
|
|
570
|
+
provide: NG_VALUE_ACCESSOR,
|
|
571
|
+
multi: true,
|
|
572
|
+
useExisting: forwardRef(() => HeaderSelectFilterComponent),
|
|
573
|
+
},
|
|
574
|
+
], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n <mat-select [formControl]=\"selectControl\" [placeholder]=\"column.placeholder!\">\n @let options = column.options | async;\n\n <mat-select-trigger>\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\"></mat-label>\n }\n </mat-select-trigger>\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 </mat-select>\n\n <button\n *ngIf=\"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 <mat-icon [style.color]=\"option.iconColor\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n <mat-label [style.color]=\"option.color\" [innerHTML]=\"option.name\"></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}\n"] }]
|
|
575
|
+
}], propDecorators: { column: [{
|
|
576
|
+
type: Input
|
|
577
|
+
}] } });
|
|
578
|
+
|
|
579
|
+
class HeaderTextFilterComponent {
|
|
580
|
+
column;
|
|
581
|
+
control;
|
|
582
|
+
selectControl = new FormControl();
|
|
583
|
+
onChange = () => { };
|
|
584
|
+
onTouched = () => { };
|
|
585
|
+
injector = inject(Injector);
|
|
586
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
587
|
+
subsink = new Subscription();
|
|
588
|
+
writeValue = (value) => {
|
|
589
|
+
if (value?.value !== this.selectControl.value)
|
|
590
|
+
this.selectControl.setValue(value?.value);
|
|
591
|
+
};
|
|
592
|
+
registerOnChange(onChange) {
|
|
593
|
+
this.onChange = onChange;
|
|
594
|
+
}
|
|
595
|
+
registerOnTouched(onTouched) {
|
|
596
|
+
this.onTouched = onTouched;
|
|
597
|
+
}
|
|
598
|
+
async ngAfterViewInit() {
|
|
599
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
600
|
+
if (!ngControl)
|
|
601
|
+
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
602
|
+
this.control = ngControl.control;
|
|
603
|
+
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
604
|
+
if (!value)
|
|
605
|
+
this.control.setValue(undefined);
|
|
606
|
+
else
|
|
607
|
+
this.control.setValue({ value, regex: true });
|
|
608
|
+
}));
|
|
609
|
+
this.changeDetectorRef.detectChanges();
|
|
610
|
+
}
|
|
611
|
+
ngOnDestroy() {
|
|
612
|
+
this.subsink.unsubscribe();
|
|
613
|
+
}
|
|
614
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderTextFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
615
|
+
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: [
|
|
616
|
+
{
|
|
617
|
+
provide: NG_VALUE_ACCESSOR,
|
|
618
|
+
multi: true,
|
|
619
|
+
useExisting: forwardRef(() => HeaderTextFilterComponent),
|
|
620
|
+
},
|
|
621
|
+
], ngImport: i0, template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n <input matInput [formControl]=\"selectControl\" />\n <button\n *ngIf=\"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.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"] }] });
|
|
622
|
+
}
|
|
623
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderTextFilterComponent, decorators: [{
|
|
624
|
+
type: Component,
|
|
625
|
+
args: [{ selector: 'lib-header-text-filter', imports: [
|
|
626
|
+
CommonModule,
|
|
627
|
+
FormsModule,
|
|
628
|
+
MatButtonModule,
|
|
629
|
+
MatFormFieldModule,
|
|
630
|
+
MatIconModule,
|
|
631
|
+
MatInputModule,
|
|
632
|
+
ReactiveFormsModule,
|
|
633
|
+
], providers: [
|
|
634
|
+
{
|
|
635
|
+
provide: NG_VALUE_ACCESSOR,
|
|
636
|
+
multi: true,
|
|
637
|
+
useExisting: forwardRef(() => HeaderTextFilterComponent),
|
|
638
|
+
},
|
|
639
|
+
], template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field appearance=\"fill\" [class.has-value]=\"selectControl.value\">\n <mat-label [innerHTML]=\"column.header\"></mat-label>\n <input matInput [formControl]=\"selectControl\" />\n <button\n *ngIf=\"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"] }]
|
|
640
|
+
}], propDecorators: { column: [{
|
|
641
|
+
type: Input
|
|
642
|
+
}] } });
|
|
643
|
+
|
|
644
|
+
class DatagridDataSource extends DataSource {
|
|
645
|
+
service;
|
|
646
|
+
loading$ = new BehaviorSubject(true);
|
|
647
|
+
recordsTotal = 0;
|
|
648
|
+
recordsFiltered = 0;
|
|
649
|
+
options;
|
|
650
|
+
dataStream = new BehaviorSubject([]);
|
|
651
|
+
constructor(service) {
|
|
652
|
+
super();
|
|
653
|
+
this.service = service;
|
|
654
|
+
}
|
|
655
|
+
connect() {
|
|
656
|
+
return this.dataStream;
|
|
657
|
+
}
|
|
658
|
+
disconnect() { }
|
|
659
|
+
async loadData(options) {
|
|
660
|
+
this.options = options;
|
|
661
|
+
this.loading$.next(true);
|
|
662
|
+
try {
|
|
663
|
+
const result = await this.service(options);
|
|
664
|
+
if (options.draw !== result.draw)
|
|
665
|
+
return;
|
|
666
|
+
this.recordsTotal = result.recordsTotal;
|
|
667
|
+
this.recordsFiltered = result.recordsFiltered;
|
|
668
|
+
this.dataStream.next(result.data);
|
|
669
|
+
}
|
|
670
|
+
finally {
|
|
671
|
+
this.loading$.next(false);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
refresh() {
|
|
675
|
+
if (this.options)
|
|
676
|
+
this.loadData(this.options);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/** @format */
|
|
681
|
+
class NgxMatDatatableCellDirective {
|
|
682
|
+
templateRef;
|
|
683
|
+
columnDef;
|
|
684
|
+
constructor(templateRef) {
|
|
685
|
+
this.templateRef = templateRef;
|
|
686
|
+
}
|
|
687
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableCellDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
688
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: NgxMatDatatableCellDirective, isStandalone: true, selector: "[ngxMatDatatableCell]", inputs: { columnDef: ["ngxMatDatatableCell", "columnDef"] }, ngImport: i0 });
|
|
689
|
+
}
|
|
690
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableCellDirective, decorators: [{
|
|
691
|
+
type: Directive,
|
|
692
|
+
args: [{
|
|
693
|
+
selector: '[ngxMatDatatableCell]',
|
|
694
|
+
}]
|
|
695
|
+
}], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { columnDef: [{
|
|
696
|
+
type: Input,
|
|
697
|
+
args: ['ngxMatDatatableCell']
|
|
698
|
+
}] } });
|
|
699
|
+
|
|
700
|
+
/** @format */
|
|
701
|
+
class NgxMatDatatableComponent {
|
|
702
|
+
options;
|
|
703
|
+
onDisplayChanged = new EventEmitter();
|
|
704
|
+
paginator;
|
|
705
|
+
cellRefs;
|
|
706
|
+
displayedColumns = [];
|
|
707
|
+
dataSource;
|
|
708
|
+
loaded = false;
|
|
709
|
+
searchFormGroup;
|
|
710
|
+
subscriptions = new Subscription();
|
|
711
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
712
|
+
ngOnInit() {
|
|
713
|
+
if (!this.options?.service)
|
|
714
|
+
throw new Error(`missing mongoose datatable component service`);
|
|
715
|
+
if (!this.options?.columns)
|
|
716
|
+
throw new Error(`missing mongoose datatable component columns`);
|
|
717
|
+
this.buildDisplayColumns();
|
|
718
|
+
this.buildSearchFormGroup();
|
|
719
|
+
this.dataSource = new DatagridDataSource(this.options.service);
|
|
720
|
+
this.changeDetectorRef.detectChanges();
|
|
721
|
+
}
|
|
722
|
+
ngOnDestroy() {
|
|
723
|
+
this.subscriptions.unsubscribe();
|
|
724
|
+
}
|
|
725
|
+
load(intersect) {
|
|
726
|
+
if (!intersect || this.loaded)
|
|
727
|
+
return;
|
|
728
|
+
this.loaded = true;
|
|
729
|
+
this.subscriptions.add(this.paginator?.page.subscribe(() => this.loadPage()));
|
|
730
|
+
this.loadPage();
|
|
731
|
+
}
|
|
732
|
+
sortColumn(column) {
|
|
733
|
+
if (column.sortable === false)
|
|
734
|
+
return;
|
|
735
|
+
if (!column.order)
|
|
736
|
+
column.order = { index: this.options.columns.filter(c => !!c.order).length, dir: 'asc' };
|
|
737
|
+
else if (column.order.dir === 'asc')
|
|
738
|
+
column.order.dir = 'desc';
|
|
739
|
+
else {
|
|
740
|
+
delete column.order;
|
|
741
|
+
this.consolidateOrderIndex();
|
|
742
|
+
}
|
|
743
|
+
this.paginator.pageIndex = 0;
|
|
744
|
+
this.loadPage();
|
|
745
|
+
}
|
|
746
|
+
loadPage() {
|
|
747
|
+
const columns = this.buildRequestColumns();
|
|
748
|
+
const order = [];
|
|
749
|
+
this.options.columns
|
|
750
|
+
.filter(c => !!c.order)
|
|
751
|
+
.sort((c1, c2) => c1.order.index - c2.order.index)
|
|
752
|
+
.forEach(c => {
|
|
753
|
+
const index = columns.findIndex(column => column.data === (c.sortProperty || c.property));
|
|
754
|
+
if (index !== -1)
|
|
755
|
+
order.push({ column: index, dir: c.order.dir });
|
|
756
|
+
});
|
|
757
|
+
this.dataSource.loadData({
|
|
758
|
+
draw: Date.now().toString(),
|
|
759
|
+
columns,
|
|
760
|
+
start: this.paginator.pageIndex,
|
|
761
|
+
length: this.paginator.pageSize,
|
|
762
|
+
order,
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
updateColumns = [];
|
|
766
|
+
openUpdateColumnDisplay() {
|
|
767
|
+
this.updateColumns = this.options.columns.map(column => ({
|
|
768
|
+
columnDef: column.columnDef,
|
|
769
|
+
header: column.header,
|
|
770
|
+
sticky: column.sticky,
|
|
771
|
+
hidden: column.hidden,
|
|
772
|
+
}));
|
|
773
|
+
}
|
|
774
|
+
reorderColumns(event) {
|
|
775
|
+
moveItemInArray(this.updateColumns, event.previousIndex, event.currentIndex);
|
|
776
|
+
}
|
|
777
|
+
closeUpdateColumnDisplay() {
|
|
778
|
+
let reload = false;
|
|
779
|
+
this.updateColumns.forEach((updated, index) => {
|
|
780
|
+
const columnIndex = this.options.columns.findIndex(c => c.columnDef === updated.columnDef);
|
|
781
|
+
if (columnIndex == -1)
|
|
782
|
+
return;
|
|
783
|
+
if (columnIndex !== index)
|
|
784
|
+
moveItemInArray(this.options.columns, index, columnIndex);
|
|
785
|
+
const column = this.options.columns[columnIndex];
|
|
786
|
+
if (updated.sticky !== column.sticky)
|
|
787
|
+
column.sticky = updated.sticky;
|
|
788
|
+
if (updated.hidden !== column.hidden) {
|
|
789
|
+
column.hidden = updated.hidden;
|
|
790
|
+
reload = reload || !updated.hidden;
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
this.buildDisplayColumns();
|
|
794
|
+
this.onDisplayChanged.emit(this.options.columns);
|
|
795
|
+
if (reload)
|
|
796
|
+
this.loadPage();
|
|
797
|
+
}
|
|
798
|
+
buildRequestColumns() {
|
|
799
|
+
const columns = [];
|
|
800
|
+
const additionalColumns = [];
|
|
801
|
+
this.options.columns.forEach(c => {
|
|
802
|
+
if (c.hidden)
|
|
803
|
+
return;
|
|
804
|
+
const column = { data: c.property, name: c.columnDef };
|
|
805
|
+
if (c.sortProperty && c.order)
|
|
806
|
+
this.addAdditionalColumn(additionalColumns, c.sortProperty);
|
|
807
|
+
if (c.searchable) {
|
|
808
|
+
const control = this.searchFormGroup.controls[c.columnDef];
|
|
809
|
+
if (control.value) {
|
|
810
|
+
if (c.searchProperty)
|
|
811
|
+
this.addAdditionalColumn(additionalColumns, c.searchProperty, control.value);
|
|
812
|
+
else
|
|
813
|
+
column.search = control.value;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (c.additionalProperties) {
|
|
817
|
+
c.additionalProperties.forEach(property => this.addAdditionalColumn(additionalColumns, property));
|
|
818
|
+
}
|
|
819
|
+
columns.push(column);
|
|
820
|
+
});
|
|
821
|
+
for (let additionalColumn of additionalColumns) {
|
|
822
|
+
const c = columns.find(c => c.data === additionalColumn.data);
|
|
823
|
+
if (!c)
|
|
824
|
+
columns.push(additionalColumn);
|
|
825
|
+
else if (additionalColumn.search && !c.search)
|
|
826
|
+
c.search = additionalColumn.search;
|
|
827
|
+
}
|
|
828
|
+
return columns;
|
|
829
|
+
}
|
|
830
|
+
addAdditionalColumn(additionalColumns, data, search) {
|
|
831
|
+
let column = additionalColumns.find(c => c.data === data);
|
|
832
|
+
if (!column)
|
|
833
|
+
additionalColumns.push((column = { data }));
|
|
834
|
+
if (search)
|
|
835
|
+
column.search = search;
|
|
836
|
+
return column;
|
|
837
|
+
}
|
|
838
|
+
buildDisplayColumns() {
|
|
839
|
+
const displayedColumns = [];
|
|
840
|
+
this.options.columns.forEach(column => {
|
|
841
|
+
if (column.hidden)
|
|
842
|
+
return;
|
|
843
|
+
displayedColumns.push(column.columnDef);
|
|
844
|
+
});
|
|
845
|
+
this.displayedColumns = displayedColumns;
|
|
846
|
+
}
|
|
847
|
+
buildSearchFormGroup() {
|
|
848
|
+
this.searchFormGroup = new FormGroup(this.options.columns.reduce((controls, column) => {
|
|
849
|
+
if (column.searchable) {
|
|
850
|
+
controls[column.columnDef] = new FormControl({ value: undefined, disabled: false });
|
|
851
|
+
}
|
|
852
|
+
return controls;
|
|
853
|
+
}, {}));
|
|
854
|
+
this.subscriptions.add(this.searchFormGroup.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
|
855
|
+
this.paginator.pageIndex = 0;
|
|
856
|
+
this.loadPage();
|
|
857
|
+
}));
|
|
858
|
+
}
|
|
859
|
+
consolidateOrderIndex() {
|
|
860
|
+
let index = 0;
|
|
861
|
+
this.options.columns
|
|
862
|
+
.filter(c => !!c.order)
|
|
863
|
+
.sort((c1, c2) => c1.order.index - c2.order.index)
|
|
864
|
+
.forEach(c => (c.order.index = index++));
|
|
865
|
+
}
|
|
866
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
867
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: NgxMatDatatableComponent, isStandalone: true, selector: "ngx-mat-datatable", inputs: { options: "options" }, outputs: { onDisplayChanged: "onDisplayChanged" }, queries: [{ propertyName: "cellRefs", predicate: NgxMatDatatableCellDirective }], viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<!-- @format -->\n\n<div *ngIf=\"dataSource\" id=\"container\">\n <ng-container *ngTemplateOutlet=\"actionsTmpl\"></ng-container>\n\n <div id=\"table-container\">\n <table\n id=\"table\"\n intersectionObserver\n (intersection)=\"load($event.intersect)\"\n mat-table\n [fixedLayout]=\"false\"\n [dataSource]=\"dataSource\"\n 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 mat-cell *matCellDef=\"let row\" [style.min-width.px]=\"column.minWidth || options.columnMinWith\">\n <ng-container *ngTemplateOutlet=\"cellTmpl; context: { column, row }\"></ng-container>\n </td>\n </ng-container>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n </div>\n\n <mat-paginator\n id=\"paginator\"\n [length]=\"dataSource.recordsFiltered\"\n [pageSizeOptions]=\"options.pageSizeOptions || [5, 10, 20, 50, 100]\"\n [pageSize]=\"(options.pageSizeOptions || [5, 10, 20, 50, 100])[options.pageSizeOptionsIndex || 0]\"\n [showFirstLastButtons]=\"true\">\n </mat-paginator>\n\n <div id=\"loading\" *ngIf=\"dataSource.loading$ | async\" @fade>\n <mat-spinner></mat-spinner>\n </div>\n</div>\n\n<ng-template #actionsTmpl>\n <div id=\"actions\">\n <div id=\"actions-start\"></div>\n\n <div id=\"actions-center\"></div>\n\n <div id=\"actions-end\">\n <div\n *ngIf=\"\n options.actions?.columns?.hideAndShow || options.actions?.columns?.sticky || options.actions?.columns?.reorder\n \">\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 <div *ngIf=\"options.actions?.refresh\" class=\"action\">\n <button\n mat-icon-button\n color=\"primary\"\n class=\"icon-only\"\n [disabled]=\"dataSource.loading$ | async\"\n (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 </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\">{{ 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\" [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 @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</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 class=\"cell\">\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.cellContent) {\n @let cell = cellRefs | findCellContent: column;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else {\n @if (column.prefix) {\n {{ column.prefix }}\n }\n @switch (column.type) {\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 @default {\n {{ value }}\n }\n }\n @if (column.suffix) {\n {{ column.suffix }}\n }\n }\n </div>\n } @placeholder {\n <div class=\"cell\"></div>\n }\n</ng-template>\n", styles: [":host{display:block;--datatable-background: #ffffff;--datatable-border-color: #ccc;--datatable-sticky-background: var(--datatable-background);--datatable-sticky-border: 1px dashed #e6a93a}#container{display:flex;box-sizing:border-box;flex-direction:column;position:relative;overflow:hidden;height:100%;width:100%;background-color:var(--datatable-background)}#actions{width:100%;display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row;border-bottom:1px solid var(--datatable-border-color)}#actions #actions-start,#actions #actions-center,#actions #actions-end{display:flex;box-sizing:border-box;align-items:center;flex-direction:row}#actions #actions-start{place-content:center start}#actions #actions-center{place-content:center center}#actions #actions-end{place-content:center end}#actions .action{position:relative}#actions .action .action-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#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:auto;width:100%;scrollbar-width:thin}#table{width:100%;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{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%;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)}#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 .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%}#paginator{--mat-paginator-container-background-color: var(--datatable-background);border-top:1px solid var(--datatable-border-color)}#loading{position:absolute;z-index:200;inset:0;background-color:#00000029}#loading mat-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}::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}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { 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: "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: 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.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { 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: i8.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: i8.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: i9.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: i10$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i11.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i11.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i11.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i11.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i11.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i11.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i11.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i11.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i11.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i11.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i12.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { 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"] }], animations: [
|
|
868
|
+
trigger('fade', [
|
|
869
|
+
transition(':enter', [
|
|
870
|
+
style({ opacity: 0 }), // initial
|
|
871
|
+
animate('0.2s', style({ opacity: 1 })), // final
|
|
872
|
+
]),
|
|
873
|
+
transition(':leave', [
|
|
874
|
+
style({ opacity: 1 }), // initial
|
|
875
|
+
animate('0.2s', style({ opacity: 0 })), // final
|
|
876
|
+
]),
|
|
877
|
+
]),
|
|
878
|
+
], deferBlockDependencies: [() => [import('./eherve-angular-material-datatable-cell-checkbox-value.component-BsEd3gO0.mjs').then(m => m.CellCheckboxValueComponent), import('./eherve-angular-material-datatable-cell-date-value.component-CDzvdmYI.mjs').then(m => m.CellDateValueComponent), import('./eherve-angular-material-datatable-cell-select-value.component-CxBvtvVx.mjs').then(m => m.CellSelectValueComponent), i1.NgComponentOutlet, i1.NgTemplateOutlet, import('./eherve-angular-material-datatable-find-cell-content.pipe-Cco9XewC.mjs').then(m => m.FindCellContentPipe), import('./eherve-angular-material-datatable-get.pipe--ODBMh1N.mjs').then(m => m.GetPipe)]] });
|
|
879
|
+
}
|
|
880
|
+
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableComponent, resolveDeferredDeps: () => [import('./eherve-angular-material-datatable-cell-checkbox-value.component-BsEd3gO0.mjs').then(m => m.CellCheckboxValueComponent), import('./eherve-angular-material-datatable-cell-date-value.component-CDzvdmYI.mjs').then(m => m.CellDateValueComponent), import('./eherve-angular-material-datatable-cell-select-value.component-CxBvtvVx.mjs').then(m => m.CellSelectValueComponent), import('./eherve-angular-material-datatable-find-cell-content.pipe-Cco9XewC.mjs').then(m => m.FindCellContentPipe), import('./eherve-angular-material-datatable-get.pipe--ODBMh1N.mjs').then(m => m.GetPipe)], resolveMetadata: (CellCheckboxValueComponent, CellDateValueComponent, CellSelectValueComponent, FindCellContentPipe, GetPipe) => ({ decorators: [{
|
|
881
|
+
type: Component,
|
|
882
|
+
args: [{ imports: [
|
|
883
|
+
CellCheckboxValueComponent,
|
|
884
|
+
CellDateValueComponent,
|
|
885
|
+
CellSelectValueComponent,
|
|
886
|
+
CommonModule,
|
|
887
|
+
DragDropModule,
|
|
888
|
+
FindCellContentPipe,
|
|
889
|
+
FormsModule,
|
|
890
|
+
GetPipe,
|
|
891
|
+
HeaderAutocompleteFilterComponent,
|
|
892
|
+
HeaderCheckboxFilterComponent,
|
|
893
|
+
HeaderDateFilterComponent,
|
|
894
|
+
HeaderNumberFilterComponent,
|
|
895
|
+
HeaderSelectFilterComponent,
|
|
896
|
+
HeaderTextFilterComponent,
|
|
897
|
+
IntersectionObserverModule,
|
|
898
|
+
MatBadgeModule,
|
|
899
|
+
MatButtonModule,
|
|
900
|
+
MatFormFieldModule,
|
|
901
|
+
MatIconModule,
|
|
902
|
+
MatMenuModule,
|
|
903
|
+
MatPaginatorModule,
|
|
904
|
+
MatProgressSpinnerModule,
|
|
905
|
+
MatTableModule,
|
|
906
|
+
MatTooltipModule,
|
|
907
|
+
ReactiveFormsModule,
|
|
908
|
+
], selector: 'ngx-mat-datatable', animations: [
|
|
909
|
+
trigger('fade', [
|
|
910
|
+
transition(':enter', [
|
|
911
|
+
style({ opacity: 0 }), // initial
|
|
912
|
+
animate('0.2s', style({ opacity: 1 })), // final
|
|
913
|
+
]),
|
|
914
|
+
transition(':leave', [
|
|
915
|
+
style({ opacity: 1 }), // initial
|
|
916
|
+
animate('0.2s', style({ opacity: 0 })), // final
|
|
917
|
+
]),
|
|
918
|
+
]),
|
|
919
|
+
], template: "<!-- @format -->\n\n<div *ngIf=\"dataSource\" id=\"container\">\n <ng-container *ngTemplateOutlet=\"actionsTmpl\"></ng-container>\n\n <div id=\"table-container\">\n <table\n id=\"table\"\n intersectionObserver\n (intersection)=\"load($event.intersect)\"\n mat-table\n [fixedLayout]=\"false\"\n [dataSource]=\"dataSource\"\n 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 mat-cell *matCellDef=\"let row\" [style.min-width.px]=\"column.minWidth || options.columnMinWith\">\n <ng-container *ngTemplateOutlet=\"cellTmpl; context: { column, row }\"></ng-container>\n </td>\n </ng-container>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n </div>\n\n <mat-paginator\n id=\"paginator\"\n [length]=\"dataSource.recordsFiltered\"\n [pageSizeOptions]=\"options.pageSizeOptions || [5, 10, 20, 50, 100]\"\n [pageSize]=\"(options.pageSizeOptions || [5, 10, 20, 50, 100])[options.pageSizeOptionsIndex || 0]\"\n [showFirstLastButtons]=\"true\">\n </mat-paginator>\n\n <div id=\"loading\" *ngIf=\"dataSource.loading$ | async\" @fade>\n <mat-spinner></mat-spinner>\n </div>\n</div>\n\n<ng-template #actionsTmpl>\n <div id=\"actions\">\n <div id=\"actions-start\"></div>\n\n <div id=\"actions-center\"></div>\n\n <div id=\"actions-end\">\n <div\n *ngIf=\"\n options.actions?.columns?.hideAndShow || options.actions?.columns?.sticky || options.actions?.columns?.reorder\n \">\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 <div *ngIf=\"options.actions?.refresh\" class=\"action\">\n <button\n mat-icon-button\n color=\"primary\"\n class=\"icon-only\"\n [disabled]=\"dataSource.loading$ | async\"\n (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 </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\">{{ 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\" [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 @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</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 class=\"cell\">\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.cellContent) {\n @let cell = cellRefs | findCellContent: column;\n @if (cell) {\n <ng-container *ngTemplateOutlet=\"cell.templateRef; context: { column, row, value }\" />\n }\n } @else {\n @if (column.prefix) {\n {{ column.prefix }}\n }\n @switch (column.type) {\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 @default {\n {{ value }}\n }\n }\n @if (column.suffix) {\n {{ column.suffix }}\n }\n }\n </div>\n } @placeholder {\n <div class=\"cell\"></div>\n }\n</ng-template>\n", styles: [":host{display:block;--datatable-background: #ffffff;--datatable-border-color: #ccc;--datatable-sticky-background: var(--datatable-background);--datatable-sticky-border: 1px dashed #e6a93a}#container{display:flex;box-sizing:border-box;flex-direction:column;position:relative;overflow:hidden;height:100%;width:100%;background-color:var(--datatable-background)}#actions{width:100%;display:flex;box-sizing:border-box;place-content:center space-between;align-items:center;flex-direction:row;border-bottom:1px solid var(--datatable-border-color)}#actions #actions-start,#actions #actions-center,#actions #actions-end{display:flex;box-sizing:border-box;align-items:center;flex-direction:row}#actions #actions-start{place-content:center start}#actions #actions-center{place-content:center center}#actions #actions-end{place-content:center end}#actions .action{position:relative}#actions .action .action-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#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:auto;width:100%;scrollbar-width:thin}#table{width:100%;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{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%;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)}#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 .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%}#paginator{--mat-paginator-container-background-color: var(--datatable-background);border-top:1px solid var(--datatable-border-color)}#loading{position:absolute;z-index:200;inset:0;background-color:#00000029}#loading mat-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}::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}\n"] }]
|
|
920
|
+
}], ctorParameters: null, propDecorators: { options: [{
|
|
921
|
+
type: Input,
|
|
922
|
+
args: ['options']
|
|
923
|
+
}], onDisplayChanged: [{
|
|
924
|
+
type: Output
|
|
925
|
+
}], paginator: [{
|
|
926
|
+
type: ViewChild,
|
|
927
|
+
args: [MatPaginator]
|
|
928
|
+
}], cellRefs: [{
|
|
929
|
+
type: ContentChildren,
|
|
930
|
+
args: [NgxMatDatatableCellDirective]
|
|
931
|
+
}] } }) });
|
|
932
|
+
|
|
933
|
+
/** @format */
|
|
934
|
+
class NgxMatDatatableModule {
|
|
935
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
936
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, imports: [CommonModule, NgxMatDatatableComponent, NgxMatDatatableCellDirective], exports: [NgxMatDatatableComponent, NgxMatDatatableCellDirective] });
|
|
937
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, imports: [CommonModule, NgxMatDatatableComponent] });
|
|
938
|
+
}
|
|
939
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: NgxMatDatatableModule, decorators: [{
|
|
940
|
+
type: NgModule,
|
|
941
|
+
args: [{
|
|
942
|
+
imports: [CommonModule, NgxMatDatatableComponent, NgxMatDatatableCellDirective],
|
|
943
|
+
exports: [NgxMatDatatableComponent, NgxMatDatatableCellDirective],
|
|
944
|
+
}]
|
|
945
|
+
}] });
|
|
946
|
+
|
|
947
|
+
/** @format */
|
|
948
|
+
|
|
949
|
+
/** @format */
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* Public API Surface of mongoose-datatable
|
|
953
|
+
*
|
|
954
|
+
* @format
|
|
955
|
+
*/
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Generated bundle index. Do not edit.
|
|
959
|
+
*/
|
|
960
|
+
|
|
961
|
+
export { NgxMatDatatableComponent as N, SelectOptionPipe as S, NgxMatDatatableModule as a, NgxMatDatatableCellDirective as b };
|
|
962
|
+
//# sourceMappingURL=eherve-angular-material-datatable-eherve-angular-material-datatable-CjmrdtGO.mjs.map
|