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