@one-paragon/angular-utilities 1.2.9 → 1.2.10-beta-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/action-state/ngrx.d.ts +1 -1
- package/esm2022/http-request-state/HttpRequestStateStore.mjs +19 -3
- package/esm2022/http-request-state/types.mjs +1 -1
- package/esm2022/public-api.mjs +2 -1
- package/esm2022/table-builder/classes/TableBuilderDataSource.mjs +18 -12
- package/esm2022/table-builder/classes/TableState.mjs +5 -3
- package/esm2022/table-builder/classes/data-store.mjs +15 -0
- package/esm2022/table-builder/classes/table-builder-general-settings.mjs +14 -1
- package/esm2022/table-builder/classes/table-builder.mjs +3 -3
- package/esm2022/table-builder/classes/table-store.mjs +71 -46
- package/esm2022/table-builder/components/column-builder/column-builder.component.mjs +2 -2
- package/esm2022/table-builder/components/generic-table/generic-table.component.mjs +100 -55
- package/esm2022/table-builder/components/generic-table/paginator.component.mjs +6 -4
- package/esm2022/table-builder/components/sort-menu/sort-menu.component-store.mjs +4 -2
- package/esm2022/table-builder/components/table-container/table-container.mjs +90 -65
- package/esm2022/table-builder/components/table-container/tableProps.mjs +2 -1
- package/esm2022/table-builder/components/table-container/virtual-scroll-container.mjs +36 -10
- package/esm2022/table-builder/components/table-container-filter/filter-list/filter-list.component.mjs +5 -6
- package/esm2022/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.mjs +9 -11
- package/esm2022/table-builder/directives/custom-cell-directive.mjs +12 -13
- package/esm2022/table-builder/directives/table-wrapper.directive.mjs +4 -4
- package/esm2022/table-builder/interfaces/ColumnInfo.mjs +1 -1
- package/esm2022/table-builder/services/export-to-csv.service.mjs +3 -3
- package/fesm2022/one-paragon-angular-utilities.mjs +537 -374
- package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -1
- package/http-request-state/HttpRequestStateStore.d.ts +5 -0
- package/http-request-state/types.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -2
- package/table-builder/classes/TableBuilderDataSource.d.ts +2 -3
- package/table-builder/classes/TableState.d.ts +14 -4
- package/table-builder/classes/data-store.d.ts +8 -0
- package/table-builder/classes/table-builder-general-settings.d.ts +6 -0
- package/table-builder/classes/table-store.d.ts +16 -28
- package/table-builder/components/generic-table/generic-table.component.d.ts +20 -10
- package/table-builder/components/generic-table/paginator.component.d.ts +1 -0
- package/table-builder/components/sort-menu/sort-menu.component-store.d.ts +1 -0
- package/table-builder/components/table-container/table-container-imports.d.ts +1 -1
- package/table-builder/components/table-container/table-container.d.ts +15 -8
- package/table-builder/components/table-container/tableProps.d.ts +1 -0
- package/table-builder/components/table-container/virtual-scroll-container.d.ts +9 -3
- package/table-builder/components/table-container-filter/filter-list/filter-list.component.d.ts +2 -3
- package/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.d.ts +1 -3
- package/table-builder/directives/custom-cell-directive.d.ts +6 -4
- package/table-builder/directives/table-wrapper.directive.d.ts +1 -1
- package/table-builder/interfaces/ColumnInfo.d.ts +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, inject, Injector, TemplateRef, ViewContainerRef, NgModule,
|
|
3
|
-
import { shareReplay, switchAll, map, filter, tap, catchError, startWith, switchMap, mergeMap, concatMap, takeUntil,
|
|
2
|
+
import { Directive, Input, inject, Injector, TemplateRef, ViewContainerRef, NgModule, assertInInjectionContext, DestroyRef, isSignal, computed, Injectable, Pipe, Renderer2, ElementRef, booleanAttribute, signal, InjectionToken, makeEnvironmentProviders, HostListener, Component, ChangeDetectionStrategy, EventEmitter, untracked, Output, ContentChildren, ChangeDetectorRef, input, output, ViewChild, EnvironmentInjector, createComponent, viewChild, effect, contentChild, forwardRef, contentChildren, ContentChild, APP_INITIALIZER } from '@angular/core';
|
|
3
|
+
import { shareReplay, switchAll, map, filter, tap, catchError, startWith, switchMap, mergeMap, concatMap as concatMap$1, takeUntil, distinctUntilChanged, first as first$1, distinctUntilKeyChanged, delay as delay$1, observeOn, scan as scan$1, timestamp as timestamp$1, withLatestFrom, mergeAll } from 'rxjs/operators';
|
|
4
4
|
import * as i1 from 'rxjs';
|
|
5
|
-
import { Subject, isObservable, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, concatMap
|
|
5
|
+
import { Subject, isObservable, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, concatMap, merge, delay, fromEvent, tap as tap$1, BehaviorSubject, takeUntil as takeUntil$1, switchMap as switchMap$1, scan, asyncScheduler, animationFrameScheduler, distinctUntilChanged as distinctUntilChanged$1, timestamp, skip } from 'rxjs';
|
|
6
6
|
import { ComponentStore } from '@ngrx/component-store';
|
|
7
|
+
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
7
8
|
import * as i1$8 from '@angular/common';
|
|
8
9
|
import { DatePipe, CurrencyPipe, AsyncPipe, KeyValuePipe, NgTemplateOutlet, NgClass, DecimalPipe, CommonModule } from '@angular/common';
|
|
9
10
|
import * as i3$2 from '@angular/material/sort';
|
|
10
11
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
11
12
|
import { v4 } from 'uuid';
|
|
12
|
-
import { merge, get, sumBy, difference, orderBy, intersection, groupBy, set, cloneDeep } from 'lodash';
|
|
13
|
+
import { merge as merge$1, get, sumBy, difference, orderBy, intersection, groupBy, set, cloneDeep } from 'lodash';
|
|
13
14
|
import { CdkColumnDef } from '@angular/cdk/table';
|
|
14
15
|
import { MatSlideToggle } from '@angular/material/slide-toggle';
|
|
15
16
|
import * as i10 from '@angular/material/radio';
|
|
@@ -23,7 +24,6 @@ import * as i9 from '@angular/material/core';
|
|
|
23
24
|
import { MatOption, MatNativeDateModule } from '@angular/material/core';
|
|
24
25
|
import * as i5 from '@angular/cdk/drag-drop';
|
|
25
26
|
import { moveItemInArray, DragDropModule, CDK_DROP_LIST, CdkDropList, transferArrayItem } from '@angular/cdk/drag-drop';
|
|
26
|
-
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
27
27
|
import * as i1$4 from '@angular/router';
|
|
28
28
|
import { RouterModule } from '@angular/router';
|
|
29
29
|
import * as i1$1 from '@angular/material/input';
|
|
@@ -49,7 +49,7 @@ import { LetDirective } from '@ngrx/component';
|
|
|
49
49
|
import * as i4$3 from '@angular/material/chips';
|
|
50
50
|
import { MatChipsModule } from '@angular/material/chips';
|
|
51
51
|
import * as i1$5 from '@angular/material/table';
|
|
52
|
-
import { MatTable, MatColumnDef, MatTableModule, MatTableDataSource, MatRowDef } from '@angular/material/table';
|
|
52
|
+
import { MatTable, MatColumnDef, MatTableModule, MatHeaderRowDef, MatFooterRowDef, MatTableDataSource, MatRowDef } from '@angular/material/table';
|
|
53
53
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
54
54
|
import * as i1$6 from '@angular/material/paginator';
|
|
55
55
|
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
@@ -362,14 +362,168 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
362
362
|
}]
|
|
363
363
|
}] });
|
|
364
364
|
|
|
365
|
+
const onceWhen = (predicate) => (src) => {
|
|
366
|
+
return src.pipe(filter$1(predicate), first());
|
|
367
|
+
};
|
|
368
|
+
const mapArray = (mapFunc) => (source) => source.pipe(map$1(src => src.map(mapFunc)));
|
|
369
|
+
const filterArray = (filterFunc) => (source) => source.pipe(map$1(src => src.filter(filterFunc)));
|
|
370
|
+
const onWait = startWithIfEmpty;
|
|
371
|
+
function startWithIfEmpty(val, wait = 0) {
|
|
372
|
+
return (source) => {
|
|
373
|
+
return new Observable(subscriber => {
|
|
374
|
+
let emitted = false;
|
|
375
|
+
setTimeout(() => {
|
|
376
|
+
if (!emitted) {
|
|
377
|
+
subscriber.next(val);
|
|
378
|
+
}
|
|
379
|
+
}, wait);
|
|
380
|
+
const sub = source.subscribe({
|
|
381
|
+
next(x) { emitted = true; subscriber.next(x); },
|
|
382
|
+
error(err) { emitted = true; subscriber.error(err); },
|
|
383
|
+
complete() { emitted = true; subscriber.complete(); }
|
|
384
|
+
});
|
|
385
|
+
return () => sub.unsubscribe();
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
const combineArrays = (sources) => {
|
|
390
|
+
return combineLatest(sources.map(src => src.pipe(startWithIfEmpty([])))).pipe(map$1(res => res.flat()));
|
|
391
|
+
};
|
|
392
|
+
function switchOff(switchSource, defaultState = true) {
|
|
393
|
+
return (source) => {
|
|
394
|
+
return new Observable(subsciber => {
|
|
395
|
+
let isOn = defaultState;
|
|
396
|
+
const subscription = new Subscription();
|
|
397
|
+
subscription.add(switchSource.subscribe(on => isOn = on));
|
|
398
|
+
subscription.add(source.subscribe({
|
|
399
|
+
next(value) {
|
|
400
|
+
if (isOn) {
|
|
401
|
+
subsciber.next(value);
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
error: error => subsciber.error(error),
|
|
405
|
+
complete: () => subsciber.complete()
|
|
406
|
+
}));
|
|
407
|
+
return subscription;
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function skipOneWhen(skipper) {
|
|
412
|
+
return (source) => {
|
|
413
|
+
return new Observable(subsriber => {
|
|
414
|
+
const subscription = new Subscription();
|
|
415
|
+
let skipNext = false;
|
|
416
|
+
subscription.add(skipper.subscribe(_ => skipNext = true));
|
|
417
|
+
subscription.add(source.subscribe({
|
|
418
|
+
next(value) {
|
|
419
|
+
if (skipNext) {
|
|
420
|
+
skipNext = false;
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
subsriber.next(value);
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
error: error => subsriber.error(error),
|
|
427
|
+
complete: () => subsriber.complete()
|
|
428
|
+
}));
|
|
429
|
+
return subscription;
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function previousAndCurrent(startingValue) {
|
|
434
|
+
return (source) => {
|
|
435
|
+
return source.pipe(startWith$1(startingValue), pairwise());
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
function notNull() {
|
|
439
|
+
return (source) => {
|
|
440
|
+
return source.pipe(filter$1((o) => o != null));
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function delayOn(predicate, delayTime) {
|
|
444
|
+
return (src) => {
|
|
445
|
+
return src.pipe(concatMap(r => {
|
|
446
|
+
if (predicate(r)) {
|
|
447
|
+
return merge(of({ r }), of(null).pipe(delay(delayTime))).pipe(notNull(), map$1(d => d.r));
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
return of(r);
|
|
451
|
+
}
|
|
452
|
+
}));
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
class Subjectifier extends Observable {
|
|
457
|
+
_subj = new Subject();
|
|
458
|
+
merged;
|
|
459
|
+
constructor(_source) {
|
|
460
|
+
super((obs) => {
|
|
461
|
+
const s = merge(_source, this._subj).subscribe(obs);
|
|
462
|
+
return s;
|
|
463
|
+
});
|
|
464
|
+
this.merged = merge(_source, this._subj);
|
|
465
|
+
}
|
|
466
|
+
next = this._subj.next.bind(this._subj);
|
|
467
|
+
newSubj = (...operations) => new Subjectifier(this.merged.pipe(...operations));
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
class Subscriber {
|
|
471
|
+
subscriptions = [];
|
|
472
|
+
handle = (subscription) => {
|
|
473
|
+
this.subscriptions.push(subscription);
|
|
474
|
+
};
|
|
475
|
+
on = (obs, action) => {
|
|
476
|
+
this.handle(obs.subscribe(action));
|
|
477
|
+
};
|
|
478
|
+
ngOnDestroy() {
|
|
479
|
+
this.subscriptions.forEach(subscription => {
|
|
480
|
+
subscription.unsubscribe();
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: Subscriber, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
484
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.2", type: Subscriber, ngImport: i0 });
|
|
485
|
+
}
|
|
486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: Subscriber, decorators: [{
|
|
487
|
+
type: Directive
|
|
488
|
+
}] });
|
|
489
|
+
function subscriber(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
490
|
+
const destroyRef = getDestroyRef$1(obsOrSubOrInjector, actionOrInjector, injector);
|
|
491
|
+
const subscriber = new Subscriber();
|
|
492
|
+
if (obsOrSubOrInjector instanceof Subscription) {
|
|
493
|
+
subscriber.handle(obsOrSubOrInjector);
|
|
494
|
+
}
|
|
495
|
+
else if (obsOrSubOrInjector instanceof Observable) {
|
|
496
|
+
subscriber.handle(obsOrSubOrInjector.subscribe(actionOrInjector));
|
|
497
|
+
}
|
|
498
|
+
destroyRef.onDestroy(() => subscriber?.ngOnDestroy());
|
|
499
|
+
return subscriber;
|
|
500
|
+
}
|
|
501
|
+
function getDestroyRef$1(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
502
|
+
const providedInjector = obsOrSubOrInjector instanceof Injector ? obsOrSubOrInjector
|
|
503
|
+
: actionOrInjector instanceof Injector ? actionOrInjector
|
|
504
|
+
: injector;
|
|
505
|
+
if (!providedInjector) {
|
|
506
|
+
try {
|
|
507
|
+
assertInInjectionContext(subscriber);
|
|
508
|
+
}
|
|
509
|
+
catch (error) {
|
|
510
|
+
throw new Error('createRequestor() must be used in an Injection Context or you must provide an injector to createRequestor()');
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const destroyRef = providedInjector?.get(DestroyRef) || inject(DestroyRef);
|
|
514
|
+
return destroyRef;
|
|
515
|
+
}
|
|
516
|
+
|
|
365
517
|
class HttpRequestStateStore extends ComponentStore {
|
|
366
518
|
options;
|
|
367
519
|
project;
|
|
368
520
|
req;
|
|
521
|
+
injector;
|
|
369
522
|
constructor(req, options, project) {
|
|
370
523
|
super({ requestParams: null, response: notStarted });
|
|
371
524
|
this.project = project;
|
|
372
525
|
this.options = options;
|
|
526
|
+
this.injector = options?.injector;
|
|
373
527
|
this.req = req;
|
|
374
528
|
this.request = (this.options?.strategy === HttpRequestStrategy.singleUse) ? this.singleUseRequest : this.flattenedRequest;
|
|
375
529
|
if (options?.autoRequestWith) {
|
|
@@ -383,7 +537,7 @@ class HttpRequestStateStore extends ComponentStore {
|
|
|
383
537
|
if (this.options?.strategy === HttpRequestStrategy.concurrent)
|
|
384
538
|
return mergeMap((params) => this.createRequest(...params));
|
|
385
539
|
if (this.options?.strategy === HttpRequestStrategy.sequential)
|
|
386
|
-
return concatMap((params) => this.createRequest(...params));
|
|
540
|
+
return concatMap$1((params) => this.createRequest(...params));
|
|
387
541
|
return switchMap((params) => (params[0] instanceof CancellationToken) ?
|
|
388
542
|
of({ requestParams: params[0], response: { status: HttpRequestStatus.cancelled } }) : this.createRequest(...params));
|
|
389
543
|
};
|
|
@@ -449,6 +603,13 @@ class HttpRequestStateStore extends ComponentStore {
|
|
|
449
603
|
ngOnDestroy() {
|
|
450
604
|
super.ngOnDestroy();
|
|
451
605
|
}
|
|
606
|
+
requestWith = (params) => {
|
|
607
|
+
if (isSignal(params)) {
|
|
608
|
+
params = toObservable(params, { injector: this.injector }).pipe(notNull());
|
|
609
|
+
}
|
|
610
|
+
params.pipe(takeUntil(this.destroy$)).subscribe((p) => this.request(...p));
|
|
611
|
+
return this;
|
|
612
|
+
};
|
|
452
613
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: HttpRequestStateStore, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
453
614
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.2", type: HttpRequestStateStore, usesInheritance: true, ngImport: i0 });
|
|
454
615
|
}
|
|
@@ -457,6 +618,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
457
618
|
}], ctorParameters: () => [{ type: undefined }, { type: undefined }, { type: undefined }] });
|
|
458
619
|
class CancellationToken {
|
|
459
620
|
}
|
|
621
|
+
function wrapInArr(sigOrObs) {
|
|
622
|
+
return isSignal(sigOrObs) ?
|
|
623
|
+
computed(() => [sigOrObs()])
|
|
624
|
+
: sigOrObs.pipe(map(a => [a]));
|
|
625
|
+
}
|
|
460
626
|
|
|
461
627
|
class HttpRequestStateFactory {
|
|
462
628
|
constructor() { }
|
|
@@ -482,7 +648,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
482
648
|
}], ctorParameters: () => [] });
|
|
483
649
|
function createRequestor(req, optionsOrProject, options) {
|
|
484
650
|
const ops = isFunction(optionsOrProject) ? options : optionsOrProject;
|
|
485
|
-
const destroyRef = getDestroyRef
|
|
651
|
+
const destroyRef = getDestroyRef(ops);
|
|
486
652
|
const requestStore = typeof (optionsOrProject) === 'function' ?
|
|
487
653
|
new HttpRequestStateStore(req, options, optionsOrProject)
|
|
488
654
|
: new HttpRequestStateStore(req, optionsOrProject);
|
|
@@ -492,7 +658,7 @@ function createRequestor(req, optionsOrProject, options) {
|
|
|
492
658
|
function isFunction(value) {
|
|
493
659
|
return typeof value === 'function';
|
|
494
660
|
}
|
|
495
|
-
function getDestroyRef
|
|
661
|
+
function getDestroyRef(options) {
|
|
496
662
|
const providedInjector = options?.injector;
|
|
497
663
|
if (!providedInjector) {
|
|
498
664
|
try {
|
|
@@ -585,12 +751,18 @@ function metaDataArrToDict(arr, transform) {
|
|
|
585
751
|
class GeneralTableSettings {
|
|
586
752
|
constructor(settings) {
|
|
587
753
|
if (settings) {
|
|
588
|
-
merge(this.headerSettings, settings.headerSettings);
|
|
589
|
-
merge(this.footerSettings, settings.footerSettings);
|
|
590
|
-
merge(this.columnHeaderSettings, settings.columnHeaderSettings);
|
|
591
|
-
merge(this.tableSettings, settings.tableSettings);
|
|
754
|
+
merge$1(this.headerSettings, settings.headerSettings);
|
|
755
|
+
merge$1(this.footerSettings, settings.footerSettings);
|
|
756
|
+
merge$1(this.columnHeaderSettings, settings.columnHeaderSettings);
|
|
757
|
+
merge$1(this.tableSettings, settings.tableSettings);
|
|
592
758
|
if (settings.tableSettings?.useVirtualScroll) {
|
|
593
759
|
const currVirt = settings.tableSettings.useVirtualScroll === true ? new VirtualScrollOptions() : settings.tableSettings.useVirtualScroll;
|
|
760
|
+
if (!currVirt.headerHeight || settings.tableSettings.useVirtualScroll === true) {
|
|
761
|
+
currVirt.headerHeight = (typeof settings.headerSettings?.headerHeight === 'number' ? settings.headerSettings?.headerHeight : DefaultVirtualScrollOptions.headerHeight);
|
|
762
|
+
}
|
|
763
|
+
if (!currVirt.rowHeight || settings.tableSettings.useVirtualScroll === true) {
|
|
764
|
+
currVirt.rowHeight = (typeof settings.tableSettings?.rowHeight === 'number' ? settings.tableSettings?.rowHeight : DefaultVirtualScrollOptions.rowHeight);
|
|
765
|
+
}
|
|
594
766
|
this.tableSettings.useVirtualScroll = { ...new VirtualScrollOptions(), ...currVirt };
|
|
595
767
|
}
|
|
596
768
|
}
|
|
@@ -624,6 +796,7 @@ class TableSettings {
|
|
|
624
796
|
useVirtualScroll = null;
|
|
625
797
|
includeAllInPaginatorOptions = false;
|
|
626
798
|
rowHeight = undefined;
|
|
799
|
+
groupHeaderHeight = undefined;
|
|
627
800
|
}
|
|
628
801
|
class PersistedTableSettings {
|
|
629
802
|
constructor(tableSettings) {
|
|
@@ -651,6 +824,7 @@ class NotPersistedTableSettings {
|
|
|
651
824
|
this.includeAllInPaginatorOptions = tableSettings.tableSettings.includeAllInPaginatorOptions;
|
|
652
825
|
this.rowHeight = tableSettings.tableSettings.rowHeight;
|
|
653
826
|
this.headerHeight = tableSettings.headerSettings.headerHeight;
|
|
827
|
+
this.groupHeaderHeight = tableSettings.tableSettings.groupHeaderHeight;
|
|
654
828
|
}
|
|
655
829
|
}
|
|
656
830
|
hideExport = true;
|
|
@@ -664,6 +838,7 @@ class NotPersistedTableSettings {
|
|
|
664
838
|
usePaginator = true;
|
|
665
839
|
useVirtualScroll = null;
|
|
666
840
|
includeAllInPaginatorOptions = false;
|
|
841
|
+
groupHeaderHeight = undefined;
|
|
667
842
|
rowHeight;
|
|
668
843
|
headerHeight = undefined;
|
|
669
844
|
}
|
|
@@ -679,6 +854,10 @@ class VirtualScrollOptions {
|
|
|
679
854
|
*/
|
|
680
855
|
maxViewPortHeight = undefined;
|
|
681
856
|
}
|
|
857
|
+
const DefaultVirtualScrollOptions = {
|
|
858
|
+
rowHeight: 48,
|
|
859
|
+
headerHeight: 56,
|
|
860
|
+
};
|
|
682
861
|
|
|
683
862
|
class KeysToDelete {
|
|
684
863
|
initializationState = null;
|
|
@@ -717,13 +896,15 @@ const defaultTableState = {
|
|
|
717
896
|
groupBy: [],
|
|
718
897
|
minColumnWidth: undefined,
|
|
719
898
|
currentPage: 0,
|
|
899
|
+
props: {},
|
|
900
|
+
showAll: false,
|
|
901
|
+
};
|
|
902
|
+
const defaultDataState = {
|
|
720
903
|
virtualScrollOffset: 0,
|
|
721
904
|
dataLen: 0,
|
|
722
905
|
virtualEnds: {
|
|
723
906
|
start: 0, end: 20
|
|
724
907
|
},
|
|
725
|
-
props: {},
|
|
726
|
-
showAll: false,
|
|
727
908
|
};
|
|
728
909
|
|
|
729
910
|
// here is how to use it
|
|
@@ -749,23 +930,21 @@ class CustomCellDirective {
|
|
|
749
930
|
if (this.templateRef !== null)
|
|
750
931
|
this.TemplateRef = this.templateRef;
|
|
751
932
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
this.TemplateRef = this.templateRef;
|
|
755
|
-
}
|
|
933
|
+
ngOnInit() {
|
|
934
|
+
this.$metaData.next(this.getMetaData());
|
|
756
935
|
}
|
|
757
|
-
|
|
936
|
+
$metaData = new ReplaySubject();
|
|
937
|
+
getMetaData = () => {
|
|
758
938
|
return {
|
|
759
939
|
key: this.customCell,
|
|
760
|
-
displayName: this.displayName
|
|
761
|
-
preSort: this.preSort
|
|
762
|
-
fieldType:
|
|
763
|
-
order: this.customCellOrder
|
|
764
|
-
width: this.customCellWidth
|
|
940
|
+
displayName: this.displayName,
|
|
941
|
+
preSort: this.preSort,
|
|
942
|
+
fieldType: this.customCellNotMapped ? FieldType.NotMapped : FieldType.Unknown,
|
|
943
|
+
order: this.customCellOrder,
|
|
944
|
+
width: this.customCellWidth,
|
|
765
945
|
customCell: true,
|
|
766
|
-
noExport: !metaData,
|
|
767
946
|
};
|
|
768
|
-
}
|
|
947
|
+
};
|
|
769
948
|
static ngTemplateContextGuard(dir, ctx) {
|
|
770
949
|
return true;
|
|
771
950
|
}
|
|
@@ -796,158 +975,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
796
975
|
type: Input
|
|
797
976
|
}] } });
|
|
798
977
|
|
|
799
|
-
const onceWhen = (predicate) => (src) => {
|
|
800
|
-
return src.pipe(filter$1(predicate), first());
|
|
801
|
-
};
|
|
802
|
-
const mapArray = (mapFunc) => (source) => source.pipe(map$1(src => src.map(mapFunc)));
|
|
803
|
-
const filterArray = (filterFunc) => (source) => source.pipe(map$1(src => src.filter(filterFunc)));
|
|
804
|
-
const onWait = startWithIfEmpty;
|
|
805
|
-
function startWithIfEmpty(val, wait = 0) {
|
|
806
|
-
return (source) => {
|
|
807
|
-
return new Observable(subscriber => {
|
|
808
|
-
let emitted = false;
|
|
809
|
-
setTimeout(() => {
|
|
810
|
-
if (!emitted) {
|
|
811
|
-
subscriber.next(val);
|
|
812
|
-
}
|
|
813
|
-
}, wait);
|
|
814
|
-
const sub = source.subscribe({
|
|
815
|
-
next(x) { emitted = true; subscriber.next(x); },
|
|
816
|
-
error(err) { emitted = true; subscriber.error(err); },
|
|
817
|
-
complete() { emitted = true; subscriber.complete(); }
|
|
818
|
-
});
|
|
819
|
-
return () => sub.unsubscribe();
|
|
820
|
-
});
|
|
821
|
-
};
|
|
822
|
-
}
|
|
823
|
-
const combineArrays = (sources) => {
|
|
824
|
-
return combineLatest(sources.map(src => src.pipe(startWithIfEmpty([])))).pipe(map$1(res => res.flat()));
|
|
825
|
-
};
|
|
826
|
-
function switchOff(switchSource, defaultState = true) {
|
|
827
|
-
return (source) => {
|
|
828
|
-
return new Observable(subsciber => {
|
|
829
|
-
let isOn = defaultState;
|
|
830
|
-
const subscription = new Subscription();
|
|
831
|
-
subscription.add(switchSource.subscribe(on => isOn = on));
|
|
832
|
-
subscription.add(source.subscribe({
|
|
833
|
-
next(value) {
|
|
834
|
-
if (isOn) {
|
|
835
|
-
subsciber.next(value);
|
|
836
|
-
}
|
|
837
|
-
},
|
|
838
|
-
error: error => subsciber.error(error),
|
|
839
|
-
complete: () => subsciber.complete()
|
|
840
|
-
}));
|
|
841
|
-
return subscription;
|
|
842
|
-
});
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
function skipOneWhen(skipper) {
|
|
846
|
-
return (source) => {
|
|
847
|
-
return new Observable(subsriber => {
|
|
848
|
-
const subscription = new Subscription();
|
|
849
|
-
let skipNext = false;
|
|
850
|
-
subscription.add(skipper.subscribe(_ => skipNext = true));
|
|
851
|
-
subscription.add(source.subscribe({
|
|
852
|
-
next(value) {
|
|
853
|
-
if (skipNext) {
|
|
854
|
-
skipNext = false;
|
|
855
|
-
}
|
|
856
|
-
else {
|
|
857
|
-
subsriber.next(value);
|
|
858
|
-
}
|
|
859
|
-
},
|
|
860
|
-
error: error => subsriber.error(error),
|
|
861
|
-
complete: () => subsriber.complete()
|
|
862
|
-
}));
|
|
863
|
-
return subscription;
|
|
864
|
-
});
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
function previousAndCurrent(startingValue) {
|
|
868
|
-
return (source) => {
|
|
869
|
-
return source.pipe(startWith$1(startingValue), pairwise());
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
function notNull() {
|
|
873
|
-
return (source) => {
|
|
874
|
-
return source.pipe(filter$1((o) => o != null));
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
function delayOn(predicate, delayTime) {
|
|
878
|
-
return (src) => {
|
|
879
|
-
return src.pipe(concatMap$1(r => {
|
|
880
|
-
if (predicate(r)) {
|
|
881
|
-
return merge$1(of({ r }), of(null).pipe(delay(delayTime))).pipe(notNull(), map$1(d => d.r));
|
|
882
|
-
}
|
|
883
|
-
else {
|
|
884
|
-
return of(r);
|
|
885
|
-
}
|
|
886
|
-
}));
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
class Subjectifier extends Observable {
|
|
891
|
-
_subj = new Subject();
|
|
892
|
-
merged;
|
|
893
|
-
constructor(_source) {
|
|
894
|
-
super((obs) => {
|
|
895
|
-
const s = merge$1(_source, this._subj).subscribe(obs);
|
|
896
|
-
return s;
|
|
897
|
-
});
|
|
898
|
-
this.merged = merge$1(_source, this._subj);
|
|
899
|
-
}
|
|
900
|
-
next = this._subj.next.bind(this._subj);
|
|
901
|
-
newSubj = (...operations) => new Subjectifier(this.merged.pipe(...operations));
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
class Subscriber {
|
|
905
|
-
subscriptions = [];
|
|
906
|
-
handle = (subscription) => {
|
|
907
|
-
this.subscriptions.push(subscription);
|
|
908
|
-
};
|
|
909
|
-
on = (obs, action) => {
|
|
910
|
-
this.handle(obs.subscribe(action));
|
|
911
|
-
};
|
|
912
|
-
ngOnDestroy() {
|
|
913
|
-
this.subscriptions.forEach(subscription => {
|
|
914
|
-
subscription.unsubscribe();
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: Subscriber, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
918
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.2", type: Subscriber, ngImport: i0 });
|
|
919
|
-
}
|
|
920
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: Subscriber, decorators: [{
|
|
921
|
-
type: Directive
|
|
922
|
-
}] });
|
|
923
|
-
function subscriber(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
924
|
-
const destroyRef = getDestroyRef(obsOrSubOrInjector, actionOrInjector, injector);
|
|
925
|
-
const subscriber = new Subscriber();
|
|
926
|
-
if (obsOrSubOrInjector instanceof Subscription) {
|
|
927
|
-
subscriber.handle(obsOrSubOrInjector);
|
|
928
|
-
}
|
|
929
|
-
else if (obsOrSubOrInjector instanceof Observable) {
|
|
930
|
-
subscriber.handle(obsOrSubOrInjector.subscribe(actionOrInjector));
|
|
931
|
-
}
|
|
932
|
-
destroyRef.onDestroy(() => subscriber?.ngOnDestroy());
|
|
933
|
-
return subscriber;
|
|
934
|
-
}
|
|
935
|
-
function getDestroyRef(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
936
|
-
const providedInjector = obsOrSubOrInjector instanceof Injector ? obsOrSubOrInjector
|
|
937
|
-
: actionOrInjector instanceof Injector ? actionOrInjector
|
|
938
|
-
: injector;
|
|
939
|
-
if (!providedInjector) {
|
|
940
|
-
try {
|
|
941
|
-
assertInInjectionContext(subscriber);
|
|
942
|
-
}
|
|
943
|
-
catch (error) {
|
|
944
|
-
throw new Error('createRequestor() must be used in an Injection Context or you must provide an injector to createRequestor()');
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
const destroyRef = providedInjector?.get(DestroyRef) || inject(DestroyRef);
|
|
948
|
-
return destroyRef;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
978
|
class ResizeColumnDirective {
|
|
952
979
|
renderer = inject(Renderer2);
|
|
953
980
|
el = inject(ElementRef);
|
|
@@ -1030,9 +1057,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
1030
1057
|
}] } });
|
|
1031
1058
|
|
|
1032
1059
|
class TableWrapperDirective {
|
|
1033
|
-
registrations = [];
|
|
1060
|
+
$registrations = signal([]);
|
|
1034
1061
|
register(filter) {
|
|
1035
|
-
this
|
|
1062
|
+
this.$registrations.update(registrations => [...registrations, filter]);
|
|
1036
1063
|
}
|
|
1037
1064
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TableWrapperDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1038
1065
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.2", type: TableWrapperDirective, isStandalone: true, selector: "[tbWrapper]", ngImport: i0 });
|
|
@@ -1729,22 +1756,18 @@ class TableStore extends ComponentStore {
|
|
|
1729
1756
|
this.effect(() => srcObservable.pipe(tap(func)));
|
|
1730
1757
|
return this;
|
|
1731
1758
|
};
|
|
1732
|
-
onLast(callback) {
|
|
1733
|
-
this.on(this.state$.pipe(last()), callback);
|
|
1734
|
-
}
|
|
1735
1759
|
metaData$ = this.select(state => state.metaData);
|
|
1736
|
-
|
|
1737
|
-
|
|
1760
|
+
$metaData = this.selectSignal(state => state.metaData);
|
|
1761
|
+
$userDefinedOrder = this.selectSignal(state => state.userDefined.order);
|
|
1762
|
+
$hiddenKeys = this.selectSignal(state => state.hiddenKeys);
|
|
1763
|
+
$metaDataArray = this.selectSignal(this.$metaData, this.$userDefinedOrder, orderMetaData);
|
|
1738
1764
|
getMetaData$ = (key) => {
|
|
1739
1765
|
return this.select(state => state.metaData[key]).pipe(tap(meta => { if (!meta)
|
|
1740
1766
|
console.warn(`Meta data with key ${key} not found`); }), notNull());
|
|
1741
1767
|
};
|
|
1742
|
-
getUserDefinedWidth
|
|
1743
|
-
|
|
1744
|
-
getUserDefinedWidths$ = this.select(state => state.userDefined.widths);
|
|
1745
|
-
getUserDefinedWidths = this.selectSignal(state => state.userDefined.widths);
|
|
1768
|
+
$getUserDefinedWidth = (key) => this.selectSignal(state => state.userDefined.widths[key]);
|
|
1769
|
+
$getUserDefinedWidths = this.selectSignal(state => state.userDefined.widths);
|
|
1746
1770
|
tableSettingsMinWidth = this.selectSignal(state => state.minColumnWidth);
|
|
1747
|
-
displayedColumns$ = this.select(orderedVisibleColumns);
|
|
1748
1771
|
resetState = this.updater((state) => {
|
|
1749
1772
|
const sorted = this.createPreSort(state.metaData);
|
|
1750
1773
|
return ({ ...state, hiddenKeys: [], sorted, filters: {}, groupBy: [], userDefined: { widths: {}, order: {}, table: {} } });
|
|
@@ -1769,7 +1792,7 @@ class TableStore extends ComponentStore {
|
|
|
1769
1792
|
});
|
|
1770
1793
|
setUserDefinedOrder = this.updater((state, moved) => {
|
|
1771
1794
|
const { newOrder, oldOrder } = moved;
|
|
1772
|
-
const mdsArr =
|
|
1795
|
+
const mdsArr = orderedStateVisibleMetaData(state);
|
|
1773
1796
|
moveItemInArray(mdsArr, oldOrder, newOrder);
|
|
1774
1797
|
const userDefinedOrder = mdsArr.reduce((aggregate, current, index) => {
|
|
1775
1798
|
aggregate[current.key] = index;
|
|
@@ -1777,6 +1800,7 @@ class TableStore extends ComponentStore {
|
|
|
1777
1800
|
}, {});
|
|
1778
1801
|
return ({ ...state, userDefined: { ...state.userDefined, order: userDefinedOrder } });
|
|
1779
1802
|
});
|
|
1803
|
+
$filters = this.selectSignal(state => state.filters);
|
|
1780
1804
|
filters$ = this.select(state => state.filters);
|
|
1781
1805
|
getFilter$ = (filterId) => {
|
|
1782
1806
|
return this.select(state => state.filters[filterId]);
|
|
@@ -1826,7 +1850,7 @@ class TableStore extends ComponentStore {
|
|
|
1826
1850
|
createPreSort = (metaDatas) => {
|
|
1827
1851
|
return Object.values(metaDatas).filter((metaData) => !!metaData.preSort)
|
|
1828
1852
|
.sort(({ preSort: ps1 }, { preSort: ps2 }) => (ps1.precedence || Number.MAX_VALUE) - (ps2.precedence || Number.MAX_VALUE))
|
|
1829
|
-
.map(({ key, preSort }) => ({ active: key, direction
|
|
1853
|
+
.map(({ key, preSort: { direction } }) => ({ active: key, direction }));
|
|
1830
1854
|
};
|
|
1831
1855
|
setSort = this.updater((state, { key, direction }) => {
|
|
1832
1856
|
const sortArray = state.sorted.filter(s => s.active !== key);
|
|
@@ -1853,17 +1877,8 @@ class TableStore extends ComponentStore {
|
|
|
1853
1877
|
setPageSize = this.updater((state, pageSize) => ({ ...state, pageSize, userDefined: { ...state.userDefined, pageSize } }));
|
|
1854
1878
|
getPageSize = this.select(state => state.userDefined.pageSize || state.pageSize);
|
|
1855
1879
|
updateState = this.updater(this.updateStateFunc);
|
|
1856
|
-
cleanPersistedState(state, pState) {
|
|
1857
|
-
const metas = Object.values(state.metaData);
|
|
1858
|
-
const filters = Object.values(pState.filters).filter(fltr => isCustomFilter(fltr) || metas.some(m => m.key === fltr.key)).reduce((obj, filter) => {
|
|
1859
|
-
obj[filter.filterId] = pState.filters[filter.filterId];
|
|
1860
|
-
return obj;
|
|
1861
|
-
}, {});
|
|
1862
|
-
const sorted = pState.sorted.filter(s => metas.some(m => m.key === s.active));
|
|
1863
|
-
return ({ ...pState, filters, sorted });
|
|
1864
|
-
}
|
|
1865
1880
|
updateStateFromPersistedState = this.updater((state, persistedState) => {
|
|
1866
|
-
const incomingTableState =
|
|
1881
|
+
const incomingTableState = cleanPersistedState(state, persistedState);
|
|
1867
1882
|
const newState = this.updateStateFunc(state, incomingTableState);
|
|
1868
1883
|
newState.initializationState = state.initializationState === InitializationState.MetaDataLoaded ? InitializationState.LoadedFromStore : state.initializationState;
|
|
1869
1884
|
return newState;
|
|
@@ -1906,7 +1921,7 @@ class TableStore extends ComponentStore {
|
|
|
1906
1921
|
this.runOnceWhen(stateIs(InitializationState.Ready), func);
|
|
1907
1922
|
}
|
|
1908
1923
|
setMetaData = this.updater((state, md) => {
|
|
1909
|
-
const metaData =
|
|
1924
|
+
const metaData = md
|
|
1910
1925
|
.reduce((prev, curr) => {
|
|
1911
1926
|
if (prev[curr.key]) {
|
|
1912
1927
|
prev[curr.key] = this.mergeMeta(prev[curr.key], curr);
|
|
@@ -2011,43 +2026,80 @@ class TableStore extends ComponentStore {
|
|
|
2011
2026
|
$isVirtual = this.selectSignal(state => state.notPersistedTableSettings.useVirtualScroll === true || state.notPersistedTableSettings.useVirtualScroll?.virtualAsDefault || state.showAll);
|
|
2012
2027
|
$viewType = this.selectSignal(state => {
|
|
2013
2028
|
const usePaginator = state.notPersistedTableSettings.usePaginator;
|
|
2014
|
-
|
|
2029
|
+
if (state.showAll || (this.$isVirtual() && !usePaginator)) {
|
|
2030
|
+
return 'virtual all';
|
|
2031
|
+
}
|
|
2032
|
+
else if (this.$isVirtual() && usePaginator) {
|
|
2033
|
+
return 'virtual paginator';
|
|
2034
|
+
}
|
|
2035
|
+
else if (usePaginator) {
|
|
2036
|
+
return 'paginator';
|
|
2037
|
+
}
|
|
2038
|
+
else {
|
|
2039
|
+
return 'all';
|
|
2040
|
+
}
|
|
2015
2041
|
});
|
|
2016
2042
|
viewType$ = toObservable(this.$viewType);
|
|
2043
|
+
$orderedVisibleColumns = this.selectSignal(this.$metaData, this.$userDefinedOrder, this.$hiddenKeys, (m, u, h) => orderedVisibleMetaData(m, u, h).map(md => md.key), { equal: (a, b) => b.length === a.length && b.every((s, i) => a[i] === s) });
|
|
2017
2044
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TableStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2018
2045
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TableStore });
|
|
2019
2046
|
}
|
|
2020
2047
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TableStore, decorators: [{
|
|
2021
2048
|
type: Injectable
|
|
2022
2049
|
}], ctorParameters: () => [] });
|
|
2023
|
-
const orderedVisibleColumns = (state) =>
|
|
2024
|
-
const
|
|
2025
|
-
const ordered =
|
|
2050
|
+
const orderedVisibleColumns = (state) => orderedStateVisibleMetaData(state).map(md => md.key);
|
|
2051
|
+
const orderedStateVisibleMetaData = (state) => {
|
|
2052
|
+
const ordered = orderStateMetaData(state);
|
|
2026
2053
|
const orderedVisible = ordered
|
|
2027
2054
|
.filter(metaData => !state.hiddenKeys.includes(metaData.key) && state.metaData[metaData.key].fieldType !== FieldType.Hidden);
|
|
2028
2055
|
return orderedVisible;
|
|
2029
2056
|
};
|
|
2030
|
-
const
|
|
2031
|
-
const
|
|
2032
|
-
const
|
|
2057
|
+
const orderedVisibleMetaData = (metaData, userDefinedOrder, hiddenKeys) => {
|
|
2058
|
+
const ordered = orderMetaData(metaData, userDefinedOrder);
|
|
2059
|
+
const orderedVisible = ordered
|
|
2060
|
+
.filter(m => !hiddenKeys.includes(m.key) && metaData[m.key].fieldType !== FieldType.Hidden);
|
|
2061
|
+
return orderedVisible;
|
|
2062
|
+
};
|
|
2063
|
+
const orderedCodeVisibleMetaData = (state) => orderStateMetaData(state).filter(md => md.fieldType !== FieldType.Hidden);
|
|
2064
|
+
const orderStateMetaData = (state) => {
|
|
2065
|
+
return orderMetaData(state.metaData, state.userDefined.order);
|
|
2066
|
+
};
|
|
2067
|
+
const orderMetaData = (metaData, userDefined) => {
|
|
2068
|
+
const userOrderArr = Object.entries(userDefined);
|
|
2033
2069
|
return userOrderArr.length ?
|
|
2034
|
-
Object.values(
|
|
2035
|
-
const orderA =
|
|
2036
|
-
const orderB =
|
|
2037
|
-
|
|
2038
|
-
return 0;
|
|
2039
|
-
}
|
|
2040
|
-
if (orderA == null) {
|
|
2041
|
-
return 1;
|
|
2042
|
-
}
|
|
2043
|
-
if (orderB == null) {
|
|
2044
|
-
return -1;
|
|
2045
|
-
}
|
|
2046
|
-
return state.userDefined.order[a.key] - state.userDefined.order[b.key];
|
|
2070
|
+
Object.values(metaData).sort((a, b) => {
|
|
2071
|
+
const orderA = userDefined[a.key];
|
|
2072
|
+
const orderB = userDefined[b.key];
|
|
2073
|
+
return order(orderA, orderB);
|
|
2047
2074
|
})
|
|
2048
2075
|
:
|
|
2049
|
-
Object.values(
|
|
2076
|
+
Object.values(metaData).sort((a, b) => {
|
|
2077
|
+
const orderA = a.order;
|
|
2078
|
+
const orderB = b.order;
|
|
2079
|
+
return order(orderA, orderB);
|
|
2080
|
+
});
|
|
2050
2081
|
};
|
|
2082
|
+
function order(orderA, orderB) {
|
|
2083
|
+
if (orderA == null && orderB == null) {
|
|
2084
|
+
return 0;
|
|
2085
|
+
}
|
|
2086
|
+
if (orderA == null) {
|
|
2087
|
+
return 1;
|
|
2088
|
+
}
|
|
2089
|
+
if (orderB == null) {
|
|
2090
|
+
return -1;
|
|
2091
|
+
}
|
|
2092
|
+
return orderA - orderB;
|
|
2093
|
+
}
|
|
2094
|
+
function cleanPersistedState(state, pState) {
|
|
2095
|
+
const metas = Object.values(state.metaData);
|
|
2096
|
+
const filters = Object.values(pState.filters).filter(fltr => isCustomFilter(fltr) || metas.some(m => m.key === fltr.key)).reduce((obj, filter) => {
|
|
2097
|
+
obj[filter.filterId] = pState.filters[filter.filterId];
|
|
2098
|
+
return obj;
|
|
2099
|
+
}, {});
|
|
2100
|
+
const sorted = pState.sorted.filter(s => metas.some(m => m.key === s.active));
|
|
2101
|
+
return ({ ...pState, filters, sorted });
|
|
2102
|
+
}
|
|
2051
2103
|
|
|
2052
2104
|
class MultiSortDirective extends MatSort {
|
|
2053
2105
|
state = inject(TableStore);
|
|
@@ -2422,7 +2474,7 @@ class MatSlideToggleGroupDirective {
|
|
|
2422
2474
|
return startValue;
|
|
2423
2475
|
}
|
|
2424
2476
|
getObs() {
|
|
2425
|
-
var toggleChanges = merge
|
|
2477
|
+
var toggleChanges = merge(...this._toggles.map(toggle => toggle.change));
|
|
2426
2478
|
const startValue = this.getInitValue();
|
|
2427
2479
|
return toggleChanges.pipe(scan((prev, cur) => {
|
|
2428
2480
|
const toggleName = cur.source.name;
|
|
@@ -2908,24 +2960,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
2908
2960
|
class GenFilterDisplayerComponent {
|
|
2909
2961
|
tableState = inject(TableStore);
|
|
2910
2962
|
filterStore = inject(WrapperFilterStore);
|
|
2911
|
-
|
|
2912
|
-
const
|
|
2913
|
-
|
|
2914
|
-
}
|
|
2915
|
-
filterCols$;
|
|
2963
|
+
$filterCols = computed(() => {
|
|
2964
|
+
const mds = this.tableState.$metaDataArray();
|
|
2965
|
+
return mds.filter(m => m.fieldType !== FieldType.Hidden && m.fieldType !== FieldType.NotMapped && !m.noFilter);
|
|
2966
|
+
});
|
|
2916
2967
|
addFilter(metaData) {
|
|
2917
2968
|
this.filterStore.addFilter({ key: metaData.key, fieldType: metaData.fieldType });
|
|
2918
2969
|
}
|
|
2919
2970
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: GenFilterDisplayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2920
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: GenFilterDisplayerComponent, isStandalone: true, selector: "tb-filter-displayer", ngImport: i0, template: "<button stop-propagation class=\"filter-button\" mat-icon-button [matMenuTriggerFor]=\"menu\" matTooltip=\"Add Filter\">\n <mat-icon class=\"filter-icon\" color=\"primary\">filter_list</mat-icon>\n</button>\n<mat-menu #menu=\"matMenu\">\n @for (md of filterCols
|
|
2971
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: GenFilterDisplayerComponent, isStandalone: true, selector: "tb-filter-displayer", ngImport: i0, template: "<button stop-propagation class=\"filter-button\" mat-icon-button [matMenuTriggerFor]=\"menu\" matTooltip=\"Add Filter\">\n <mat-icon class=\"filter-icon\" color=\"primary\">filter_list</mat-icon>\n</button>\n<mat-menu #menu=\"matMenu\">\n @for (md of $filterCols(); track md.key) {\n <button (click)=\"addFilter(md)\" mat-menu-item>\n <span class=\"filter-labels\">{{md.displayName || (md.key | spaceCase)}}</span>\n </button>\n }\n</mat-menu>\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{color:#6495ed;font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{color:#6495ed;font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i4$2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$2.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: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: SpaceCasePipe, name: "spaceCase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2921
2972
|
}
|
|
2922
2973
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: GenFilterDisplayerComponent, decorators: [{
|
|
2923
2974
|
type: Component,
|
|
2924
2975
|
args: [{ selector: 'tb-filter-displayer', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
2925
2976
|
MatButtonModule, MatMenuModule, MatTooltipModule, StopPropagationDirective, MatIconModule,
|
|
2926
2977
|
AsyncPipe, SpaceCasePipe
|
|
2927
|
-
], template: "<button stop-propagation class=\"filter-button\" mat-icon-button [matMenuTriggerFor]=\"menu\" matTooltip=\"Add Filter\">\n <mat-icon class=\"filter-icon\" color=\"primary\">filter_list</mat-icon>\n</button>\n<mat-menu #menu=\"matMenu\">\n @for (md of filterCols
|
|
2928
|
-
}]
|
|
2978
|
+
], template: "<button stop-propagation class=\"filter-button\" mat-icon-button [matMenuTriggerFor]=\"menu\" matTooltip=\"Add Filter\">\n <mat-icon class=\"filter-icon\" color=\"primary\">filter_list</mat-icon>\n</button>\n<mat-menu #menu=\"matMenu\">\n @for (md of $filterCols(); track md.key) {\n <button (click)=\"addFilter(md)\" mat-menu-item>\n <span class=\"filter-labels\">{{md.displayName || (md.key | spaceCase)}}</span>\n </button>\n }\n</mat-menu>\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{color:#6495ed;font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{color:#6495ed;font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
|
|
2979
|
+
}] });
|
|
2929
2980
|
|
|
2930
2981
|
class KeyDisplayPipe {
|
|
2931
2982
|
tableState = inject(TableStore);
|
|
@@ -2992,7 +3043,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
2992
3043
|
class FilterChipsComponent {
|
|
2993
3044
|
tableState = inject(TableStore);
|
|
2994
3045
|
filterStore = inject(WrapperFilterStore);
|
|
2995
|
-
filters
|
|
3046
|
+
$filters = computed(() => Object.values(this.tableState.$filters()).filter(f => isFilterInfo(f) && !f._isExternallyManaged));
|
|
2996
3047
|
deleteByIndex(index) {
|
|
2997
3048
|
this.filterStore.deleteByIndex(index);
|
|
2998
3049
|
}
|
|
@@ -3004,14 +3055,14 @@ class FilterChipsComponent {
|
|
|
3004
3055
|
}
|
|
3005
3056
|
currentFilters$ = this.filterStore.currentFilters$;
|
|
3006
3057
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: FilterChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3007
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: FilterChipsComponent, isStandalone: true, selector: "lib-filter-list", ngImport: i0, template: "<div class=\"d-w\" *ngrxLet=\"currentFilters$ as currentFilters\" >\n\n @if (currentFilters.length) {\n <button class=\"cancel-button\" mat-icon-button (click)=\"clearAll()\" matTooltip=\"Close all Filters Cards\">\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\n </button>\n <div class=\"float\">\n @for (filter of currentFilters; track filter.key) {\n <div class=\"filter\">\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\n </div>\n }\n </div>\n }\n\n <mat-chip-set
|
|
3058
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: FilterChipsComponent, isStandalone: true, selector: "lib-filter-list", ngImport: i0, template: "<div class=\"d-w\" *ngrxLet=\"currentFilters$ as currentFilters\" >\n\n @if (currentFilters.length) {\n <button class=\"cancel-button\" mat-icon-button (click)=\"clearAll()\" matTooltip=\"Close all Filters Cards\">\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\n </button>\n <div class=\"float\">\n @for (filter of currentFilters; track filter.key) {\n <div class=\"filter\">\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\n </div>\n }\n </div>\n }\n\n <mat-chip-set>\n @for (filter of $filters(); track filter.key) {\n <mat-chip (dblclick)=\"addFilter(filter)\" (removed)=\"tableState.removeFilter(filter.filterId!)\">\n {{ filter.key | keyDisplay | async }} {{filter.filterType | formatFilterType : filter.filterValue}} {{ filter.filterValue | formatFilterValue: filter.key : filter.filterType | async }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n }\n @if ($filters().length > 1) {\n <mat-chip (removed)=\"tableState.clearFilters()\">\n Clear All\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n }\n </mat-chip-set>\n\n</div>\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{color:#6495ed;font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{color:#6495ed;font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"], dependencies: [{ kind: "directive", type: LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FilterComponent, selector: "tb-filter", inputs: ["filter"], outputs: ["close"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i4$3.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: "directive", type: i4$3.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i4$3.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: KeyDisplayPipe, name: "keyDisplay" }, { kind: "pipe", type: FormatFilterTypePipe, name: "formatFilterType" }, { kind: "pipe", type: FormatFilterValuePipe, name: "formatFilterValue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3008
3059
|
}
|
|
3009
3060
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: FilterChipsComponent, decorators: [{
|
|
3010
3061
|
type: Component,
|
|
3011
3062
|
args: [{ selector: 'lib-filter-list', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
3012
3063
|
LetDirective, MatButtonModule, MatTooltipModule, MatIconModule, FilterComponent,
|
|
3013
3064
|
MatChipsModule, AsyncPipe, KeyDisplayPipe, FormatFilterTypePipe, FormatFilterValuePipe
|
|
3014
|
-
], template: "<div class=\"d-w\" *ngrxLet=\"currentFilters$ as currentFilters\" >\n\n @if (currentFilters.length) {\n <button class=\"cancel-button\" mat-icon-button (click)=\"clearAll()\" matTooltip=\"Close all Filters Cards\">\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\n </button>\n <div class=\"float\">\n @for (filter of currentFilters; track filter.key) {\n <div class=\"filter\">\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\n </div>\n }\n </div>\n }\n\n <mat-chip-set
|
|
3065
|
+
], template: "<div class=\"d-w\" *ngrxLet=\"currentFilters$ as currentFilters\" >\n\n @if (currentFilters.length) {\n <button class=\"cancel-button\" mat-icon-button (click)=\"clearAll()\" matTooltip=\"Close all Filters Cards\">\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\n </button>\n <div class=\"float\">\n @for (filter of currentFilters; track filter.key) {\n <div class=\"filter\">\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\n </div>\n }\n </div>\n }\n\n <mat-chip-set>\n @for (filter of $filters(); track filter.key) {\n <mat-chip (dblclick)=\"addFilter(filter)\" (removed)=\"tableState.removeFilter(filter.filterId!)\">\n {{ filter.key | keyDisplay | async }} {{filter.filterType | formatFilterType : filter.filterValue}} {{ filter.filterValue | formatFilterValue: filter.key : filter.filterType | async }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n }\n @if ($filters().length > 1) {\n <mat-chip (removed)=\"tableState.clearFilters()\">\n Clear All\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n }\n </mat-chip-set>\n\n</div>\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{color:#6495ed;font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{color:#6495ed;font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
|
|
3015
3066
|
}] });
|
|
3016
3067
|
|
|
3017
3068
|
function isPipe(o) {
|
|
@@ -3507,7 +3558,7 @@ class ColumnBuilderComponent {
|
|
|
3507
3558
|
}
|
|
3508
3559
|
classes;
|
|
3509
3560
|
styles = computed(() => {
|
|
3510
|
-
return columnStyles(this.metaData, this.state
|
|
3561
|
+
return columnStyles(this.metaData, this.state.$getUserDefinedWidth(this.metaData.key)(), this.state.tableSettingsMinWidth());
|
|
3511
3562
|
});
|
|
3512
3563
|
ngOnInit() {
|
|
3513
3564
|
this.initialSetUp();
|
|
@@ -3609,10 +3660,25 @@ function getSameTailLength(previousSorts, currentSorts) {
|
|
|
3609
3660
|
const initIndexSymbol = Symbol('tb_init_index');
|
|
3610
3661
|
const initialSortState = { sortsToRun: [], allSorts: [] };
|
|
3611
3662
|
|
|
3663
|
+
class DataStore extends ComponentStore {
|
|
3664
|
+
constructor() {
|
|
3665
|
+
super({ ...defaultDataState });
|
|
3666
|
+
}
|
|
3667
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DataStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3668
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DataStore });
|
|
3669
|
+
}
|
|
3670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DataStore, decorators: [{
|
|
3671
|
+
type: Injectable
|
|
3672
|
+
}], ctorParameters: () => [] });
|
|
3673
|
+
|
|
3612
3674
|
class GenericTableComponent {
|
|
3613
3675
|
state = inject(TableStore);
|
|
3676
|
+
dataStore = inject(DataStore);
|
|
3614
3677
|
viewContainer = inject(ViewContainerRef);
|
|
3615
3678
|
transformCreator = inject(TransformCreator);
|
|
3679
|
+
$headerRow = viewChild(MatHeaderRowDef);
|
|
3680
|
+
$footerRow = viewChild(MatFooterRowDef);
|
|
3681
|
+
$table = viewChild(MatTable);
|
|
3616
3682
|
drop(event) {
|
|
3617
3683
|
this.state.setUserDefinedOrder({ newOrder: event.currentIndex, oldOrder: event.previousIndex });
|
|
3618
3684
|
}
|
|
@@ -3625,55 +3691,103 @@ class GenericTableComponent {
|
|
|
3625
3691
|
this.setUpSelections(trackBy);
|
|
3626
3692
|
}
|
|
3627
3693
|
get trackBy() { return this._trackBy; }
|
|
3628
|
-
displayData
|
|
3694
|
+
$displayData = input.required({ alias: 'displayData' });
|
|
3695
|
+
$displayDataLength = computed(() => this.$displayData()?.length || 0);
|
|
3696
|
+
$hasFooterMeta = computed(() => this.state.$metaDataArray().some(md => !!md.additional?.footer));
|
|
3629
3697
|
$data = input.required({ alias: 'data' });
|
|
3630
3698
|
data$ = toObservable(this.$data);
|
|
3631
3699
|
rows;
|
|
3632
3700
|
columnBuilders;
|
|
3633
|
-
columnInfos;
|
|
3634
|
-
|
|
3701
|
+
$columnInfos = input.required({ alias: 'columnInfos' });
|
|
3702
|
+
$hasCustomFooter = computed(() => this.$columnInfos()?.some(ci => !!ci.customCell?.columnDef?.footerCell));
|
|
3635
3703
|
dropList;
|
|
3704
|
+
$footerRowStyle = computed(() => {
|
|
3705
|
+
const hasData = !!this.$displayDataLength();
|
|
3706
|
+
const metaFooter = this.$hasFooterMeta();
|
|
3707
|
+
const customFooter = this.$hasCustomFooter();
|
|
3708
|
+
const hasSelectionColumn = this.state.props().selectionColumn;
|
|
3709
|
+
return customFooter || (hasData && (metaFooter || hasSelectionColumn)) ? 'regular-footer' : hasData ? 'no-footer' : 'small-footer';
|
|
3710
|
+
});
|
|
3711
|
+
$showFooterRow = computed(() => this.$footerRowStyle() !== 'no-footer');
|
|
3636
3712
|
currentColumns;
|
|
3637
|
-
keys = [];
|
|
3638
3713
|
_injector = inject(Injector);
|
|
3639
3714
|
injector = Injector.create({
|
|
3640
3715
|
providers: [
|
|
3641
|
-
{ provide: MatTable, useFactory: () => this
|
|
3716
|
+
{ provide: MatTable, useFactory: () => this.$table() },
|
|
3642
3717
|
{ provide: CdkDropList, useFactory: () => this.dropList },
|
|
3643
3718
|
],
|
|
3644
3719
|
parent: this._injector
|
|
3645
3720
|
});
|
|
3646
3721
|
rowDefArr = [];
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3722
|
+
$hasSelectColumn = computed(() => this.state.selectSignal(state => state.props.selectionColumn)());
|
|
3723
|
+
$hasIndexColumn = computed(() => this.state.selectSignal(state => state.props.indexColumn)());
|
|
3724
|
+
myColumns = signal({});
|
|
3725
|
+
$showHeader = computed(() => !this.state.tableSettings().hideColumnHeader);
|
|
3726
|
+
offset$ = this.dataStore.select(s => s.virtualScrollOffset);
|
|
3651
3727
|
offsetIndex = 0;
|
|
3652
3728
|
dataView;
|
|
3653
3729
|
constructor() {
|
|
3654
3730
|
this.setUpSelections();
|
|
3731
|
+
effect(() => {
|
|
3732
|
+
const columnInfos = this.$columnInfos() || [];
|
|
3733
|
+
untracked(() => {
|
|
3734
|
+
Object.entries(this.myColumns()).forEach(([key, value]) => {
|
|
3735
|
+
const columnInfo = columnInfos.find(ci => ci.metaData.key === key);
|
|
3736
|
+
if (!columnInfo || columnInfo.customCell !== value.customCell) {
|
|
3737
|
+
delete this.myColumns()[key];
|
|
3738
|
+
this.$table()?.removeColumnDef(value.columnDef);
|
|
3739
|
+
}
|
|
3740
|
+
});
|
|
3741
|
+
columnInfos.forEach(ci => this.addMetaData(ci));
|
|
3742
|
+
});
|
|
3743
|
+
});
|
|
3744
|
+
effect(() => {
|
|
3745
|
+
const headerRow = this.$headerRow();
|
|
3746
|
+
const showHeader = this.$showHeader();
|
|
3747
|
+
const table = this.$table();
|
|
3748
|
+
untracked(() => {
|
|
3749
|
+
if (headerRow && showHeader && table)
|
|
3750
|
+
table.addHeaderRowDef(headerRow);
|
|
3751
|
+
else if (headerRow && table)
|
|
3752
|
+
table.removeHeaderRowDef(headerRow);
|
|
3753
|
+
});
|
|
3754
|
+
});
|
|
3755
|
+
effect(() => {
|
|
3756
|
+
const footerRow = this.$footerRow();
|
|
3757
|
+
const showFooter = this.$showFooterRow();
|
|
3758
|
+
const table = this.$table();
|
|
3759
|
+
untracked(() => {
|
|
3760
|
+
if (footerRow && showFooter && table)
|
|
3761
|
+
table.addFooterRowDef(footerRow);
|
|
3762
|
+
else if (footerRow && table)
|
|
3763
|
+
table.removeFooterRowDef(footerRow);
|
|
3764
|
+
});
|
|
3765
|
+
});
|
|
3655
3766
|
}
|
|
3656
3767
|
defaultTrackBy = (index, item) => item[initIndexSymbol];
|
|
3657
3768
|
trackByFunction = this.defaultTrackBy;
|
|
3658
3769
|
ngOnChanges(changes) {
|
|
3659
|
-
if (changes.rows && this.rows && this.myColumns.length) {
|
|
3770
|
+
if (changes.rows && this.rows && this.myColumns().length) {
|
|
3660
3771
|
this.initializeRowDefs([...this.rows]);
|
|
3661
3772
|
}
|
|
3662
3773
|
}
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3774
|
+
$keys = computed(() => {
|
|
3775
|
+
const displayed = this.state.$orderedVisibleColumns();
|
|
3776
|
+
const built = this.myColumns();
|
|
3777
|
+
const keys = displayed.filter(d => !!built[d]);
|
|
3778
|
+
if (this.$hasSelectColumn()) {
|
|
3779
|
+
keys.unshift('select');
|
|
3666
3780
|
}
|
|
3667
|
-
if (this
|
|
3668
|
-
|
|
3781
|
+
if (this.$hasIndexColumn()) {
|
|
3782
|
+
keys.unshift('index');
|
|
3669
3783
|
}
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3784
|
+
return keys;
|
|
3785
|
+
});
|
|
3786
|
+
keys$ = toObservable(this.$keys);
|
|
3787
|
+
ngOnInit() {
|
|
3673
3788
|
this.initializeRowDefs([...this.rows]);
|
|
3674
|
-
this.state.on(this.
|
|
3675
|
-
this.
|
|
3676
|
-
this.rowDefArr?.forEach(row => row.columns = this.keys);
|
|
3789
|
+
this.state.on(this.keys$, keys => {
|
|
3790
|
+
this.rowDefArr?.forEach(row => row.columns = keys);
|
|
3677
3791
|
});
|
|
3678
3792
|
this.state.on(this.selectableData$, (data) => {
|
|
3679
3793
|
if (this.selection.selected.length) {
|
|
@@ -3682,18 +3796,9 @@ class GenericTableComponent {
|
|
|
3682
3796
|
this.selection.deselect(...removed);
|
|
3683
3797
|
}
|
|
3684
3798
|
});
|
|
3685
|
-
this.showHeader$ = this.state.tableSettings$.pipe(map(settings => !(settings.hideColumnHeader)));
|
|
3686
|
-
this.showFooterRow$ = combineLatest([
|
|
3687
|
-
this.displayData$.pipe(map(d => !!d.length), distinctUntilChanged()),
|
|
3688
|
-
this.state.metaDataArray$.pipe(map(metaData => metaData.some(md => !!md.additional?.footer)), distinctUntilChanged()),
|
|
3689
|
-
this.columnInfos.pipe(map(columnInfos => columnInfos.some(ci => !!ci.customCell?.columnDef?.footerCell)), distinctUntilChanged()),
|
|
3690
|
-
]).pipe(map(([hasData, hasFooterDef, hasCustomFooter]) => {
|
|
3691
|
-
const hasSelectionColumn = this.state.props().selectionColumn;
|
|
3692
|
-
return hasCustomFooter || (hasData && (hasFooterDef || hasSelectionColumn)) ? 'regular-footer' : hasData ? 'no-footer' : 'small-footer';
|
|
3693
|
-
}));
|
|
3694
3799
|
if (this.state.tableSettings().usePaginator || this.state.tableSettings().useVirtualScroll) {
|
|
3695
|
-
this.state.on(this.state.state$, (state) => {
|
|
3696
|
-
this.offsetIndex =
|
|
3800
|
+
this.state.on(combineLatest([this.state.state$, this.dataStore.state$]), ([state, data]) => {
|
|
3801
|
+
this.offsetIndex = data.virtualEnds.start;
|
|
3697
3802
|
if (this.state.tableSettings().usePaginator) {
|
|
3698
3803
|
this.offsetIndex += (state.pageSize * state.currentPage);
|
|
3699
3804
|
}
|
|
@@ -3707,7 +3812,7 @@ class GenericTableComponent {
|
|
|
3707
3812
|
this.state.updateExpandedGroups({ key, isExpanded, groupKey });
|
|
3708
3813
|
}
|
|
3709
3814
|
addMetaData(column) {
|
|
3710
|
-
const columnBuilder = this.myColumns[column.metaData.key];
|
|
3815
|
+
const columnBuilder = this.myColumns()[column.metaData.key];
|
|
3711
3816
|
if (columnBuilder) {
|
|
3712
3817
|
columnBuilder.metaData = column.metaData;
|
|
3713
3818
|
}
|
|
@@ -3719,17 +3824,18 @@ class GenericTableComponent {
|
|
|
3719
3824
|
component.instance.customCell = column.customCell;
|
|
3720
3825
|
component.instance.metaData = column.metaData;
|
|
3721
3826
|
component.instance.data$ = this.data$;
|
|
3722
|
-
this.myColumns[column.metaData.key]
|
|
3827
|
+
this.myColumns.update(mc => ({ ...mc, [column.metaData.key]: component.instance }));
|
|
3723
3828
|
}
|
|
3724
3829
|
}
|
|
3725
3830
|
initializeRowDefs = (defs) => {
|
|
3726
|
-
|
|
3831
|
+
const table = this.$table();
|
|
3832
|
+
if (!table)
|
|
3833
|
+
return;
|
|
3834
|
+
this.rowDefArr.forEach(r => table.removeRowDef(r));
|
|
3727
3835
|
this.rowDefArr = defs;
|
|
3728
3836
|
defs.forEach(r => {
|
|
3729
|
-
r.columns = this.
|
|
3730
|
-
|
|
3731
|
-
this.table.addRowDef(r);
|
|
3732
|
-
}
|
|
3837
|
+
r.columns = this.$keys().concat(Object.values(this.myColumns()).filter(c => c.metaData.fieldType !== FieldType.Hidden).map(c => c.metaData.key));
|
|
3838
|
+
table.addRowDef(r);
|
|
3733
3839
|
});
|
|
3734
3840
|
};
|
|
3735
3841
|
selection;
|
|
@@ -3780,7 +3886,6 @@ class GenericTableComponent {
|
|
|
3780
3886
|
return (previousUserDefinedWidth ?? 0) >= 0 && currentUserDefinedWidth == null;
|
|
3781
3887
|
}
|
|
3782
3888
|
}));
|
|
3783
|
-
showFooterRow$;
|
|
3784
3889
|
getTransform = (key, val) => {
|
|
3785
3890
|
if (val == undefined || val === 'null')
|
|
3786
3891
|
return '';
|
|
@@ -3793,7 +3898,8 @@ class GenericTableComponent {
|
|
|
3793
3898
|
};
|
|
3794
3899
|
$rowHeight = this.state.selectSignal(s => {
|
|
3795
3900
|
if (this.state.$isVirtual() && s.notPersistedTableSettings.useVirtualScroll?.enforceRowHeight) {
|
|
3796
|
-
|
|
3901
|
+
const height = s.notPersistedTableSettings.useVirtualScroll.rowHeight;
|
|
3902
|
+
return height + 'px';
|
|
3797
3903
|
}
|
|
3798
3904
|
if (typeof s.notPersistedTableSettings.rowHeight === 'number') {
|
|
3799
3905
|
return s.notPersistedTableSettings.rowHeight + 'px';
|
|
@@ -3802,36 +3908,36 @@ class GenericTableComponent {
|
|
|
3802
3908
|
});
|
|
3803
3909
|
$headerHeight = this.state.selectSignal(s => {
|
|
3804
3910
|
if (this.state.$isVirtual() && s.notPersistedTableSettings.useVirtualScroll?.enforceHeaderHeight) {
|
|
3805
|
-
|
|
3911
|
+
const height = s.notPersistedTableSettings.useVirtualScroll.headerHeight;
|
|
3912
|
+
return height + 'px';
|
|
3806
3913
|
}
|
|
3807
3914
|
if (typeof s.notPersistedTableSettings.headerHeight === 'number') {
|
|
3808
3915
|
return s.notPersistedTableSettings.headerHeight + 'px';
|
|
3809
3916
|
}
|
|
3810
3917
|
return s.notPersistedTableSettings.headerHeight;
|
|
3811
3918
|
});
|
|
3919
|
+
$groupHeaderHeight = this.state.selectSignal(s => {
|
|
3920
|
+
if (s.notPersistedTableSettings.groupHeaderHeight) {
|
|
3921
|
+
return s.notPersistedTableSettings.groupHeaderHeight + 'px';
|
|
3922
|
+
}
|
|
3923
|
+
return this.$rowHeight();
|
|
3924
|
+
});
|
|
3812
3925
|
$stickyFooter = computed(() => this.state.props().stickyFooter || this.state.$isVirtual());
|
|
3813
3926
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: GenericTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3814
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: GenericTableComponent, isStandalone: true, selector: "tb-generic-table", inputs: { trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: false, isRequired: false, transformFunction: null }, displayData
|
|
3927
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: GenericTableComponent, isStandalone: true, selector: "tb-generic-table", inputs: { trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: false, isRequired: false, transformFunction: null }, $displayData: { classPropertyName: "$displayData", publicName: "displayData", isSignal: true, isRequired: true, transformFunction: null }, $data: { classPropertyName: "$data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: false, isRequired: false, transformFunction: null }, columnBuilders: { classPropertyName: "columnBuilders", publicName: "columnBuilders", isSignal: false, isRequired: false, transformFunction: null }, $columnInfos: { classPropertyName: "$columnInfos", publicName: "columnInfos", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selection$: "selection$" }, viewQueries: [{ propertyName: "$headerRow", first: true, predicate: MatHeaderRowDef, descendants: true, isSignal: true }, { propertyName: "$footerRow", first: true, predicate: MatFooterRowDef, descendants: true, isSignal: true }, { propertyName: "$table", first: true, predicate: MatTable, descendants: true, isSignal: true }, { propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<mat-table\n cdkDropList\n cdkDropListLockAxis='x'\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"drop($event)\"\n class=\"table-drag-list\"\n [class]=\"($footerRowStyle())\"\n #table\n [dataSource]=\"state.props().dataSource!\"\n [trackBy]=\"trackByFunction\"\n [style]=\"tableWidth | async \"\n>\n\n <!-- select column -->\n <ng-container matColumnDef=\"select\">\n\n <mat-header-cell *matHeaderCellDef class=\"select-column\">\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\n [checked]=\"!!(masterToggleChecked$ | async)\"\n [indeterminate]=\"masterToggleIndeterminate$ | async\">\n </mat-checkbox>\n </mat-header-cell>\n\n <mat-cell *matCellDef=\"let row\" class=\"select-column\">\n <mat-checkbox\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\"\n [checked]=\"selection.isSelected(row)\"/>\n </mat-cell>\n\n <mat-footer-cell *matFooterCellDef class=\"select-column\">\n {{ selection.selected.length }}\n </mat-footer-cell>\n </ng-container>\n\n\n <!-- index column -->\n <ng-container matColumnDef=\"index\">\n <mat-header-cell *matHeaderCellDef class=\"f-mat-header-cell\" class=\"index-column\">#\n </mat-header-cell>\n <mat-cell *matCellDef=\"let i = index;\" class=\"index-column\">\n {{ 1 + i + offsetIndex }}\n </mat-cell>\n <mat-footer-cell *matFooterCellDef class=\"index-column\"></mat-footer-cell>\n </ng-container>\n\n <!-- Grouping -->\n <ng-container matColumnDef=\"groupHeader\">\n <mat-cell *matCellDef=\"let row\">\n @let expanded = (state.getIsExpanded | func : row.key : row.groupName );\n <div [style.paddingLeft]=\"row.padding + 'px !important'\">\n <button mat-icon-button (click)=\"setExpanded(row.key, row.groupName, !expanded());\">\n @if (!expanded()) {\n <mat-icon>chevron_right</mat-icon>\n } @else {\n <mat-icon>expand_more</mat-icon>\n }\n </button>\n {{ getTransform | func : row.key : row.groupHeaderDisplay }} ({{ row.length }})\n </div>\n <div style=\"flex-grow: 1\">\n <ng-container *ngTemplateOutlet=\"state.props().groupHeaderTemplate!; context: { element: row }\"></ng-container>\n </div>\n </mat-cell>\n </ng-container>\n\n <mat-row [style.height]=\"$rowHeight()\" [style.min-height]=\"$rowHeight()\"\n *matRowDef=\"let row; columns: $keys(); let i = index\"/>\n <mat-row [style.height]=\"state.props().groupHeaderHeight ? state.props().groupHeaderHeight + 'px' : $groupHeaderHeight()\"\n [style.min-height]=\"state.props().groupHeaderHeight ? state.props().groupHeaderHeight + 'px' : $groupHeaderHeight()\"\n *matRowDef=\"let row; columns: ['groupHeader']; when: isGroupHeader\" style=\"background-color: white;\"/>\n</mat-table>\n\n<mat-header-row [style.height]=\"$headerHeight()\" [style.min-height]=\"$headerHeight()\"\n *matHeaderRowDef=\"$keys(); sticky: state.props().isSticky\" [style.top.px]=\"((offset$ | async)! * -1)\"/>\n<mat-footer-row [style.height]=\"$rowHeight()\" [style.min-height]=\"$rowHeight()\"\n *matFooterRowDef=\"$keys(); sticky: $stickyFooter() \"\n [style.bottom.px]=\"$stickyFooter() ? (offset$ | async) : undefined\"/>", styles: [":host{--mat-paginator-container-size: initial}.select-column{min-width:var(--tb-min-select-column-width, 42px)}.index-column{min-width:var(--tb-min-index-column-width, 42px)}.mat-mdc-row:nth-child(odd){background-color:var(--tb-odd-row-background-color, #cdeefe)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host::ng-deep .mdc-data-table__cell,:host::ng-deep .mdc-data-table__header-cell{padding:var(--tb-cell-padding, 0 0 0 .2rem);line-height:var(--tb-cell-line-height, normal)}::ng-deep .op-date-time-input{line-height:3rem;font-size:.9rem;font-family:Roboto,Helvetica Neue,sans-serif;padding-left:.2rem;width:12rem}.small-footer mat-footer-row{min-height:1rem;height:1rem}\n"], dependencies: [{ kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i1$5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i1$5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i1$5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i1$5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i1$5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i1$5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i1$5.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i1$5.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i1$5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i1$5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i1$5.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i1$5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i1$5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i1$5.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i5.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: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i1$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: FunctionPipe, name: "func" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3815
3928
|
}
|
|
3816
3929
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: GenericTableComponent, decorators: [{
|
|
3817
3930
|
type: Component,
|
|
3818
3931
|
args: [{ selector: 'tb-generic-table', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
3819
3932
|
MatTableModule, DragDropModule, MatCheckboxModule, MatButtonModule, MatIconModule, NgTemplateOutlet,
|
|
3820
3933
|
MatTooltipModule, AsyncPipe, FunctionPipe,
|
|
3821
|
-
], template: "<mat-table\n cdkDropList\n cdkDropListLockAxis='x'\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"drop($event)\"\n class=\"table-drag-list\"\n [class]=\"(
|
|
3934
|
+
], template: "<mat-table\n cdkDropList\n cdkDropListLockAxis='x'\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"drop($event)\"\n class=\"table-drag-list\"\n [class]=\"($footerRowStyle())\"\n #table\n [dataSource]=\"state.props().dataSource!\"\n [trackBy]=\"trackByFunction\"\n [style]=\"tableWidth | async \"\n>\n\n <!-- select column -->\n <ng-container matColumnDef=\"select\">\n\n <mat-header-cell *matHeaderCellDef class=\"select-column\">\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\n [checked]=\"!!(masterToggleChecked$ | async)\"\n [indeterminate]=\"masterToggleIndeterminate$ | async\">\n </mat-checkbox>\n </mat-header-cell>\n\n <mat-cell *matCellDef=\"let row\" class=\"select-column\">\n <mat-checkbox\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\"\n [checked]=\"selection.isSelected(row)\"/>\n </mat-cell>\n\n <mat-footer-cell *matFooterCellDef class=\"select-column\">\n {{ selection.selected.length }}\n </mat-footer-cell>\n </ng-container>\n\n\n <!-- index column -->\n <ng-container matColumnDef=\"index\">\n <mat-header-cell *matHeaderCellDef class=\"f-mat-header-cell\" class=\"index-column\">#\n </mat-header-cell>\n <mat-cell *matCellDef=\"let i = index;\" class=\"index-column\">\n {{ 1 + i + offsetIndex }}\n </mat-cell>\n <mat-footer-cell *matFooterCellDef class=\"index-column\"></mat-footer-cell>\n </ng-container>\n\n <!-- Grouping -->\n <ng-container matColumnDef=\"groupHeader\">\n <mat-cell *matCellDef=\"let row\">\n @let expanded = (state.getIsExpanded | func : row.key : row.groupName );\n <div [style.paddingLeft]=\"row.padding + 'px !important'\">\n <button mat-icon-button (click)=\"setExpanded(row.key, row.groupName, !expanded());\">\n @if (!expanded()) {\n <mat-icon>chevron_right</mat-icon>\n } @else {\n <mat-icon>expand_more</mat-icon>\n }\n </button>\n {{ getTransform | func : row.key : row.groupHeaderDisplay }} ({{ row.length }})\n </div>\n <div style=\"flex-grow: 1\">\n <ng-container *ngTemplateOutlet=\"state.props().groupHeaderTemplate!; context: { element: row }\"></ng-container>\n </div>\n </mat-cell>\n </ng-container>\n\n <mat-row [style.height]=\"$rowHeight()\" [style.min-height]=\"$rowHeight()\"\n *matRowDef=\"let row; columns: $keys(); let i = index\"/>\n <mat-row [style.height]=\"state.props().groupHeaderHeight ? state.props().groupHeaderHeight + 'px' : $groupHeaderHeight()\"\n [style.min-height]=\"state.props().groupHeaderHeight ? state.props().groupHeaderHeight + 'px' : $groupHeaderHeight()\"\n *matRowDef=\"let row; columns: ['groupHeader']; when: isGroupHeader\" style=\"background-color: white;\"/>\n</mat-table>\n\n<mat-header-row [style.height]=\"$headerHeight()\" [style.min-height]=\"$headerHeight()\"\n *matHeaderRowDef=\"$keys(); sticky: state.props().isSticky\" [style.top.px]=\"((offset$ | async)! * -1)\"/>\n<mat-footer-row [style.height]=\"$rowHeight()\" [style.min-height]=\"$rowHeight()\"\n *matFooterRowDef=\"$keys(); sticky: $stickyFooter() \"\n [style.bottom.px]=\"$stickyFooter() ? (offset$ | async) : undefined\"/>", styles: [":host{--mat-paginator-container-size: initial}.select-column{min-width:var(--tb-min-select-column-width, 42px)}.index-column{min-width:var(--tb-min-index-column-width, 42px)}.mat-mdc-row:nth-child(odd){background-color:var(--tb-odd-row-background-color, #cdeefe)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host::ng-deep .mdc-data-table__cell,:host::ng-deep .mdc-data-table__header-cell{padding:var(--tb-cell-padding, 0 0 0 .2rem);line-height:var(--tb-cell-line-height, normal)}::ng-deep .op-date-time-input{line-height:3rem;font-size:.9rem;font-family:Roboto,Helvetica Neue,sans-serif;padding-left:.2rem;width:12rem}.small-footer mat-footer-row{min-height:1rem;height:1rem}\n"] }]
|
|
3822
3935
|
}], ctorParameters: () => [], propDecorators: { trackBy: [{
|
|
3823
3936
|
type: Input
|
|
3824
|
-
}], displayData$: [{
|
|
3825
|
-
type: Input
|
|
3826
3937
|
}], rows: [{
|
|
3827
3938
|
type: Input
|
|
3828
3939
|
}], columnBuilders: [{
|
|
3829
3940
|
type: Input
|
|
3830
|
-
}], columnInfos: [{
|
|
3831
|
-
type: Input
|
|
3832
|
-
}], table: [{
|
|
3833
|
-
type: ViewChild,
|
|
3834
|
-
args: [MatTable, { static: true }]
|
|
3835
3941
|
}], dropList: [{
|
|
3836
3942
|
type: ViewChild,
|
|
3837
3943
|
args: [CdkDropList, { static: true }]
|
|
@@ -3914,7 +4020,7 @@ class ExportToCsvService {
|
|
|
3914
4020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: ExportToCsvService, decorators: [{
|
|
3915
4021
|
type: Injectable
|
|
3916
4022
|
}] });
|
|
3917
|
-
const removeFromMetaData = (state, keysToRemove) =>
|
|
4023
|
+
const removeFromMetaData = (state, keysToRemove) => orderStateMetaData(state)
|
|
3918
4024
|
.filter(meta => !keysToRemove.includes(meta.key));
|
|
3919
4025
|
const nonExportableFields = (state) => Object.values(state.metaData)
|
|
3920
4026
|
.filter(md => md.noExport)
|
|
@@ -4173,11 +4279,12 @@ class SortMenuComponentStore extends ComponentStore {
|
|
|
4173
4279
|
sorted.splice(index, 1, sort);
|
|
4174
4280
|
return ({ ...state, sorted });
|
|
4175
4281
|
});
|
|
4282
|
+
metaDataArr$ = toObservable(this.tableState.$metaDataArray);
|
|
4176
4283
|
reset = () => {
|
|
4177
4284
|
const sorted = this.tableState.sort$.pipe(mergeMap(sort => this.tableState.metaData$.pipe(notNull(), map(meta => sort.map(s => {
|
|
4178
4285
|
return { ...s, displayName: meta[s.active]?.displayName };
|
|
4179
4286
|
})))));
|
|
4180
|
-
const notSorted = this.
|
|
4287
|
+
const notSorted = this.metaDataArr$.pipe(mergeMap(metas => this.tableState.sort$.pipe(map(s => metas
|
|
4181
4288
|
.filter(meta => !s.some(s => s.active === meta.key) && meta.fieldType !== FieldType.NotMapped && !meta.noSort)
|
|
4182
4289
|
.map(meta => ({ active: meta.key, displayName: meta.displayName }))))));
|
|
4183
4290
|
this.set(combineLatest([
|
|
@@ -4257,6 +4364,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
4257
4364
|
|
|
4258
4365
|
class PaginatorComponent {
|
|
4259
4366
|
state = inject(TableStore);
|
|
4367
|
+
data = inject(DataStore);
|
|
4260
4368
|
paginator;
|
|
4261
4369
|
currentPageData$;
|
|
4262
4370
|
$collapseFooter = computed(() => this.state.selectSignal(state => state.persistedTableSettings.collapseFooter)() || this.$showAll());
|
|
@@ -4269,10 +4377,10 @@ class PaginatorComponent {
|
|
|
4269
4377
|
this.state.updateState({ currentPage: pageEvent.pageIndex });
|
|
4270
4378
|
});
|
|
4271
4379
|
this.state.setPageSize(onPaginatorPageSizeChange(this.paginator));
|
|
4272
|
-
this.state.on(this.
|
|
4380
|
+
this.state.on(this.data.select(s => s.dataLen), (len) => this.paginator.length = len);
|
|
4273
4381
|
}
|
|
4274
4382
|
ngAfterViewInit() {
|
|
4275
|
-
this.currentPageData$ = merge
|
|
4383
|
+
this.currentPageData$ = merge(this.paginator.page.pipe(map(mapPaginationEventToCurrentPageDetails)), this.data$.pipe(distinctUntilKeyChanged("length"), delayToAllowForProperUpdate, map(updateCurrentPageDetailsOnDataLengthChange(this.paginator))));
|
|
4276
4384
|
}
|
|
4277
4385
|
paginatorChange() {
|
|
4278
4386
|
if (!this.ourPageEvent) {
|
|
@@ -4302,7 +4410,7 @@ class PaginatorComponent {
|
|
|
4302
4410
|
</mat-paginator>
|
|
4303
4411
|
@if ($showAllOption()) {<button mat-button (click)="updatePaginator()"><span [style.text-decoration]="$showAll() ? 'line-through' : ''" >All</span></button>}
|
|
4304
4412
|
</div>
|
|
4305
|
-
`, isInline: true, styles: [":host{--mat-paginator-container-size: initial}.select-column{min-width:var(--tb-min-select-column-width, 42px)}.index-column{min-width:var(--tb-min-index-column-width, 42px)}.mat-mdc-row:nth-child(odd){background-color:var(--tb-odd-row-background-color, #cdeefe)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host::ng-deep .mdc-data-table__cell,:host::ng-deep .mdc-data-table__header-cell{padding:var(--tb-cell-padding, 0 0 0 .2rem);line-height:var(--tb-cell-line-height, normal)}::ng-deep .op-date-time-input{line-height:3rem;font-size:.9rem;font-family:Roboto,Helvetica Neue,sans-serif;padding-left:.2rem;width:12rem}.small-footer mat-footer-row{min-height:1rem;height:1rem}
|
|
4413
|
+
`, isInline: true, styles: [":host{--mat-paginator-container-size: initial}.select-column{min-width:var(--tb-min-select-column-width, 42px)}.index-column{min-width:var(--tb-min-index-column-width, 42px)}.mat-mdc-row:nth-child(odd){background-color:var(--tb-odd-row-background-color, #cdeefe)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host::ng-deep .mdc-data-table__cell,:host::ng-deep .mdc-data-table__header-cell{padding:var(--tb-cell-padding, 0 0 0 .2rem);line-height:var(--tb-cell-line-height, normal)}::ng-deep .op-date-time-input{line-height:3rem;font-size:.9rem;font-family:Roboto,Helvetica Neue,sans-serif;padding-left:.2rem;width:12rem}.small-footer mat-footer-row{min-height:1rem;height:1rem}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}.paginator-row{display:flex;align-items:center}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i1$6.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4306
4414
|
}
|
|
4307
4415
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: PaginatorComponent, decorators: [{
|
|
4308
4416
|
type: Component,
|
|
@@ -4318,7 +4426,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
4318
4426
|
</mat-paginator>
|
|
4319
4427
|
@if ($showAllOption()) {<button mat-button (click)="updatePaginator()"><span [style.text-decoration]="$showAll() ? 'line-through' : ''" >All</span></button>}
|
|
4320
4428
|
</div>
|
|
4321
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{--mat-paginator-container-size: initial}.select-column{min-width:var(--tb-min-select-column-width, 42px)}.index-column{min-width:var(--tb-min-index-column-width, 42px)}.mat-mdc-row:nth-child(odd){background-color:var(--tb-odd-row-background-color, #cdeefe)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host::ng-deep .mdc-data-table__cell,:host::ng-deep .mdc-data-table__header-cell{padding:var(--tb-cell-padding, 0 0 0 .2rem);line-height:var(--tb-cell-line-height, normal)}::ng-deep .op-date-time-input{line-height:3rem;font-size:.9rem;font-family:Roboto,Helvetica Neue,sans-serif;padding-left:.2rem;width:12rem}.small-footer mat-footer-row{min-height:1rem;height:1rem}
|
|
4429
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{--mat-paginator-container-size: initial}.select-column{min-width:var(--tb-min-select-column-width, 42px)}.index-column{min-width:var(--tb-min-index-column-width, 42px)}.mat-mdc-row:nth-child(odd){background-color:var(--tb-odd-row-background-color, #cdeefe)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host::ng-deep .mdc-data-table__cell,:host::ng-deep .mdc-data-table__header-cell{padding:var(--tb-cell-padding, 0 0 0 .2rem);line-height:var(--tb-cell-line-height, normal)}::ng-deep .op-date-time-input{line-height:3rem;font-size:.9rem;font-family:Roboto,Helvetica Neue,sans-serif;padding-left:.2rem;width:12rem}.small-footer mat-footer-row{min-height:1rem;height:1rem}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}.paginator-row{display:flex;align-items:center}\n"] }]
|
|
4322
4430
|
}], propDecorators: { paginator: [{
|
|
4323
4431
|
type: ViewChild,
|
|
4324
4432
|
args: [MatPaginator, { static: true }]
|
|
@@ -4400,14 +4508,18 @@ class TableVirtualScrollStrategy {
|
|
|
4400
4508
|
|
|
4401
4509
|
class VirtualScrollContainer {
|
|
4402
4510
|
state = inject(TableStore);
|
|
4511
|
+
dataStore = inject(DataStore);
|
|
4512
|
+
genericTable = contentChild(GenericTableComponent);
|
|
4513
|
+
sub;
|
|
4514
|
+
footerStyle = 'regular-footer';
|
|
4403
4515
|
viewport = viewChild(CdkVirtualScrollViewport);
|
|
4404
4516
|
defaultOptions = new VirtualScrollOptions();
|
|
4405
4517
|
scrollStrategy = new TableVirtualScrollStrategy(this.computedRowHeight(), this.computedHeaderHeight());
|
|
4406
|
-
dataLength$ = this.state.state
|
|
4518
|
+
dataLength$ = combineLatest([this.state.state$, this.dataStore.state$]).pipe(map$1(([s, d]) => ({
|
|
4407
4519
|
paginated: s.notPersistedTableSettings.usePaginator && !s.showAll,
|
|
4408
4520
|
pageSize: s.userDefined?.pageSize || s.pageSize,
|
|
4409
4521
|
pageNumber: s.currentPage,
|
|
4410
|
-
dataLen:
|
|
4522
|
+
dataLen: d.dataLen
|
|
4411
4523
|
})), distinctUntilChanged$1((a, b) => a.dataLen === b.dataLen &&
|
|
4412
4524
|
a.pageSize === b.pageSize &&
|
|
4413
4525
|
a.pageNumber === b.pageNumber &&
|
|
@@ -4428,7 +4540,7 @@ class VirtualScrollContainer {
|
|
|
4428
4540
|
if (!!viewport) {
|
|
4429
4541
|
addEventListener('resize', this.resizeHandler);
|
|
4430
4542
|
this.subscriber.on(viewport.renderedRangeStream, (range) => {
|
|
4431
|
-
this.
|
|
4543
|
+
this.dataStore.patchState({
|
|
4432
4544
|
virtualEnds: {
|
|
4433
4545
|
start: range.start,
|
|
4434
4546
|
end: range.end + 25,
|
|
@@ -4437,15 +4549,22 @@ class VirtualScrollContainer {
|
|
|
4437
4549
|
});
|
|
4438
4550
|
var offset$ = viewport.scrolledIndexChange.pipe(map$1(() => viewport.getOffsetToRenderedContentStart() ?? 0), distinctUntilChanged$1(), defaultShareReplay());
|
|
4439
4551
|
this.subscriber.on(offset$, (offset) => {
|
|
4440
|
-
this.
|
|
4552
|
+
this.dataStore.patchState({ virtualScrollOffset: offset });
|
|
4441
4553
|
});
|
|
4442
4554
|
this.setSize(this.viewport().elementRef);
|
|
4443
4555
|
}
|
|
4444
4556
|
;
|
|
4445
4557
|
});
|
|
4446
4558
|
});
|
|
4559
|
+
ngAfterViewInit() {
|
|
4560
|
+
const footerRowStyle$ = this.genericTable()?.$footerRowStyle();
|
|
4561
|
+
if (footerRowStyle$) {
|
|
4562
|
+
this.footerStyle = footerRowStyle$;
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4447
4565
|
ngOnDestroy() {
|
|
4448
4566
|
removeEventListener('resize', this.resizeHandler);
|
|
4567
|
+
this.sub?.unsubscribe();
|
|
4449
4568
|
}
|
|
4450
4569
|
setSize(el) {
|
|
4451
4570
|
const vsViewport = el.nativeElement;
|
|
@@ -4453,7 +4572,20 @@ class VirtualScrollContainer {
|
|
|
4453
4572
|
const rowHeight = this.computedRowHeight();
|
|
4454
4573
|
let amountOfVisibleItems = virtualScrollOptions?.amountOfVisibleItems || this.defaultOptions.amountOfVisibleItems;
|
|
4455
4574
|
virtualScrollOptions?.amountOfVisibleItems || this.defaultOptions.amountOfVisibleItems;
|
|
4456
|
-
let height =
|
|
4575
|
+
let height = 0;
|
|
4576
|
+
var sub = this.dataLength$.subscribe(dataLength => {
|
|
4577
|
+
if (dataLength < amountOfVisibleItems) {
|
|
4578
|
+
height = +(this.computedRowHeight() * dataLength);
|
|
4579
|
+
}
|
|
4580
|
+
else {
|
|
4581
|
+
height = (rowHeight * amountOfVisibleItems);
|
|
4582
|
+
}
|
|
4583
|
+
});
|
|
4584
|
+
if (this.footerStyle !== 'no-footer') {
|
|
4585
|
+
height += rowHeight;
|
|
4586
|
+
console.log(height);
|
|
4587
|
+
console.log('regular-footer');
|
|
4588
|
+
}
|
|
4457
4589
|
if (!this.state.tableSettings().hideHeader) {
|
|
4458
4590
|
const headerHeight = this.computedHeaderHeight();
|
|
4459
4591
|
height += headerHeight;
|
|
@@ -4463,7 +4595,7 @@ class VirtualScrollContainer {
|
|
|
4463
4595
|
vsViewport.setAttribute('style', `height: ${height}px !important;`);
|
|
4464
4596
|
this.viewport()?.checkViewportSize();
|
|
4465
4597
|
const virtualScrollOffset = this.viewport()?.getOffsetToRenderedContentStart() ?? 0;
|
|
4466
|
-
this.
|
|
4598
|
+
this.dataStore.patchState({ virtualScrollOffset });
|
|
4467
4599
|
}
|
|
4468
4600
|
resizeHandler = () => {
|
|
4469
4601
|
if (this.viewport()) {
|
|
@@ -4481,7 +4613,7 @@ class VirtualScrollContainer {
|
|
|
4481
4613
|
return headerHeight;
|
|
4482
4614
|
}
|
|
4483
4615
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: VirtualScrollContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4484
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.2", type: VirtualScrollContainer, isStandalone: true, selector: "tb-virtual-scroll-container", viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
4616
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.2", type: VirtualScrollContainer, isStandalone: true, selector: "tb-virtual-scroll-container", queries: [{ propertyName: "genericTable", first: true, predicate: GenericTableComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
4485
4617
|
<cdk-virtual-scroll-viewport>
|
|
4486
4618
|
<ng-content/>
|
|
4487
4619
|
</cdk-virtual-scroll-viewport>
|
|
@@ -4857,18 +4989,25 @@ const defaultProps = {
|
|
|
4857
4989
|
selectionColumn: false,
|
|
4858
4990
|
isSticky: true,
|
|
4859
4991
|
stickyFooter: false,
|
|
4992
|
+
groupHeaderHeight: undefined,
|
|
4860
4993
|
};
|
|
4861
4994
|
|
|
4862
4995
|
class TableBuilderDataSource extends MatTableDataSource {
|
|
4863
4996
|
dataSrc;
|
|
4864
4997
|
subscription;
|
|
4865
|
-
|
|
4866
|
-
viewableData$ = this.#viewableData$.pipe(mergeAll());
|
|
4867
|
-
constructor(dataSrc, state) {
|
|
4998
|
+
constructor(dataSrc, state, data) {
|
|
4868
4999
|
super([]);
|
|
4869
5000
|
this.dataSrc = dataSrc;
|
|
4870
|
-
|
|
4871
|
-
|
|
5001
|
+
const viewType$ = state.viewType$.pipe(distinctUntilChanged$1(), defaultShareReplay());
|
|
5002
|
+
const distinctSizingData = combineLatest([state.state$, data.state$]).pipe(map$1(([{ currentPage, pageSize }, { virtualEnds }]) => ({ currentPage, pageSize, virtualEnd: virtualEnds?.end, virtualStart: virtualEnds?.start })), distinctUntilChanged$1((d1, d2) => d1.currentPage === d2.currentPage
|
|
5003
|
+
&& d1.pageSize === d2.pageSize
|
|
5004
|
+
&& d1.virtualEnd === d2.virtualEnd
|
|
5005
|
+
&& d1.virtualStart === d2.virtualStart));
|
|
5006
|
+
const _dataLength = this.dataSrc.pipe(map$1((data) => data.length), distinctUntilChanged$1());
|
|
5007
|
+
const firstDataLength = _dataLength.pipe(first());
|
|
5008
|
+
const subsequentDataLength = _dataLength.pipe(skip(1), delay(0));
|
|
5009
|
+
const dataLength = merge(firstDataLength, subsequentDataLength);
|
|
5010
|
+
const dataSize$ = combineLatest([viewType$, distinctSizingData, dataLength]).pipe(map$1(([viewType, { currentPage, pageSize, virtualEnd, virtualStart }, length]) => {
|
|
4872
5011
|
const previousPageRecords = currentPage * pageSize;
|
|
4873
5012
|
if (viewType === 'virtual paginator') {
|
|
4874
5013
|
return ({ start: virtualStart + previousPageRecords, end: Math.min(virtualEnd, pageSize) + previousPageRecords });
|
|
@@ -4876,15 +5015,16 @@ class TableBuilderDataSource extends MatTableDataSource {
|
|
|
4876
5015
|
if (viewType === 'paginator') {
|
|
4877
5016
|
return ({ start: previousPageRecords, end: previousPageRecords + pageSize });
|
|
4878
5017
|
}
|
|
5018
|
+
if (viewType === 'all') {
|
|
5019
|
+
return ({ start: 0, end: length });
|
|
5020
|
+
}
|
|
4879
5021
|
return ({ start: virtualStart, end: virtualEnd });
|
|
4880
|
-
}))
|
|
5022
|
+
}))
|
|
4881
5023
|
.pipe(distinctUntilChanged$1((a, b) => a.start === b.start && a.end === b.end), defaultShareReplay());
|
|
4882
|
-
this.dataToShow$ = combineLatest([this.dataSrc,
|
|
5024
|
+
this.dataToShow$ = combineLatest([this.dataSrc, dataSize$])
|
|
4883
5025
|
.pipe(map$1(([data, size]) => data.slice(size.start, size.end)))
|
|
4884
5026
|
.pipe(defaultShareReplay());
|
|
4885
5027
|
}
|
|
4886
|
-
#viewType$;
|
|
4887
|
-
#dataSize$;
|
|
4888
5028
|
dataToShow$;
|
|
4889
5029
|
connect() {
|
|
4890
5030
|
if (!this.subscription) {
|
|
@@ -4892,7 +5032,6 @@ class TableBuilderDataSource extends MatTableDataSource {
|
|
|
4892
5032
|
this.data = data;
|
|
4893
5033
|
});
|
|
4894
5034
|
}
|
|
4895
|
-
this.#viewableData$.next(this.dataToShow$);
|
|
4896
5035
|
return super.connect();
|
|
4897
5036
|
}
|
|
4898
5037
|
disconnect() {
|
|
@@ -4908,17 +5047,55 @@ class TableContainerComponent {
|
|
|
4908
5047
|
props = { ...defaultProps };
|
|
4909
5048
|
dataSubject = new ReplaySubject(1);
|
|
4910
5049
|
state = inject(TableStore);
|
|
5050
|
+
dataStore = inject(DataStore);
|
|
4911
5051
|
config = inject(TableBuilderConfigToken);
|
|
4912
5052
|
exportToCsvService = inject((ExportToCsvService));
|
|
4913
5053
|
wrapper = inject(TableWrapperDirective, { optional: true });
|
|
4914
5054
|
stateService = inject(TableBuilderStateStore);
|
|
4915
5055
|
injector = inject(Injector);
|
|
5056
|
+
filterDirectives = contentChildren(TableFilterDirective, { descendants: true });
|
|
5057
|
+
customFilterDirectives = contentChildren(TableCustomFilterDirective, { descendants: true });
|
|
5058
|
+
allFilterDirectives = computed(() => {
|
|
5059
|
+
if (this.wrapper) {
|
|
5060
|
+
return [...this.filterDirectives(), ...this.customFilterDirectives(), ...this.wrapper.$registrations()];
|
|
5061
|
+
}
|
|
5062
|
+
{
|
|
5063
|
+
return [...this.filterDirectives(), ...this.customFilterDirectives()];
|
|
5064
|
+
}
|
|
5065
|
+
});
|
|
5066
|
+
tableState = toSignal(this.state.state$.pipe(filter(stateIs(InitializationState.LoadedFromStore))));
|
|
5067
|
+
allFilterDirectivesEffect = effect(() => {
|
|
5068
|
+
const state = this.tableState();
|
|
5069
|
+
untracked(() => {
|
|
5070
|
+
if (state) {
|
|
5071
|
+
this.allFilterDirectives().filter(f => !f.used).forEach(f => {
|
|
5072
|
+
f.used = true;
|
|
5073
|
+
if (f.savable) {
|
|
5074
|
+
var filter = state.filters[f.filterId];
|
|
5075
|
+
if (isFilterInfo(filter)) {
|
|
5076
|
+
const filterDirective = f;
|
|
5077
|
+
filterDirective.fieldType = filter.fieldType;
|
|
5078
|
+
filterDirective.filterType = filter.filterType;
|
|
5079
|
+
filterDirective.setFilterValue(filter.filterValue);
|
|
5080
|
+
filterDirective.key = filter.key;
|
|
5081
|
+
filterDirective.update();
|
|
5082
|
+
}
|
|
5083
|
+
if (isCustomFilter(filter)) {
|
|
5084
|
+
f.active = filter.active ?? false;
|
|
5085
|
+
}
|
|
5086
|
+
this.state.addFilter(f.filter$);
|
|
5087
|
+
}
|
|
5088
|
+
});
|
|
5089
|
+
}
|
|
5090
|
+
});
|
|
5091
|
+
});
|
|
4916
5092
|
paginatorComponent;
|
|
4917
5093
|
genericTable;
|
|
4918
|
-
customFilterDirectives;
|
|
4919
|
-
filterDirectives;
|
|
4920
5094
|
customRows;
|
|
4921
|
-
customCells;
|
|
5095
|
+
$customCells = contentChildren(CustomCellDirective);
|
|
5096
|
+
$myColumns = computed(() => {
|
|
5097
|
+
return this.state.$metaDataArray().map(metaData => ({ metaData, customCell: this.$customCells().find(cc => cc.customCell === metaData.key) }));
|
|
5098
|
+
});
|
|
4922
5099
|
tableElRef;
|
|
4923
5100
|
tableBuilder;
|
|
4924
5101
|
tableId;
|
|
@@ -4940,6 +5117,9 @@ class TableContainerComponent {
|
|
|
4940
5117
|
set groupHeaderTemplate(template) {
|
|
4941
5118
|
this.props.groupHeaderTemplate = template;
|
|
4942
5119
|
}
|
|
5120
|
+
set groupHeaderHeight(value) {
|
|
5121
|
+
this.props.groupHeaderHeight = value;
|
|
5122
|
+
}
|
|
4943
5123
|
trackBy;
|
|
4944
5124
|
inputFilters;
|
|
4945
5125
|
selection$ = new EventEmitter();
|
|
@@ -4954,7 +5134,6 @@ class TableContainerComponent {
|
|
|
4954
5134
|
displayData = this.displayDataSubject.pipe(switchAll(), defaultShareReplay());
|
|
4955
5135
|
$displayData = toSignal(this.displayData, { initialValue: [] });
|
|
4956
5136
|
collapseFooter$ = this.state.state$.pipe(map(state => state.persistedTableSettings.collapseFooter));
|
|
4957
|
-
myColumns$;
|
|
4958
5137
|
ngOnDestroy() {
|
|
4959
5138
|
if (this.tableId) {
|
|
4960
5139
|
this.stateService.saveTableStateToLocal({ tableId: this.tableId, tableState: this.state.getSavableStateSignal() });
|
|
@@ -4967,8 +5146,8 @@ class TableContainerComponent {
|
|
|
4967
5146
|
this.paginatorComponent?.paginator?.lastPage();
|
|
4968
5147
|
}
|
|
4969
5148
|
resetState() {
|
|
4970
|
-
this.customFilterDirectives.forEach(cf => cf.reset());
|
|
4971
|
-
this.filterDirectives.forEach(cf => cf.reset());
|
|
5149
|
+
this.customFilterDirectives().forEach(cf => cf.reset());
|
|
5150
|
+
this.filterDirectives().forEach(cf => cf.reset());
|
|
4972
5151
|
this.state.resetState();
|
|
4973
5152
|
this.onStateReset.next(null);
|
|
4974
5153
|
}
|
|
@@ -5003,11 +5182,21 @@ class TableContainerComponent {
|
|
|
5003
5182
|
this.displayDataSubject.next(flatGrouped$);
|
|
5004
5183
|
this.dataSubject.next(sortedAndFilteredData$);
|
|
5005
5184
|
this.state.on(this.displayData, (data) => {
|
|
5006
|
-
this.
|
|
5185
|
+
this.dataStore.patchState({ dataLen: data.length });
|
|
5007
5186
|
});
|
|
5008
5187
|
}
|
|
5009
5188
|
ngOnInit() {
|
|
5010
|
-
const
|
|
5189
|
+
const customCells$ = toObservable(this.$customCells, { injector: this.injector });
|
|
5190
|
+
this.state.setLinkMaps(this.tableBuilder.metaData$.pipe(map(createLinkCreatorDict)));
|
|
5191
|
+
const c = customCells$.pipe(switchMap(c => c.length ? combineLatest(c.map(c => c.$metaData)) : of([])));
|
|
5192
|
+
this.state.setMetaData(combineLatest([this.tableBuilder.metaData$, c]).pipe(map(([mds, customCells]) => {
|
|
5193
|
+
mds = mds.map(this.mapArrayFieldsMetaDatas);
|
|
5194
|
+
return [
|
|
5195
|
+
...mds,
|
|
5196
|
+
...customCells.map(md => this.mergeMetaData(md, mds.find(item => item.key === md.key)))
|
|
5197
|
+
];
|
|
5198
|
+
})));
|
|
5199
|
+
const ds = new TableBuilderDataSource(this.displayData, this.state, this.dataStore);
|
|
5011
5200
|
this.state.updateState({ props: {
|
|
5012
5201
|
dataSource: ds,
|
|
5013
5202
|
...this.props
|
|
@@ -5015,6 +5204,24 @@ class TableContainerComponent {
|
|
|
5015
5204
|
this.initializeState();
|
|
5016
5205
|
this.initializeData();
|
|
5017
5206
|
}
|
|
5207
|
+
mergeMetaData(metaData1, metaData2) {
|
|
5208
|
+
if (!metaData2) {
|
|
5209
|
+
metaData1.noExport = true;
|
|
5210
|
+
return metaData1;
|
|
5211
|
+
}
|
|
5212
|
+
if (!metaData1.displayName)
|
|
5213
|
+
metaData1.displayName = metaData2.displayName;
|
|
5214
|
+
if (!metaData1.preSort)
|
|
5215
|
+
metaData1.preSort = metaData2.preSort;
|
|
5216
|
+
if (!metaData1.order)
|
|
5217
|
+
metaData1.order = metaData2.order;
|
|
5218
|
+
if (!metaData1.width)
|
|
5219
|
+
metaData1.width = metaData2.width;
|
|
5220
|
+
if (metaData2.fieldType)
|
|
5221
|
+
metaData1.fieldType = metaData2.fieldType;
|
|
5222
|
+
metaData1.noExport = !metaData2;
|
|
5223
|
+
return metaData1;
|
|
5224
|
+
}
|
|
5018
5225
|
exportToCsv() {
|
|
5019
5226
|
const sorted = this.data.pipe(withLatestFrom(this.state.sort$), map(([data, sorted]) => sortData(data, sorted)));
|
|
5020
5227
|
this.exportToCsvService.exportToCsv(sorted);
|
|
@@ -5025,25 +5232,12 @@ class TableContainerComponent {
|
|
|
5025
5232
|
};
|
|
5026
5233
|
collapseAllGroups = () => this.state.collapseAll();
|
|
5027
5234
|
ngAfterContentInit() {
|
|
5028
|
-
this.initializeColumns();
|
|
5029
5235
|
this.state.runOnceWhen(stateIs(InitializationState.LoadedFromStore), state => {
|
|
5030
5236
|
this.addFilterDirectives(state);
|
|
5031
5237
|
this.state.updateState({ initializationState: InitializationState.Ready });
|
|
5032
5238
|
});
|
|
5033
5239
|
}
|
|
5034
|
-
|
|
5035
|
-
const customCellMap = new Map(this.customCells.map(cc => [cc.customCell, cc]));
|
|
5036
|
-
this.state.setMetaData(this.tableBuilder.metaData$.pipe(map((mds) => {
|
|
5037
|
-
mds = mds.map(this.mapMetaDatas);
|
|
5038
|
-
return [
|
|
5039
|
-
...mds,
|
|
5040
|
-
...this.customCells.map(cc => cc.getMetaData(mds.find(item => item.key === cc.customCell)))
|
|
5041
|
-
];
|
|
5042
|
-
})));
|
|
5043
|
-
this.state.setLinkMaps(this.tableBuilder.metaData$.pipe(map(createLinkCreatorDict)));
|
|
5044
|
-
this.myColumns$ = this.state.metaDataArray$.pipe(mapArray(metaData => ({ metaData, customCell: customCellMap.get(metaData.key) })), defaultShareReplay());
|
|
5045
|
-
}
|
|
5046
|
-
mapMetaDatas = (meta) => {
|
|
5240
|
+
mapArrayFieldsMetaDatas = (meta) => {
|
|
5047
5241
|
if (meta.fieldType === FieldType.Array) {
|
|
5048
5242
|
const additional = { ...meta.additional };
|
|
5049
5243
|
additional.arrayStyle = additional?.arrayStyle ?? ArrayDefaults.arrayStyle;
|
|
@@ -5054,33 +5248,9 @@ class TableContainerComponent {
|
|
|
5054
5248
|
};
|
|
5055
5249
|
collapseHeader$ = this.state.state$.pipe(map(state => state.persistedTableSettings.collapseHeader));
|
|
5056
5250
|
addFilterDirectives = (state) => {
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
}
|
|
5061
|
-
const customFilters = [];
|
|
5062
|
-
allFilterDirectives.filter(f => !f.used).forEach(f => {
|
|
5063
|
-
f.used = true;
|
|
5064
|
-
if (f.savable) {
|
|
5065
|
-
var filter = state.filters[f.filterId];
|
|
5066
|
-
if (isFilterInfo(filter)) {
|
|
5067
|
-
const filterDirective = f;
|
|
5068
|
-
filterDirective.fieldType = filter.fieldType;
|
|
5069
|
-
filterDirective.filterType = filter.filterType;
|
|
5070
|
-
filterDirective.setFilterValue(filter.filterValue);
|
|
5071
|
-
filterDirective.key = filter.key;
|
|
5072
|
-
filterDirective.update();
|
|
5073
|
-
}
|
|
5074
|
-
if (isCustomFilter(filter)) {
|
|
5075
|
-
f.active = filter.active ?? false;
|
|
5076
|
-
}
|
|
5077
|
-
this.state.addFilter(f.filter$);
|
|
5078
|
-
}
|
|
5079
|
-
else {
|
|
5080
|
-
customFilters.push(f);
|
|
5081
|
-
}
|
|
5082
|
-
});
|
|
5083
|
-
const customFilters$ = from(customFilters.map(cf => cf.filter$)).pipe(mergeAll$1(), scan$1((a, b) => {
|
|
5251
|
+
const customFilters$ = toObservable(this.allFilterDirectives, { injector: this.injector }).pipe(mergeMap(customerFilters => customerFilters
|
|
5252
|
+
.filter(filter => !filter.savable)
|
|
5253
|
+
.map(filter => filter.filter$)), mergeAll(), scan$1((a, b) => {
|
|
5084
5254
|
if (b.active) {
|
|
5085
5255
|
a[b.filterId] = isCustomFilter(b) ? b.predicate : createFilterFunc(b);
|
|
5086
5256
|
}
|
|
@@ -5095,29 +5265,20 @@ class TableContainerComponent {
|
|
|
5095
5265
|
};
|
|
5096
5266
|
$useVirtual = this.state.$isVirtual;
|
|
5097
5267
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TableContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5098
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: TableContainerComponent, isStandalone: true, selector: "tb-table-container", inputs: { tableBuilder: "tableBuilder", tableId: "tableId", indexColumn: "indexColumn", selectionColumn: "selectionColumn", isSticky: "isSticky", stickyFooter: "stickyFooter", pageSize: "pageSize", groupHeaderTemplate: "groupHeaderTemplate", trackBy: "trackBy", inputFilters: "inputFilters" }, outputs: { selection$: "selection$", data: "data", onStateReset: "onStateReset", onSaveState: "onSaveState", state$: "state$" }, providers: [TableStore, ExportToCsvService, WrapperFilterStore], queries: [{ propertyName: "
|
|
5268
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.2", type: TableContainerComponent, isStandalone: true, selector: "tb-table-container", inputs: { tableBuilder: "tableBuilder", tableId: "tableId", indexColumn: "indexColumn", selectionColumn: "selectionColumn", isSticky: "isSticky", stickyFooter: "stickyFooter", pageSize: "pageSize", groupHeaderTemplate: "groupHeaderTemplate", groupHeaderHeight: "groupHeaderHeight", trackBy: "trackBy", inputFilters: "inputFilters" }, outputs: { selection$: "selection$", data: "data", onStateReset: "onStateReset", onSaveState: "onSaveState", state$: "state$" }, providers: [TableStore, ExportToCsvService, WrapperFilterStore, DataStore], queries: [{ propertyName: "filterDirectives", predicate: TableFilterDirective, descendants: true, isSignal: true }, { propertyName: "customFilterDirectives", predicate: TableCustomFilterDirective, descendants: true, isSignal: true }, { propertyName: "$customCells", predicate: CustomCellDirective, isSignal: true }, { propertyName: "tableElRef", first: true, predicate: ["table"], descendants: true, read: ElementRef }, { propertyName: "customRows", predicate: MatRowDef }], viewQueries: [{ propertyName: "paginatorComponent", first: true, predicate: PaginatorComponent, descendants: true }, { propertyName: "genericTable", first: true, predicate: GenericTableComponent, descendants: true }], ngImport: i0, template: "<ng-content select=\"[before]\" />\n\n<ng-container multiSort *ngrxLet=\"state.tableSettings$ as tableSettings\">\n <div class=\"header-wrapper\">\n <div class=\"title\">\n @if ((!(collapseHeader$ | async)) || tableSettings.showTitleWhenHeaderCollapsed) {\n <ng-content select=\".tb-header-title\"/>\n }\n @if((state.groupByKeys$ | async)?.length){\n <group-by-list />\n }\n </div>\n <div class=\"flx-row-end\">\n <lib-filter-list />\n @if (!tableSettings.hideHeader) {\n @if (!(collapseHeader$ | async)) {\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\n <button mat-icon-button color='primary' [matMenuTriggerFor]=\"mainMenu\">\n <mat-icon>more_vert</mat-icon>\n </button>\n <mat-menu #mainMenu='matMenu'>\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\n </mat-menu>\n }\n @else {\n <mat-icon color=\"primary\" [matMenuTriggerFor]=\"mainMenu\" class=\"flat-menu-button pointer\">more_horiz</mat-icon>\n <mat-menu #mainMenu='matMenu'>\n <div class=\"flex-column\">\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\n </div>\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\n </mat-menu>\n }\n <mat-icon [matTooltip]=\"(collapseHeader$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon header\"\n (click)=\"state.toggleCollapseHeader()\">\n {{(collapseHeader$ | async) ? 'expand_less' : 'expand_more'}}\n </mat-icon>\n }\n\n </div>\n </div>\n <div class=\"table-wrapper\">\n @if($useVirtual())\n {\n <tb-virtual-scroll-container>\n <tb-generic-table [rows]='customRows' [data]=\"(data | async)!\" [displayData]=\"$displayData()\"\n (selection$)='selection$.emit($event)' [columnInfos]='$myColumns()' [trackBy]=\"trackBy\" />\n </tb-virtual-scroll-container>\n }\n @else\n {\n <tb-generic-table [rows]='customRows' [data]=\"(data | async)!\" [displayData]=\"$displayData()\"\n (selection$)='selection$.emit($event)' [columnInfos]='$myColumns()' [trackBy]=\"trackBy\" />\n }\n\n </div>\n @if(tableSettings.usePaginator)\n {\n <div class=\"paginator\">\n <tb-paginator #tbPaginator [data$]=\"data\" [tableElRef]=\"tableElRef\" />\n\n <mat-icon [matTooltip]=\"(collapseFooter$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon footer\"\n (click)=\"state.toggleCollapseFooter()\">\n {{(collapseFooter$ | async) ? 'expand_more' : 'expand_less'}}\n </mat-icon>\n </div>\n }\n\n <ng-template #headerMenu>\n @if (!tableSettings.hideFilter) {<tb-filter-displayer/>}\n @if (!tableSettings.hideColumnSettings) {<tb-col-displayer/>}\n @if (!tableSettings.hideSort) {<tb-sort-menu/>}\n @if (!!tableId) {<tb-profiles-menu [$tableId]=\"tableId\" (onSaveState)=\"onSaveState.emit($event)\"/>}\n </ng-template>\n\n <ng-template #headerMenuExtra>\n <button mat-menu-item (click)=\"resetState()\">\n <mat-icon color=\"primary\">autorenew</mat-icon>\n <span>Reset table</span>\n </button>\n @if (!tableSettings.hideExport) {\n <button mat-menu-item (click)=\"exportToCsv()\">\n <mat-icon color=\"primary\">file_download</mat-icon>\n <span>Export Table</span>\n </button>\n }\n @if (tableId) {\n <button stop-propagation mat-menu-item (click)=\"pm.trigger()?.toggleMenu()\">\n <mat-icon color=\"primary\">people</mat-icon>\n <span>Profiles</span>\n </button>\n <tb-profiles-menu class=\"profiles-menu\" #pm [$tableId]=\"tableId\" (onSaveState)=\"onSaveState.emit($event)\"/>\n }\n </ng-template>\n</ng-container>\n", styles: [".header-wrapper{display:flex;flex-direction:row;justify-content:space-between;width:100%}.table-wrapper{overflow-x:auto}.flx-row-end{display:flex;flex-direction:row;justify-content:flex-end;align-items:center}.flat-menu{line-height:initial;height:initial}.pointer{cursor:pointer}.add-key{width:90%}.paginator{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;background-color:#fff;bottom:0;position:sticky;border-top:.5px solid rgba(0,0,0,.12)}.profiles-menu{visibility:hidden;width:0px;height:0px;display:block;overflow:hidden;position:absolute;top:50px}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}.paginator-row{display:flex;align-items:center}\n"], dependencies: [{ kind: "pipe", type: i1$8.AsyncPipe, name: "async" }, { kind: "directive", type: i1$8.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PaginatorComponent, selector: "tb-paginator", inputs: ["data$", "tableElRef"] }, { kind: "directive", type: i3$3.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "directive", type: MultiSortDirective, selector: "[multiSort]", inputs: ["matSortDisabled"], exportAs: ["multiSort"] }, { kind: "component", type: GroupByListComponent, selector: "group-by-list" }, { kind: "component", type: FilterChipsComponent, selector: "lib-filter-list" }, { kind: "component", type: GenFilterDisplayerComponent, selector: "tb-filter-displayer" }, { kind: "component", type: GenColDisplayerComponent, selector: "tb-col-displayer" }, { kind: "component", type: SortMenuComponent, selector: "tb-sort-menu" }, { kind: "component", type: GenericTableComponent, selector: "tb-generic-table", inputs: ["trackBy", "displayData", "data", "rows", "columnBuilders", "columnInfos"], outputs: ["selection$"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "component", type: ProfilesMenuComponent, selector: "tb-profiles-menu", inputs: ["$tableId"], outputs: ["onSaveState"] }, { kind: "ngmodule", type: i3$1.MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: i4$2.MatMenuModule }, { kind: "component", type: i4$2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$2.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: i2.MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: i4$1.MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: VirtualScrollContainer, selector: "tb-virtual-scroll-container" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5099
5269
|
}
|
|
5100
5270
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TableContainerComponent, decorators: [{
|
|
5101
5271
|
type: Component,
|
|
5102
|
-
args: [{ selector: 'tb-table-container', changeDetection: ChangeDetectionStrategy.OnPush, providers: [TableStore, ExportToCsvService, WrapperFilterStore], standalone: true, imports: containerImports, template: "<ng-content select=\"[before]\" />\n\n<ng-container multiSort *ngrxLet=\"state.tableSettings$ as tableSettings\">\n <div class=\"header-wrapper\">\n <div class=\"title\">\n @if ((!(collapseHeader$ | async)) || tableSettings.showTitleWhenHeaderCollapsed) {\n <ng-content select=\".tb-header-title\"/>\n }\n @if((state.groupByKeys$ | async)?.length){\n <group-by-list />\n }\n </div>\n <div class=\"flx-row-end\">\n <lib-filter-list />\n @if (!tableSettings.hideHeader) {\n @if (!(collapseHeader$ | async)) {\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\n <button mat-icon-button color='primary' [matMenuTriggerFor]=\"mainMenu\">\n <mat-icon>more_vert</mat-icon>\n </button>\n <mat-menu #mainMenu='matMenu'>\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\n </mat-menu>\n }\n @else {\n <mat-icon color=\"primary\" [matMenuTriggerFor]=\"mainMenu\" class=\"flat-menu-button pointer\">more_horiz</mat-icon>\n <mat-menu #mainMenu='matMenu'>\n <div class=\"flex-column\">\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\n </div>\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\n </mat-menu>\n }\n <mat-icon [matTooltip]=\"(collapseHeader$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon header\"\n (click)=\"state.toggleCollapseHeader()\">\n {{(collapseHeader$ | async) ? 'expand_less' : 'expand_more'}}\n </mat-icon>\n }\n\n </div>\n </div>\n <div class=\"table-wrapper\">\n @if($useVirtual())\n {\n <tb-virtual-scroll-container>\n <tb-generic-table [rows]='customRows' [data]=\"(data | async)!\" [displayData
|
|
5272
|
+
args: [{ selector: 'tb-table-container', changeDetection: ChangeDetectionStrategy.OnPush, providers: [TableStore, ExportToCsvService, WrapperFilterStore, DataStore], standalone: true, imports: containerImports, template: "<ng-content select=\"[before]\" />\n\n<ng-container multiSort *ngrxLet=\"state.tableSettings$ as tableSettings\">\n <div class=\"header-wrapper\">\n <div class=\"title\">\n @if ((!(collapseHeader$ | async)) || tableSettings.showTitleWhenHeaderCollapsed) {\n <ng-content select=\".tb-header-title\"/>\n }\n @if((state.groupByKeys$ | async)?.length){\n <group-by-list />\n }\n </div>\n <div class=\"flx-row-end\">\n <lib-filter-list />\n @if (!tableSettings.hideHeader) {\n @if (!(collapseHeader$ | async)) {\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\n <button mat-icon-button color='primary' [matMenuTriggerFor]=\"mainMenu\">\n <mat-icon>more_vert</mat-icon>\n </button>\n <mat-menu #mainMenu='matMenu'>\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\n </mat-menu>\n }\n @else {\n <mat-icon color=\"primary\" [matMenuTriggerFor]=\"mainMenu\" class=\"flat-menu-button pointer\">more_horiz</mat-icon>\n <mat-menu #mainMenu='matMenu'>\n <div class=\"flex-column\">\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\n </div>\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\n </mat-menu>\n }\n <mat-icon [matTooltip]=\"(collapseHeader$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon header\"\n (click)=\"state.toggleCollapseHeader()\">\n {{(collapseHeader$ | async) ? 'expand_less' : 'expand_more'}}\n </mat-icon>\n }\n\n </div>\n </div>\n <div class=\"table-wrapper\">\n @if($useVirtual())\n {\n <tb-virtual-scroll-container>\n <tb-generic-table [rows]='customRows' [data]=\"(data | async)!\" [displayData]=\"$displayData()\"\n (selection$)='selection$.emit($event)' [columnInfos]='$myColumns()' [trackBy]=\"trackBy\" />\n </tb-virtual-scroll-container>\n }\n @else\n {\n <tb-generic-table [rows]='customRows' [data]=\"(data | async)!\" [displayData]=\"$displayData()\"\n (selection$)='selection$.emit($event)' [columnInfos]='$myColumns()' [trackBy]=\"trackBy\" />\n }\n\n </div>\n @if(tableSettings.usePaginator)\n {\n <div class=\"paginator\">\n <tb-paginator #tbPaginator [data$]=\"data\" [tableElRef]=\"tableElRef\" />\n\n <mat-icon [matTooltip]=\"(collapseFooter$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon footer\"\n (click)=\"state.toggleCollapseFooter()\">\n {{(collapseFooter$ | async) ? 'expand_more' : 'expand_less'}}\n </mat-icon>\n </div>\n }\n\n <ng-template #headerMenu>\n @if (!tableSettings.hideFilter) {<tb-filter-displayer/>}\n @if (!tableSettings.hideColumnSettings) {<tb-col-displayer/>}\n @if (!tableSettings.hideSort) {<tb-sort-menu/>}\n @if (!!tableId) {<tb-profiles-menu [$tableId]=\"tableId\" (onSaveState)=\"onSaveState.emit($event)\"/>}\n </ng-template>\n\n <ng-template #headerMenuExtra>\n <button mat-menu-item (click)=\"resetState()\">\n <mat-icon color=\"primary\">autorenew</mat-icon>\n <span>Reset table</span>\n </button>\n @if (!tableSettings.hideExport) {\n <button mat-menu-item (click)=\"exportToCsv()\">\n <mat-icon color=\"primary\">file_download</mat-icon>\n <span>Export Table</span>\n </button>\n }\n @if (tableId) {\n <button stop-propagation mat-menu-item (click)=\"pm.trigger()?.toggleMenu()\">\n <mat-icon color=\"primary\">people</mat-icon>\n <span>Profiles</span>\n </button>\n <tb-profiles-menu class=\"profiles-menu\" #pm [$tableId]=\"tableId\" (onSaveState)=\"onSaveState.emit($event)\"/>\n }\n </ng-template>\n</ng-container>\n", styles: [".header-wrapper{display:flex;flex-direction:row;justify-content:space-between;width:100%}.table-wrapper{overflow-x:auto}.flx-row-end{display:flex;flex-direction:row;justify-content:flex-end;align-items:center}.flat-menu{line-height:initial;height:initial}.pointer{cursor:pointer}.add-key{width:90%}.paginator{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;background-color:#fff;bottom:0;position:sticky;border-top:.5px solid rgba(0,0,0,.12)}.profiles-menu{visibility:hidden;width:0px;height:0px;display:block;overflow:hidden;position:absolute;top:50px}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}.paginator-row{display:flex;align-items:center}\n"] }]
|
|
5103
5273
|
}], propDecorators: { paginatorComponent: [{
|
|
5104
5274
|
type: ViewChild,
|
|
5105
5275
|
args: [PaginatorComponent]
|
|
5106
5276
|
}], genericTable: [{
|
|
5107
5277
|
type: ViewChild,
|
|
5108
5278
|
args: [GenericTableComponent]
|
|
5109
|
-
}], customFilterDirectives: [{
|
|
5110
|
-
type: ContentChildren,
|
|
5111
|
-
args: [TableCustomFilterDirective, { descendants: true }]
|
|
5112
|
-
}], filterDirectives: [{
|
|
5113
|
-
type: ContentChildren,
|
|
5114
|
-
args: [TableFilterDirective, { descendants: true }]
|
|
5115
5279
|
}], customRows: [{
|
|
5116
5280
|
type: ContentChildren,
|
|
5117
5281
|
args: [MatRowDef]
|
|
5118
|
-
}], customCells: [{
|
|
5119
|
-
type: ContentChildren,
|
|
5120
|
-
args: [CustomCellDirective]
|
|
5121
5282
|
}], tableElRef: [{
|
|
5122
5283
|
type: ContentChild,
|
|
5123
5284
|
args: ['table', { read: ElementRef }]
|
|
@@ -5138,6 +5299,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
|
|
|
5138
5299
|
type: Input
|
|
5139
5300
|
}], groupHeaderTemplate: [{
|
|
5140
5301
|
type: Input
|
|
5302
|
+
}], groupHeaderHeight: [{
|
|
5303
|
+
type: Input
|
|
5141
5304
|
}], trackBy: [{
|
|
5142
5305
|
type: Input
|
|
5143
5306
|
}], inputFilters: [{
|
|
@@ -5294,7 +5457,7 @@ class TableBuilder {
|
|
|
5294
5457
|
this.settings = this.coerceSettingsToObservable(settings)
|
|
5295
5458
|
.pipe(map(sett => new GeneralTableSettings(sett)), defaultShareReplay());
|
|
5296
5459
|
this.data$ = this.coerceToObservable(data, this.settings)
|
|
5297
|
-
.pipe(defaultShareReplay());
|
|
5460
|
+
.pipe(notNull(), defaultShareReplay());
|
|
5298
5461
|
this.metaData$ = metaData ?
|
|
5299
5462
|
this.coerceToObservable(metaData, this.settings).pipe(defaultShareReplay())
|
|
5300
5463
|
:
|
|
@@ -5529,5 +5692,5 @@ function provideActionableSelector() {
|
|
|
5529
5692
|
* Generated bundle index. Do not edit.
|
|
5530
5693
|
*/
|
|
5531
5694
|
|
|
5532
|
-
export { ActionStateSpinnerComponent, ActionStateUiModule, ActionStatus, AppStatusState, ArrayStyle, AutoFocusDirective, CancellationToken, ClickEmitterDirective, ClickSubjectDirective, ConditionalClassesDirective, CreateTableBuilder, CustomCellDirective, DateFilterComponent, DialogDirective, DialogService, DialogWrapper, FieldType, FilterChipsComponent, FilterComponent, FunctionPipe, GenColDisplayerComponent, GenFilterDisplayerComponent, GeneralTableSettings, GenericTableComponent, GroupByListComponent, HttpErrorStateDirective, HttpInProgressStateDirective, HttpNotStartedStateDirective, HttpRequestModule, HttpRequestStateDirective, HttpRequestStateFactory, HttpRequestStateStore, HttpRequestStatus, HttpRequestStrategy, HttpSuccessStateDirective, MatButtonToggleFilterDirective, MatCheckboxTbFilterDirective, MatOptionTbFilterDirective, MatRadioButtonTbFilterDirective, MatSlideToggleGroupDirective, MatSlideToggleTbFilterDirective, MatTableObservableDataSource, MultiSortDirective, NgrxExtModule, NotPersistedTableSettings, PaginatorComponent, PersistedTableSettings, PhoneNumberPipe, PreventEnterDirective, ResizeColumnDirective, SortDirection, SpaceCasePipe, StopPropagationDirective, StylerDirective, Subjectifier, Subscriber, TableBuilder, TableBuilderConfigToken, TableBuilderModule, TableColumnHeaderSettings, TableContainerComponent, TableCustomFilterDirective, TableCustomFilterDirectiveBase, TableFilterDirective, TableFilterStringContainsDirective, TableSettings, TableWrapperDirective, TableWrapperFooterSettings, TableWrapperHeaderSettings, Target, TbSelectedFilterDirective, TrimWhitespaceDirective, UtilitiesModule, VirtualScrollOptions, actionStatusReducer, chainRequest, clearActionableSelectorRequestCache, combineArrays, createActionableSelector, createFailure, createRequestor, createSuccess, defaultFilter, defaultShareReplay, delayOn, filterArray, getRequestorBody, getRequestorStatus, getStatusState, httpRequest, httpRequestor, inProgress, initialState, isDifferent, isErrorState, isSuccessOrErrorState, isSuccessState, mapArray, mapError, metaDataArrToDict, notNull, notStarted, onWait, onceWhen, previousAndCurrent, provideActionableSelector, provideTableBuilder, selectAll, selectEntities, selectEntity, selectIds, selectTotal, serverStatusTypes, setUpStoreFactory, skipOneWhen, spaceCase, startWithIfEmpty, statusAdapter, statusIsSuccessOrInProgress, subscriber, switchOff, tapError, tapSuccess };
|
|
5695
|
+
export { ActionStateSpinnerComponent, ActionStateUiModule, ActionStatus, AppStatusState, ArrayStyle, AutoFocusDirective, CancellationToken, ClickEmitterDirective, ClickSubjectDirective, ConditionalClassesDirective, CreateTableBuilder, CustomCellDirective, DateFilterComponent, DefaultVirtualScrollOptions, DialogDirective, DialogService, DialogWrapper, FieldType, FilterChipsComponent, FilterComponent, FilterTypes, FunctionPipe, GenColDisplayerComponent, GenFilterDisplayerComponent, GeneralTableSettings, GenericTableComponent, GroupByListComponent, HttpErrorStateDirective, HttpInProgressStateDirective, HttpNotStartedStateDirective, HttpRequestModule, HttpRequestStateDirective, HttpRequestStateFactory, HttpRequestStateStore, HttpRequestStatus, HttpRequestStrategy, HttpSuccessStateDirective, MatButtonToggleFilterDirective, MatCheckboxTbFilterDirective, MatOptionTbFilterDirective, MatRadioButtonTbFilterDirective, MatSlideToggleGroupDirective, MatSlideToggleTbFilterDirective, MatTableObservableDataSource, MultiSortDirective, NgrxExtModule, NotPersistedTableSettings, PaginatorComponent, PersistedTableSettings, PhoneNumberPipe, PreventEnterDirective, ResizeColumnDirective, SortDirection, SpaceCasePipe, StopPropagationDirective, StylerDirective, Subjectifier, Subscriber, TableBuilder, TableBuilderConfigToken, TableBuilderModule, TableColumnHeaderSettings, TableContainerComponent, TableCustomFilterDirective, TableCustomFilterDirectiveBase, TableFilterDirective, TableFilterStringContainsDirective, TableSettings, TableWrapperDirective, TableWrapperFooterSettings, TableWrapperHeaderSettings, Target, TbSelectedFilterDirective, TrimWhitespaceDirective, UtilitiesModule, VirtualScrollOptions, actionStatusReducer, chainRequest, clearActionableSelectorRequestCache, combineArrays, createActionableSelector, createFailure, createRequestor, createSuccess, defaultFilter, defaultShareReplay, delayOn, filterArray, getRequestorBody, getRequestorStatus, getStatusState, httpRequest, httpRequestor, inProgress, initialState, isDifferent, isErrorState, isSuccessOrErrorState, isSuccessState, mapArray, mapError, metaDataArrToDict, notNull, notStarted, onWait, onceWhen, previousAndCurrent, provideActionableSelector, provideTableBuilder, selectAll, selectEntities, selectEntity, selectIds, selectTotal, serverStatusTypes, setUpStoreFactory, skipOneWhen, spaceCase, startWithIfEmpty, statusAdapter, statusIsSuccessOrInProgress, subscriber, switchOff, tapError, tapSuccess, wrapInArr };
|
|
5533
5696
|
//# sourceMappingURL=one-paragon-angular-utilities.mjs.map
|