@one-paragon/angular-utilities 0.3.6 → 0.3.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/http-request-state/directives/http-success-state-directive.mjs +1 -1
- package/esm2022/rxjs/rxjs-operators.mjs +7 -6
- package/esm2022/table-builder/classes/TableState.mjs +2 -3
- package/esm2022/table-builder/classes/filter-info.mjs +1 -1
- package/esm2022/table-builder/classes/table-builder.mjs +8 -3
- package/esm2022/table-builder/classes/table-store.mjs +40 -21
- package/esm2022/table-builder/components/array-column.component.mjs +18 -9
- package/esm2022/table-builder/components/column-builder/column-builder.component.mjs +12 -5
- package/esm2022/table-builder/components/generic-table/generic-table.component.mjs +45 -56
- package/esm2022/table-builder/components/generic-table/paginator.component.mjs +1 -1
- package/esm2022/table-builder/components/initialization-component/initialization-component.mjs +1 -1
- package/esm2022/table-builder/components/sort-menu/sort-menu.component-store.mjs +3 -3
- package/esm2022/table-builder/components/table-container/table-container-imports.mjs +2 -2
- package/esm2022/table-builder/components/table-container/table-container.helpers/data-state.helpers.mjs +2 -0
- package/esm2022/table-builder/components/table-container/table-container.helpers/filter-state.helpers.mjs +62 -0
- package/esm2022/table-builder/components/table-container/table-container.helpers/groupBy.helpers.mjs +56 -0
- package/esm2022/table-builder/components/table-container/table-container.helpers/sort-state.helpers.mjs +36 -0
- package/esm2022/table-builder/components/table-container/table-container.mjs +76 -114
- package/esm2022/table-builder/components/table-container-filter/filter-list/filter-list.component.mjs +2 -2
- package/esm2022/table-builder/directives/multi-sort.directive.mjs +12 -17
- package/esm2022/table-builder/directives/table-wrapper.directive.mjs +4 -11
- package/esm2022/table-builder/directives/tb-filter.directive.mjs +2 -2
- package/esm2022/table-builder/functions/sort-data-function.mjs +14 -2
- package/esm2022/table-builder/interfaces/report-def.mjs +1 -1
- package/esm2022/table-builder/pipes/column-total.pipe.mjs +2 -2
- package/esm2022/table-builder/services/transform-creator.mjs +7 -4
- package/esm2022/utilities/array-helpers.mjs +14 -0
- package/esm2022/utilities/directives/conditional-classes.directive.mjs +1 -1
- package/esm2022/utilities/directives/styler.mjs +25 -10
- package/fesm2022/one-paragon-angular-utilities.mjs +552 -416
- package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -1
- package/http-request-state/directives/http-success-state-directive.d.ts +4 -4
- package/package.json +5 -5
- package/rxjs/rxjs-operators.d.ts +3 -2
- package/table-builder/classes/TableState.d.ts +5 -2
- package/table-builder/classes/filter-info.d.ts +1 -1
- package/table-builder/classes/table-store.d.ts +16 -6
- package/table-builder/components/array-column.component.d.ts +4 -4
- package/table-builder/components/column-builder/column-builder.component.d.ts +7 -3
- package/table-builder/components/generic-table/generic-table.component.d.ts +11 -13
- package/table-builder/components/generic-table/paginator.component.d.ts +2 -2
- package/table-builder/components/table-container/table-container-imports.d.ts +2 -2
- package/table-builder/components/table-container/table-container.d.ts +8 -11
- package/table-builder/components/table-container/table-container.helpers/data-state.helpers.d.ts +5 -0
- package/table-builder/components/table-container/table-container.helpers/filter-state.helpers.d.ts +15 -0
- package/table-builder/components/table-container/table-container.helpers/groupBy.helpers.d.ts +15 -0
- package/table-builder/components/table-container/table-container.helpers/sort-state.helpers.d.ts +9 -0
- package/table-builder/directives/multi-sort.directive.d.ts +1 -1
- package/table-builder/directives/table-wrapper.directive.d.ts +1 -4
- package/table-builder/functions/sort-data-function.d.ts +3 -0
- package/table-builder/interfaces/report-def.d.ts +9 -8
- package/table-builder/services/transform-creator.d.ts +1 -1
- package/utilities/array-helpers.d.ts +1 -0
- package/utilities/directives/styler.d.ts +11 -4
- package/esm2022/table-builder/classes/GenericTableDataSource.mjs +0 -11
- package/esm2022/table-builder/classes/data-filter.mjs +0 -26
- package/table-builder/classes/GenericTableDataSource.d.ts +0 -5
- package/table-builder/classes/data-filter.d.ts +0 -9
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, NgModule, Injectable, Pipe, Optional,
|
|
3
|
-
import { shareReplay, map, switchAll, filter, tap, catchError, startWith, switchMap, mergeMap, concatMap, takeUntil, last, distinctUntilKeyChanged, delay as delay$1, distinct,
|
|
2
|
+
import { Directive, Input, NgModule, Injectable, Pipe, Optional, InjectionToken, makeEnvironmentProviders, Inject, HostListener, Component, ChangeDetectionStrategy, EventEmitter, Output, ContentChildren, inject, ViewChild, Injector, ElementRef, APP_INITIALIZER } from '@angular/core';
|
|
3
|
+
import { shareReplay, map, switchAll, filter, tap, catchError, startWith, switchMap, mergeMap, concatMap, takeUntil, distinctUntilChanged, last, distinctUntilKeyChanged, delay as delay$1, distinct, first as first$1, mergeAll, scan as scan$1, timestamp as timestamp$1, withLatestFrom } from 'rxjs/operators';
|
|
4
4
|
import * as i3$1 from 'rxjs';
|
|
5
|
-
import { isObservable, Subject, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, delay, merge as merge$1, concatMap as concatMap$1, fromEvent, tap as tap$1, BehaviorSubject, takeUntil as takeUntil$1, switchMap as switchMap$1, scan, asyncScheduler, from } from 'rxjs';
|
|
5
|
+
import { isObservable, Subject, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, delay, merge as merge$1, concatMap as concatMap$1, fromEvent, tap as tap$1, BehaviorSubject, takeUntil as takeUntil$1, switchMap as switchMap$1, scan, asyncScheduler, timestamp, from } from 'rxjs';
|
|
6
6
|
import { ComponentStore } from '@ngrx/component-store';
|
|
7
7
|
import * as i1$3 from '@angular/common';
|
|
8
8
|
import { DatePipe, CurrencyPipe, AsyncPipe, KeyValuePipe, NgTemplateOutlet, NgClass, DecimalPipe, CommonModule } from '@angular/common';
|
|
9
9
|
import * as i1$4 from '@angular/material/sort';
|
|
10
10
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
11
11
|
import { v4 } from 'uuid';
|
|
12
|
-
import { merge,
|
|
12
|
+
import { merge, get, sumBy, difference, orderBy, intersection, groupBy, cloneDeep, set } from 'lodash';
|
|
13
13
|
import * as i1 from '@angular/cdk/table';
|
|
14
14
|
import * as i3 from '@angular/forms';
|
|
15
15
|
import { FormsModule, ControlContainer, NgForm, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
@@ -22,8 +22,7 @@ import { MatRadioModule } from '@angular/material/radio';
|
|
|
22
22
|
import * as i7 from '@angular/material/core';
|
|
23
23
|
import { MatNativeDateModule } from '@angular/material/core';
|
|
24
24
|
import * as i8 from '@angular/material/button-toggle';
|
|
25
|
-
import
|
|
26
|
-
import * as i6$1 from '@angular/cdk/drag-drop';
|
|
25
|
+
import * as i5$2 from '@angular/cdk/drag-drop';
|
|
27
26
|
import { moveItemInArray, DragDropModule, CDK_DROP_LIST, CdkDropList, transferArrayItem } from '@angular/cdk/drag-drop';
|
|
28
27
|
import * as i2$1 from '@angular/router';
|
|
29
28
|
import { RouterModule } from '@angular/router';
|
|
@@ -50,7 +49,7 @@ import * as i2$3 from '@ngrx/component';
|
|
|
50
49
|
import { LetDirective } from '@ngrx/component';
|
|
51
50
|
import * as i4$3 from '@angular/material/chips';
|
|
52
51
|
import { MatChipsModule } from '@angular/material/chips';
|
|
53
|
-
import * as
|
|
52
|
+
import * as i4$4 from '@angular/material/table';
|
|
54
53
|
import { MatColumnDef, MatTableModule, MatTableDataSource, MatTable, MatRowDef } from '@angular/material/table';
|
|
55
54
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
56
55
|
import * as i2$2 from '@angular/material/paginator';
|
|
@@ -658,8 +657,7 @@ const defaultTableState = {
|
|
|
658
657
|
notPersistedTableSettings: new NotPersistedTableSettings(),
|
|
659
658
|
pageSize: 10,
|
|
660
659
|
linkMaps: {},
|
|
661
|
-
|
|
662
|
-
groups: []
|
|
660
|
+
groupBy: [],
|
|
663
661
|
};
|
|
664
662
|
|
|
665
663
|
// here is how to use it
|
|
@@ -723,7 +721,8 @@ const onceWhen = (predicate) => (src) => {
|
|
|
723
721
|
};
|
|
724
722
|
const mapArray = (mapFunc) => (source) => source.pipe(map$1(src => src.map(mapFunc)));
|
|
725
723
|
const filterArray = (filterFunc) => (source) => source.pipe(map$1(src => src.filter(filterFunc)));
|
|
726
|
-
|
|
724
|
+
const onWait = startWithIfEmpty;
|
|
725
|
+
function startWithIfEmpty(val, wait = 0) {
|
|
727
726
|
return (source) => {
|
|
728
727
|
return new Observable(subscriber => {
|
|
729
728
|
let emitted = false;
|
|
@@ -731,17 +730,18 @@ function onWait(val) {
|
|
|
731
730
|
if (!emitted) {
|
|
732
731
|
subscriber.next(val);
|
|
733
732
|
}
|
|
734
|
-
},
|
|
735
|
-
source.subscribe({
|
|
733
|
+
}, wait);
|
|
734
|
+
const sub = source.subscribe({
|
|
736
735
|
next(x) { emitted = true; subscriber.next(x); },
|
|
737
736
|
error(err) { emitted = true; subscriber.error(err); },
|
|
738
737
|
complete() { emitted = true; subscriber.complete(); }
|
|
739
738
|
});
|
|
739
|
+
return () => sub.unsubscribe();
|
|
740
740
|
});
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
743
|
const combineArrays = (sources) => {
|
|
744
|
-
return combineLatest(sources.map(src => src.pipe(
|
|
744
|
+
return combineLatest(sources.map(src => src.pipe(startWithIfEmpty([])))).pipe(map$1(res => res.flat()));
|
|
745
745
|
};
|
|
746
746
|
function switchOff(switchSource, defaultState = true) {
|
|
747
747
|
return (source) => {
|
|
@@ -902,6 +902,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
902
902
|
type: Input
|
|
903
903
|
}] } });
|
|
904
904
|
|
|
905
|
+
class TableWrapperDirective {
|
|
906
|
+
constructor() {
|
|
907
|
+
this.registrations = [];
|
|
908
|
+
}
|
|
909
|
+
register(filter) {
|
|
910
|
+
this.registrations.push(filter);
|
|
911
|
+
}
|
|
912
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableWrapperDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
913
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.3", type: TableWrapperDirective, isStandalone: true, selector: "[tbWrapper]", ngImport: i0 }); }
|
|
914
|
+
}
|
|
915
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableWrapperDirective, decorators: [{
|
|
916
|
+
type: Directive,
|
|
917
|
+
args: [{
|
|
918
|
+
selector: '[tbWrapper]',
|
|
919
|
+
standalone: true,
|
|
920
|
+
}]
|
|
921
|
+
}] });
|
|
922
|
+
|
|
905
923
|
var FilterType;
|
|
906
924
|
(function (FilterType) {
|
|
907
925
|
FilterType["NumberEquals"] = "Equals";
|
|
@@ -1053,7 +1071,7 @@ class TableFilterDirective extends ComponentStore {
|
|
|
1053
1071
|
fieldType: this.fieldType,
|
|
1054
1072
|
filterValue: this.filterValue,
|
|
1055
1073
|
active: this.active && this.filterValue !== undefined,
|
|
1056
|
-
|
|
1074
|
+
_isExternallyManaged: true,
|
|
1057
1075
|
});
|
|
1058
1076
|
}
|
|
1059
1077
|
}
|
|
@@ -1369,30 +1387,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1369
1387
|
type: Optional
|
|
1370
1388
|
}] }] });
|
|
1371
1389
|
|
|
1372
|
-
class TableWrapperDirective {
|
|
1373
|
-
constructor() {
|
|
1374
|
-
this.registrations = [];
|
|
1375
|
-
}
|
|
1376
|
-
register(filter) {
|
|
1377
|
-
this.registrations.push(filter);
|
|
1378
|
-
}
|
|
1379
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableWrapperDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1380
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.3", type: TableWrapperDirective, isStandalone: true, selector: "[tbWrapper]", queries: [{ propertyName: "customFilters", predicate: TableCustomFilterDirective, descendants: true }, { propertyName: "filters", predicate: TableFilterDirective, descendants: true }], ngImport: i0 }); }
|
|
1381
|
-
}
|
|
1382
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableWrapperDirective, decorators: [{
|
|
1383
|
-
type: Directive,
|
|
1384
|
-
args: [{
|
|
1385
|
-
selector: '[tbWrapper]',
|
|
1386
|
-
standalone: true,
|
|
1387
|
-
}]
|
|
1388
|
-
}], propDecorators: { customFilters: [{
|
|
1389
|
-
type: ContentChildren,
|
|
1390
|
-
args: [TableCustomFilterDirective, { descendants: true }]
|
|
1391
|
-
}], filters: [{
|
|
1392
|
-
type: ContentChildren,
|
|
1393
|
-
args: [TableFilterDirective, { descendants: true }]
|
|
1394
|
-
}] } });
|
|
1395
|
-
|
|
1396
1390
|
class PhoneNumberPipe {
|
|
1397
1391
|
transform(phoneNum) {
|
|
1398
1392
|
if (phoneNum) {
|
|
@@ -1629,12 +1623,27 @@ function createFilterFunc(filter) {
|
|
|
1629
1623
|
}
|
|
1630
1624
|
const FalseyValueCanBeIncludedFilterTypes = [FilterType.IsNull, FilterType.NumberNotEqual, FilterType.DateIsNotOn, FilterType.StringDoesNotContain];
|
|
1631
1625
|
|
|
1626
|
+
const replaceInArrayWithClone = (arr, findMeth, actionOnClone = ((t) => { })) => {
|
|
1627
|
+
const index = arr.findIndex(findMeth);
|
|
1628
|
+
const clonedArray = [...arr];
|
|
1629
|
+
const t = clonedArray[index];
|
|
1630
|
+
clonedArray[index] =
|
|
1631
|
+
t != null && typeof t === 'object' ?
|
|
1632
|
+
Array.isArray(t) ?
|
|
1633
|
+
[...t]
|
|
1634
|
+
: { ...t }
|
|
1635
|
+
: t;
|
|
1636
|
+
actionOnClone(clonedArray[index]);
|
|
1637
|
+
return clonedArray;
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1632
1640
|
function stateIs(initializationState) {
|
|
1633
1641
|
return (state) => state.initializationState === initializationState;
|
|
1634
1642
|
}
|
|
1635
1643
|
class TableStore extends ComponentStore {
|
|
1636
1644
|
constructor(config) {
|
|
1637
1645
|
super({ ...defaultTableState, ...config.defaultTableState });
|
|
1646
|
+
this.selectStateReady = this.select(state => state.initializationState).pipe(filter(i => i === InitializationState.Ready));
|
|
1638
1647
|
this.on = (srcObservable, func) => {
|
|
1639
1648
|
this.effect(() => srcObservable.pipe(tap(func)));
|
|
1640
1649
|
return this;
|
|
@@ -1655,16 +1664,11 @@ class TableStore extends ComponentStore {
|
|
|
1655
1664
|
hiddenKeys: [...state.hiddenKeys.filter(k => k !== key), key],
|
|
1656
1665
|
}));
|
|
1657
1666
|
this.resetState = this.updater((state) => {
|
|
1658
|
-
const
|
|
1667
|
+
const hiddenKeys = Object.values(state.metaData)
|
|
1659
1668
|
.filter(md => md.fieldType === FieldType.Hidden)
|
|
1660
1669
|
.map(md => md.key);
|
|
1661
1670
|
const sorted = this.createPreSort(state.metaData);
|
|
1662
|
-
return
|
|
1663
|
-
hiddenKeys: { $set: [...hiddenColumns] },
|
|
1664
|
-
filters: { $set: {} },
|
|
1665
|
-
sorted: { $set: sorted },
|
|
1666
|
-
userDefined: { $set: { widths: {}, order: {}, table: {} } },
|
|
1667
|
-
});
|
|
1671
|
+
return ({ ...state, hiddenKeys, sorted, filters: {}, groupBy: [], userDefined: { widths: {}, order: {}, table: {} } });
|
|
1668
1672
|
});
|
|
1669
1673
|
this.showColumn = this.updater((state, key) => ({
|
|
1670
1674
|
...state,
|
|
@@ -1675,7 +1679,7 @@ class TableStore extends ComponentStore {
|
|
|
1675
1679
|
...displayCols.filter(col => !col.visible).map(col => col.key),
|
|
1676
1680
|
...Object.values(state.metaData).filter(md => md.fieldType === FieldType.Hidden).map(md => md.key)
|
|
1677
1681
|
]);
|
|
1678
|
-
return
|
|
1682
|
+
return ({ ...state, hiddenKeys: [...hiddenKeysSet] });
|
|
1679
1683
|
});
|
|
1680
1684
|
this.setUserDefinedWidth = this.updater((state, colWidths) => {
|
|
1681
1685
|
const userDefinedWidths = { ...state.userDefined.widths };
|
|
@@ -1727,10 +1731,19 @@ class TableStore extends ComponentStore {
|
|
|
1727
1731
|
filters: { ...state.filters, ...filtersObj }
|
|
1728
1732
|
};
|
|
1729
1733
|
};
|
|
1730
|
-
this.removeFilter = this.updater((state, filterId) =>
|
|
1731
|
-
|
|
1734
|
+
this.removeFilter = this.updater((state, filterId) => {
|
|
1735
|
+
const filtersCopy = { ...state.filters };
|
|
1736
|
+
delete filtersCopy[filterId];
|
|
1737
|
+
return ({ ...state, filters: filtersCopy });
|
|
1738
|
+
});
|
|
1739
|
+
this.removeFilters = this.updater((state, filterIds) => {
|
|
1740
|
+
const filtersCopy = { ...state.filters };
|
|
1741
|
+
filterIds.forEach(id => { delete filtersCopy[id]; });
|
|
1742
|
+
return ({ ...state, filters: filtersCopy });
|
|
1743
|
+
});
|
|
1732
1744
|
this.clearFilters = this.updater((state) => ({ ...state, filters: {} }));
|
|
1733
|
-
this.
|
|
1745
|
+
this.selectSorted = this.select(state => state.sorted).pipe(distinctUntilChanged((f, s) => !isDifferent(f, s)));
|
|
1746
|
+
this.sort$ = this.select(this.selectStateReady, this.selectSorted, (_, s) => s);
|
|
1734
1747
|
this.createPreSort = (metaDatas) => {
|
|
1735
1748
|
return Object.values(metaDatas).filter((metaData) => !!metaData.preSort)
|
|
1736
1749
|
.sort(({ preSort: ps1 }, { preSort: ps2 }) => (ps1.precedence || Number.MAX_VALUE) - (ps2.precedence || Number.MAX_VALUE))
|
|
@@ -1832,18 +1845,28 @@ class TableStore extends ComponentStore {
|
|
|
1832
1845
|
});
|
|
1833
1846
|
this.addGroupByKey = this.updater((state, groupByKey) => ({
|
|
1834
1847
|
...state,
|
|
1835
|
-
|
|
1848
|
+
groupBy: [...state.groupBy, { key: groupByKey, expandedHeaders: [] }]
|
|
1836
1849
|
}));
|
|
1837
1850
|
this.removeGroupByKey = this.updater((state, groupByKey) => ({
|
|
1838
1851
|
...state,
|
|
1839
|
-
|
|
1852
|
+
groupBy: state.groupBy.filter(key => groupByKey !== key.key)
|
|
1840
1853
|
}));
|
|
1841
|
-
this.
|
|
1842
|
-
|
|
1843
|
-
|
|
1854
|
+
this.updateExpandedGroups = this.updater((state, data) => {
|
|
1855
|
+
const gbk = replaceInArrayWithClone(state.groupBy, k => k.key === data.key, gk => {
|
|
1856
|
+
gk.expandedHeaders = data.isExpanded ? [...gk.expandedHeaders, data.groupKey] : gk.expandedHeaders.filter(g => g !== data.groupKey);
|
|
1857
|
+
});
|
|
1858
|
+
return ({
|
|
1859
|
+
...state,
|
|
1860
|
+
groupBy: gbk
|
|
1861
|
+
});
|
|
1862
|
+
});
|
|
1863
|
+
this.groupByKeys$ = this.select(state => state.groupBy.map(gbk => gbk.key))
|
|
1864
|
+
.pipe(distinctUntilChanged((prev, curr) => prev.length === curr.length && curr.every((k, i) => prev[i] === k)));
|
|
1865
|
+
this.expandedGroups$ = this.select(state => state.groupBy).pipe(distinctUntilChanged((a, b) => {
|
|
1866
|
+
const aa = a.flatMap(g => g.expandedHeaders);
|
|
1867
|
+
const bb = b.flatMap(g => g.expandedHeaders);
|
|
1868
|
+
return aa.length === bb.length && aa.every((k) => bb.includes(k));
|
|
1844
1869
|
}));
|
|
1845
|
-
this.groupByKeys$ = this.select(state => state.groupByKeys);
|
|
1846
|
-
this.groups$ = this.select(state => state.groups);
|
|
1847
1870
|
this.setTableSettings = this.updater((state, settings) => {
|
|
1848
1871
|
const s = {
|
|
1849
1872
|
...state,
|
|
@@ -1864,6 +1887,9 @@ class TableStore extends ComponentStore {
|
|
|
1864
1887
|
return state.linkMaps[md.key];
|
|
1865
1888
|
});
|
|
1866
1889
|
};
|
|
1890
|
+
this.getIsExpanded = (columnKey, groupHeaderKey) => {
|
|
1891
|
+
return this.select(state => !!state.groupBy.filter(g => g.key === columnKey && g.expandedHeaders.includes(groupHeaderKey)).length);
|
|
1892
|
+
};
|
|
1867
1893
|
}
|
|
1868
1894
|
getSavableState() {
|
|
1869
1895
|
return this.state$.pipe(map(s => {
|
|
@@ -1915,20 +1941,15 @@ class MultiSortDirective extends MatSort {
|
|
|
1915
1941
|
constructor(state) {
|
|
1916
1942
|
super();
|
|
1917
1943
|
this.state = state;
|
|
1918
|
-
this.
|
|
1919
|
-
this.state.
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
this.
|
|
1923
|
-
if (
|
|
1924
|
-
this.active =
|
|
1925
|
-
this.direction =
|
|
1926
|
-
this.sortChange.emit(
|
|
1927
|
-
}
|
|
1928
|
-
else if (!!rules.length && isDifferent(oldRules, rules)) {
|
|
1929
|
-
this.active = rules[0].active;
|
|
1930
|
-
this.direction = rules[0].direction;
|
|
1931
|
-
this.sortChange.emit(rules[0]);
|
|
1944
|
+
this.state.setSort(this.sortChange.pipe(distinctUntilChanged((f, s) => f.active === s.active && f.direction === s.direction), map(sc => ({ key: sc.active, direction: sc.direction }))));
|
|
1945
|
+
this.state.on(this.state.sort$, (rules) => {
|
|
1946
|
+
const topRule = { active: rules[0]?.active || '', direction: rules[0]?.direction || '' };
|
|
1947
|
+
const topActiveChanged = topRule.active !== this.active || '';
|
|
1948
|
+
const topDirectionChanged = topRule.direction !== this.direction || '';
|
|
1949
|
+
if (topActiveChanged || topDirectionChanged) {
|
|
1950
|
+
this.active = topRule.active;
|
|
1951
|
+
this.direction = topRule.direction;
|
|
1952
|
+
this.sortChange.emit(topRule);
|
|
1932
1953
|
}
|
|
1933
1954
|
});
|
|
1934
1955
|
}
|
|
@@ -2227,18 +2248,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
2227
2248
|
|
|
2228
2249
|
class StylerDirective {
|
|
2229
2250
|
set styler(styles) {
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2251
|
+
const toApply = Object.entries(styles ?? {}).reduce((acc, [key, val]) => {
|
|
2252
|
+
if (typeof (val) === 'string') {
|
|
2253
|
+
acc[key] = val;
|
|
2254
|
+
this.el.nativeElement.style[key] = val;
|
|
2255
|
+
}
|
|
2256
|
+
else if (val?.condition === true || val?.condition(this.element)) {
|
|
2257
|
+
const value = typeof (val.value) === 'string' ? val.value : val?.value(this.element);
|
|
2258
|
+
acc[key] = value;
|
|
2259
|
+
this.el.nativeElement.style[key] = value;
|
|
2260
|
+
}
|
|
2261
|
+
return acc;
|
|
2262
|
+
}, {});
|
|
2263
|
+
Object.keys(this.stylesApplied).filter(key => !Object.keys(toApply).includes(key)).forEach(key => {
|
|
2264
|
+
this.renderer.removeStyle(this.el.nativeElement, key);
|
|
2265
|
+
});
|
|
2266
|
+
this.stylesApplied = toApply;
|
|
2235
2267
|
}
|
|
2236
2268
|
;
|
|
2237
|
-
constructor(el) {
|
|
2269
|
+
constructor(el, renderer) {
|
|
2238
2270
|
this.el = el;
|
|
2271
|
+
this.renderer = renderer;
|
|
2272
|
+
this.stylesApplied = {};
|
|
2239
2273
|
}
|
|
2240
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: StylerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2241
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.3", type: StylerDirective, isStandalone: true, selector: "[styler]", inputs: { styler: "styler" }, ngImport: i0 }); }
|
|
2274
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: StylerDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2275
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.3", type: StylerDirective, isStandalone: true, selector: "[styler]", inputs: { element: "element", styler: "styler" }, ngImport: i0 }); }
|
|
2242
2276
|
}
|
|
2243
2277
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: StylerDirective, decorators: [{
|
|
2244
2278
|
type: Directive,
|
|
@@ -2246,7 +2280,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
2246
2280
|
selector: '[styler]',
|
|
2247
2281
|
standalone: true
|
|
2248
2282
|
}]
|
|
2249
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: {
|
|
2283
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { element: [{
|
|
2284
|
+
type: Input
|
|
2285
|
+
}], styler: [{
|
|
2250
2286
|
type: Input
|
|
2251
2287
|
}] } });
|
|
2252
2288
|
|
|
@@ -2726,7 +2762,7 @@ class GenColDisplayerComponent {
|
|
|
2726
2762
|
this.tableState.setHiddenColumns(displayCols.map(c => ({ key: c.key, visible: c.isVisible })));
|
|
2727
2763
|
}
|
|
2728
2764
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: GenColDisplayerComponent, deps: [{ token: TableStore }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2729
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: GenColDisplayerComponent, isStandalone: true, selector: "tb-col-displayer", ngImport: i0, template: "@if(columns$ | async; as displayCols){\r\n <span matTooltip=\"Show/hide columns\">\r\n <button mat-icon-button [matMenuTriggerFor]=\"menu\">\r\n <mat-icon color=\"primary\">visibility_off</mat-icon>\r\n </button>\r\n </span>\r\n <mat-menu #menu=\"matMenu\" class=\"my-mat-menu\">\r\n\r\n <button mat-menu-item>\r\n <span matTooltip=\"Close\">\r\n <button class=\"filter-button\" mat-icon-button>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </span>\r\n </button>\r\n\r\n <button mat-menu-item stop-propagation>\r\n <span matTooltip=\"Show all columns\">\r\n <button mat-icon-button (click)=\"reset(displayCols)\">\r\n <mat-icon color=\"primary\">done_all</mat-icon>\r\n </button>\r\n </span>\r\n\r\n <span matTooltip=\"Hide all columns\">\r\n <button mat-icon-button (click)=\"unset(displayCols)\">\r\n <mat-icon color=\"primary\">cancel</mat-icon>\r\n </button>\r\n </span>\r\n </button>\r\n\r\n <div cdkDropList (cdkDropListDropped)=\"drop($event)\" stop-propagation [cdkDropListLockAxis]=\"'y'\">\r\n @for (col of displayCols; track col.key) {\r\n <button [class.isHidden]=\"!col.isVisible\" stop-propagation mat-menu-item cdkDrag [cdkDragData]=\"col\">\r\n <div (click)=\"col.isVisible = !col.isVisible; emit(displayCols)\" style=\"display: flex; align-items: center;\">\r\n @if(col.isVisible){\r\n <button mat-icon-button matTooltip=\"Hide Column\" class=\"show-hide\">\r\n <mat-icon color=\"primary\">check_box</mat-icon>\r\n </button>\r\n } @else {\r\n <button mat-icon-button matTooltip=\"Show Column\" class=\"show-hide\">\r\n <mat-icon>indeterminate_check_box</mat-icon>\r\n </button>\r\n }\r\n \r\n <p class=\"label\">\r\n {{col.displayName || (col.key | spaceCase) }}\r\n </p>\r\n\r\n </div>\r\n </button>\r\n }\r\n\r\n </div>\r\n </mat-menu>\r\n}", styles: [".show-hide{margin-right:15px;height:24px;width:24px;padding:4px}.label{color:#6495ed;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;text-align:left;margin:0;font-size:17px;font-weight:700;display:inline-block;width:66%}.row{margin:0;padding:0}.isHidden{background-color:#d3d3d3;color:#a9a9a9;font-weight:700;font-size:17px;white-space:nowrap}.filter-button{margin-top:10px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.mdc-list-item__primary-text{display:inline-block;width:100%}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i14.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: i14.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i14.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type:
|
|
2765
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: GenColDisplayerComponent, isStandalone: true, selector: "tb-col-displayer", ngImport: i0, template: "@if(columns$ | async; as displayCols){\r\n <span matTooltip=\"Show/hide columns\">\r\n <button mat-icon-button [matMenuTriggerFor]=\"menu\">\r\n <mat-icon color=\"primary\">visibility_off</mat-icon>\r\n </button>\r\n </span>\r\n <mat-menu #menu=\"matMenu\" class=\"my-mat-menu\">\r\n\r\n <button mat-menu-item>\r\n <span matTooltip=\"Close\">\r\n <button class=\"filter-button\" mat-icon-button>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </span>\r\n </button>\r\n\r\n <button mat-menu-item stop-propagation>\r\n <span matTooltip=\"Show all columns\">\r\n <button mat-icon-button (click)=\"reset(displayCols)\">\r\n <mat-icon color=\"primary\">done_all</mat-icon>\r\n </button>\r\n </span>\r\n\r\n <span matTooltip=\"Hide all columns\">\r\n <button mat-icon-button (click)=\"unset(displayCols)\">\r\n <mat-icon color=\"primary\">cancel</mat-icon>\r\n </button>\r\n </span>\r\n </button>\r\n\r\n <div cdkDropList (cdkDropListDropped)=\"drop($event)\" stop-propagation [cdkDropListLockAxis]=\"'y'\">\r\n @for (col of displayCols; track col.key) {\r\n <button [class.isHidden]=\"!col.isVisible\" stop-propagation mat-menu-item cdkDrag [cdkDragData]=\"col\">\r\n <div (click)=\"col.isVisible = !col.isVisible; emit(displayCols)\" style=\"display: flex; align-items: center;\">\r\n @if(col.isVisible){\r\n <button mat-icon-button matTooltip=\"Hide Column\" class=\"show-hide\">\r\n <mat-icon color=\"primary\">check_box</mat-icon>\r\n </button>\r\n } @else {\r\n <button mat-icon-button matTooltip=\"Show Column\" class=\"show-hide\">\r\n <mat-icon>indeterminate_check_box</mat-icon>\r\n </button>\r\n }\r\n \r\n <p class=\"label\">\r\n {{col.displayName || (col.key | spaceCase) }}\r\n </p>\r\n\r\n </div>\r\n </button>\r\n }\r\n\r\n </div>\r\n </mat-menu>\r\n}", styles: [".show-hide{margin-right:15px;height:24px;width:24px;padding:4px}.label{color:#6495ed;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;text-align:left;margin:0;font-size:17px;font-weight:700;display:inline-block;width:66%}.row{margin:0;padding:0}.isHidden{background-color:#d3d3d3;color:#a9a9a9;font-weight:700;font-size:17px;white-space:nowrap}.filter-button{margin-top:10px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.mdc-list-item__primary-text{display:inline-block;width:100%}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i14.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: i14.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i14.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i5$2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i5$2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "pipe", type: SpaceCasePipe, name: "spaceCase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2730
2766
|
}
|
|
2731
2767
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: GenColDisplayerComponent, decorators: [{
|
|
2732
2768
|
type: Component,
|
|
@@ -2847,7 +2883,7 @@ class FilterChipsComponent {
|
|
|
2847
2883
|
constructor() {
|
|
2848
2884
|
this.tableState = inject(TableStore);
|
|
2849
2885
|
this.filterStore = inject(WrapperFilterStore);
|
|
2850
|
-
this.filters$ = this.tableState.filters$.pipe(map(filters => Object.values(filters).filter(f => isFilterInfo(f) && !f.
|
|
2886
|
+
this.filters$ = this.tableState.filters$.pipe(map(filters => Object.values(filters).filter(f => isFilterInfo(f) && !f._isExternallyManaged)));
|
|
2851
2887
|
this.currentFilters$ = this.filterStore.currentFilters$;
|
|
2852
2888
|
}
|
|
2853
2889
|
deleteByIndex(index) {
|
|
@@ -2948,7 +2984,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
2948
2984
|
|
|
2949
2985
|
class ColumnTotalPipe {
|
|
2950
2986
|
transform(data, metaData) {
|
|
2951
|
-
const dataToCalculate = data.filter(d => !d.isGroupHeader
|
|
2987
|
+
const dataToCalculate = data.filter(d => !d.isGroupHeader);
|
|
2952
2988
|
switch (metaData.additional.footer.type) {
|
|
2953
2989
|
case 'sum':
|
|
2954
2990
|
return sumBy(dataToCalculate, metaData.key);
|
|
@@ -2976,7 +3012,7 @@ class TransformCreator {
|
|
|
2976
3012
|
this.casePipe = casePipe;
|
|
2977
3013
|
this.config = config;
|
|
2978
3014
|
}
|
|
2979
|
-
createTransformer(metaData) {
|
|
3015
|
+
createTransformer(metaData, noIcons = false) {
|
|
2980
3016
|
const defaultFunc = (value) => get(value, metaData.key);
|
|
2981
3017
|
if (metaData.transform) {
|
|
2982
3018
|
if (isPipe(metaData.transform)) {
|
|
@@ -2985,8 +3021,8 @@ class TransformCreator {
|
|
|
2985
3021
|
return metaData.fieldType === FieldType.Expression ? metaData.transform : (value) => metaData.transform(defaultFunc(value), value);
|
|
2986
3022
|
}
|
|
2987
3023
|
if (this.config.transformers && this.config.transformers[metaData.fieldType]) {
|
|
2988
|
-
var
|
|
2989
|
-
return (value) =>
|
|
3024
|
+
var transformer = this.config.transformers[metaData.fieldType];
|
|
3025
|
+
return (value) => transformer(defaultFunc(value));
|
|
2990
3026
|
}
|
|
2991
3027
|
const defaultDateFormat = this.config.defaultSettings?.dateFormat ?? 'shortDate';
|
|
2992
3028
|
const defaultDateTimeFormat = this.config.defaultSettings?.dateTimeFormat ?? 'short';
|
|
@@ -3004,6 +3040,9 @@ class TransformCreator {
|
|
|
3004
3040
|
case FieldType.Enum:
|
|
3005
3041
|
return (value) => this.casePipe.transform(metaData.additional?.enumMap[defaultFunc(value)]);
|
|
3006
3042
|
case FieldType.Boolean:
|
|
3043
|
+
if (noIcons) {
|
|
3044
|
+
return defaultFunc;
|
|
3045
|
+
}
|
|
3007
3046
|
let forTrue = 'check';
|
|
3008
3047
|
let forFalse = '';
|
|
3009
3048
|
if (metaData.additional?.boolean?.forTrue) {
|
|
@@ -3099,16 +3138,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3099
3138
|
}] } });
|
|
3100
3139
|
|
|
3101
3140
|
class ArrayColumnComponent {
|
|
3141
|
+
set metaData(metaData) {
|
|
3142
|
+
const additional = this.metaData?.additional ?? this.config.arrayInfo;
|
|
3143
|
+
if (additional) {
|
|
3144
|
+
this.additional = additional;
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
set _array(array) {
|
|
3148
|
+
this.array = (array ?? []).slice(0, this.additional.limit);
|
|
3149
|
+
}
|
|
3150
|
+
;
|
|
3102
3151
|
constructor(config) {
|
|
3103
3152
|
this.config = config;
|
|
3104
3153
|
this.ArrayStyle = ArrayStyle;
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
this.additional = this.metaData?.additional ?? this.config.arrayInfo ?? { limit: 3, arrayStyle: ArrayStyle.NewLine };
|
|
3108
|
-
this.array = (this.array ?? []).slice(0, this.additional.limit);
|
|
3154
|
+
this.array = [];
|
|
3155
|
+
this.additional = { limit: 3, arrayStyle: ArrayStyle.NewLine };
|
|
3109
3156
|
}
|
|
3110
3157
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: ArrayColumnComponent, deps: [{ token: TableBuilderConfigToken }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3111
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: ArrayColumnComponent, isStandalone: true, selector: "tb-array-column", inputs: {
|
|
3158
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: ArrayColumnComponent, isStandalone: true, selector: "tb-array-column", inputs: { metaData: "metaData", _array: ["array", "_array"] }, ngImport: i0, template: `
|
|
3112
3159
|
@if(!array.length){
|
|
3113
3160
|
-
|
|
3114
3161
|
} @else {
|
|
@@ -3157,15 +3204,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3157
3204
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3158
3205
|
type: Inject,
|
|
3159
3206
|
args: [TableBuilderConfigToken]
|
|
3160
|
-
}] }], propDecorators: {
|
|
3161
|
-
type: Input
|
|
3162
|
-
}], metaData: [{
|
|
3207
|
+
}] }], propDecorators: { metaData: [{
|
|
3163
3208
|
type: Input
|
|
3209
|
+
}], _array: [{
|
|
3210
|
+
type: Input,
|
|
3211
|
+
args: ['array']
|
|
3164
3212
|
}] } });
|
|
3165
3213
|
|
|
3166
3214
|
class InitializationComponent {
|
|
3167
3215
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: InitializationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3168
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.3", type: InitializationComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "linkTemplate", first: true, predicate: ["link"], descendants: true, static: true }, { propertyName: "imageUrlTemplate", first: true, predicate: ["imageUrl"], descendants: true, static: true }, { propertyName: "currencyTemplate", first: true, predicate: ["currency"], descendants: true, static: true }, { propertyName: "arrayTemplate", first: true, predicate: ["array"], descendants: true, static: true }, { propertyName: "defaultTemplate", first: true, predicate: ["default"], descendants: true, static: true }, { propertyName: "defaultWithIcon", first: true, predicate: ["defaultWithIcon"], descendants: true, static: true }], ngImport: i0, template: "<ng-template #link let-element='element' let-metaData='metaData' let-transform='transform'>\r\n <tb-link-column [element]=\"element\" [metaData]=\"metaData\" [transform]=\"transform\"></tb-link-column>\r\n</ng-template>\r\n\r\n<ng-template #imageUrl let-element='element' let-metaData='metaData'>\r\n <span>\r\n <img src=\"{{element[metaData.key]}}\" height=\"75px\" width=\"75px\" />\r\n </span>\r\n</ng-template>\r\n\r\n<ng-template #array let-element='element' let-metaData='metaData'>\r\n <tb-array-column [array]='element[metaData.key]' [metaData]='metaData'></tb-array-column>\r\n</ng-template>\r\n\r\n<ng-template #default let-element='element' let-metaData='metaData' let-transform='transform' >\r\n <span>{{ transform | func : element }}</span>\r\n</ng-template>\r\n\r\n<ng-template #defaultWithIcon let-element='element' let-metaData='metaData' let-transform='transform' >\r\n <mat-icon>{{ transform | func : element }}</mat-icon>\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: LinkColumnComponent, selector: "tb-link-column", inputs: ["metaData", "element", "transform"] }, { kind: "component", type: ArrayColumnComponent, selector: "tb-array-column", inputs: ["
|
|
3216
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.3", type: InitializationComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "linkTemplate", first: true, predicate: ["link"], descendants: true, static: true }, { propertyName: "imageUrlTemplate", first: true, predicate: ["imageUrl"], descendants: true, static: true }, { propertyName: "currencyTemplate", first: true, predicate: ["currency"], descendants: true, static: true }, { propertyName: "arrayTemplate", first: true, predicate: ["array"], descendants: true, static: true }, { propertyName: "defaultTemplate", first: true, predicate: ["default"], descendants: true, static: true }, { propertyName: "defaultWithIcon", first: true, predicate: ["defaultWithIcon"], descendants: true, static: true }], ngImport: i0, template: "<ng-template #link let-element='element' let-metaData='metaData' let-transform='transform'>\r\n <tb-link-column [element]=\"element\" [metaData]=\"metaData\" [transform]=\"transform\"></tb-link-column>\r\n</ng-template>\r\n\r\n<ng-template #imageUrl let-element='element' let-metaData='metaData'>\r\n <span>\r\n <img src=\"{{element[metaData.key]}}\" height=\"75px\" width=\"75px\" />\r\n </span>\r\n</ng-template>\r\n\r\n<ng-template #array let-element='element' let-metaData='metaData'>\r\n <tb-array-column [array]='element[metaData.key]' [metaData]='metaData'></tb-array-column>\r\n</ng-template>\r\n\r\n<ng-template #default let-element='element' let-metaData='metaData' let-transform='transform' >\r\n <span>{{ transform | func : element }}</span>\r\n</ng-template>\r\n\r\n<ng-template #defaultWithIcon let-element='element' let-metaData='metaData' let-transform='transform' >\r\n <mat-icon>{{ transform | func : element }}</mat-icon>\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: LinkColumnComponent, selector: "tb-link-column", inputs: ["metaData", "element", "transform"] }, { kind: "component", type: ArrayColumnComponent, selector: "tb-array-column", inputs: ["metaData", "array"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: FunctionPipe, name: "func" }] }); }
|
|
3169
3217
|
}
|
|
3170
3218
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: InitializationComponent, decorators: [{
|
|
3171
3219
|
type: Component,
|
|
@@ -3254,6 +3302,12 @@ class ColumnBuilderComponent {
|
|
|
3254
3302
|
return previousUserDefinedWidth >= 0 && currentUserDefinedWidth == null;
|
|
3255
3303
|
}
|
|
3256
3304
|
};
|
|
3305
|
+
this.getTooltip = (element) => {
|
|
3306
|
+
if (typeof this.metaData.toolTip === 'string') {
|
|
3307
|
+
return this.metaData.toolTip;
|
|
3308
|
+
}
|
|
3309
|
+
return this.metaData.toolTip(element);
|
|
3310
|
+
};
|
|
3257
3311
|
}
|
|
3258
3312
|
getInnerTemplate() {
|
|
3259
3313
|
if (this.metaData.template)
|
|
@@ -3299,8 +3353,8 @@ class ColumnBuilderComponent {
|
|
|
3299
3353
|
this.metaData.click(element, key);
|
|
3300
3354
|
}
|
|
3301
3355
|
}
|
|
3302
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: ColumnBuilderComponent, deps: [{ token: TransformCreator }, { token:
|
|
3303
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: ColumnBuilderComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "columnDef", first: true, predicate: MatColumnDef, descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: ["body"], descendants: true }], ngImport: i0, template: "<ng-container [matColumnDef]=\"metaData.key\" *ngrxLet=\"styles$ as styles\" >\r\n\r\n <!-- header -->\r\n <ng-template matHeaderCellDef #myHeader>\r\n @if(customCell?.columnDef?.headerCell){\r\n <ng-container *ngTemplateOutlet=\"customCell!.columnDef.headerCell.template; context: {metaData: metaData, styles: styles.header} \"/>\r\n } @else {\r\n <mat-header-cell cdkDrag [
|
|
3356
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: ColumnBuilderComponent, deps: [{ token: TransformCreator }, { token: i4$4.MatTable }, { token: TableStore }, { token: TableTemplateService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3357
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: ColumnBuilderComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "columnDef", first: true, predicate: MatColumnDef, descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: ["body"], descendants: true }], ngImport: i0, template: "<ng-container [matColumnDef]=\"metaData.key\" *ngrxLet=\"styles$ as styles\" >\r\n\r\n <!-- header -->\r\n <ng-template matHeaderCellDef #myHeader>\r\n @if(customCell?.columnDef?.headerCell){\r\n <ng-container *ngTemplateOutlet=\"customCell!.columnDef.headerCell.template; context: {metaData: metaData, styles: styles.header} \"/>\r\n } @else {\r\n <mat-header-cell cdkDrag [style]='styles.header' [resizeColumn]=\"true\" [key]=\"metaData.key\" class=\"column-head drag-header\" #headref \r\n [class]='metaData.additional?.columnPartClasses?.header'>\r\n <div class=\"header-container\" cdkDragHandle>\r\n @if(!metaData._internalNotUserDefined || !customCell?.columnDef?.cell){\r\n <div mat-sort-header [disabled]=\"metaData.noSort\" style=\"width: 100%\">\r\n {{ metaData.displayName ? metaData.displayName : ( metaData.key | spaceCase ) }}\r\n </div>\r\n } @else if(metaData._internalNotUserDefined) {\r\n <div style=\"width: 100%\">\r\n {{ metaData.displayName ? metaData.displayName : ( metaData.key | spaceCase ) }}\r\n </div>\r\n }\r\n @if((!metaData._internalNotUserDefined || !customCell?.columnDef?.cell) && (showFilters$ | async)){\r\n <tb-header-menu #menu [metaData]='metaData' [filter]='filter' />\r\n }\r\n \r\n </div>\r\n </mat-header-cell>\r\n }\r\n </ng-template>\r\n\r\n <!-- body -->\r\n <ng-container *matCellDef=\"let element;\">\r\n <ng-container *ngTemplateOutlet=\"outerTemplate; context: { metaData: metaData, element: element , styles: styles.body, $implicit: element }\"/>\r\n </ng-container>\r\n <ng-template #body let-element='element' >\r\n <mat-cell [matTooltip]=\"metaData.toolTip ? (getTooltip | func : element) : ''\" [conditionalClasses]='metaData.classes' [element]='element' [styler]='styles.body' (click)='cellClicked(element, metaData.key)' >\r\n <ng-container *ngTemplateOutlet=\"innerTemplate; context: { metaData: metaData, element: element, transform: transform, $implicit: element }; Injector: injector\" />\r\n </mat-cell>\r\n </ng-template>\r\n \r\n <!-- footer -->\r\n <ng-template matFooterCellDef>\r\n @if(customCell?.columnDef?.footerCell){\r\n <ng-container\r\n *ngTemplateOutlet=\"customCell!.columnDef.footerCell.template;context: {metaData: metaData, data: data$, styles : styles.footer }\"/>\r\n } @else {\r\n <mat-footer-cell [style]='styles.footer' *ngrxLet=\"data$ as data\" [class]='metaData.additional?.columnPartClasses?.footer'>\r\n @if(!!data?.length && metaData.additional?.footer){\r\n <span class=\"bold\">\r\n @switch (metaData.fieldType) {\r\n @case (FieldType.Currency) { {{ data | columnTotal: metaData | currency }} }\r\n @case (FieldType.Number) { {{ data | columnTotal: metaData | number }} }\r\n }\r\n </span>\r\n }\r\n \r\n </mat-footer-cell>\r\n }\r\n </ng-template>\r\n</ng-container>\r\n", styles: [".header-container{display:flex;flex-direction:row;width:100%;align-items:center}.negative-currency{color:red}.column-head{position:relative}.bold,.group-footer{font-weight:900}.cdk-drag-preview{background:white;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:33%;border-right-width:0px}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-handle{color:#add8e6;cursor:move;margin-right:9px}\n"], dependencies: [{ kind: "ngmodule", type: MatTableModule }, { kind: "directive", type: i4$4.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i4$4.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i4$4.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i4$4.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i4$4.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i4$4.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i4$4.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ResizeColumnDirective, selector: "[resizeColumn]", inputs: ["resizeColumn", "key"] }, { kind: "pipe", type: FunctionPipe, name: "func" }, { kind: "directive", type: StylerDirective, selector: "[styler]", inputs: ["element", "styler"] }, { kind: "directive", type: ConditionalClassesDirective, selector: "[conditionalClasses]", inputs: ["element", "conditionalClasses"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i5$2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i5$2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "component", type: i1$4.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "mat-sort-header", "arrowPosition", "start", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "pipe", type: SpaceCasePipe, name: "spaceCase" }, { kind: "component", type: HeaderMenuComponent, selector: "tb-header-menu", inputs: ["filter", "metaData"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "pipe", type: ColumnTotalPipe, name: "columnTotal" }, { kind: "pipe", type: CurrencyPipe, name: "currency" }, { kind: "pipe", type: DecimalPipe, name: "number" }], viewProviders: [
|
|
3304
3358
|
{ provide: CDK_DROP_LIST, useExisting: CdkDropList },
|
|
3305
3359
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3306
3360
|
}
|
|
@@ -3309,11 +3363,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3309
3363
|
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, viewProviders: [
|
|
3310
3364
|
{ provide: CDK_DROP_LIST, useExisting: CdkDropList },
|
|
3311
3365
|
], standalone: true, imports: [
|
|
3312
|
-
MatTableModule, NgTemplateOutlet,
|
|
3366
|
+
MatTableModule, NgTemplateOutlet, ResizeColumnDirective, FunctionPipe, StylerDirective,
|
|
3313
3367
|
ConditionalClassesDirective, DragDropModule, MatSortModule, SpaceCasePipe, HeaderMenuComponent,
|
|
3314
3368
|
AsyncPipe, MatTooltipModule, LetDirective, ColumnTotalPipe, CurrencyPipe, DecimalPipe
|
|
3315
|
-
], template: "<ng-container [matColumnDef]=\"metaData.key\" *ngrxLet=\"styles$ as styles\" >\r\n\r\n <!-- header -->\r\n <ng-template matHeaderCellDef #myHeader>\r\n @if(customCell?.columnDef?.headerCell){\r\n <ng-container *ngTemplateOutlet=\"customCell!.columnDef.headerCell.template; context: {metaData: metaData, styles: styles.header} \"/>\r\n } @else {\r\n <mat-header-cell cdkDrag [
|
|
3316
|
-
}], ctorParameters: () => [{ type: TransformCreator }, { type:
|
|
3369
|
+
], template: "<ng-container [matColumnDef]=\"metaData.key\" *ngrxLet=\"styles$ as styles\" >\r\n\r\n <!-- header -->\r\n <ng-template matHeaderCellDef #myHeader>\r\n @if(customCell?.columnDef?.headerCell){\r\n <ng-container *ngTemplateOutlet=\"customCell!.columnDef.headerCell.template; context: {metaData: metaData, styles: styles.header} \"/>\r\n } @else {\r\n <mat-header-cell cdkDrag [style]='styles.header' [resizeColumn]=\"true\" [key]=\"metaData.key\" class=\"column-head drag-header\" #headref \r\n [class]='metaData.additional?.columnPartClasses?.header'>\r\n <div class=\"header-container\" cdkDragHandle>\r\n @if(!metaData._internalNotUserDefined || !customCell?.columnDef?.cell){\r\n <div mat-sort-header [disabled]=\"metaData.noSort\" style=\"width: 100%\">\r\n {{ metaData.displayName ? metaData.displayName : ( metaData.key | spaceCase ) }}\r\n </div>\r\n } @else if(metaData._internalNotUserDefined) {\r\n <div style=\"width: 100%\">\r\n {{ metaData.displayName ? metaData.displayName : ( metaData.key | spaceCase ) }}\r\n </div>\r\n }\r\n @if((!metaData._internalNotUserDefined || !customCell?.columnDef?.cell) && (showFilters$ | async)){\r\n <tb-header-menu #menu [metaData]='metaData' [filter]='filter' />\r\n }\r\n \r\n </div>\r\n </mat-header-cell>\r\n }\r\n </ng-template>\r\n\r\n <!-- body -->\r\n <ng-container *matCellDef=\"let element;\">\r\n <ng-container *ngTemplateOutlet=\"outerTemplate; context: { metaData: metaData, element: element , styles: styles.body, $implicit: element }\"/>\r\n </ng-container>\r\n <ng-template #body let-element='element' >\r\n <mat-cell [matTooltip]=\"metaData.toolTip ? (getTooltip | func : element) : ''\" [conditionalClasses]='metaData.classes' [element]='element' [styler]='styles.body' (click)='cellClicked(element, metaData.key)' >\r\n <ng-container *ngTemplateOutlet=\"innerTemplate; context: { metaData: metaData, element: element, transform: transform, $implicit: element }; Injector: injector\" />\r\n </mat-cell>\r\n </ng-template>\r\n \r\n <!-- footer -->\r\n <ng-template matFooterCellDef>\r\n @if(customCell?.columnDef?.footerCell){\r\n <ng-container\r\n *ngTemplateOutlet=\"customCell!.columnDef.footerCell.template;context: {metaData: metaData, data: data$, styles : styles.footer }\"/>\r\n } @else {\r\n <mat-footer-cell [style]='styles.footer' *ngrxLet=\"data$ as data\" [class]='metaData.additional?.columnPartClasses?.footer'>\r\n @if(!!data?.length && metaData.additional?.footer){\r\n <span class=\"bold\">\r\n @switch (metaData.fieldType) {\r\n @case (FieldType.Currency) { {{ data | columnTotal: metaData | currency }} }\r\n @case (FieldType.Number) { {{ data | columnTotal: metaData | number }} }\r\n }\r\n </span>\r\n }\r\n \r\n </mat-footer-cell>\r\n }\r\n </ng-template>\r\n</ng-container>\r\n", styles: [".header-container{display:flex;flex-direction:row;width:100%;align-items:center}.negative-currency{color:red}.column-head{position:relative}.bold,.group-footer{font-weight:900}.cdk-drag-preview{background:white;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:33%;border-right-width:0px}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-handle{color:#add8e6;cursor:move;margin-right:9px}\n"] }]
|
|
3370
|
+
}], ctorParameters: () => [{ type: TransformCreator }, { type: i4$4.MatTable }, { type: TableStore }, { type: TableTemplateService }, { type: i0.Injector }], propDecorators: { columnDef: [{
|
|
3317
3371
|
type: ViewChild,
|
|
3318
3372
|
args: [MatColumnDef]
|
|
3319
3373
|
}], bodyTemplate: [{
|
|
@@ -3321,38 +3375,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3321
3375
|
args: ['body']
|
|
3322
3376
|
}] } });
|
|
3323
3377
|
|
|
3324
|
-
class MatTableObservableDataSource extends MatTableDataSource {
|
|
3325
|
-
constructor(dataSrc) {
|
|
3326
|
-
super([]);
|
|
3327
|
-
this.dataSrc = dataSrc;
|
|
3328
|
-
}
|
|
3329
|
-
connect() {
|
|
3330
|
-
if (!this.subscription) {
|
|
3331
|
-
this.subscription = this.dataSrc.subscribe(data => this.data = data);
|
|
3332
|
-
}
|
|
3333
|
-
return super.connect();
|
|
3334
|
-
}
|
|
3335
|
-
disconnect() {
|
|
3336
|
-
if (this.subscription) {
|
|
3337
|
-
this.subscription.unsubscribe();
|
|
3338
|
-
this.subscription = undefined;
|
|
3339
|
-
}
|
|
3340
|
-
super.disconnect();
|
|
3341
|
-
}
|
|
3342
|
-
}
|
|
3343
|
-
|
|
3344
|
-
function sortData(data, sorted) {
|
|
3345
|
-
return orderBy(data, sorted.map(r => r.active), sorted.map(r => r.direction));
|
|
3346
|
-
}
|
|
3347
|
-
|
|
3348
|
-
class GenericTableDataSource extends MatTableObservableDataSource {
|
|
3349
|
-
constructor(dataSrc) {
|
|
3350
|
-
super(dataSrc);
|
|
3351
|
-
const baseSort = this.sortData;
|
|
3352
|
-
this.sortData = ((data, sort) => sort instanceof MultiSortDirective ? sortData(data, sort.rules) : baseSort(data, sort));
|
|
3353
|
-
}
|
|
3354
|
-
}
|
|
3355
|
-
|
|
3356
3378
|
class PaginatorComponent {
|
|
3357
3379
|
constructor(state) {
|
|
3358
3380
|
this.state = state;
|
|
@@ -3423,28 +3445,75 @@ const metaDataPageSizeChange = (state) => state.state$.pipe(map(state => state.u
|
|
|
3423
3445
|
const setPaginatorPageSize = (paginator) => (pageSize) => paginator._changePageSize(pageSize);
|
|
3424
3446
|
const onPaginatorPageSizeChange = (paginator) => paginator.page.pipe(map(e => e.pageSize), distinct());
|
|
3425
3447
|
|
|
3448
|
+
class MatTableObservableDataSource extends MatTableDataSource {
|
|
3449
|
+
constructor(dataSrc) {
|
|
3450
|
+
super([]);
|
|
3451
|
+
this.dataSrc = dataSrc;
|
|
3452
|
+
}
|
|
3453
|
+
connect() {
|
|
3454
|
+
if (!this.subscription) {
|
|
3455
|
+
this.subscription = this.dataSrc.subscribe(data => this.data = data);
|
|
3456
|
+
}
|
|
3457
|
+
return super.connect();
|
|
3458
|
+
}
|
|
3459
|
+
disconnect() {
|
|
3460
|
+
if (this.subscription) {
|
|
3461
|
+
this.subscription.unsubscribe();
|
|
3462
|
+
this.subscription = undefined;
|
|
3463
|
+
}
|
|
3464
|
+
super.disconnect();
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
// If we are only sorting due to a change in the Sorts[] we can 'optimize'. If the sort array was first by column a asc then by column b desc then by column c asc,
|
|
3469
|
+
// and now it is first by column d asc then by column a desc then by column b desc then by column c asc, we dont need to rerun the tail, i.e. for culumn b and c.
|
|
3470
|
+
// So we need to calculate the matching tail of the sort array. Then sortsToRun will be the non-matching head.
|
|
3471
|
+
// But if any sorts were removed the only way to 'unsort' is to start by the original data and run all the existing sorts again, so 'sorts to run' will be all
|
|
3472
|
+
// the sorts.
|
|
3473
|
+
// We always pass allSorts to the container because if the table data changes all the sorts will need to be run.
|
|
3474
|
+
function updateSortState(previousSorts, currentSorts) {
|
|
3475
|
+
currentSorts = addInitSort(currentSorts);
|
|
3476
|
+
if (sortsRemoved(previousSorts.allSorts, currentSorts)) {
|
|
3477
|
+
return ({ sortsToRun: currentSorts, allSorts: currentSorts });
|
|
3478
|
+
}
|
|
3479
|
+
const sameTailLength = getSameTailLength(previousSorts.allSorts, currentSorts);
|
|
3480
|
+
const sortsToRun = currentSorts.slice(0, currentSorts.length - sameTailLength);
|
|
3481
|
+
return ({ sortsToRun, allSorts: currentSorts });
|
|
3482
|
+
}
|
|
3483
|
+
function addInitSort(sorts) {
|
|
3484
|
+
return [...sorts, { active: initIndexSymbol, direction: 'asc' }];
|
|
3485
|
+
}
|
|
3486
|
+
function sortsRemoved(previousSorts, currentSorts) {
|
|
3487
|
+
const previousSortedColumns = previousSorts.map(s => s.active);
|
|
3488
|
+
const currentSortedColumns = currentSorts.map(s => s.active);
|
|
3489
|
+
const sortsRemoved = !!difference(previousSortedColumns, currentSortedColumns).length;
|
|
3490
|
+
return sortsRemoved;
|
|
3491
|
+
}
|
|
3492
|
+
function getSameTailLength(previousSorts, currentSorts) {
|
|
3493
|
+
previousSorts = [...previousSorts].reverse();
|
|
3494
|
+
currentSorts = [...currentSorts].reverse();
|
|
3495
|
+
let indexOfChange = currentSorts.findIndex((s, i) => s.active !== previousSorts[i]?.active || s.direction !== previousSorts[i]?.direction);
|
|
3496
|
+
if (indexOfChange === -1)
|
|
3497
|
+
return indexOfChange = currentSorts.length;
|
|
3498
|
+
return indexOfChange;
|
|
3499
|
+
}
|
|
3500
|
+
const initIndexSymbol = Symbol('tb_init_index');
|
|
3501
|
+
const initialSortState = { sortsToRun: [], allSorts: [] };
|
|
3502
|
+
|
|
3426
3503
|
class GenericTableComponent {
|
|
3427
3504
|
drop(event) {
|
|
3428
3505
|
this.state.setUserDefinedOrder({ newOrder: event.currentIndex, oldOrder: event.previousIndex });
|
|
3429
3506
|
}
|
|
3430
|
-
set
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
if (this.dataSource?.sort) {
|
|
3434
|
-
this.dataSource.sort = null;
|
|
3435
|
-
}
|
|
3436
|
-
}
|
|
3437
|
-
else {
|
|
3438
|
-
if (this.dataSource && !this.dataSource.sort) {
|
|
3439
|
-
this.dataSource.sort = this.sort;
|
|
3440
|
-
}
|
|
3507
|
+
set trackBy(trackBy) {
|
|
3508
|
+
if (trackBy) {
|
|
3509
|
+
this.trackByFunction = (index, item) => item[trackBy];
|
|
3441
3510
|
}
|
|
3442
3511
|
}
|
|
3443
|
-
|
|
3444
|
-
constructor(sort, state, viewContainer, injector) {
|
|
3512
|
+
constructor(sort, state, viewContainer, transformCreator, injector) {
|
|
3445
3513
|
this.sort = sort;
|
|
3446
3514
|
this.state = state;
|
|
3447
3515
|
this.viewContainer = viewContainer;
|
|
3516
|
+
this.transformCreator = transformCreator;
|
|
3448
3517
|
this.indexColumn = false;
|
|
3449
3518
|
this.selectionColumn = false;
|
|
3450
3519
|
this.isSticky = false;
|
|
@@ -3452,15 +3521,8 @@ class GenericTableComponent {
|
|
|
3452
3521
|
this.rowDefArr = [];
|
|
3453
3522
|
this.columns = [];
|
|
3454
3523
|
this.myColumns = {};
|
|
3455
|
-
this.
|
|
3456
|
-
|
|
3457
|
-
return null;
|
|
3458
|
-
}
|
|
3459
|
-
if (this.trackBy) {
|
|
3460
|
-
return item[this.trackBy];
|
|
3461
|
-
}
|
|
3462
|
-
return item;
|
|
3463
|
-
};
|
|
3524
|
+
this.defaultTrackBy = (index, item) => item[initIndexSymbol];
|
|
3525
|
+
this.trackByFunction = this.defaultTrackBy;
|
|
3464
3526
|
this.initializeRowDefs = (defs) => {
|
|
3465
3527
|
this.rowDefArr.forEach(r => this.table.removeRowDef(r));
|
|
3466
3528
|
this.rowDefArr = defs;
|
|
@@ -3488,6 +3550,16 @@ class GenericTableComponent {
|
|
|
3488
3550
|
}
|
|
3489
3551
|
}));
|
|
3490
3552
|
this.collapseFooter$ = this.state.state$.pipe(map(state => state.persistedTableSettings.collapseFooter));
|
|
3553
|
+
this.getTransform = (key, val) => {
|
|
3554
|
+
if (val == undefined || val === 'null')
|
|
3555
|
+
return '';
|
|
3556
|
+
try {
|
|
3557
|
+
return this.transformCreator.createTransformer(this.myColumns[key].metaData, true)({ [key]: val });
|
|
3558
|
+
}
|
|
3559
|
+
catch (error) {
|
|
3560
|
+
return val;
|
|
3561
|
+
}
|
|
3562
|
+
};
|
|
3491
3563
|
this.injector = Injector.create({
|
|
3492
3564
|
providers: [
|
|
3493
3565
|
{ provide: MatTable, useFactory: () => this.table },
|
|
@@ -3519,31 +3591,22 @@ class GenericTableComponent {
|
|
|
3519
3591
|
});
|
|
3520
3592
|
this.showHeader$ = this.state.tableSettings$.pipe(map(settings => !(settings.hideColumnHeader)));
|
|
3521
3593
|
this.showFooterRow$ = combineLatest([
|
|
3522
|
-
this.
|
|
3594
|
+
this.displayData$.pipe(map(d => !!d.length), distinctUntilChanged()),
|
|
3523
3595
|
this.state.metaDataArray$.pipe(map(metaData => metaData.some(md => !!md.additional?.footer)), distinctUntilChanged()),
|
|
3524
3596
|
this.columnInfos.pipe(map(columnInfos => columnInfos.some(ci => !!ci.customCell?.columnDef?.footerCell)), distinctUntilChanged()),
|
|
3525
3597
|
]).pipe(map(([hasData, hasFooterDef, hasCustomFooter]) => {
|
|
3526
|
-
const
|
|
3527
|
-
return hasCustomFooter || (hasData && (hasFooterDef ||
|
|
3598
|
+
const hasSelectionColumn = this.selectionColumn;
|
|
3599
|
+
return hasCustomFooter || (hasData && (hasFooterDef || hasSelectionColumn)) ? 'regular-footer' : hasData ? 'no-footer' : 'small-footer';
|
|
3528
3600
|
}));
|
|
3529
3601
|
}
|
|
3530
3602
|
createDataSource() {
|
|
3531
|
-
this.dataSource = new
|
|
3532
|
-
if (!this.disableSort) {
|
|
3533
|
-
this.dataSource.sort = this.sort;
|
|
3534
|
-
}
|
|
3603
|
+
this.dataSource = new MatTableObservableDataSource(this.displayData$.pipe(tap((d) => this.selection.clear())));
|
|
3535
3604
|
}
|
|
3536
3605
|
isGroupHeader(_, row) {
|
|
3537
3606
|
return row.isGroupHeader;
|
|
3538
3607
|
}
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
}
|
|
3542
|
-
updateGroup(group) {
|
|
3543
|
-
this.state.updateGroup({
|
|
3544
|
-
...group,
|
|
3545
|
-
isExpanded: !group.isExpanded
|
|
3546
|
-
});
|
|
3608
|
+
setExpanded(key, groupKey, isExpanded) {
|
|
3609
|
+
this.state.updateExpandedGroups({ key, isExpanded, groupKey });
|
|
3547
3610
|
}
|
|
3548
3611
|
addMetaData(column) {
|
|
3549
3612
|
const columnBuilder = this.myColumns[column.metaData.key];
|
|
@@ -3572,23 +3635,25 @@ class GenericTableComponent {
|
|
|
3572
3635
|
this.selection.clear() :
|
|
3573
3636
|
this.selection.select(...this.dataSource.data);
|
|
3574
3637
|
}
|
|
3575
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: GenericTableComponent, deps: [{ token: i1$4.MatSort }, { token: TableStore }, { token: i0.ViewContainerRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3576
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: GenericTableComponent, isStandalone: true, selector: "tb-generic-table", inputs: { data$: "data$", indexColumn: "indexColumn", selectionColumn: "selectionColumn",
|
|
3638
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: GenericTableComponent, deps: [{ token: i1$4.MatSort }, { token: TableStore }, { token: i0.ViewContainerRef }, { token: TransformCreator }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3639
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: GenericTableComponent, isStandalone: true, selector: "tb-generic-table", inputs: { trackBy: "trackBy", displayData$: "displayData$", data$: "data$", indexColumn: "indexColumn", selectionColumn: "selectionColumn", rows: "rows", isSticky: "isSticky", columnBuilders: "columnBuilders", columnInfos: "columnInfos", groupHeaderTemplate: "groupHeaderTemplate" }, outputs: { selection$: "selection$" }, viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true, static: true }, { propertyName: "dropList", first: true, predicate: CdkDropList, descendants: true, static: true }, { propertyName: "tableElRef", first: true, predicate: ["table"], descendants: true, read: ElementRef }, { propertyName: "paginatorComponent", first: true, predicate: PaginatorComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<mat-table\r\n cdkDropList\r\n cdkDropListLockAxis='x'\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListDropped)=\"drop($event)\"\r\n class=\"table-drag-list\"\r\n [class]=\"(showFooterRow$ | async)\"\r\n #table\r\n [dataSource]=\"dataSource\"\r\n [trackBy]=\"trackByFunction\"\r\n [style]=\"tableWidth | async\"\r\n>\r\n\r\n <!-- select column -->\r\n <ng-container matColumnDef=\"select\">\r\n\r\n <mat-header-cell *matHeaderCellDef class=\"f-mat-header-cell\">\r\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\r\n [checked]=\"!!(masterToggleChecked$ | async)\"\r\n [indeterminate]=\"masterToggleIndeterminate$ | async\">\r\n </mat-checkbox>\r\n </mat-header-cell>\r\n\r\n <mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox\r\n (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? selection.toggle(row) : null\"\r\n [checked]=\"selection.isSelected(row)\"/>\r\n </mat-cell>\r\n\r\n <mat-footer-cell *matFooterCellDef>\r\n {{ selection.selected.length }}\r\n </mat-footer-cell>\r\n </ng-container>\r\n\r\n <!-- index column -->\r\n <ng-container matColumnDef=\"index\">\r\n <mat-header-cell *matHeaderCellDef class=\"f-mat-header-cell\" >#</mat-header-cell>\r\n <mat-cell *matCellDef=\"let i = index;\"> {{ (tbPaginator.paginator.pageIndex * tbPaginator.paginator.pageSize) + i + 1 }} </mat-cell>\r\n <mat-footer-cell *matFooterCellDef></mat-footer-cell>\r\n </ng-container>\r\n\r\n <!-- Grouping -->\r\n <ng-container matColumnDef=\"groupHeader\">\r\n <mat-cell *matCellDef=\"let row\">\r\n <div [style.paddingLeft]=\"row.padding + 'px !important'\" *ngrxLet=\"(state.getIsExpanded | func : row.key : row.groupName ) as expanded\">\r\n <button mat-icon-button (click)=\"setExpanded(row.key, row.groupName, !expanded);\">\r\n @if(!expanded){\r\n <mat-icon>chevron_right</mat-icon>\r\n } @else {\r\n <mat-icon>expand_more</mat-icon> \r\n }\r\n </button>\r\n {{getTransform | func : row.key : row.groupHeaderDisplay}} ({{row.length}})\r\n </div>\r\n <div style=\"flex-grow: 1\">\r\n <ng-container *ngTemplateOutlet=\"groupHeaderTemplate; context: { element: row }\"></ng-container>\r\n </div>\r\n </mat-cell>\r\n </ng-container>\r\n\r\n @if(showHeader$ | async){\r\n <mat-header-row *matHeaderRowDef=\"keys; sticky: isSticky\" />\r\n }\r\n <mat-row *matRowDef=\"let row; columns: keys; let i = index\" />\r\n <mat-row *matRowDef=\"let row; columns: ['groupHeader']; when: isGroupHeader\" style=\"background-color: white;\" />\r\n <mat-footer-row *matFooterRowDef=\"(showFooterRow$ | async) === 'regular-footer' ? keys : []\" />\r\n\r\n</mat-table>\r\n\r\n<div class=\"flx-row-end sticky\">\r\n <tb-paginator #tbPaginator\r\n [dataSource]=\"dataSource\"\r\n [tableElRef]=\"tableElRef\"\r\n [data$]=\"data$\" />\r\n\r\n <mat-icon [matTooltip]=\"(collapseFooter$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon footer\" (click)=\"state.toggleCollapseFooter()\">\r\n {{(collapseFooter$ | async) ? 'expand_more' : 'expand_less'}}\r\n </mat-icon>\r\n</div>\r\n", styles: [".mat-mdc-row:nth-child(odd){background-color:#cdeefe}.sticky{bottom:0;position:sticky;border-top:.5px solid rgba(0,0,0,.12)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}.flx-row-end{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;background-color:#fff}:host::ng-deep .mat-mdc-paginator-container{min-height:initial!important}.group-header{display:flex}: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:0 0 0 .2rem;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}.no-footer mat-footer-row{display:none}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}\n"], dependencies: [{ kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i4$4.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i4$4.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i4$4.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i4$4.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i4$4.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i4$4.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i4$4.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i4$4.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i4$4.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i4$4.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i4$4.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i4$4.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i4$4.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i4$4.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i5$2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i4.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PaginatorComponent, selector: "tb-paginator", inputs: ["dataSource", "tableElRef", "data$"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "pipe", type: FunctionPipe, name: "func" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3577
3640
|
}
|
|
3578
3641
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: GenericTableComponent, decorators: [{
|
|
3579
3642
|
type: Component,
|
|
3580
3643
|
args: [{ selector: 'tb-generic-table', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
3581
|
-
MatTableModule, DragDropModule,
|
|
3582
|
-
PaginatorComponent, MatTooltipModule, AsyncPipe
|
|
3583
|
-
], template: "<mat-table\r\n cdkDropList\r\n cdkDropListLockAxis='x'\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListDropped)=\"drop($event)\"\r\n class=\"table-drag-list\"\r\n [class]=\"(showFooterRow$ | async)\"\r\n #table\r\n [dataSource]=\"dataSource\"\r\n [trackBy]
|
|
3584
|
-
}], ctorParameters: () => [{ type: i1$4.MatSort }, { type: TableStore }, { type: i0.ViewContainerRef }, { type: i0.Injector }], propDecorators: {
|
|
3644
|
+
MatTableModule, DragDropModule, MatCheckboxModule, MatButtonModule, MatIconModule, NgTemplateOutlet,
|
|
3645
|
+
PaginatorComponent, MatTooltipModule, AsyncPipe, LetDirective, FunctionPipe
|
|
3646
|
+
], template: "<mat-table\r\n cdkDropList\r\n cdkDropListLockAxis='x'\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListDropped)=\"drop($event)\"\r\n class=\"table-drag-list\"\r\n [class]=\"(showFooterRow$ | async)\"\r\n #table\r\n [dataSource]=\"dataSource\"\r\n [trackBy]=\"trackByFunction\"\r\n [style]=\"tableWidth | async\"\r\n>\r\n\r\n <!-- select column -->\r\n <ng-container matColumnDef=\"select\">\r\n\r\n <mat-header-cell *matHeaderCellDef class=\"f-mat-header-cell\">\r\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\r\n [checked]=\"!!(masterToggleChecked$ | async)\"\r\n [indeterminate]=\"masterToggleIndeterminate$ | async\">\r\n </mat-checkbox>\r\n </mat-header-cell>\r\n\r\n <mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox\r\n (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? selection.toggle(row) : null\"\r\n [checked]=\"selection.isSelected(row)\"/>\r\n </mat-cell>\r\n\r\n <mat-footer-cell *matFooterCellDef>\r\n {{ selection.selected.length }}\r\n </mat-footer-cell>\r\n </ng-container>\r\n\r\n <!-- index column -->\r\n <ng-container matColumnDef=\"index\">\r\n <mat-header-cell *matHeaderCellDef class=\"f-mat-header-cell\" >#</mat-header-cell>\r\n <mat-cell *matCellDef=\"let i = index;\"> {{ (tbPaginator.paginator.pageIndex * tbPaginator.paginator.pageSize) + i + 1 }} </mat-cell>\r\n <mat-footer-cell *matFooterCellDef></mat-footer-cell>\r\n </ng-container>\r\n\r\n <!-- Grouping -->\r\n <ng-container matColumnDef=\"groupHeader\">\r\n <mat-cell *matCellDef=\"let row\">\r\n <div [style.paddingLeft]=\"row.padding + 'px !important'\" *ngrxLet=\"(state.getIsExpanded | func : row.key : row.groupName ) as expanded\">\r\n <button mat-icon-button (click)=\"setExpanded(row.key, row.groupName, !expanded);\">\r\n @if(!expanded){\r\n <mat-icon>chevron_right</mat-icon>\r\n } @else {\r\n <mat-icon>expand_more</mat-icon> \r\n }\r\n </button>\r\n {{getTransform | func : row.key : row.groupHeaderDisplay}} ({{row.length}})\r\n </div>\r\n <div style=\"flex-grow: 1\">\r\n <ng-container *ngTemplateOutlet=\"groupHeaderTemplate; context: { element: row }\"></ng-container>\r\n </div>\r\n </mat-cell>\r\n </ng-container>\r\n\r\n @if(showHeader$ | async){\r\n <mat-header-row *matHeaderRowDef=\"keys; sticky: isSticky\" />\r\n }\r\n <mat-row *matRowDef=\"let row; columns: keys; let i = index\" />\r\n <mat-row *matRowDef=\"let row; columns: ['groupHeader']; when: isGroupHeader\" style=\"background-color: white;\" />\r\n <mat-footer-row *matFooterRowDef=\"(showFooterRow$ | async) === 'regular-footer' ? keys : []\" />\r\n\r\n</mat-table>\r\n\r\n<div class=\"flx-row-end sticky\">\r\n <tb-paginator #tbPaginator\r\n [dataSource]=\"dataSource\"\r\n [tableElRef]=\"tableElRef\"\r\n [data$]=\"data$\" />\r\n\r\n <mat-icon [matTooltip]=\"(collapseFooter$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon footer\" (click)=\"state.toggleCollapseFooter()\">\r\n {{(collapseFooter$ | async) ? 'expand_more' : 'expand_less'}}\r\n </mat-icon>\r\n</div>\r\n", styles: [".mat-mdc-row:nth-child(odd){background-color:#cdeefe}.sticky{bottom:0;position:sticky;border-top:.5px solid rgba(0,0,0,.12)}.page-amounts{color:#0000008a;font-family:Roboto,Helvetica Neue,sans-serif;font-size:12px;margin-right:.2rem}.flx-row-end{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;background-color:#fff}:host::ng-deep .mat-mdc-paginator-container{min-height:initial!important}.group-header{display:flex}: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:0 0 0 .2rem;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}.no-footer mat-footer-row{display:none}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}\n"] }]
|
|
3647
|
+
}], ctorParameters: () => [{ type: i1$4.MatSort }, { type: TableStore }, { type: i0.ViewContainerRef }, { type: TransformCreator }, { type: i0.Injector }], propDecorators: { trackBy: [{
|
|
3648
|
+
type: Input
|
|
3649
|
+
}], displayData$: [{
|
|
3650
|
+
type: Input
|
|
3651
|
+
}], data$: [{
|
|
3585
3652
|
type: Input
|
|
3586
3653
|
}], indexColumn: [{
|
|
3587
3654
|
type: Input
|
|
3588
3655
|
}], selectionColumn: [{
|
|
3589
3656
|
type: Input
|
|
3590
|
-
}], trackBy: [{
|
|
3591
|
-
type: Input
|
|
3592
3657
|
}], rows: [{
|
|
3593
3658
|
type: Input
|
|
3594
3659
|
}], isSticky: [{
|
|
@@ -3599,8 +3664,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3599
3664
|
type: Input
|
|
3600
3665
|
}], groupHeaderTemplate: [{
|
|
3601
3666
|
type: Input
|
|
3602
|
-
}], disableSort: [{
|
|
3603
|
-
type: Input
|
|
3604
3667
|
}], table: [{
|
|
3605
3668
|
type: ViewChild,
|
|
3606
3669
|
args: [MatTable, { static: true }]
|
|
@@ -3617,28 +3680,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3617
3680
|
type: Output
|
|
3618
3681
|
}] } });
|
|
3619
3682
|
|
|
3620
|
-
class DataFilter {
|
|
3621
|
-
constructor(filters$) {
|
|
3622
|
-
this.filters$ = filters$;
|
|
3623
|
-
}
|
|
3624
|
-
filter(data, filters) {
|
|
3625
|
-
return data.filter(r => filters.every(fltr => fltr(r)));
|
|
3626
|
-
}
|
|
3627
|
-
filterData(data$) {
|
|
3628
|
-
return combineLatest([data$, this.filters$]).pipe(map(([data, filters]) => this.filter(data, filters)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
3629
|
-
}
|
|
3630
|
-
appendFilters(filters$) {
|
|
3631
|
-
return new DataFilter(combineArrays([
|
|
3632
|
-
this.filters$ ?? of([]),
|
|
3633
|
-
filters$.pipe(map(fltrs => fltrs
|
|
3634
|
-
// we only want to remove it if it was specifically set to false
|
|
3635
|
-
// as apposed to falsy
|
|
3636
|
-
.filter(f => f.active !== false)
|
|
3637
|
-
.map(filter => createFilterFunc(filter))))
|
|
3638
|
-
]));
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
|
|
3642
3683
|
function downloadData(data, filename, mimeType) {
|
|
3643
3684
|
const url = URL.createObjectURL(new Blob([data], { type: mimeType }));
|
|
3644
3685
|
const downloadLink = document.createElement('a');
|
|
@@ -3732,6 +3773,22 @@ const ArrayDefaults = {
|
|
|
3732
3773
|
arrayStyle: ArrayStyle.CommaDelimited
|
|
3733
3774
|
};
|
|
3734
3775
|
|
|
3776
|
+
function sortData(data, sorted) {
|
|
3777
|
+
const ordered = orderBy(data, sorted.map(r => r.active), sorted.map(r => r.direction));
|
|
3778
|
+
return ordered;
|
|
3779
|
+
}
|
|
3780
|
+
function filterData(data, filters, update = false) {
|
|
3781
|
+
for (let index = 0; index < data.length; index++) {
|
|
3782
|
+
const element = data[index];
|
|
3783
|
+
const hide = !filters.every(filter => filter(element));
|
|
3784
|
+
if (hide || update) {
|
|
3785
|
+
element[tbNoShowSymbol] = hide;
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
return data;
|
|
3789
|
+
}
|
|
3790
|
+
const tbNoShowSymbol = Symbol('tb_no_show');
|
|
3791
|
+
|
|
3735
3792
|
function createLinkCreator(metaData) {
|
|
3736
3793
|
const target = metaData.additional?.link?.target || metaData.additional?.target || '_blank';
|
|
3737
3794
|
const useRouterLink = metaData.additional?.link?.useRouterLink || metaData.additional?.useRouterLink;
|
|
@@ -3773,6 +3830,116 @@ const key = (metaData) => metaData.additional.link?.urlKey ?
|
|
|
3773
3830
|
(element) => get(element, metaData.key);
|
|
3774
3831
|
const parseInterpolated = (interpolatedString, element) => interpolatedString.replace(/{([^}]+)}/g, (_, key) => get(element, key));
|
|
3775
3832
|
|
|
3833
|
+
class TableBuilderStateStore extends ComponentStore {
|
|
3834
|
+
constructor() {
|
|
3835
|
+
super(loadGlobalStorageState());
|
|
3836
|
+
//selectors
|
|
3837
|
+
this.selectLocalProfile = (key) => this.select(state => state.localProfiles[key]);
|
|
3838
|
+
this.selectLocalProfileState = (key) => this.select(this.selectLocalProfile(key), (profile) => {
|
|
3839
|
+
if (profile) {
|
|
3840
|
+
return profile.states[profile.current ?? profile.default];
|
|
3841
|
+
}
|
|
3842
|
+
return null;
|
|
3843
|
+
});
|
|
3844
|
+
this.selectLocalProfileCurrentKey = (key) => this.select(this.selectLocalProfile(key), (profile) => {
|
|
3845
|
+
if (profile) {
|
|
3846
|
+
return profile.current ?? profile.default;
|
|
3847
|
+
}
|
|
3848
|
+
return 'default';
|
|
3849
|
+
});
|
|
3850
|
+
this.selectLocalProfileKeys = (key) => this.select(this.selectLocalProfile(key), (profile) => {
|
|
3851
|
+
if (profile) {
|
|
3852
|
+
return Object.keys(profile.states).filter(key => key);
|
|
3853
|
+
}
|
|
3854
|
+
return null;
|
|
3855
|
+
});
|
|
3856
|
+
// reducers
|
|
3857
|
+
this.setLocalProfile = this.updater((state, props) => {
|
|
3858
|
+
let profile = state.localProfiles[props.key];
|
|
3859
|
+
if (!profile) {
|
|
3860
|
+
profile = { default: 'default', current: 'default', states: {
|
|
3861
|
+
default: props.value
|
|
3862
|
+
} };
|
|
3863
|
+
}
|
|
3864
|
+
else {
|
|
3865
|
+
profile = { ...profile, states: { ...profile.states, [profile.current ?? profile.default]: props.value } };
|
|
3866
|
+
}
|
|
3867
|
+
return { ...state, localProfiles: { ...state.localProfiles, [props.key]: profile } };
|
|
3868
|
+
});
|
|
3869
|
+
this.setLocalProfilesState = this.updater((state, props) => {
|
|
3870
|
+
let profile = state.localProfiles[props.key];
|
|
3871
|
+
if (!profile) {
|
|
3872
|
+
profile = { default: props.current, current: props.current, states: { [props.current]: null } };
|
|
3873
|
+
}
|
|
3874
|
+
else {
|
|
3875
|
+
const state = profile.states[props.current] ?? profile.states[profile.current ?? profile.default];
|
|
3876
|
+
profile = { ...profile, current: props.current, states: { ...profile.states, [props.current]: state } };
|
|
3877
|
+
}
|
|
3878
|
+
return { ...state, localProfiles: { ...state.localProfiles, [props.key]: profile } };
|
|
3879
|
+
});
|
|
3880
|
+
this.deleteLocalProfilesState = this.updater((state, props) => {
|
|
3881
|
+
let profile = state.localProfiles[props.key];
|
|
3882
|
+
if (profile) {
|
|
3883
|
+
const current = profile.current === props.stateKey ? profile.default : profile.current;
|
|
3884
|
+
profile = { ...profile, current, states: { ...profile.states } };
|
|
3885
|
+
delete profile.states[props.stateKey];
|
|
3886
|
+
return { ...state, localProfiles: { ...state.localProfiles, [props.key]: profile } };
|
|
3887
|
+
}
|
|
3888
|
+
else {
|
|
3889
|
+
return state;
|
|
3890
|
+
}
|
|
3891
|
+
});
|
|
3892
|
+
// effects
|
|
3893
|
+
this.saveLocalProfile = this.effect((props$) => props$.pipe(filter$1(action => !!action.persist), concatLatestFrom((action) => this.selectLocalProfile(action.key)), tap$1(([action, profile]) => {
|
|
3894
|
+
const globalSavedState = JSON.parse(localStorage.getItem('global-state-storage') ?? JSON.stringify(defaultStorageState));
|
|
3895
|
+
if (!profile) {
|
|
3896
|
+
profile = { default: 'default', current: 'default', states: { default: action.value } };
|
|
3897
|
+
globalSavedState.localProfiles[action.key] = profile;
|
|
3898
|
+
}
|
|
3899
|
+
{
|
|
3900
|
+
if (!globalSavedState.localProfiles[action.key]) {
|
|
3901
|
+
globalSavedState.localProfiles[action.key] = { ...profile, states: { [profile.current ?? profile.default]: action.value } };
|
|
3902
|
+
}
|
|
3903
|
+
else {
|
|
3904
|
+
globalSavedState.localProfiles[action.key].states[profile.current ?? profile.default] = action.value;
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
localStorage.setItem('global-state-storage', JSON.stringify(globalSavedState));
|
|
3908
|
+
this.setLocalProfile(action);
|
|
3909
|
+
})));
|
|
3910
|
+
this.deleteLocalProfile = this.effect((props$) => props$.pipe(tap$1((props) => {
|
|
3911
|
+
const globalSavedState = JSON.parse(localStorage.getItem('global-state-storage') ?? JSON.stringify(defaultStorageState));
|
|
3912
|
+
if (!globalSavedState.localProfiles[props.key]) {
|
|
3913
|
+
return;
|
|
3914
|
+
}
|
|
3915
|
+
else {
|
|
3916
|
+
delete globalSavedState.localProfiles[props.key].states[props.stateKey];
|
|
3917
|
+
}
|
|
3918
|
+
localStorage.setItem('global-state-storage', JSON.stringify(globalSavedState));
|
|
3919
|
+
this.deleteLocalProfilesState(props);
|
|
3920
|
+
})));
|
|
3921
|
+
}
|
|
3922
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableBuilderStateStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3923
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableBuilderStateStore, providedIn: 'root' }); }
|
|
3924
|
+
}
|
|
3925
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableBuilderStateStore, decorators: [{
|
|
3926
|
+
type: Injectable,
|
|
3927
|
+
args: [{ providedIn: 'root' }]
|
|
3928
|
+
}], ctorParameters: () => [] });
|
|
3929
|
+
function loadGlobalStorageState() {
|
|
3930
|
+
const storage = localStorage.getItem('global-state-storage');
|
|
3931
|
+
if (storage) {
|
|
3932
|
+
return { ...defaultStorageState, ...JSON.parse(storage) };
|
|
3933
|
+
}
|
|
3934
|
+
return defaultStorageState;
|
|
3935
|
+
}
|
|
3936
|
+
const defaultStorageState = {
|
|
3937
|
+
globalProfileKeys: ['Default'],
|
|
3938
|
+
currentGlobalProfile: 'Default',
|
|
3939
|
+
globalProfiles: {},
|
|
3940
|
+
localProfiles: {}
|
|
3941
|
+
};
|
|
3942
|
+
|
|
3776
3943
|
class GroupByListComponent {
|
|
3777
3944
|
constructor() {
|
|
3778
3945
|
this.tableStore = inject(TableStore);
|
|
@@ -3803,10 +3970,10 @@ class SortMenuComponentStore extends ComponentStore {
|
|
|
3803
3970
|
return ({ ...state, sorted });
|
|
3804
3971
|
});
|
|
3805
3972
|
this.reset = () => {
|
|
3806
|
-
const sorted = this.tableState.
|
|
3973
|
+
const sorted = this.tableState.sort$.pipe(mergeMap(sort => this.tableState.metaData$.pipe(notNull(), map(meta => sort.map(s => {
|
|
3807
3974
|
return { ...s, displayName: meta[s.active]?.displayName };
|
|
3808
3975
|
})))));
|
|
3809
|
-
const notSorted = this.tableState.metaDataArray$.pipe(mergeMap(metas => this.tableState.
|
|
3976
|
+
const notSorted = this.tableState.metaDataArray$.pipe(mergeMap(metas => this.tableState.sort$.pipe(map(s => metas
|
|
3810
3977
|
.filter(meta => !s.some(s => s.active === meta.key) && !meta.noSort)
|
|
3811
3978
|
.map(meta => ({ active: meta.key, displayName: meta.displayName }))))));
|
|
3812
3979
|
this.set(combineLatest([
|
|
@@ -3873,7 +4040,7 @@ class SortMenuComponent {
|
|
|
3873
4040
|
this.store.setDirection(sort);
|
|
3874
4041
|
}
|
|
3875
4042
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: SortMenuComponent, deps: [{ token: TableStore }, { token: SortMenuComponentStore }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3876
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: SortMenuComponent, isStandalone: true, selector: "tb-sort-menu", providers: [SortMenuComponentStore], ngImport: i0, template: "<ng-container *ngrxLet=\"dirty$ as dirty\">\r\n @if(sorted$ | async; as sorted){\r\n @if (notSorted$ | async; as notSorted) {\r\n <!-- Menu Trigger -->\r\n <span matTooltip=\"Sort\">\r\n <button mat-icon-button [matMenuTriggerFor]=\"menu\">\r\n <mat-icon color=\"primary\">swap_vert</mat-icon>\r\n </button>\r\n </span>\r\n\r\n <!-- Menu -->\r\n <mat-menu #menu=\"matMenu\" class=\"my-mat-menu\" (closed)=\"reset()\">\r\n <div mat-menu-item class=\"menu-button\">\r\n <div class=\"close-button-wrapper\">\r\n <span matTooltip=\"Close\">\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n @if(dirty){\r\n <span matTooltip=\"Undo\" stop-propagation (click)=\"reset()\">\r\n <mat-icon>undo</mat-icon>\r\n </span>\r\n }\r\n \r\n </div>\r\n </div>\r\n\r\n <!-- Apply Button -->\r\n <div class=\"apply-button-wrapper\">\r\n <button mat-button color=\"primary\" (click)=\"apply(null)\"\r\n stop-propagation [class.apply-border]=\"dirty\"\r\n [disabled]=\"!dirty\">\r\n Apply @if (dirty) { Unsaved Changes }\r\n </button>\r\n </div>\r\n\r\n <!-- Default Sorting Text -->\r\n @if (!sorted.length) {\r\n <div class=\"tip\" >\r\n Sorting List\r\n </div>\r\n }\r\n\r\n <!-- Sorted Menu List -->\r\n <div class=\"list\"\r\n cdkDropList\r\n #sortedGroup=\"cdkDropList\"\r\n [cdkDropListConnectedTo]=\"[notSortedGroup]\"\r\n [cdkDropListData]=\"sorted\"\r\n (cdkDropListDropped)=\"dropIntoSorted($event)\">\r\n\r\n <!-- Menu Item Wrapper -->\r\n @for (sort of sorted; track sort.active) {\r\n <!-- Menu Item Headers -->\r\n @if (sorted.length > 1) {\r\n <span class=\"description sort-header\">{{$index === 0 ? 'First By' : 'Then By'}}</span>\r\n }\r\n \r\n <!-- Menu Item -->\r\n <div mat-menu-item cdkDrag class=\"menu-item\">\r\n <div class=\"sort-item\">\r\n <span class=\"sorted-name\">\r\n {{sort.displayName || (sort.active | spaceCase)}}\r\n <span class=\"direction-text\">{{sort.direction}}</span>\r\n </span>\r\n \r\n <!-- Sort Direction Buttons -->\r\n <div class=\"up-down-buttons-wrapper\">\r\n <button class=\"up-down-button up-button\" stop-propagation\r\n (click)=\"setDirection({active:sort.active,direction:SortDirection.asc,displayName:sort.displayName})\">\r\n <mat-icon [ngClass]=\"sort.direction !== SortDirection.asc ? 'light-arrow' : 'dark-arrow'\" class=\"up-down-icon\">\r\n arrow_upward\r\n </mat-icon>\r\n </button>\r\n \r\n <button class=\"up-down-button\" stop-propagation\r\n (click)=\"setDirection({active:sort.active,direction:SortDirection.desc,displayName:sort.displayName})\">\r\n <mat-icon [ngClass]=\"sort.direction === SortDirection.asc ? 'light-arrow' : 'dark-arrow'\" class=\"up-down-icon\">\r\n arrow_downward\r\n </mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n <!-- Default Not Sorted Text -->\r\n @if(!notSorted.length){\r\n <div class=\"tip\" >\r\n Not Sorted List\r\n </div>\r\n }\r\n\r\n <!-- Not Sorted Menu List -->\r\n <div class=\"list\"\r\n cdkDropList\r\n #notSortedGroup=\"cdkDropList\"\r\n [cdkDropListConnectedTo]=\"[sortedGroup]\"\r\n [cdkDropListData]=\"notSorted\"\r\n (cdkDropListDropped)=\"dropIntoNotSorted($event)\">\r\n @for (sort of notSorted; track sort.active) {\r\n <div mat-menu-item class=\"menu-item\" cdkDrag>\r\n <span class=\"not-sorted-name\">{{sort.displayName || (sort.active | spaceCase)}}</span>\r\n </div>\r\n }\r\n </div>\r\n </mat-menu>\r\n }\r\n }\r\n</ng-container>\r\n", styles: [".cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list{padding:5px 2px;border-bottom:solid 1px #ccc;color:#000000de;background:white}.light-arrow{color:#93b1ea78}.dark-arrow{color:#224e9c}.up-down-button{background-color:#fff;border-radius:30%;border-color:#0ff;padding:1px 1px 0;border-width:.5px;cursor:pointer;height:27px}.mat-icon.up-down-icon{margin-right:0;font-size:20px;font-weight:lighter}.sort-item{display:flex;align-items:center;justify-content:space-between}.up-down-buttons-wrapper{margin-left:2rem}.up-button{margin-right:.3rem}.mat-mdc-menu-item.menu-item,.mat-mdc-menu-item.menu-button{min-height:initial;padding:0 3px;line-height:25px;height:30px}.mat-mdc-menu-item.menu-item{cursor:move}.sorted-name{color:#224e9c;font-size:17px;font-weight:700}.not-sorted-name{color:#93b1ea;font-size:17px;font-weight:700}.apply-border{border:#224e9c solid .5px}.apply-border:hover{background-color:#faebd7}.apply-button-wrapper{display:grid;justify-content:center}.sort-header{font-size:10px;font-style:italic}.tip{padding:0 3px;color:#d3d3d3}.direction-text{font-size:small;font-weight:400}.close-button-wrapper{display:flex;flex-direction:row-reverse}\n"], dependencies: [{ kind: "directive", type: LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i4$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i14.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: i14.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i14.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type:
|
|
4043
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: SortMenuComponent, isStandalone: true, selector: "tb-sort-menu", providers: [SortMenuComponentStore], ngImport: i0, template: "<ng-container *ngrxLet=\"dirty$ as dirty\">\r\n @if(sorted$ | async; as sorted){\r\n @if (notSorted$ | async; as notSorted) {\r\n <!-- Menu Trigger -->\r\n <span matTooltip=\"Sort\">\r\n <button mat-icon-button [matMenuTriggerFor]=\"menu\">\r\n <mat-icon color=\"primary\">swap_vert</mat-icon>\r\n </button>\r\n </span>\r\n\r\n <!-- Menu -->\r\n <mat-menu #menu=\"matMenu\" class=\"my-mat-menu\" (closed)=\"reset()\">\r\n <div mat-menu-item class=\"menu-button\">\r\n <div class=\"close-button-wrapper\">\r\n <span matTooltip=\"Close\">\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n @if(dirty){\r\n <span matTooltip=\"Undo\" stop-propagation (click)=\"reset()\">\r\n <mat-icon>undo</mat-icon>\r\n </span>\r\n }\r\n \r\n </div>\r\n </div>\r\n\r\n <!-- Apply Button -->\r\n <div class=\"apply-button-wrapper\">\r\n <button mat-button color=\"primary\" (click)=\"apply(null)\"\r\n stop-propagation [class.apply-border]=\"dirty\"\r\n [disabled]=\"!dirty\">\r\n Apply @if (dirty) { Unsaved Changes }\r\n </button>\r\n </div>\r\n\r\n <!-- Default Sorting Text -->\r\n @if (!sorted.length) {\r\n <div class=\"tip\" >\r\n Sorting List\r\n </div>\r\n }\r\n\r\n <!-- Sorted Menu List -->\r\n <div class=\"list\"\r\n cdkDropList\r\n #sortedGroup=\"cdkDropList\"\r\n [cdkDropListConnectedTo]=\"[notSortedGroup]\"\r\n [cdkDropListData]=\"sorted\"\r\n (cdkDropListDropped)=\"dropIntoSorted($event)\">\r\n\r\n <!-- Menu Item Wrapper -->\r\n @for (sort of sorted; track sort.active) {\r\n <!-- Menu Item Headers -->\r\n @if (sorted.length > 1) {\r\n <span class=\"description sort-header\">{{$index === 0 ? 'First By' : 'Then By'}}</span>\r\n }\r\n \r\n <!-- Menu Item -->\r\n <div mat-menu-item cdkDrag class=\"menu-item\">\r\n <div class=\"sort-item\">\r\n <span class=\"sorted-name\">\r\n {{sort.displayName || (sort.active | spaceCase)}}\r\n <span class=\"direction-text\">{{sort.direction}}</span>\r\n </span>\r\n \r\n <!-- Sort Direction Buttons -->\r\n <div class=\"up-down-buttons-wrapper\">\r\n <button class=\"up-down-button up-button\" stop-propagation\r\n (click)=\"setDirection({active:sort.active,direction:SortDirection.asc,displayName:sort.displayName})\">\r\n <mat-icon [ngClass]=\"sort.direction !== SortDirection.asc ? 'light-arrow' : 'dark-arrow'\" class=\"up-down-icon\">\r\n arrow_upward\r\n </mat-icon>\r\n </button>\r\n \r\n <button class=\"up-down-button\" stop-propagation\r\n (click)=\"setDirection({active:sort.active,direction:SortDirection.desc,displayName:sort.displayName})\">\r\n <mat-icon [ngClass]=\"sort.direction === SortDirection.asc ? 'light-arrow' : 'dark-arrow'\" class=\"up-down-icon\">\r\n arrow_downward\r\n </mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n <!-- Default Not Sorted Text -->\r\n @if(!notSorted.length){\r\n <div class=\"tip\" >\r\n Not Sorted List\r\n </div>\r\n }\r\n\r\n <!-- Not Sorted Menu List -->\r\n <div class=\"list\"\r\n cdkDropList\r\n #notSortedGroup=\"cdkDropList\"\r\n [cdkDropListConnectedTo]=\"[sortedGroup]\"\r\n [cdkDropListData]=\"notSorted\"\r\n (cdkDropListDropped)=\"dropIntoNotSorted($event)\">\r\n @for (sort of notSorted; track sort.active) {\r\n <div mat-menu-item class=\"menu-item\" cdkDrag>\r\n <span class=\"not-sorted-name\">{{sort.displayName || (sort.active | spaceCase)}}</span>\r\n </div>\r\n }\r\n </div>\r\n </mat-menu>\r\n }\r\n }\r\n</ng-container>\r\n", styles: [".cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list{padding:5px 2px;border-bottom:solid 1px #ccc;color:#000000de;background:white}.light-arrow{color:#93b1ea78}.dark-arrow{color:#224e9c}.up-down-button{background-color:#fff;border-radius:30%;border-color:#0ff;padding:1px 1px 0;border-width:.5px;cursor:pointer;height:27px}.mat-icon.up-down-icon{margin-right:0;font-size:20px;font-weight:lighter}.sort-item{display:flex;align-items:center;justify-content:space-between}.up-down-buttons-wrapper{margin-left:2rem}.up-button{margin-right:.3rem}.mat-mdc-menu-item.menu-item,.mat-mdc-menu-item.menu-button{min-height:initial;padding:0 3px;line-height:25px;height:30px}.mat-mdc-menu-item.menu-item{cursor:move}.sorted-name{color:#224e9c;font-size:17px;font-weight:700}.not-sorted-name{color:#93b1ea;font-size:17px;font-weight:700}.apply-border{border:#224e9c solid .5px}.apply-border:hover{background-color:#faebd7}.apply-button-wrapper{display:grid;justify-content:center}.sort-header{font-size:10px;font-style:italic}.tip{padding:0 3px;color:#d3d3d3}.direction-text{font-size:small;font-weight:400}.close-button-wrapper{display:flex;flex-direction:row-reverse}\n"], dependencies: [{ kind: "directive", type: LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i4$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i14.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: i14.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i14.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i5$2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i5$2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "pipe", type: SpaceCasePipe, name: "spaceCase" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3877
4044
|
}
|
|
3878
4045
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: SortMenuComponent, decorators: [{
|
|
3879
4046
|
type: Component,
|
|
@@ -3883,7 +4050,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
3883
4050
|
], template: "<ng-container *ngrxLet=\"dirty$ as dirty\">\r\n @if(sorted$ | async; as sorted){\r\n @if (notSorted$ | async; as notSorted) {\r\n <!-- Menu Trigger -->\r\n <span matTooltip=\"Sort\">\r\n <button mat-icon-button [matMenuTriggerFor]=\"menu\">\r\n <mat-icon color=\"primary\">swap_vert</mat-icon>\r\n </button>\r\n </span>\r\n\r\n <!-- Menu -->\r\n <mat-menu #menu=\"matMenu\" class=\"my-mat-menu\" (closed)=\"reset()\">\r\n <div mat-menu-item class=\"menu-button\">\r\n <div class=\"close-button-wrapper\">\r\n <span matTooltip=\"Close\">\r\n <mat-icon>close</mat-icon>\r\n </span>\r\n @if(dirty){\r\n <span matTooltip=\"Undo\" stop-propagation (click)=\"reset()\">\r\n <mat-icon>undo</mat-icon>\r\n </span>\r\n }\r\n \r\n </div>\r\n </div>\r\n\r\n <!-- Apply Button -->\r\n <div class=\"apply-button-wrapper\">\r\n <button mat-button color=\"primary\" (click)=\"apply(null)\"\r\n stop-propagation [class.apply-border]=\"dirty\"\r\n [disabled]=\"!dirty\">\r\n Apply @if (dirty) { Unsaved Changes }\r\n </button>\r\n </div>\r\n\r\n <!-- Default Sorting Text -->\r\n @if (!sorted.length) {\r\n <div class=\"tip\" >\r\n Sorting List\r\n </div>\r\n }\r\n\r\n <!-- Sorted Menu List -->\r\n <div class=\"list\"\r\n cdkDropList\r\n #sortedGroup=\"cdkDropList\"\r\n [cdkDropListConnectedTo]=\"[notSortedGroup]\"\r\n [cdkDropListData]=\"sorted\"\r\n (cdkDropListDropped)=\"dropIntoSorted($event)\">\r\n\r\n <!-- Menu Item Wrapper -->\r\n @for (sort of sorted; track sort.active) {\r\n <!-- Menu Item Headers -->\r\n @if (sorted.length > 1) {\r\n <span class=\"description sort-header\">{{$index === 0 ? 'First By' : 'Then By'}}</span>\r\n }\r\n \r\n <!-- Menu Item -->\r\n <div mat-menu-item cdkDrag class=\"menu-item\">\r\n <div class=\"sort-item\">\r\n <span class=\"sorted-name\">\r\n {{sort.displayName || (sort.active | spaceCase)}}\r\n <span class=\"direction-text\">{{sort.direction}}</span>\r\n </span>\r\n \r\n <!-- Sort Direction Buttons -->\r\n <div class=\"up-down-buttons-wrapper\">\r\n <button class=\"up-down-button up-button\" stop-propagation\r\n (click)=\"setDirection({active:sort.active,direction:SortDirection.asc,displayName:sort.displayName})\">\r\n <mat-icon [ngClass]=\"sort.direction !== SortDirection.asc ? 'light-arrow' : 'dark-arrow'\" class=\"up-down-icon\">\r\n arrow_upward\r\n </mat-icon>\r\n </button>\r\n \r\n <button class=\"up-down-button\" stop-propagation\r\n (click)=\"setDirection({active:sort.active,direction:SortDirection.desc,displayName:sort.displayName})\">\r\n <mat-icon [ngClass]=\"sort.direction === SortDirection.asc ? 'light-arrow' : 'dark-arrow'\" class=\"up-down-icon\">\r\n arrow_downward\r\n </mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n <!-- Default Not Sorted Text -->\r\n @if(!notSorted.length){\r\n <div class=\"tip\" >\r\n Not Sorted List\r\n </div>\r\n }\r\n\r\n <!-- Not Sorted Menu List -->\r\n <div class=\"list\"\r\n cdkDropList\r\n #notSortedGroup=\"cdkDropList\"\r\n [cdkDropListConnectedTo]=\"[sortedGroup]\"\r\n [cdkDropListData]=\"notSorted\"\r\n (cdkDropListDropped)=\"dropIntoNotSorted($event)\">\r\n @for (sort of notSorted; track sort.active) {\r\n <div mat-menu-item class=\"menu-item\" cdkDrag>\r\n <span class=\"not-sorted-name\">{{sort.displayName || (sort.active | spaceCase)}}</span>\r\n </div>\r\n }\r\n </div>\r\n </mat-menu>\r\n }\r\n }\r\n</ng-container>\r\n", styles: [".cdk-drag-preview{box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list{padding:5px 2px;border-bottom:solid 1px #ccc;color:#000000de;background:white}.light-arrow{color:#93b1ea78}.dark-arrow{color:#224e9c}.up-down-button{background-color:#fff;border-radius:30%;border-color:#0ff;padding:1px 1px 0;border-width:.5px;cursor:pointer;height:27px}.mat-icon.up-down-icon{margin-right:0;font-size:20px;font-weight:lighter}.sort-item{display:flex;align-items:center;justify-content:space-between}.up-down-buttons-wrapper{margin-left:2rem}.up-button{margin-right:.3rem}.mat-mdc-menu-item.menu-item,.mat-mdc-menu-item.menu-button{min-height:initial;padding:0 3px;line-height:25px;height:30px}.mat-mdc-menu-item.menu-item{cursor:move}.sorted-name{color:#224e9c;font-size:17px;font-weight:700}.not-sorted-name{color:#93b1ea;font-size:17px;font-weight:700}.apply-border{border:#224e9c solid .5px}.apply-border:hover{background-color:#faebd7}.apply-button-wrapper{display:grid;justify-content:center}.sort-header{font-size:10px;font-style:italic}.tip{padding:0 3px;color:#d3d3d3}.direction-text{font-size:small;font-weight:400}.close-button-wrapper{display:flex;flex-direction:row-reverse}\n"] }]
|
|
3884
4051
|
}], ctorParameters: () => [{ type: TableStore }, { type: SortMenuComponentStore }] });
|
|
3885
4052
|
|
|
3886
|
-
const
|
|
4053
|
+
const containerImports = [
|
|
3887
4054
|
AsyncPipe, NgTemplateOutlet,
|
|
3888
4055
|
LetDirective,
|
|
3889
4056
|
MultiSortDirective, GroupByListComponent, FilterChipsComponent, GenFilterDisplayerComponent, GenColDisplayerComponent,
|
|
@@ -3891,115 +4058,120 @@ const i = [
|
|
|
3891
4058
|
MatButtonModule, MatMenuModule, MatIconModule, MatTooltipModule, MatInputModule
|
|
3892
4059
|
];
|
|
3893
4060
|
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
return null;
|
|
3904
|
-
});
|
|
3905
|
-
this.selectLocalProfileCurrentKey = (key) => this.select(this.selectLocalProfile(key), (profile) => {
|
|
3906
|
-
if (profile) {
|
|
3907
|
-
return profile.current ?? profile.default;
|
|
3908
|
-
}
|
|
3909
|
-
return 'default';
|
|
3910
|
-
});
|
|
3911
|
-
this.selectLocalProfileKeys = (key) => this.select(this.selectLocalProfile(key), (profile) => {
|
|
3912
|
-
if (profile) {
|
|
3913
|
-
return Object.keys(profile.states).filter(key => key);
|
|
3914
|
-
}
|
|
3915
|
-
return null;
|
|
3916
|
-
});
|
|
3917
|
-
// reducers
|
|
3918
|
-
this.setLocalProfile = this.updater((state, props) => {
|
|
3919
|
-
let profile = state.localProfiles[props.key];
|
|
3920
|
-
if (!profile) {
|
|
3921
|
-
profile = { default: 'default', current: 'default', states: {
|
|
3922
|
-
default: props.value
|
|
3923
|
-
} };
|
|
3924
|
-
}
|
|
3925
|
-
else {
|
|
3926
|
-
profile = { ...profile, states: { ...profile.states, [profile.current ?? profile.default]: props.value } };
|
|
3927
|
-
}
|
|
3928
|
-
return { ...state, localProfiles: { ...state.localProfiles, [props.key]: profile } };
|
|
3929
|
-
});
|
|
3930
|
-
this.setLocalProfilesState = this.updater((state, props) => {
|
|
3931
|
-
let profile = state.localProfiles[props.key];
|
|
3932
|
-
if (!profile) {
|
|
3933
|
-
profile = { default: props.current, current: props.current, states: { [props.current]: null } };
|
|
3934
|
-
}
|
|
3935
|
-
else {
|
|
3936
|
-
const state = profile.states[props.current] ?? profile.states[profile.current ?? profile.default];
|
|
3937
|
-
profile = { ...profile, current: props.current, states: { ...profile.states, [props.current]: state } };
|
|
3938
|
-
}
|
|
3939
|
-
return { ...state, localProfiles: { ...state.localProfiles, [props.key]: profile } };
|
|
3940
|
-
});
|
|
3941
|
-
this.deleteLocalProfilesState = this.updater((state, props) => {
|
|
3942
|
-
let profile = state.localProfiles[props.key];
|
|
3943
|
-
if (profile) {
|
|
3944
|
-
const current = profile.current === props.stateKey ? profile.default : profile.current;
|
|
3945
|
-
profile = { ...profile, current, states: { ...profile.states } };
|
|
3946
|
-
delete profile.states[props.stateKey];
|
|
3947
|
-
return { ...state, localProfiles: { ...state.localProfiles, [props.key]: profile } };
|
|
3948
|
-
}
|
|
3949
|
-
else {
|
|
3950
|
-
return state;
|
|
3951
|
-
}
|
|
3952
|
-
});
|
|
3953
|
-
// effects
|
|
3954
|
-
this.saveLocalProfile = this.effect((props$) => props$.pipe(filter$1(action => !!action.persist), concatLatestFrom((action) => this.selectLocalProfile(action.key)), tap$1(([action, profile]) => {
|
|
3955
|
-
const globalSavedState = JSON.parse(localStorage.getItem('global-state-storage') ?? JSON.stringify(defaultStorageState));
|
|
3956
|
-
if (!profile) {
|
|
3957
|
-
profile = { default: 'default', current: 'default', states: { default: action.value } };
|
|
3958
|
-
globalSavedState.localProfiles[action.key] = profile;
|
|
3959
|
-
}
|
|
3960
|
-
{
|
|
3961
|
-
if (!globalSavedState.localProfiles[action.key]) {
|
|
3962
|
-
globalSavedState.localProfiles[action.key] = { ...profile, states: { [profile.current ?? profile.default]: action.value } };
|
|
3963
|
-
}
|
|
3964
|
-
else {
|
|
3965
|
-
globalSavedState.localProfiles[action.key].states[profile.current ?? profile.default] = action.value;
|
|
3966
|
-
}
|
|
3967
|
-
}
|
|
3968
|
-
localStorage.setItem('global-state-storage', JSON.stringify(globalSavedState));
|
|
3969
|
-
this.setLocalProfile(action);
|
|
3970
|
-
})));
|
|
3971
|
-
this.deleteLocalProfile = this.effect((props$) => props$.pipe(tap$1((props) => {
|
|
3972
|
-
const globalSavedState = JSON.parse(localStorage.getItem('global-state-storage') ?? JSON.stringify(defaultStorageState));
|
|
3973
|
-
if (!globalSavedState.localProfiles[props.key]) {
|
|
3974
|
-
return;
|
|
3975
|
-
}
|
|
3976
|
-
else {
|
|
3977
|
-
delete globalSavedState.localProfiles[props.key].states[props.stateKey];
|
|
3978
|
-
}
|
|
3979
|
-
localStorage.setItem('global-state-storage', JSON.stringify(globalSavedState));
|
|
3980
|
-
this.deleteLocalProfilesState(props);
|
|
3981
|
-
})));
|
|
4061
|
+
const updateFilterState = (previousState, [filterInfoDict, predicateArr], index) => {
|
|
4062
|
+
const currentFilterState = {
|
|
4063
|
+
predicateArr: predicateArr.value,
|
|
4064
|
+
filterInfoDict: filterInfoDict.value,
|
|
4065
|
+
allFilters: [...predicateArr.value, ...Object.values(filterInfoDict.value).map(createFilterFunc)],
|
|
4066
|
+
onlyAddedFilters: undefined
|
|
4067
|
+
};
|
|
4068
|
+
if (index === 0) {
|
|
4069
|
+
return currentFilterState;
|
|
3982
4070
|
}
|
|
3983
|
-
|
|
3984
|
-
|
|
4071
|
+
if (filterInfoDict.timestamp > predicateArr.timestamp) {
|
|
4072
|
+
currentFilterState.onlyAddedFilters = filterInfoOnlyAdded(previousState.filterInfoDict, filterInfoDict.value);
|
|
4073
|
+
}
|
|
4074
|
+
else {
|
|
4075
|
+
currentFilterState.onlyAddedFilters = predicatesOnlyAdded(previousState.predicateArr, predicateArr.value);
|
|
4076
|
+
}
|
|
4077
|
+
return currentFilterState;
|
|
4078
|
+
};
|
|
4079
|
+
const predicateAndFilterInfos = (filterInfos, predicates) => {
|
|
4080
|
+
return combineLatest([filterInfos.pipe(map$1(filterNonActiveFilters), timestamp()),
|
|
4081
|
+
predicates.pipe(timestamp())]);
|
|
4082
|
+
};
|
|
4083
|
+
const filterNonActiveFilters = (filtersDict) => Object.entries(filtersDict).reduce((obj, [key, value]) => {
|
|
4084
|
+
if (value.active !== false) {
|
|
4085
|
+
obj[key] = value;
|
|
4086
|
+
}
|
|
4087
|
+
;
|
|
4088
|
+
return obj;
|
|
4089
|
+
}, {});
|
|
4090
|
+
//The idea of this is that if filters were only added, and none were removed or changed, then we only need to tag more rows to not be shown. We don't need to remove any 'dont show' tags.
|
|
4091
|
+
// So if filters were only added this method will return the added filters, if filters were removed or changed this method will return undefined.
|
|
4092
|
+
function filterInfoOnlyAdded(previousFilterInfos, currentFilterInfos) {
|
|
4093
|
+
const previousKeys = Object.keys(previousFilterInfos);
|
|
4094
|
+
const currentKeys = Object.keys(currentFilterInfos);
|
|
4095
|
+
const keysInBoth = intersection(previousKeys, currentKeys);
|
|
4096
|
+
const someRemoved = previousKeys.length > keysInBoth.length;
|
|
4097
|
+
if (someRemoved) {
|
|
4098
|
+
return undefined;
|
|
4099
|
+
}
|
|
4100
|
+
if (filtersUpdated(previousFilterInfos, currentFilterInfos)) {
|
|
4101
|
+
return undefined;
|
|
4102
|
+
}
|
|
4103
|
+
const addedFilters = difference(currentKeys, keysInBoth).map(key => createFilterFunc(currentFilterInfos[key]));
|
|
4104
|
+
return addedFilters;
|
|
3985
4105
|
}
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
function loadGlobalStorageState() {
|
|
3991
|
-
const storage = localStorage.getItem('global-state-storage');
|
|
3992
|
-
if (storage) {
|
|
3993
|
-
return { ...defaultStorageState, ...JSON.parse(storage) };
|
|
4106
|
+
function predicatesOnlyAdded(previousPredicates, currentPredicates) {
|
|
4107
|
+
const predicateFiltersRemoved = difference(previousPredicates, currentPredicates).length;
|
|
4108
|
+
if (predicateFiltersRemoved) {
|
|
4109
|
+
return undefined;
|
|
3994
4110
|
}
|
|
3995
|
-
return
|
|
4111
|
+
return difference(currentPredicates, previousPredicates);
|
|
3996
4112
|
}
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4113
|
+
function filtersUpdated(previousFilterInfos, currentFilterInfos) {
|
|
4114
|
+
return !Object.entries(previousFilterInfos).every(([key, val]) => {
|
|
4115
|
+
return currentFilterInfos[key].filterType === val.filterType && currentFilterInfos[key].filterValue === val.filterValue;
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
const initialFilterState = { allFilters: [], onlyAddedFilters: undefined, predicateArr: [], filterInfoDict: {} };
|
|
4119
|
+
|
|
4120
|
+
function getGroupedData(data, groupByKeys) {
|
|
4121
|
+
return tbGroupBy(data, groupByKeys);
|
|
4122
|
+
}
|
|
4123
|
+
const tbGroupBy = (data, groupByKeys, parentGroupName) => {
|
|
4124
|
+
const currentKey = groupByKeys[0];
|
|
4125
|
+
const res = groupBy(data, currentKey);
|
|
4126
|
+
const remainingGroupByKeys = groupByKeys.slice(1);
|
|
4127
|
+
const finalGroups = !remainingGroupByKeys.length;
|
|
4128
|
+
if (remainingGroupByKeys.length) {
|
|
4129
|
+
Object.keys(res).forEach(key => res[key] = tbGroupBy(res[key], remainingGroupByKeys, key));
|
|
4130
|
+
}
|
|
4131
|
+
return Object.keys(res).map((groupName, i) => {
|
|
4132
|
+
const uniqName = parentGroupName ? `${parentGroupName}-${groupName}` : `${groupName}`;
|
|
4133
|
+
const groupHeaders = res[groupName]?.filter(row => row.isGroupHeader) ?? [];
|
|
4134
|
+
return ({
|
|
4135
|
+
isGroupHeader: true,
|
|
4136
|
+
groupHeaderDisplay: groupName,
|
|
4137
|
+
hasTheData: finalGroups,
|
|
4138
|
+
children: finalGroups ? res[groupName] : res[groupName].map(d => { d.padding += 20; return d; }),
|
|
4139
|
+
groupName: `tb_group_${uniqName}`,
|
|
4140
|
+
padding: 1,
|
|
4141
|
+
key: currentKey,
|
|
4142
|
+
length: groupHeaders.reduce((acc, curr) => curr.length + acc, 0) + ((res[groupName] ?? []).length - groupHeaders.length),
|
|
4143
|
+
[initIndexSymbol]: uniqName,
|
|
4144
|
+
});
|
|
4145
|
+
});
|
|
4002
4146
|
};
|
|
4147
|
+
function updateGroupByState({ groupedData }, [data, groups, expandedGroups], index) {
|
|
4148
|
+
if (index === 0
|
|
4149
|
+
|| dataUpdated(data, groups, expandedGroups)
|
|
4150
|
+
|| groupsUpdated(groups, expandedGroups)) {
|
|
4151
|
+
groupedData = groups.value.length ? getGroupedData(data.value, groups.value) : data.value;
|
|
4152
|
+
}
|
|
4153
|
+
const newDisplayData = expandedGroups.value.length === 0
|
|
4154
|
+
? groupedData
|
|
4155
|
+
: groupedData.map(group => mapGroupHeader(group, expandedGroups.value)).flat();
|
|
4156
|
+
return ({ displayData: newDisplayData, groupedData });
|
|
4157
|
+
}
|
|
4158
|
+
function mapGroupHeader(obj, data) {
|
|
4159
|
+
const showChildren = data.find(a => a.expandedHeaders.includes(obj.groupName));
|
|
4160
|
+
const children = !showChildren ? [] :
|
|
4161
|
+
obj.hasTheData ? obj.children
|
|
4162
|
+
: obj.children.map(a => mapGroupHeader(a, data));
|
|
4163
|
+
return [obj, ...children].flat();
|
|
4164
|
+
}
|
|
4165
|
+
function dataUpdated(data, groups, expandedGroups) {
|
|
4166
|
+
return data.timestamp > groups.timestamp && data.timestamp > expandedGroups.timestamp;
|
|
4167
|
+
}
|
|
4168
|
+
function groupsUpdated(groups, expandedGroups) {
|
|
4169
|
+
return groups.timestamp > expandedGroups.timestamp;
|
|
4170
|
+
}
|
|
4171
|
+
;
|
|
4172
|
+
const initialGroupByState = { displayData: [], groupedData: [] };
|
|
4173
|
+
|
|
4174
|
+
const initialDataState = { mappedData: [] };
|
|
4003
4175
|
|
|
4004
4176
|
class TableContainerComponent {
|
|
4005
4177
|
constructor() {
|
|
@@ -4007,6 +4179,8 @@ class TableContainerComponent {
|
|
|
4007
4179
|
this.selectionColumn = false;
|
|
4008
4180
|
this.isSticky = true;
|
|
4009
4181
|
this.selection$ = new EventEmitter();
|
|
4182
|
+
this.displayDataSubject = new ReplaySubject(1);
|
|
4183
|
+
this.displayData = this.displayDataSubject.pipe(switchAll(), delay$1(0), defaultShareReplay());
|
|
4010
4184
|
this.dataSubject = new ReplaySubject(1);
|
|
4011
4185
|
this.data = this.dataSubject.pipe(switchAll(), defaultShareReplay());
|
|
4012
4186
|
this.onStateReset = new EventEmitter();
|
|
@@ -4033,54 +4207,45 @@ class TableContainerComponent {
|
|
|
4033
4207
|
return meta;
|
|
4034
4208
|
};
|
|
4035
4209
|
this.collapseHeader$ = this.state.state$.pipe(map(state => state.persistedTableSettings.collapseHeader));
|
|
4036
|
-
this.
|
|
4037
|
-
let
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
if (remainingGroupByKeys.length) {
|
|
4041
|
-
Object.keys(res).forEach(key => res[key] = this.tbGroupBy(res[key], remainingGroupByKeys, key));
|
|
4210
|
+
this.addFilterDirectives = (state) => {
|
|
4211
|
+
let allFilterDirectives = [...this.filterDirectives, ...this.customFilterDirectives];
|
|
4212
|
+
if (this.wrapper) {
|
|
4213
|
+
allFilterDirectives = [...allFilterDirectives, ...this.wrapper.registrations];
|
|
4042
4214
|
}
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
d.padding += 20;
|
|
4215
|
+
const customFilters = [];
|
|
4216
|
+
allFilterDirectives.filter(f => !f.used).forEach(f => {
|
|
4217
|
+
f.used = true;
|
|
4218
|
+
if (f.savable) {
|
|
4219
|
+
var filter = state.filters[f.filterId];
|
|
4220
|
+
if (isFilterInfo(filter)) {
|
|
4221
|
+
const filterDirective = f;
|
|
4222
|
+
filterDirective.fieldType = filter.fieldType;
|
|
4223
|
+
filterDirective.filterType = filter.filterType;
|
|
4224
|
+
filterDirective.setFilterValue(filter.filterValue);
|
|
4225
|
+
filterDirective.key = filter.key;
|
|
4226
|
+
filterDirective.update();
|
|
4227
|
+
}
|
|
4228
|
+
if (isCustomFilter(filter)) {
|
|
4229
|
+
f.active = filter.active ?? false;
|
|
4230
|
+
}
|
|
4231
|
+
this.state.addFilter(f.filter$);
|
|
4061
4232
|
}
|
|
4062
4233
|
else {
|
|
4063
|
-
|
|
4234
|
+
customFilters.push(f);
|
|
4064
4235
|
}
|
|
4065
|
-
}
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
}
|
|
4079
|
-
const parentGroup = groups?.find(g => g.groupName == currentGroup.parentGroupName);
|
|
4080
|
-
if (parentGroup) {
|
|
4081
|
-
return this.shouldDisplay(parentGroup, groups);
|
|
4082
|
-
}
|
|
4083
|
-
return true;
|
|
4236
|
+
});
|
|
4237
|
+
const customFilters$ = from(customFilters.map(cf => cf.filter$)).pipe(mergeAll(), scan$1((a, b) => {
|
|
4238
|
+
if (b.active) {
|
|
4239
|
+
a[b.filterId] = isCustomFilter(b) ? b.predicate : createFilterFunc(b);
|
|
4240
|
+
}
|
|
4241
|
+
else {
|
|
4242
|
+
delete a[b.filterId];
|
|
4243
|
+
}
|
|
4244
|
+
return a;
|
|
4245
|
+
}, {}), map(f => Object.values(f)));
|
|
4246
|
+
this.state.on(customFilters$, (f) => {
|
|
4247
|
+
this.customFilters$.next(f);
|
|
4248
|
+
});
|
|
4084
4249
|
};
|
|
4085
4250
|
}
|
|
4086
4251
|
set pageSize(value) {
|
|
@@ -4093,8 +4258,8 @@ class TableContainerComponent {
|
|
|
4093
4258
|
this.genericTableComponent?.paginatorComponent?.paginator?.lastPage();
|
|
4094
4259
|
}
|
|
4095
4260
|
resetState() {
|
|
4096
|
-
this.
|
|
4097
|
-
this.
|
|
4261
|
+
this.customFilterDirectives.forEach(cf => cf.reset());
|
|
4262
|
+
this.filterDirectives.forEach(cf => cf.reset());
|
|
4098
4263
|
this.state.resetState();
|
|
4099
4264
|
this.onStateReset.next(null);
|
|
4100
4265
|
}
|
|
@@ -4115,14 +4280,26 @@ class TableContainerComponent {
|
|
|
4115
4280
|
});
|
|
4116
4281
|
}
|
|
4117
4282
|
initializeData() {
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
const
|
|
4122
|
-
const
|
|
4123
|
-
.
|
|
4124
|
-
|
|
4125
|
-
|
|
4283
|
+
const predicateFilters$ = combineLatest([this.inputFilters?.pipe(startWith([])) ?? of([]), this.customFilters$])
|
|
4284
|
+
.pipe(map(([a, b]) => [...a, ...b]));
|
|
4285
|
+
const filterState$ = predicateAndFilterInfos(this.state.filters$, predicateFilters$).pipe(scan$1(updateFilterState, initialFilterState));
|
|
4286
|
+
const sortsState$ = this.state.sort$.pipe(scan$1(updateSortState, initialSortState));
|
|
4287
|
+
const sortedAndFilteredData$ = combineLatest([
|
|
4288
|
+
this.tableBuilder.getData$().pipe(timestamp$1()),
|
|
4289
|
+
sortsState$.pipe(timestamp$1()),
|
|
4290
|
+
filterState$.pipe(timestamp$1())
|
|
4291
|
+
]).pipe(scan$1(({ mappedData: resultData }, [data, sort, f], index) => {
|
|
4292
|
+
if (index === 0 || (data.timestamp > sort.timestamp && data.timestamp > f.timestamp)) {
|
|
4293
|
+
return ({ mappedData: filterData(sortData(data.value, sort.value.sortsToRun), f.value.allFilters) });
|
|
4294
|
+
}
|
|
4295
|
+
if (sort.timestamp > f.timestamp) {
|
|
4296
|
+
return ({ mappedData: sortData(resultData, sort.value.sortsToRun) });
|
|
4297
|
+
}
|
|
4298
|
+
return ({ mappedData: filterData(resultData, f.value.onlyAddedFilters || f.value.allFilters, !!f.value.onlyAddedFilters) });
|
|
4299
|
+
}, initialDataState)).pipe(map(({ mappedData: resultData }) => resultData.filter(item => !item[tbNoShowSymbol])), defaultShareReplay());
|
|
4300
|
+
const flatGrouped$ = combineLatest([sortedAndFilteredData$.pipe(timestamp$1()), this.state.groupByKeys$.pipe(timestamp$1()), this.state.expandedGroups$.pipe(timestamp$1())]).pipe(scan$1(updateGroupByState, initialGroupByState), map(({ displayData }) => displayData), defaultShareReplay());
|
|
4301
|
+
this.displayDataSubject.next(flatGrouped$);
|
|
4302
|
+
this.dataSubject.next(sortedAndFilteredData$);
|
|
4126
4303
|
}
|
|
4127
4304
|
ngOnInit() {
|
|
4128
4305
|
this.initializeState();
|
|
@@ -4133,7 +4310,7 @@ class TableContainerComponent {
|
|
|
4133
4310
|
}
|
|
4134
4311
|
}
|
|
4135
4312
|
exportToCsv() {
|
|
4136
|
-
const sorted = this.data.pipe(withLatestFrom(this.state.
|
|
4313
|
+
const sorted = this.data.pipe(withLatestFrom(this.state.sort$), map(([data, sorted]) => sortData(data, sorted)));
|
|
4137
4314
|
this.exportToCsvService.exportToCsv(sorted);
|
|
4138
4315
|
}
|
|
4139
4316
|
saveState() {
|
|
@@ -4152,44 +4329,7 @@ class TableContainerComponent {
|
|
|
4152
4329
|
ngAfterContentInit() {
|
|
4153
4330
|
this.initializeColumns();
|
|
4154
4331
|
this.state.runOnceWhen(stateIs(InitializationState.LoadedFromStore), state => {
|
|
4155
|
-
|
|
4156
|
-
if (this.wrapper) {
|
|
4157
|
-
allFilters = [...allFilters, ...this.wrapper.customFilters, ...this.wrapper.filters, ...this.wrapper.registrations];
|
|
4158
|
-
}
|
|
4159
|
-
const customFilters = [];
|
|
4160
|
-
allFilters.filter(f => !f.used).forEach(f => {
|
|
4161
|
-
f.used = true;
|
|
4162
|
-
if (f.savable) {
|
|
4163
|
-
var filter = state.filters[f.filterId];
|
|
4164
|
-
if (isFilterInfo(filter)) {
|
|
4165
|
-
const filterDirective = f;
|
|
4166
|
-
filterDirective.fieldType = filter.fieldType;
|
|
4167
|
-
filterDirective.filterType = filter.filterType;
|
|
4168
|
-
filterDirective.setFilterValue(filter.filterValue);
|
|
4169
|
-
filterDirective.key = filter.key;
|
|
4170
|
-
filterDirective.update();
|
|
4171
|
-
}
|
|
4172
|
-
if (isCustomFilter(filter)) {
|
|
4173
|
-
f.active = filter.active ?? false;
|
|
4174
|
-
}
|
|
4175
|
-
this.state.addFilter(f.filter$);
|
|
4176
|
-
}
|
|
4177
|
-
else {
|
|
4178
|
-
customFilters.push(f);
|
|
4179
|
-
}
|
|
4180
|
-
});
|
|
4181
|
-
const filters$ = from(customFilters.map(cf => cf.filter$)).pipe(mergeAll(), scan$1((a, b) => {
|
|
4182
|
-
if (b.active) {
|
|
4183
|
-
a[b.filterId] = isCustomFilter(b) ? b.predicate : createFilterFunc(b);
|
|
4184
|
-
}
|
|
4185
|
-
else {
|
|
4186
|
-
delete a[b.filterId];
|
|
4187
|
-
}
|
|
4188
|
-
return a;
|
|
4189
|
-
}, {}), map(f => Object.values(f)));
|
|
4190
|
-
this.state.on(filters$, (f) => {
|
|
4191
|
-
this.customFilters$.next(f);
|
|
4192
|
-
});
|
|
4332
|
+
this.addFilterDirectives(state);
|
|
4193
4333
|
this.state.updateState({ initializationState: InitializationState.Ready });
|
|
4194
4334
|
});
|
|
4195
4335
|
}
|
|
@@ -4212,27 +4352,19 @@ class TableContainerComponent {
|
|
|
4212
4352
|
})));
|
|
4213
4353
|
this.myColumns$ = this.state.metaDataArray$.pipe(mapArray(metaData => ({ metaData, customCell: customCellMap.get(metaData.key) })));
|
|
4214
4354
|
}
|
|
4215
|
-
getData(data, groupByKeys) {
|
|
4216
|
-
if (!groupByKeys.length) {
|
|
4217
|
-
this.disableSort = false;
|
|
4218
|
-
return data;
|
|
4219
|
-
}
|
|
4220
|
-
this.disableSort = true;
|
|
4221
|
-
return this.tbGroupBy(data, groupByKeys);
|
|
4222
|
-
}
|
|
4223
4355
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4224
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: TableContainerComponent, isStandalone: true, selector: "tb-table-container", inputs: { tableId: "tableId", tableBuilder: "tableBuilder", indexColumn: "indexColumn", selectionColumn: "selectionColumn", trackBy: "trackBy", isSticky: "isSticky", pageSize: "pageSize", inputFilters: "inputFilters", groupHeaderTemplate: "groupHeaderTemplate" }, outputs: { selection$: "selection$", data: "data", onStateReset: "onStateReset", onSaveState: "onSaveState", state$: "state$" }, providers: [TableStore, ExportToCsvService, WrapperFilterStore], queries: [{ propertyName: "
|
|
4356
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.3", type: TableContainerComponent, isStandalone: true, selector: "tb-table-container", inputs: { tableId: "tableId", tableBuilder: "tableBuilder", indexColumn: "indexColumn", selectionColumn: "selectionColumn", trackBy: "trackBy", isSticky: "isSticky", pageSize: "pageSize", inputFilters: "inputFilters", groupHeaderTemplate: "groupHeaderTemplate" }, outputs: { selection$: "selection$", data: "data", onStateReset: "onStateReset", onSaveState: "onSaveState", state$: "state$" }, providers: [TableStore, ExportToCsvService, WrapperFilterStore], queries: [{ propertyName: "customFilterDirectives", predicate: TableCustomFilterDirective, descendants: true }, { propertyName: "filterDirectives", predicate: TableFilterDirective, descendants: true }, { propertyName: "customRows", predicate: MatRowDef }, { propertyName: "customCells", predicate: CustomCellDirective }], viewQueries: [{ propertyName: "genericTableComponent", first: true, predicate: GenericTableComponent, descendants: true }], ngImport: i0, template: "<ng-content select=\"[before]\" />\r\n\r\n<ng-container multiSort *ngrxLet=\"state.tableSettings$ as tableSettings\">\r\n <div class=\"header-wrapper\">\r\n <div class=\"title\">\r\n @if ((!(collapseHeader$ | async)) || tableSettings.showTitleWhenHeaderCollapsed) {\r\n <ng-content select=\".tb-header-title\"/>\r\n }\r\n @if((state.groupByKeys$ | async)?.length){\r\n <group-by-list />\r\n }\r\n </div>\r\n <div class=\"flx-row-end\">\r\n <lib-filter-list />\r\n @if (!tableSettings.hideHeader) {\r\n @if (!(collapseHeader$ | async)) {\r\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\r\n <button mat-icon-button color='primary' [matMenuTriggerFor]=\"mainMenu\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #mainMenu='matMenu'>\r\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\r\n </mat-menu>\r\n }\r\n @else {\r\n <mat-icon color=\"primary\" [matMenuTriggerFor]=\"mainMenu\" class=\"flat-menu-button pointer\">more_horiz</mat-icon>\r\n <mat-menu #mainMenu='matMenu'>\r\n <div class=\"flex-column\">\r\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\r\n </div>\r\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\r\n </mat-menu>\r\n }\r\n <mat-icon [matTooltip]=\"(collapseHeader$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon header\"\r\n (click)=\"state.toggleCollapseHeader()\">\r\n {{(collapseHeader$ | async) ? 'expand_less' : 'expand_more'}}\r\n </mat-icon>\r\n }\r\n\r\n </div>\r\n </div>\r\n\r\n <div>\r\n <tb-generic-table [rows]='customRows' [data$]=\"data\" [displayData$]=\"displayData\" [indexColumn]='indexColumn'\r\n [selectionColumn]='selectionColumn' (selection$)='selection$.emit($event)' [trackBy]='trackBy'\r\n [isSticky]='isSticky' [columnInfos]='myColumns$' [groupHeaderTemplate]=\"groupHeaderTemplate\">\r\n </tb-generic-table>\r\n </div>\r\n\r\n\r\n\r\n <ng-template #headerMenu>\r\n @if (!tableSettings.hideFilter) {<tb-filter-displayer/>}\r\n @if (!tableSettings.hideColumnSettings) {<tb-col-displayer/>}\r\n @if (!tableSettings.hideSort) {<tb-sort-menu/>}\r\n </ng-template>\r\n\r\n <ng-template #headerMenuExtra>\r\n <button mat-menu-item (click)=\"resetState()\">\r\n <mat-icon color=\"primary\">autorenew</mat-icon>\r\n <span>Reset table</span>\r\n </button>\r\n @if (!tableSettings.hideExport) {\r\n <button mat-menu-item (click)=\"exportToCsv()\">\r\n <mat-icon color=\"primary\">file_download</mat-icon>\r\n <span>Export Table</span>\r\n </button>\r\n }\r\n @if (currentStateKey$ | async; as currentKey) {\r\n @if (tableId) {\r\n <button mat-menu-item (click)=\"saveState()\">\r\n <mat-icon color=\"primary\">save</mat-icon>\r\n <span>Save to {{currentKey}}</span>\r\n </button>\r\n <button mat-menu-item [matMenuTriggerFor]=\"savedNames\">\r\n <span>Choose Profile</span>\r\n </button>\r\n }\r\n }\r\n\r\n <mat-menu #savedNames='matMenu' panelClass='wide-menu'>\r\n <button mat-menu-item clickEmitter #add='clickEmitter'>\r\n <mat-icon>add</mat-icon>\r\n <span>New</span>\r\n </button>\r\n @for (key of stateKeys$ | async; track key) {\r\n <button mat-menu-item (click)='setProfileState(key)'>\r\n <span>{{key}}</span>\r\n <mat-icon color='warn' (click)='deleteProfileState(key)' stop-propagation>delete_forever</mat-icon>\r\n </button>\r\n }\r\n </mat-menu>\r\n <ng-container *opDialog='add'>\r\n <mat-form-field>\r\n <input class=\"add-key\" matInput #addedKey />\r\n </mat-form-field>\r\n <button mat-button (click)='setProfileState(addedKey.value); add.next(false);' [disabled]=\"!addedKey.value\">\r\n Add\r\n </button>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n", styles: [".wide-menu{width:200px!important}.header-wrapper{display:flex;flex-direction:row;justify-content:space-between;width:100%}.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%}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}\n"], dependencies: [{ kind: "pipe", type: i1$3.AsyncPipe, name: "async" }, { kind: "directive", type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$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$", "indexColumn", "selectionColumn", "rows", "isSticky", "columnBuilders", "columnInfos", "groupHeaderTemplate"], outputs: ["selection$"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "directive", type: ClickEmitterDirective, selector: "[clickEmitter]", exportAs: ["clickEmitter"] }, { kind: "directive", type: DialogDirective, selector: "[opDialog]", inputs: ["opDialogAddDialogClass", "opDialogConfig", "opDialog", "opDialogOrigin"], outputs: ["opDialogClosed"] }, { kind: "ngmodule", type: i4$2.MatButtonModule }, { kind: "component", type: i4$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i4$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: i14.MatMenuModule }, { kind: "component", type: i14.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: i14.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i14.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: i3$2.MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: i5$1.MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: i1$2.MatInputModule }, { kind: "directive", type: i1$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4225
4357
|
}
|
|
4226
4358
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: TableContainerComponent, decorators: [{
|
|
4227
4359
|
type: Component,
|
|
4228
|
-
args: [{ selector: 'tb-table-container', changeDetection: ChangeDetectionStrategy.OnPush, providers: [TableStore, ExportToCsvService, WrapperFilterStore], standalone: true, imports:
|
|
4360
|
+
args: [{ selector: 'tb-table-container', changeDetection: ChangeDetectionStrategy.OnPush, providers: [TableStore, ExportToCsvService, WrapperFilterStore], standalone: true, imports: containerImports, template: "<ng-content select=\"[before]\" />\r\n\r\n<ng-container multiSort *ngrxLet=\"state.tableSettings$ as tableSettings\">\r\n <div class=\"header-wrapper\">\r\n <div class=\"title\">\r\n @if ((!(collapseHeader$ | async)) || tableSettings.showTitleWhenHeaderCollapsed) {\r\n <ng-content select=\".tb-header-title\"/>\r\n }\r\n @if((state.groupByKeys$ | async)?.length){\r\n <group-by-list />\r\n }\r\n </div>\r\n <div class=\"flx-row-end\">\r\n <lib-filter-list />\r\n @if (!tableSettings.hideHeader) {\r\n @if (!(collapseHeader$ | async)) {\r\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\r\n <button mat-icon-button color='primary' [matMenuTriggerFor]=\"mainMenu\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #mainMenu='matMenu'>\r\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\r\n </mat-menu>\r\n }\r\n @else {\r\n <mat-icon color=\"primary\" [matMenuTriggerFor]=\"mainMenu\" class=\"flat-menu-button pointer\">more_horiz</mat-icon>\r\n <mat-menu #mainMenu='matMenu'>\r\n <div class=\"flex-column\">\r\n <ng-container *ngTemplateOutlet=\"headerMenu\"/>\r\n </div>\r\n <ng-container *ngTemplateOutlet=\"headerMenuExtra\"/>\r\n </mat-menu>\r\n }\r\n <mat-icon [matTooltip]=\"(collapseHeader$ | async) ? 'expand' : 'collapse'\" class=\"collapse-icon header\"\r\n (click)=\"state.toggleCollapseHeader()\">\r\n {{(collapseHeader$ | async) ? 'expand_less' : 'expand_more'}}\r\n </mat-icon>\r\n }\r\n\r\n </div>\r\n </div>\r\n\r\n <div>\r\n <tb-generic-table [rows]='customRows' [data$]=\"data\" [displayData$]=\"displayData\" [indexColumn]='indexColumn'\r\n [selectionColumn]='selectionColumn' (selection$)='selection$.emit($event)' [trackBy]='trackBy'\r\n [isSticky]='isSticky' [columnInfos]='myColumns$' [groupHeaderTemplate]=\"groupHeaderTemplate\">\r\n </tb-generic-table>\r\n </div>\r\n\r\n\r\n\r\n <ng-template #headerMenu>\r\n @if (!tableSettings.hideFilter) {<tb-filter-displayer/>}\r\n @if (!tableSettings.hideColumnSettings) {<tb-col-displayer/>}\r\n @if (!tableSettings.hideSort) {<tb-sort-menu/>}\r\n </ng-template>\r\n\r\n <ng-template #headerMenuExtra>\r\n <button mat-menu-item (click)=\"resetState()\">\r\n <mat-icon color=\"primary\">autorenew</mat-icon>\r\n <span>Reset table</span>\r\n </button>\r\n @if (!tableSettings.hideExport) {\r\n <button mat-menu-item (click)=\"exportToCsv()\">\r\n <mat-icon color=\"primary\">file_download</mat-icon>\r\n <span>Export Table</span>\r\n </button>\r\n }\r\n @if (currentStateKey$ | async; as currentKey) {\r\n @if (tableId) {\r\n <button mat-menu-item (click)=\"saveState()\">\r\n <mat-icon color=\"primary\">save</mat-icon>\r\n <span>Save to {{currentKey}}</span>\r\n </button>\r\n <button mat-menu-item [matMenuTriggerFor]=\"savedNames\">\r\n <span>Choose Profile</span>\r\n </button>\r\n }\r\n }\r\n\r\n <mat-menu #savedNames='matMenu' panelClass='wide-menu'>\r\n <button mat-menu-item clickEmitter #add='clickEmitter'>\r\n <mat-icon>add</mat-icon>\r\n <span>New</span>\r\n </button>\r\n @for (key of stateKeys$ | async; track key) {\r\n <button mat-menu-item (click)='setProfileState(key)'>\r\n <span>{{key}}</span>\r\n <mat-icon color='warn' (click)='deleteProfileState(key)' stop-propagation>delete_forever</mat-icon>\r\n </button>\r\n }\r\n </mat-menu>\r\n <ng-container *opDialog='add'>\r\n <mat-form-field>\r\n <input class=\"add-key\" matInput #addedKey />\r\n </mat-form-field>\r\n <button mat-button (click)='setProfileState(addedKey.value); add.next(false);' [disabled]=\"!addedKey.value\">\r\n Add\r\n </button>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n", styles: [".wide-menu{width:200px!important}.header-wrapper{display:flex;flex-direction:row;justify-content:space-between;width:100%}.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%}\n", ".collapse-icon{font-size:16px;height:16px;color:#3f51b5;align-self:flex-start}.collapse-icon:hover{cursor:pointer}.hide{display:none}\n"] }]
|
|
4229
4361
|
}], propDecorators: { genericTableComponent: [{
|
|
4230
4362
|
type: ViewChild,
|
|
4231
4363
|
args: [GenericTableComponent]
|
|
4232
|
-
}],
|
|
4364
|
+
}], customFilterDirectives: [{
|
|
4233
4365
|
type: ContentChildren,
|
|
4234
4366
|
args: [TableCustomFilterDirective, { descendants: true }]
|
|
4235
|
-
}],
|
|
4367
|
+
}], filterDirectives: [{
|
|
4236
4368
|
type: ContentChildren,
|
|
4237
4369
|
args: [TableFilterDirective, { descendants: true }]
|
|
4238
4370
|
}], customRows: [{
|
|
@@ -4393,7 +4525,11 @@ class TableBuilder {
|
|
|
4393
4525
|
this.settings = s.pipe(map(sett => new GeneralTableSettings(sett)), defaultShareReplay());
|
|
4394
4526
|
}
|
|
4395
4527
|
getData$() {
|
|
4396
|
-
return this.metaData$.pipe(switchMap(metaData => this.data$.pipe(mapArray(
|
|
4528
|
+
return this.metaData$.pipe(switchMap(metaData => this.data$.pipe(mapArray((data, i) => {
|
|
4529
|
+
const cleanedRecord = this.cleanRecord(data, metaData);
|
|
4530
|
+
cleanedRecord[initIndexSymbol] = i;
|
|
4531
|
+
return cleanedRecord;
|
|
4532
|
+
}))));
|
|
4397
4533
|
}
|
|
4398
4534
|
createMetaData(obj) {
|
|
4399
4535
|
return Object.keys(obj ?? {})
|
|
@@ -4443,7 +4579,7 @@ class TableBuilder {
|
|
|
4443
4579
|
}
|
|
4444
4580
|
return prev;
|
|
4445
4581
|
}, { ...record });
|
|
4446
|
-
return
|
|
4582
|
+
return cleaned;
|
|
4447
4583
|
}
|
|
4448
4584
|
}
|
|
4449
4585
|
const CreateTableBuilder = (reportDef$) => {
|
|
@@ -4623,5 +4759,5 @@ function provideActionableSelector() {
|
|
|
4623
4759
|
* Generated bundle index. Do not edit.
|
|
4624
4760
|
*/
|
|
4625
4761
|
|
|
4626
|
-
export { ActionStateSpinnerComponent, ActionStateUiModule, ActionStatus, AppStatusState, ArrayStyle, AutoFocusDirective, CancellationToken, ClickEmitterDirective, ClickSubjectDirective, ConditionalClassesDirective, CreateTableBuilder, CustomCellDirective, DateFilterComponent, DialogDirective, DialogService, DialogWrapper, FieldType, FilterChipsComponent, FilterComponent, FilterType, 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, TableBuilder, TableBuilderConfigToken, TableBuilderModule, TableColumnHeaderSettings, TableContainerComponent, TableCustomFilterDirective, TableCustomFilterDirectiveBase, TableFilterDirective, TableFilterStringContainsDirective, TableWrapperDirective, TableWrapperFooterSettings, TableWrapperHeaderSettings, Target, TbSelectedFilterDirective, TrimWhitespaceDirective, UtilitiesModule, actionStatusReducer, chainRequest, clearActionableSelectorRequestCache, combineArrays, createActionableSelector, createFailure, createSuccess, defaultFilter, defaultShareReplay, delayOn, filterArray, getRequestorBody, getRequestorStatus, getStatusState, httpRequest, httpRequestor, inProgress, initialState, isErrorState, isSuccessOrErrorState, isSuccessState, mapArray, mapError, notNull, notStarted, onWait, onceWhen, previousAndCurrent, provideActionableSelector, provideTableBuilder, selectAll, selectEntities, selectEntity, selectIds, selectTotal, serverStatusTypes, setUpStoreFactory, skipOneWhen, spaceCase, statusAdapter, statusIsSuccessOrInProgress, switchOff, tapError, tapSuccess };
|
|
4762
|
+
export { ActionStateSpinnerComponent, ActionStateUiModule, ActionStatus, AppStatusState, ArrayStyle, AutoFocusDirective, CancellationToken, ClickEmitterDirective, ClickSubjectDirective, ConditionalClassesDirective, CreateTableBuilder, CustomCellDirective, DateFilterComponent, DialogDirective, DialogService, DialogWrapper, FieldType, FilterChipsComponent, FilterComponent, FilterType, 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, TableBuilder, TableBuilderConfigToken, TableBuilderModule, TableColumnHeaderSettings, TableContainerComponent, TableCustomFilterDirective, TableCustomFilterDirectiveBase, TableFilterDirective, TableFilterStringContainsDirective, TableWrapperDirective, TableWrapperFooterSettings, TableWrapperHeaderSettings, Target, TbSelectedFilterDirective, TrimWhitespaceDirective, UtilitiesModule, actionStatusReducer, chainRequest, clearActionableSelectorRequestCache, combineArrays, createActionableSelector, createFailure, createSuccess, defaultFilter, defaultShareReplay, delayOn, filterArray, getRequestorBody, getRequestorStatus, getStatusState, httpRequest, httpRequestor, inProgress, initialState, isDifferent, isErrorState, isSuccessOrErrorState, isSuccessState, mapArray, mapError, notNull, notStarted, onWait, onceWhen, previousAndCurrent, provideActionableSelector, provideTableBuilder, selectAll, selectEntities, selectEntity, selectIds, selectTotal, serverStatusTypes, setUpStoreFactory, skipOneWhen, spaceCase, startWithIfEmpty, statusAdapter, statusIsSuccessOrInProgress, switchOff, tapError, tapSuccess };
|
|
4627
4763
|
//# sourceMappingURL=one-paragon-angular-utilities.mjs.map
|