@eherve/angular-material-datatable 19.0.0 → 19.0.2
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-CSQp0UWo.mjs +24 -0
- package/fesm2022/eherve-angular-material-datatable-cell-date-value.component-CSQp0UWo.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-CeO753TD.mjs +28 -0
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-CeO753TD.mjs.map +1 -0
- package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-D-zJZjLj.mjs +962 -0
- package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-D-zJZjLj.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/datatable.component.d.ts +5 -5
- package/lib/datatable.module.d.ts +4 -4
- package/lib/directives/datatable-cell.directive.d.ts +3 -3
- package/lib/pipes/find-cell-content.pipe.d.ts +2 -2
- package/lib/types/datatable-column.type.d.ts +7 -3
- package/package.json +1 -1
|
@@ -1,1031 +1,2 @@
|
|
|
1
|
-
|
|
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 { Pipe, Component, Input, inject, Injector, ChangeDetectorRef, forwardRef, ViewChild, signal, ChangeDetectionStrategy, 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 { MatLabel, MatFormFieldModule } from '@angular/material/form-field';
|
|
16
|
-
import * as i5 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$1 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 GetPipe {
|
|
52
|
-
transform(obj, path) {
|
|
53
|
-
const chunks = path.split('.');
|
|
54
|
-
let value = obj;
|
|
55
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
56
|
-
value = value[chunks[i]];
|
|
57
|
-
}
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
60
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: GetPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
61
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: GetPipe, isStandalone: true, name: "get" });
|
|
62
|
-
}
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: GetPipe, decorators: [{
|
|
64
|
-
type: Pipe,
|
|
65
|
-
args: [{ name: 'get' }]
|
|
66
|
-
}] });
|
|
67
|
-
|
|
68
|
-
/** @format */
|
|
69
|
-
class CellCheckboxValueComponent {
|
|
70
|
-
column;
|
|
71
|
-
row;
|
|
72
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellCheckboxValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
73
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: CellCheckboxValueComponent, isStandalone: true, selector: "lib-cell-checkbox-value", inputs: { column: "column", row: "row" }, ngImport: i0, template: "<!-- @format -->\n\n@let value = row | get: column.property;\n@if (value === false) {\n <mat-icon>check_box_outline_blank</mat-icon>\n} @else if (value === true) {\n <mat-icon color=\"primary\">check_box</mat-icon>\n}\n", styles: ["mat-icon{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: GetPipe, name: "get" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
74
|
-
}
|
|
75
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellCheckboxValueComponent, decorators: [{
|
|
76
|
-
type: Component,
|
|
77
|
-
args: [{ selector: 'lib-cell-checkbox-value', imports: [CommonModule, GetPipe, MatIconModule], template: "<!-- @format -->\n\n@let value = row | get: column.property;\n@if (value === false) {\n <mat-icon>check_box_outline_blank</mat-icon>\n} @else if (value === true) {\n <mat-icon color=\"primary\">check_box</mat-icon>\n}\n", styles: ["mat-icon{padding:8px}\n"] }]
|
|
78
|
-
}], propDecorators: { column: [{
|
|
79
|
-
type: Input
|
|
80
|
-
}], row: [{
|
|
81
|
-
type: Input
|
|
82
|
-
}] } });
|
|
83
|
-
|
|
84
|
-
/** @format */
|
|
85
|
-
class CellDateValueComponent {
|
|
86
|
-
column;
|
|
87
|
-
row;
|
|
88
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellDateValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: CellDateValueComponent, isStandalone: true, selector: "lib-cell-date-value", inputs: { column: "column", row: "row" }, ngImport: i0, template: "<!-- @format -->\n\n@let value = row | get: column.property;\n@if (value) {\n {{ value.toLocaleDateString(column.locale) }}\n}\n", styles: ["mat-icon{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: GetPipe, name: "get" }, { kind: "ngmodule", type: MatIconModule }] });
|
|
90
|
-
}
|
|
91
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellDateValueComponent, decorators: [{
|
|
92
|
-
type: Component,
|
|
93
|
-
args: [{ selector: 'lib-cell-date-value', imports: [CommonModule, GetPipe, MatIconModule], template: "<!-- @format -->\n\n@let value = row | get: column.property;\n@if (value) {\n {{ value.toLocaleDateString(column.locale) }}\n}\n", styles: ["mat-icon{padding:8px}\n"] }]
|
|
94
|
-
}], propDecorators: { column: [{
|
|
95
|
-
type: Input
|
|
96
|
-
}], row: [{
|
|
97
|
-
type: Input
|
|
98
|
-
}] } });
|
|
99
|
-
|
|
100
|
-
/** @format */
|
|
101
|
-
class SelectOptionPipe {
|
|
102
|
-
transform(value, options) {
|
|
103
|
-
if (!options)
|
|
104
|
-
return null;
|
|
105
|
-
return options.find((option) => option.value === value) || null;
|
|
106
|
-
}
|
|
107
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
108
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, isStandalone: true, name: "selectOption" });
|
|
109
|
-
}
|
|
110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: SelectOptionPipe, decorators: [{
|
|
111
|
-
type: Pipe,
|
|
112
|
-
args: [{ name: 'selectOption' }]
|
|
113
|
-
}] });
|
|
114
|
-
|
|
115
|
-
/** @format */
|
|
116
|
-
class CellSelectValueComponent {
|
|
117
|
-
column;
|
|
118
|
-
row;
|
|
119
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
120
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: CellSelectValueComponent, isStandalone: true, selector: "lib-cell-select-value", inputs: { column: "column", row: "row" }, ngImport: i0, template: "<!-- @format -->\n\n@let options = $any(column.options | async);\n@let value = row | get: column.property;\n@let option = row | get: column.property | selectOption: options;\n\n@if (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.label\"></mat-label>\n </div>\n} @else {\n {{ value }}\n}\n", styles: [".option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: SelectOptionPipe, name: "selectOption" }, { kind: "pipe", type: GetPipe, name: "get" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }] });
|
|
121
|
-
}
|
|
122
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellSelectValueComponent, decorators: [{
|
|
123
|
-
type: Component,
|
|
124
|
-
args: [{ selector: 'lib-cell-select-value', imports: [CommonModule, SelectOptionPipe, GetPipe, MatIconModule, MatLabel], template: "<!-- @format -->\n\n@let options = $any(column.options | async);\n@let value = row | get: column.property;\n@let option = row | get: column.property | selectOption: options;\n\n@if (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.label\"></mat-label>\n </div>\n} @else {\n {{ value }}\n}\n", styles: [".option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}\n"] }]
|
|
125
|
-
}], propDecorators: { column: [{
|
|
126
|
-
type: Input
|
|
127
|
-
}], row: [{
|
|
128
|
-
type: Input
|
|
129
|
-
}] } });
|
|
130
|
-
|
|
131
|
-
/** @format */
|
|
132
|
-
class HeaderAutocompleteFilterComponent {
|
|
133
|
-
column;
|
|
134
|
-
options = [];
|
|
135
|
-
hasMore = false;
|
|
136
|
-
searching = false;
|
|
137
|
-
input;
|
|
138
|
-
control;
|
|
139
|
-
selectControl = new FormControl();
|
|
140
|
-
onChange = () => { };
|
|
141
|
-
onTouched = () => { };
|
|
142
|
-
filter$ = new BehaviorSubject(undefined);
|
|
143
|
-
nextPage$ = new Subject();
|
|
144
|
-
injector = inject(Injector);
|
|
145
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
146
|
-
subsink = new Subscription();
|
|
147
|
-
writeValue = (value) => {
|
|
148
|
-
if (value?.value !== this.selectControl.value)
|
|
149
|
-
this.selectControl.setValue(value?.value);
|
|
150
|
-
};
|
|
151
|
-
registerOnChange(onChange) {
|
|
152
|
-
this.onChange = onChange;
|
|
153
|
-
}
|
|
154
|
-
registerOnTouched(onTouched) {
|
|
155
|
-
this.onTouched = onTouched;
|
|
156
|
-
}
|
|
157
|
-
async ngAfterViewInit() {
|
|
158
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
159
|
-
if (!ngControl)
|
|
160
|
-
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
161
|
-
this.control = ngControl.control;
|
|
162
|
-
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
163
|
-
if (value === undefined) {
|
|
164
|
-
if (this.control.value !== undefined)
|
|
165
|
-
this.control.setValue(undefined);
|
|
166
|
-
}
|
|
167
|
-
if (value === null && !this.options.find(o => o.value === null)) {
|
|
168
|
-
if (this.control.value !== undefined)
|
|
169
|
-
this.control.setValue(undefined);
|
|
170
|
-
}
|
|
171
|
-
else if (this.control.value?.value !== value)
|
|
172
|
-
this.control.setValue({ value, regex: false });
|
|
173
|
-
}));
|
|
174
|
-
this.buildOptions();
|
|
175
|
-
this.changeDetectorRef.detectChanges();
|
|
176
|
-
}
|
|
177
|
-
ngOnDestroy() {
|
|
178
|
-
this.subsink.unsubscribe();
|
|
179
|
-
}
|
|
180
|
-
loadMore(intersect) {
|
|
181
|
-
if (!intersect)
|
|
182
|
-
return;
|
|
183
|
-
this.nextPage$.next();
|
|
184
|
-
}
|
|
185
|
-
focus() {
|
|
186
|
-
if (this.column.loadOnFocus) {
|
|
187
|
-
const search = this.input.nativeElement.value;
|
|
188
|
-
if (this.filter$.value !== search)
|
|
189
|
-
this.filter$.next(search);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
filter() {
|
|
193
|
-
const search = this.input.nativeElement.value;
|
|
194
|
-
this.filter$.next(search);
|
|
195
|
-
}
|
|
196
|
-
buildOptions() {
|
|
197
|
-
this.subsink.add(this.filter$
|
|
198
|
-
.pipe(filter(value => typeof value === 'string'), debounceTime(300), switchMap((search) => {
|
|
199
|
-
this.options = [];
|
|
200
|
-
let skip = 0;
|
|
201
|
-
return this.nextPage$.pipe(startWith(skip), tap(() => (this.searching = true)), switchMap(async () => this.column.options(this.column.limit || 10, skip, search)), map(data => {
|
|
202
|
-
this.options.push(...data);
|
|
203
|
-
skip += this.column.limit || 10;
|
|
204
|
-
this.hasMore = data?.length === (this.column.limit || 10);
|
|
205
|
-
this.searching = false;
|
|
206
|
-
}));
|
|
207
|
-
}))
|
|
208
|
-
.subscribe());
|
|
209
|
-
}
|
|
210
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderAutocompleteFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
211
|
-
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: [
|
|
212
|
-
{
|
|
213
|
-
provide: NG_VALUE_ACCESSOR,
|
|
214
|
-
multi: true,
|
|
215
|
-
useExisting: forwardRef(() => HeaderAutocompleteFilterComponent),
|
|
216
|
-
},
|
|
217
|
-
], 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.label\"></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$1.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.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"] }] });
|
|
218
|
-
}
|
|
219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderAutocompleteFilterComponent, decorators: [{
|
|
220
|
-
type: Component,
|
|
221
|
-
args: [{ selector: 'lib-header-autocomplete-filter', imports: [
|
|
222
|
-
CommonModule,
|
|
223
|
-
FormsModule,
|
|
224
|
-
IntersectionObserverModule,
|
|
225
|
-
MatAutocompleteModule,
|
|
226
|
-
MatButtonModule,
|
|
227
|
-
MatFormFieldModule,
|
|
228
|
-
MatIconModule,
|
|
229
|
-
MatInputModule,
|
|
230
|
-
MatProgressBarModule,
|
|
231
|
-
ReactiveFormsModule,
|
|
232
|
-
], providers: [
|
|
233
|
-
{
|
|
234
|
-
provide: NG_VALUE_ACCESSOR,
|
|
235
|
-
multi: true,
|
|
236
|
-
useExisting: forwardRef(() => HeaderAutocompleteFilterComponent),
|
|
237
|
-
},
|
|
238
|
-
], 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.label\"></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"] }]
|
|
239
|
-
}], propDecorators: { column: [{
|
|
240
|
-
type: Input
|
|
241
|
-
}], input: [{
|
|
242
|
-
type: ViewChild,
|
|
243
|
-
args: ['input']
|
|
244
|
-
}] } });
|
|
245
|
-
|
|
246
|
-
/** @format */
|
|
247
|
-
class HeaderCheckboxFilterComponent {
|
|
248
|
-
column;
|
|
249
|
-
control;
|
|
250
|
-
selectControl = new FormControl();
|
|
251
|
-
onChange = () => { };
|
|
252
|
-
onTouched = () => { };
|
|
253
|
-
injector = inject(Injector);
|
|
254
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
255
|
-
subsink = new Subscription();
|
|
256
|
-
writeValue = (value) => {
|
|
257
|
-
if (value?.value !== this.selectControl.value)
|
|
258
|
-
this.selectControl.setValue(value?.value);
|
|
259
|
-
};
|
|
260
|
-
registerOnChange(onChange) {
|
|
261
|
-
this.onChange = onChange;
|
|
262
|
-
}
|
|
263
|
-
registerOnTouched(onTouched) {
|
|
264
|
-
this.onTouched = onTouched;
|
|
265
|
-
}
|
|
266
|
-
async ngAfterViewInit() {
|
|
267
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
268
|
-
if (!ngControl)
|
|
269
|
-
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
270
|
-
this.control = ngControl.control;
|
|
271
|
-
let previousValue = this.control.value;
|
|
272
|
-
this.subsink.add(this.selectControl.valueChanges
|
|
273
|
-
.pipe(filter(value => {
|
|
274
|
-
if (value === true && previousValue === false) {
|
|
275
|
-
this.selectControl.setValue(undefined);
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
279
|
-
}), tap(value => (previousValue = value)))
|
|
280
|
-
.subscribe((value) => {
|
|
281
|
-
if (value === undefined)
|
|
282
|
-
this.control.setValue(undefined);
|
|
283
|
-
else
|
|
284
|
-
this.control.setValue({ value, regex: false });
|
|
285
|
-
}));
|
|
286
|
-
this.changeDetectorRef.detectChanges();
|
|
287
|
-
}
|
|
288
|
-
ngOnDestroy() {
|
|
289
|
-
this.subsink.unsubscribe();
|
|
290
|
-
}
|
|
291
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderCheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
292
|
-
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: [
|
|
293
|
-
{
|
|
294
|
-
provide: NG_VALUE_ACCESSOR,
|
|
295
|
-
multi: true,
|
|
296
|
-
useExisting: forwardRef(() => HeaderCheckboxFilterComponent),
|
|
297
|
-
},
|
|
298
|
-
], 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"] }] });
|
|
299
|
-
}
|
|
300
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderCheckboxFilterComponent, decorators: [{
|
|
301
|
-
type: Component,
|
|
302
|
-
args: [{ selector: 'lib-header-checkbox-filter', imports: [
|
|
303
|
-
CommonModule,
|
|
304
|
-
FormsModule,
|
|
305
|
-
MatButtonModule,
|
|
306
|
-
MatFormFieldModule,
|
|
307
|
-
MatIconModule,
|
|
308
|
-
MatCheckboxModule,
|
|
309
|
-
ReactiveFormsModule,
|
|
310
|
-
], providers: [
|
|
311
|
-
{
|
|
312
|
-
provide: NG_VALUE_ACCESSOR,
|
|
313
|
-
multi: true,
|
|
314
|
-
useExisting: forwardRef(() => HeaderCheckboxFilterComponent),
|
|
315
|
-
},
|
|
316
|
-
], 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"] }]
|
|
317
|
-
}], propDecorators: { column: [{
|
|
318
|
-
type: Input
|
|
319
|
-
}] } });
|
|
320
|
-
|
|
321
|
-
/** @format */
|
|
322
|
-
class OperatorSelectComponent {
|
|
323
|
-
operators = ['=', '>', '≥', '<', '≤', '<>', '≤≥'];
|
|
324
|
-
isOpen = false;
|
|
325
|
-
control;
|
|
326
|
-
onChange = () => { };
|
|
327
|
-
onTouched = () => { };
|
|
328
|
-
injector = inject(Injector);
|
|
329
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
330
|
-
writeValue = () => { };
|
|
331
|
-
registerOnChange(onChange) {
|
|
332
|
-
this.onChange = onChange;
|
|
333
|
-
}
|
|
334
|
-
registerOnTouched(onTouched) {
|
|
335
|
-
this.onTouched = onTouched;
|
|
336
|
-
}
|
|
337
|
-
async ngAfterViewInit() {
|
|
338
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
339
|
-
if (!ngControl)
|
|
340
|
-
throw new Error(`${this.constructor.name} missing control`);
|
|
341
|
-
this.control = ngControl.control;
|
|
342
|
-
this.changeDetectorRef.detectChanges();
|
|
343
|
-
}
|
|
344
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OperatorSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
345
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: OperatorSelectComponent, isStandalone: true, selector: "lib-operator-select", providers: [
|
|
346
|
-
{
|
|
347
|
-
provide: NG_VALUE_ACCESSOR,
|
|
348
|
-
multi: true,
|
|
349
|
-
useExisting: forwardRef(() => OperatorSelectComponent),
|
|
350
|
-
},
|
|
351
|
-
], ngImport: i0, template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-mini-fab\n size=\"small\"\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 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: [
|
|
352
|
-
trigger('fade', [
|
|
353
|
-
transition(':enter', [
|
|
354
|
-
style({ opacity: 0 }), // initial
|
|
355
|
-
animate('0.2s', style({ opacity: 1 })), // final
|
|
356
|
-
]),
|
|
357
|
-
transition(':leave', [
|
|
358
|
-
style({ opacity: 1 }), // initial
|
|
359
|
-
animate('0.2s', style({ opacity: 0 })), // final
|
|
360
|
-
]),
|
|
361
|
-
]),
|
|
362
|
-
] });
|
|
363
|
-
}
|
|
364
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: OperatorSelectComponent, decorators: [{
|
|
365
|
-
type: Component,
|
|
366
|
-
args: [{ selector: 'lib-operator-select', imports: [CommonModule, OverlayModule, MatIconModule, MatButtonModule], animations: [
|
|
367
|
-
trigger('fade', [
|
|
368
|
-
transition(':enter', [
|
|
369
|
-
style({ opacity: 0 }), // initial
|
|
370
|
-
animate('0.2s', style({ opacity: 1 })), // final
|
|
371
|
-
]),
|
|
372
|
-
transition(':leave', [
|
|
373
|
-
style({ opacity: 1 }), // initial
|
|
374
|
-
animate('0.2s', style({ opacity: 0 })), // final
|
|
375
|
-
]),
|
|
376
|
-
]),
|
|
377
|
-
], providers: [
|
|
378
|
-
{
|
|
379
|
-
provide: NG_VALUE_ACCESSOR,
|
|
380
|
-
multi: true,
|
|
381
|
-
useExisting: forwardRef(() => OperatorSelectComponent),
|
|
382
|
-
},
|
|
383
|
-
], template: "<!-- @format -->\n\n@if (control) {\n <button\n mat-mini-fab\n size=\"small\"\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 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"] }]
|
|
384
|
-
}] });
|
|
385
|
-
|
|
386
|
-
/** @format */
|
|
387
|
-
class HeaderDateFilterComponent {
|
|
388
|
-
column;
|
|
389
|
-
control;
|
|
390
|
-
selectControl = new FormControl(undefined);
|
|
391
|
-
rangeGroup = new FormGroup({
|
|
392
|
-
start: new FormControl(undefined, Validators.required),
|
|
393
|
-
end: new FormControl(undefined, Validators.required),
|
|
394
|
-
});
|
|
395
|
-
operatorControl = new FormControl('=');
|
|
396
|
-
onChange = () => { };
|
|
397
|
-
onTouched = () => { };
|
|
398
|
-
_adapter = inject(DateAdapter);
|
|
399
|
-
_intl = inject(MatDatepickerIntl);
|
|
400
|
-
_locale = signal(inject(MAT_DATE_LOCALE));
|
|
401
|
-
injector = inject(Injector);
|
|
402
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
403
|
-
subsink = new Subscription();
|
|
404
|
-
writeValue = (value) => {
|
|
405
|
-
if (value?.value !== this.selectControl.value)
|
|
406
|
-
this.selectControl.setValue(value?.value);
|
|
407
|
-
};
|
|
408
|
-
registerOnChange(onChange) {
|
|
409
|
-
this.onChange = onChange;
|
|
410
|
-
}
|
|
411
|
-
registerOnTouched(onTouched) {
|
|
412
|
-
this.onTouched = onTouched;
|
|
413
|
-
}
|
|
414
|
-
ngOnInit() {
|
|
415
|
-
if (this.column.locale) {
|
|
416
|
-
this._locale.set(this.column.locale);
|
|
417
|
-
this._adapter.setLocale(this._locale());
|
|
418
|
-
this._intl.changes.next();
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
async ngAfterViewInit() {
|
|
422
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
423
|
-
if (!ngControl)
|
|
424
|
-
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
425
|
-
this.control = ngControl.control;
|
|
426
|
-
this.subsink.add(this.selectControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
|
427
|
-
if (this.control.invalid)
|
|
428
|
-
return;
|
|
429
|
-
else if (!value)
|
|
430
|
-
this.control.setValue(undefined);
|
|
431
|
-
else
|
|
432
|
-
this.control.setValue({ value, regex: false, operator: this.operatorControl.value });
|
|
433
|
-
}));
|
|
434
|
-
this.subsink.add(this.rangeGroup.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
|
435
|
-
if (this.rangeGroup.invalid)
|
|
436
|
-
return;
|
|
437
|
-
else if (!value)
|
|
438
|
-
this.control.setValue(undefined);
|
|
439
|
-
else
|
|
440
|
-
this.control.setValue({
|
|
441
|
-
start: value.start,
|
|
442
|
-
end: value.end,
|
|
443
|
-
regex: false,
|
|
444
|
-
operator: this.operatorControl.value,
|
|
445
|
-
});
|
|
446
|
-
}));
|
|
447
|
-
this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
|
|
448
|
-
if (['<>', '≤≥'].includes(this.operatorControl.value)) {
|
|
449
|
-
if (!this.rangeGroup.value || this.rangeGroup.invalid)
|
|
450
|
-
return;
|
|
451
|
-
this.control.setValue({
|
|
452
|
-
start: this.rangeGroup.value.start,
|
|
453
|
-
end: this.rangeGroup.value.end,
|
|
454
|
-
regex: false,
|
|
455
|
-
operator: value,
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
if (!this.selectControl.value)
|
|
460
|
-
return;
|
|
461
|
-
this.control.setValue({ value: this.selectControl.value, regex: false, operator: value });
|
|
462
|
-
}
|
|
463
|
-
}));
|
|
464
|
-
this.changeDetectorRef.detectChanges();
|
|
465
|
-
}
|
|
466
|
-
ngOnDestroy() {
|
|
467
|
-
this.subsink.unsubscribe();
|
|
468
|
-
}
|
|
469
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDateFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
470
|
-
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: [
|
|
471
|
-
{
|
|
472
|
-
provide: NG_VALUE_ACCESSOR,
|
|
473
|
-
multi: true,
|
|
474
|
-
useExisting: forwardRef(() => HeaderDateFilterComponent),
|
|
475
|
-
},
|
|
476
|
-
provideMomentDateAdapter(),
|
|
477
|
-
], 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.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 });
|
|
478
|
-
}
|
|
479
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderDateFilterComponent, decorators: [{
|
|
480
|
-
type: Component,
|
|
481
|
-
args: [{ selector: 'lib-header-date-filter', imports: [
|
|
482
|
-
CommonModule,
|
|
483
|
-
FormsModule,
|
|
484
|
-
MatButtonModule,
|
|
485
|
-
MatDatepickerModule,
|
|
486
|
-
MatFormFieldModule,
|
|
487
|
-
MatIconModule,
|
|
488
|
-
MatInputModule,
|
|
489
|
-
MatMenuModule,
|
|
490
|
-
ReactiveFormsModule,
|
|
491
|
-
OperatorSelectComponent,
|
|
492
|
-
], providers: [
|
|
493
|
-
{
|
|
494
|
-
provide: NG_VALUE_ACCESSOR,
|
|
495
|
-
multi: true,
|
|
496
|
-
useExisting: forwardRef(() => HeaderDateFilterComponent),
|
|
497
|
-
},
|
|
498
|
-
provideMomentDateAdapter(),
|
|
499
|
-
], 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"] }]
|
|
500
|
-
}], propDecorators: { column: [{
|
|
501
|
-
type: Input
|
|
502
|
-
}] } });
|
|
503
|
-
|
|
504
|
-
/** @format */
|
|
505
|
-
class HeaderNumberFilterComponent {
|
|
506
|
-
column;
|
|
507
|
-
control;
|
|
508
|
-
selectControl = new FormControl();
|
|
509
|
-
operatorControl = new FormControl('=');
|
|
510
|
-
onChange = () => { };
|
|
511
|
-
onTouched = () => { };
|
|
512
|
-
injector = inject(Injector);
|
|
513
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
514
|
-
subsink = new Subscription();
|
|
515
|
-
writeValue = (value) => {
|
|
516
|
-
if (value?.value !== this.selectControl.value)
|
|
517
|
-
this.selectControl.setValue(value?.value);
|
|
518
|
-
};
|
|
519
|
-
registerOnChange(onChange) {
|
|
520
|
-
this.onChange = onChange;
|
|
521
|
-
}
|
|
522
|
-
registerOnTouched(onTouched) {
|
|
523
|
-
this.onTouched = onTouched;
|
|
524
|
-
}
|
|
525
|
-
async ngAfterViewInit() {
|
|
526
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
527
|
-
if (!ngControl)
|
|
528
|
-
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
529
|
-
this.control = ngControl.control;
|
|
530
|
-
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
531
|
-
if (!value)
|
|
532
|
-
this.control.setValue(undefined);
|
|
533
|
-
else
|
|
534
|
-
this.control.setValue({ value, regex: false, operator: this.operatorControl.value });
|
|
535
|
-
}));
|
|
536
|
-
this.subsink.add(this.operatorControl.valueChanges.subscribe((value) => {
|
|
537
|
-
if (this.control.value === null || this.control.value === undefined)
|
|
538
|
-
return;
|
|
539
|
-
this.control.setValue({ value: this.selectControl.value, regex: false, operator: value });
|
|
540
|
-
}));
|
|
541
|
-
this.changeDetectorRef.detectChanges();
|
|
542
|
-
}
|
|
543
|
-
ngOnDestroy() {
|
|
544
|
-
this.subsink.unsubscribe();
|
|
545
|
-
}
|
|
546
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderNumberFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
547
|
-
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: [
|
|
548
|
-
{
|
|
549
|
-
provide: NG_VALUE_ACCESSOR,
|
|
550
|
-
multi: true,
|
|
551
|
-
useExisting: forwardRef(() => HeaderNumberFilterComponent),
|
|
552
|
-
},
|
|
553
|
-
], 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.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" }] });
|
|
554
|
-
}
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderNumberFilterComponent, decorators: [{
|
|
556
|
-
type: Component,
|
|
557
|
-
args: [{ selector: 'lib-header-number-filter', imports: [
|
|
558
|
-
CommonModule,
|
|
559
|
-
FormsModule,
|
|
560
|
-
MatButtonModule,
|
|
561
|
-
MatFormFieldModule,
|
|
562
|
-
MatIconModule,
|
|
563
|
-
MatInputModule,
|
|
564
|
-
MatMenuModule,
|
|
565
|
-
ReactiveFormsModule,
|
|
566
|
-
OperatorSelectComponent,
|
|
567
|
-
], providers: [
|
|
568
|
-
{
|
|
569
|
-
provide: NG_VALUE_ACCESSOR,
|
|
570
|
-
multi: true,
|
|
571
|
-
useExisting: forwardRef(() => HeaderNumberFilterComponent),
|
|
572
|
-
},
|
|
573
|
-
], 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"] }]
|
|
574
|
-
}], propDecorators: { column: [{
|
|
575
|
-
type: Input
|
|
576
|
-
}] } });
|
|
577
|
-
|
|
578
|
-
/** @format */
|
|
579
|
-
class HeaderSelectFilterComponent {
|
|
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 === undefined)
|
|
605
|
-
this.control.setValue(undefined);
|
|
606
|
-
else
|
|
607
|
-
this.control.setValue({ value, regex: false });
|
|
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: HeaderSelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
615
|
-
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: [
|
|
616
|
-
{
|
|
617
|
-
provide: NG_VALUE_ACCESSOR,
|
|
618
|
-
multi: true,
|
|
619
|
-
useExisting: forwardRef(() => HeaderSelectFilterComponent),
|
|
620
|
-
},
|
|
621
|
-
], 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.label\"></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.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$1.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" }] });
|
|
622
|
-
}
|
|
623
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderSelectFilterComponent, decorators: [{
|
|
624
|
-
type: Component,
|
|
625
|
-
args: [{ selector: 'lib-header-select-filter', imports: [
|
|
626
|
-
CommonModule,
|
|
627
|
-
FormsModule,
|
|
628
|
-
MatButtonModule,
|
|
629
|
-
MatFormFieldModule,
|
|
630
|
-
MatIconModule,
|
|
631
|
-
MatSelectModule,
|
|
632
|
-
ReactiveFormsModule,
|
|
633
|
-
SelectOptionPipe,
|
|
634
|
-
], providers: [
|
|
635
|
-
{
|
|
636
|
-
provide: NG_VALUE_ACCESSOR,
|
|
637
|
-
multi: true,
|
|
638
|
-
useExisting: forwardRef(() => HeaderSelectFilterComponent),
|
|
639
|
-
},
|
|
640
|
-
], 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.label\"></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"] }]
|
|
641
|
-
}], propDecorators: { column: [{
|
|
642
|
-
type: Input
|
|
643
|
-
}] } });
|
|
644
|
-
|
|
645
|
-
class HeaderTextFilterComponent {
|
|
646
|
-
column;
|
|
647
|
-
control;
|
|
648
|
-
selectControl = new FormControl();
|
|
649
|
-
onChange = () => { };
|
|
650
|
-
onTouched = () => { };
|
|
651
|
-
injector = inject(Injector);
|
|
652
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
653
|
-
subsink = new Subscription();
|
|
654
|
-
writeValue = (value) => {
|
|
655
|
-
if (value?.value !== this.selectControl.value)
|
|
656
|
-
this.selectControl.setValue(value?.value);
|
|
657
|
-
};
|
|
658
|
-
registerOnChange(onChange) {
|
|
659
|
-
this.onChange = onChange;
|
|
660
|
-
}
|
|
661
|
-
registerOnTouched(onTouched) {
|
|
662
|
-
this.onTouched = onTouched;
|
|
663
|
-
}
|
|
664
|
-
async ngAfterViewInit() {
|
|
665
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
666
|
-
if (!ngControl)
|
|
667
|
-
throw new Error(`${this.constructor.name} missing control [column:${this.column.columnDef}]`);
|
|
668
|
-
this.control = ngControl.control;
|
|
669
|
-
this.subsink.add(this.selectControl.valueChanges.subscribe((value) => {
|
|
670
|
-
if (!value)
|
|
671
|
-
this.control.setValue(undefined);
|
|
672
|
-
else
|
|
673
|
-
this.control.setValue({ value, regex: true });
|
|
674
|
-
}));
|
|
675
|
-
this.changeDetectorRef.detectChanges();
|
|
676
|
-
}
|
|
677
|
-
ngOnDestroy() {
|
|
678
|
-
this.subsink.unsubscribe();
|
|
679
|
-
}
|
|
680
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderTextFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
681
|
-
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: [
|
|
682
|
-
{
|
|
683
|
-
provide: NG_VALUE_ACCESSOR,
|
|
684
|
-
multi: true,
|
|
685
|
-
useExisting: forwardRef(() => HeaderTextFilterComponent),
|
|
686
|
-
},
|
|
687
|
-
], 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.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"] }] });
|
|
688
|
-
}
|
|
689
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: HeaderTextFilterComponent, decorators: [{
|
|
690
|
-
type: Component,
|
|
691
|
-
args: [{ selector: 'lib-header-text-filter', imports: [
|
|
692
|
-
CommonModule,
|
|
693
|
-
FormsModule,
|
|
694
|
-
MatButtonModule,
|
|
695
|
-
MatFormFieldModule,
|
|
696
|
-
MatIconModule,
|
|
697
|
-
MatInputModule,
|
|
698
|
-
ReactiveFormsModule,
|
|
699
|
-
], providers: [
|
|
700
|
-
{
|
|
701
|
-
provide: NG_VALUE_ACCESSOR,
|
|
702
|
-
multi: true,
|
|
703
|
-
useExisting: forwardRef(() => HeaderTextFilterComponent),
|
|
704
|
-
},
|
|
705
|
-
], 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"] }]
|
|
706
|
-
}], propDecorators: { column: [{
|
|
707
|
-
type: Input
|
|
708
|
-
}] } });
|
|
709
|
-
|
|
710
|
-
class DatagridDataSource extends DataSource {
|
|
711
|
-
service;
|
|
712
|
-
loading$ = new BehaviorSubject(true);
|
|
713
|
-
recordsTotal = 0;
|
|
714
|
-
recordsFiltered = 0;
|
|
715
|
-
options;
|
|
716
|
-
dataStream = new BehaviorSubject([]);
|
|
717
|
-
constructor(service) {
|
|
718
|
-
super();
|
|
719
|
-
this.service = service;
|
|
720
|
-
}
|
|
721
|
-
connect() {
|
|
722
|
-
return this.dataStream;
|
|
723
|
-
}
|
|
724
|
-
disconnect() { }
|
|
725
|
-
async loadData(options) {
|
|
726
|
-
this.options = options;
|
|
727
|
-
this.loading$.next(true);
|
|
728
|
-
try {
|
|
729
|
-
const result = await this.service(options);
|
|
730
|
-
if (options.draw !== result.draw)
|
|
731
|
-
return;
|
|
732
|
-
this.recordsTotal = result.recordsTotal;
|
|
733
|
-
this.recordsFiltered = result.recordsFiltered;
|
|
734
|
-
this.dataStream.next(result.data);
|
|
735
|
-
}
|
|
736
|
-
finally {
|
|
737
|
-
this.loading$.next(false);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
refresh() {
|
|
741
|
-
if (this.options)
|
|
742
|
-
this.loadData(this.options);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
/** @format */
|
|
747
|
-
class DatatableCellDirective {
|
|
748
|
-
templateRef;
|
|
749
|
-
columnDef;
|
|
750
|
-
constructor(templateRef) {
|
|
751
|
-
this.templateRef = templateRef;
|
|
752
|
-
}
|
|
753
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatatableCellDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
754
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: DatatableCellDirective, isStandalone: true, selector: "[ngxMatDatatableCell]", inputs: { columnDef: ["ngxMatDatatableCell", "columnDef"] }, ngImport: i0 });
|
|
755
|
-
}
|
|
756
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatatableCellDirective, decorators: [{
|
|
757
|
-
type: Directive,
|
|
758
|
-
args: [{
|
|
759
|
-
selector: '[ngxMatDatatableCell]',
|
|
760
|
-
}]
|
|
761
|
-
}], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { columnDef: [{
|
|
762
|
-
type: Input,
|
|
763
|
-
args: ['ngxMatDatatableCell']
|
|
764
|
-
}] } });
|
|
765
|
-
|
|
766
|
-
/** @format */
|
|
767
|
-
class FindCellContentPipe {
|
|
768
|
-
transform(cellRefs, column) {
|
|
769
|
-
return cellRefs?.find(ref => ref.columnDef === column.columnDef);
|
|
770
|
-
}
|
|
771
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FindCellContentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
772
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: FindCellContentPipe, isStandalone: true, name: "findCellContent" });
|
|
773
|
-
}
|
|
774
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FindCellContentPipe, decorators: [{
|
|
775
|
-
type: Pipe,
|
|
776
|
-
args: [{ name: 'findCellContent' }]
|
|
777
|
-
}] });
|
|
778
|
-
|
|
779
|
-
/** @format */
|
|
780
|
-
class MongooseDatatableComponent {
|
|
781
|
-
options;
|
|
782
|
-
onDisplayChanged = new EventEmitter();
|
|
783
|
-
paginator;
|
|
784
|
-
cellRefs;
|
|
785
|
-
displayedColumns = [];
|
|
786
|
-
dataSource;
|
|
787
|
-
loaded = false;
|
|
788
|
-
searchFormGroup;
|
|
789
|
-
subscriptions = new Subscription();
|
|
790
|
-
changeDetectorRef = inject(ChangeDetectorRef);
|
|
791
|
-
ngOnInit() {
|
|
792
|
-
if (!this.options?.service)
|
|
793
|
-
throw new Error(`missing mongoose datatable component service`);
|
|
794
|
-
if (!this.options?.columns)
|
|
795
|
-
throw new Error(`missing mongoose datatable component columns`);
|
|
796
|
-
this.buildDisplayColumns();
|
|
797
|
-
this.buildSearchFormGroup();
|
|
798
|
-
this.dataSource = new DatagridDataSource(this.options.service);
|
|
799
|
-
this.changeDetectorRef.detectChanges();
|
|
800
|
-
}
|
|
801
|
-
ngOnDestroy() {
|
|
802
|
-
this.subscriptions.unsubscribe();
|
|
803
|
-
}
|
|
804
|
-
load(intersect) {
|
|
805
|
-
if (!intersect || this.loaded)
|
|
806
|
-
return;
|
|
807
|
-
this.loaded = true;
|
|
808
|
-
this.subscriptions.add(this.paginator?.page.subscribe(() => this.loadPage()));
|
|
809
|
-
this.loadPage();
|
|
810
|
-
}
|
|
811
|
-
sortColumn(column) {
|
|
812
|
-
if (column.sortable === false)
|
|
813
|
-
return;
|
|
814
|
-
if (!column.order)
|
|
815
|
-
column.order = { index: this.options.columns.filter(c => !!c.order).length, dir: 'asc' };
|
|
816
|
-
else if (column.order.dir === 'asc')
|
|
817
|
-
column.order.dir = 'desc';
|
|
818
|
-
else {
|
|
819
|
-
delete column.order;
|
|
820
|
-
this.consolidateOrderIndex();
|
|
821
|
-
}
|
|
822
|
-
this.paginator.pageIndex = 0;
|
|
823
|
-
this.loadPage();
|
|
824
|
-
}
|
|
825
|
-
loadPage() {
|
|
826
|
-
const columns = this.buildRequestColumns();
|
|
827
|
-
const order = [];
|
|
828
|
-
this.options.columns
|
|
829
|
-
.filter(c => !!c.order)
|
|
830
|
-
.sort((c1, c2) => c1.order.index - c2.order.index)
|
|
831
|
-
.forEach(c => {
|
|
832
|
-
const index = columns.findIndex(column => column.data === (c.sortProperty || c.property));
|
|
833
|
-
if (index !== -1)
|
|
834
|
-
order.push({ column: index, dir: c.order.dir });
|
|
835
|
-
});
|
|
836
|
-
this.dataSource.loadData({
|
|
837
|
-
draw: Date.now().toString(),
|
|
838
|
-
columns,
|
|
839
|
-
start: this.paginator.pageIndex,
|
|
840
|
-
length: this.paginator.pageSize,
|
|
841
|
-
order,
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
updateColumns = [];
|
|
845
|
-
openUpdateColumnDisplay() {
|
|
846
|
-
this.updateColumns = this.options.columns.map(column => ({
|
|
847
|
-
columnDef: column.columnDef,
|
|
848
|
-
header: column.header,
|
|
849
|
-
sticky: column.sticky,
|
|
850
|
-
hidden: column.hidden,
|
|
851
|
-
}));
|
|
852
|
-
}
|
|
853
|
-
reorderColumns(event) {
|
|
854
|
-
moveItemInArray(this.updateColumns, event.previousIndex, event.currentIndex);
|
|
855
|
-
}
|
|
856
|
-
closeUpdateColumnDisplay() {
|
|
857
|
-
let reload = false;
|
|
858
|
-
this.updateColumns.forEach((updated, index) => {
|
|
859
|
-
const columnIndex = this.options.columns.findIndex(c => c.columnDef === updated.columnDef);
|
|
860
|
-
if (columnIndex == -1)
|
|
861
|
-
return;
|
|
862
|
-
if (columnIndex !== index)
|
|
863
|
-
moveItemInArray(this.options.columns, index, columnIndex);
|
|
864
|
-
const column = this.options.columns[columnIndex];
|
|
865
|
-
if (updated.sticky !== column.sticky)
|
|
866
|
-
column.sticky = updated.sticky;
|
|
867
|
-
if (updated.hidden !== column.hidden) {
|
|
868
|
-
column.hidden = updated.hidden;
|
|
869
|
-
reload = reload || !updated.hidden;
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
this.buildDisplayColumns();
|
|
873
|
-
this.onDisplayChanged.emit(this.options.columns);
|
|
874
|
-
if (reload)
|
|
875
|
-
this.loadPage();
|
|
876
|
-
}
|
|
877
|
-
buildRequestColumns() {
|
|
878
|
-
const columns = [];
|
|
879
|
-
const additionalColumns = [];
|
|
880
|
-
this.options.columns.forEach(c => {
|
|
881
|
-
if (c.hidden)
|
|
882
|
-
return;
|
|
883
|
-
const column = { data: c.property, name: c.columnDef };
|
|
884
|
-
if (c.sortProperty && c.order)
|
|
885
|
-
this.addAdditionalColumn(additionalColumns, c.sortProperty);
|
|
886
|
-
if (c.searchable) {
|
|
887
|
-
const control = this.searchFormGroup.controls[c.columnDef];
|
|
888
|
-
if (control.value) {
|
|
889
|
-
if (c.searchProperty)
|
|
890
|
-
this.addAdditionalColumn(additionalColumns, c.searchProperty, control.value);
|
|
891
|
-
else
|
|
892
|
-
column.search = control.value;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
columns.push(column);
|
|
896
|
-
});
|
|
897
|
-
columns.push(...additionalColumns);
|
|
898
|
-
return columns;
|
|
899
|
-
}
|
|
900
|
-
addAdditionalColumn(additionalColumns, data, search) {
|
|
901
|
-
let column = additionalColumns.find(c => c.data === data);
|
|
902
|
-
if (!column)
|
|
903
|
-
additionalColumns.push((column = { data }));
|
|
904
|
-
if (search)
|
|
905
|
-
column.search = search;
|
|
906
|
-
return column;
|
|
907
|
-
}
|
|
908
|
-
buildDisplayColumns() {
|
|
909
|
-
const displayedColumns = [];
|
|
910
|
-
this.options.columns.forEach(column => {
|
|
911
|
-
if (column.hidden)
|
|
912
|
-
return;
|
|
913
|
-
displayedColumns.push(column.columnDef);
|
|
914
|
-
});
|
|
915
|
-
this.displayedColumns = displayedColumns;
|
|
916
|
-
}
|
|
917
|
-
buildSearchFormGroup() {
|
|
918
|
-
this.searchFormGroup = new FormGroup(this.options.columns.reduce((controls, column) => {
|
|
919
|
-
if (column.searchable) {
|
|
920
|
-
controls[column.columnDef] = new FormControl({ value: undefined, disabled: false });
|
|
921
|
-
}
|
|
922
|
-
return controls;
|
|
923
|
-
}, {}));
|
|
924
|
-
this.subscriptions.add(this.searchFormGroup.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
|
925
|
-
this.paginator.pageIndex = 0;
|
|
926
|
-
this.loadPage();
|
|
927
|
-
}));
|
|
928
|
-
}
|
|
929
|
-
consolidateOrderIndex() {
|
|
930
|
-
let index = 0;
|
|
931
|
-
this.options.columns
|
|
932
|
-
.filter(c => !!c.order)
|
|
933
|
-
.sort((c1, c2) => c1.order.index - c2.order.index)
|
|
934
|
-
.forEach(c => (c.order.index = index++));
|
|
935
|
-
}
|
|
936
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MongooseDatatableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
937
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MongooseDatatableComponent, isStandalone: true, selector: "ngx-mat-datatable", inputs: { options: "options" }, outputs: { onDisplayChanged: "onDisplayChanged" }, queries: [{ propertyName: "cellRefs", predicate: DatatableCellDirective }], 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 <div class=\"cell\">\n @let value = row[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</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 #ccc}#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 .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)}#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: "component", type: CellCheckboxValueComponent, selector: "lib-cell-checkbox-value", inputs: ["column", "row"] }, { kind: "component", type: CellDateValueComponent, selector: "lib-cell-date-value", inputs: ["column", "row"] }, { kind: "component", type: CellSelectValueComponent, selector: "lib-cell-select-value", inputs: ["column", "row"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { 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: "pipe", type: FindCellContentPipe, name: "findCellContent" }, { 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.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: [
|
|
938
|
-
trigger('fade', [
|
|
939
|
-
transition(':enter', [
|
|
940
|
-
style({ opacity: 0 }), // initial
|
|
941
|
-
animate('0.2s', style({ opacity: 1 })), // final
|
|
942
|
-
]),
|
|
943
|
-
transition(':leave', [
|
|
944
|
-
style({ opacity: 1 }), // initial
|
|
945
|
-
animate('0.2s', style({ opacity: 0 })), // final
|
|
946
|
-
]),
|
|
947
|
-
]),
|
|
948
|
-
] });
|
|
949
|
-
}
|
|
950
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MongooseDatatableComponent, decorators: [{
|
|
951
|
-
type: Component,
|
|
952
|
-
args: [{ imports: [
|
|
953
|
-
CellCheckboxValueComponent,
|
|
954
|
-
CellDateValueComponent,
|
|
955
|
-
CellSelectValueComponent,
|
|
956
|
-
CommonModule,
|
|
957
|
-
DragDropModule,
|
|
958
|
-
FindCellContentPipe,
|
|
959
|
-
FormsModule,
|
|
960
|
-
HeaderAutocompleteFilterComponent,
|
|
961
|
-
HeaderCheckboxFilterComponent,
|
|
962
|
-
HeaderDateFilterComponent,
|
|
963
|
-
HeaderNumberFilterComponent,
|
|
964
|
-
HeaderSelectFilterComponent,
|
|
965
|
-
HeaderTextFilterComponent,
|
|
966
|
-
IntersectionObserverModule,
|
|
967
|
-
MatBadgeModule,
|
|
968
|
-
MatButtonModule,
|
|
969
|
-
MatFormFieldModule,
|
|
970
|
-
MatIconModule,
|
|
971
|
-
MatMenuModule,
|
|
972
|
-
MatPaginatorModule,
|
|
973
|
-
MatProgressSpinnerModule,
|
|
974
|
-
MatTableModule,
|
|
975
|
-
MatTooltipModule,
|
|
976
|
-
ReactiveFormsModule,
|
|
977
|
-
], selector: 'ngx-mat-datatable', animations: [
|
|
978
|
-
trigger('fade', [
|
|
979
|
-
transition(':enter', [
|
|
980
|
-
style({ opacity: 0 }), // initial
|
|
981
|
-
animate('0.2s', style({ opacity: 1 })), // final
|
|
982
|
-
]),
|
|
983
|
-
transition(':leave', [
|
|
984
|
-
style({ opacity: 1 }), // initial
|
|
985
|
-
animate('0.2s', style({ opacity: 0 })), // final
|
|
986
|
-
]),
|
|
987
|
-
]),
|
|
988
|
-
], 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 <div class=\"cell\">\n @let value = row[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</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 #ccc}#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 .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)}#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"] }]
|
|
989
|
-
}], propDecorators: { options: [{
|
|
990
|
-
type: Input,
|
|
991
|
-
args: ['options']
|
|
992
|
-
}], onDisplayChanged: [{
|
|
993
|
-
type: Output
|
|
994
|
-
}], paginator: [{
|
|
995
|
-
type: ViewChild,
|
|
996
|
-
args: [MatPaginator]
|
|
997
|
-
}], cellRefs: [{
|
|
998
|
-
type: ContentChildren,
|
|
999
|
-
args: [DatatableCellDirective]
|
|
1000
|
-
}] } });
|
|
1001
|
-
|
|
1002
|
-
/** @format */
|
|
1003
|
-
class DatatableModule {
|
|
1004
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatatableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1005
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: DatatableModule, imports: [CommonModule, MongooseDatatableComponent, DatatableCellDirective], exports: [MongooseDatatableComponent, DatatableCellDirective] });
|
|
1006
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatatableModule, imports: [CommonModule, MongooseDatatableComponent] });
|
|
1007
|
-
}
|
|
1008
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DatatableModule, decorators: [{
|
|
1009
|
-
type: NgModule,
|
|
1010
|
-
args: [{
|
|
1011
|
-
imports: [CommonModule, MongooseDatatableComponent, DatatableCellDirective],
|
|
1012
|
-
exports: [MongooseDatatableComponent, DatatableCellDirective],
|
|
1013
|
-
}]
|
|
1014
|
-
}] });
|
|
1015
|
-
|
|
1016
|
-
/** @format */
|
|
1017
|
-
|
|
1018
|
-
/** @format */
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
* Public API Surface of mongoose-datatable
|
|
1022
|
-
*
|
|
1023
|
-
* @format
|
|
1024
|
-
*/
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* Generated bundle index. Do not edit.
|
|
1028
|
-
*/
|
|
1029
|
-
|
|
1030
|
-
export { DatatableCellDirective, DatatableModule, MongooseDatatableComponent };
|
|
1
|
+
export { b as NgxMatDatatableCellDirective, N as NgxMatDatatableComponent, a as NgxMatDatatableModule } from './eherve-angular-material-datatable-eherve-angular-material-datatable-D-zJZjLj.mjs';
|
|
1031
2
|
//# sourceMappingURL=eherve-angular-material-datatable.mjs.map
|