@one-paragon/angular-utilities 2.3.12 → 2.3.14

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Input, Directive, inject, Injector, TemplateRef, ViewContainerRef, NgModule, assertInInjectionContext, DestroyRef, signal, computed, isSignal, effect, untracked, InjectionToken, Injectable, runInInjectionContext, input, Renderer2, ElementRef, booleanAttribute, Pipe, makeEnvironmentProviders, ChangeDetectionStrategy, Component, HostListener, EventEmitter, Output, ContentChildren, ChangeDetectorRef, output, viewChild, EnvironmentInjector, createComponent, linkedSignal, contentChild, forwardRef, contentChildren, provideAppInitializer } from '@angular/core';
2
+ import { Input, Directive, inject, Injector, TemplateRef, ViewContainerRef, NgModule, assertInInjectionContext, DestroyRef, signal, computed, isSignal, effect, untracked, InjectionToken, Injectable, runInInjectionContext, input, Renderer2, ElementRef, booleanAttribute, Pipe, makeEnvironmentProviders, HostListener, ChangeDetectionStrategy, Component, EventEmitter, Output, ContentChildren, ChangeDetectorRef, output, viewChild, EnvironmentInjector, createComponent, linkedSignal, contentChild, forwardRef, contentChildren, provideAppInitializer } from '@angular/core';
3
3
  import { shareReplay, map, switchAll, filter, tap, catchError, startWith, switchMap, mergeMap, concatMap as concatMap$1, takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
4
4
  import * as i1 from 'rxjs';
5
5
  import { isObservable, Subject, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, pipe, concatMap, merge, delay, fromEvent, takeUntil as takeUntil$1, tap as tap$1, switchMap as switchMap$1, scan, timestamp } from 'rxjs';
@@ -18,7 +18,8 @@ import { MatCheckbox, MatCheckboxModule } from '@angular/material/checkbox';
18
18
  import * as i2 from '@angular/forms';
19
19
  import { NgControl, NgForm, ControlContainer, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
20
20
  import { MatOption } from '@angular/material/core';
21
- import { DatePipe, CurrencyPipe, NgTemplateOutlet, formatDate, formatCurrency, DecimalPipe, formatNumber, CommonModule, AsyncPipe } from '@angular/common';
21
+ import { DatePipe, CurrencyPipe, formatDate, formatCurrency, NgTemplateOutlet, DecimalPipe, formatNumber, CommonModule, AsyncPipe } from '@angular/common';
22
+ import { MatDialog, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
22
23
  import { ComponentStore } from '@ngrx/component-store';
23
24
  import * as i5 from '@angular/cdk/drag-drop';
24
25
  import { moveItemInArray, DragDropModule, CdkDropList, CDK_DROP_LIST, transferArrayItem } from '@angular/cdk/drag-drop';
@@ -28,7 +29,6 @@ import * as i3 from '@angular/material/datepicker';
28
29
  import { MatDatepickerModule } from '@angular/material/datepicker';
29
30
  import * as i1$3 from '@angular/material/card';
30
31
  import { MatCardModule } from '@angular/material/card';
31
- import { MatDialog, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
32
32
  import * as i3$1 from '@angular/material/button';
33
33
  import { MatButtonModule, MatIconButton, MatButton } from '@angular/material/button';
34
34
  import * as i4 from '@angular/material/tooltip';
@@ -1712,1366 +1712,1536 @@ function provideTableBuilder(config) {
1712
1712
  ]);
1713
1713
  }
1714
1714
 
1715
- const isNull = (filterInfo) => {
1716
- const func = filterInfo.filterValue ?
1717
- (val) => val == null || val === ''
1718
- :
1719
- (val) => val != null && val !== '';
1720
- return func;
1721
- };
1722
-
1723
- const stringEqualFunc = (filterInfo) => {
1724
- const equalsVal = prepareForStringCompare(filterInfo.filterValue);
1725
- return ((val) => prepareForStringCompare(val) === equalsVal);
1726
- };
1727
- const stringContainsFunc = (filterInfo) => {
1728
- const containsVal = prepareForStringCompare(filterInfo.filterValue);
1729
- return ((val) => prepareForStringCompare(val).includes(containsVal));
1730
- };
1731
- const stringDoesNotContainFunc = (filterInfo) => {
1732
- const doesNotContainVal = prepareForStringCompare(filterInfo.filterValue);
1733
- return ((val) => !prepareForStringCompare(val)?.includes(doesNotContainVal));
1734
- };
1735
- const stringStartsWithFunc = (filterInfo) => {
1736
- const startsWith = prepareForStringCompare(filterInfo.filterValue);
1737
- return ((val) => prepareForStringCompare(val).startsWith(startsWith));
1738
- };
1739
- const stringEndsWithFunc = (filterInfo) => {
1740
- const startsWith = prepareForStringCompare(filterInfo.filterValue);
1741
- return ((val) => prepareForStringCompare(val).endsWith(startsWith));
1742
- };
1743
- const multipleStringValuesEqualsFunc = (filterInfo) => {
1744
- const filterVals = filterInfo.filterValue.map((v) => prepareForStringCompare(v));
1745
- return ((val) => {
1746
- const v = prepareForStringCompare(val);
1747
- return filterVals.some((s) => v === s);
1748
- });
1749
- };
1750
- const StringFilterFuncs = {
1751
- [FilterType.StringEquals]: stringEqualFunc,
1752
- [FilterType.StringContains]: stringContainsFunc,
1753
- [FilterType.StringDoesNotContain]: stringDoesNotContainFunc,
1754
- [FilterType.StringStartWith]: stringStartsWithFunc,
1755
- [FilterType.StringEndsWith]: stringEndsWithFunc,
1756
- [FilterType.IsNull]: isNull,
1757
- [FilterType.In]: multipleStringValuesEqualsFunc,
1758
- };
1759
- const EnumFilterFuncs = {
1760
- [FilterType.IsNull]: isNull,
1761
- [FilterType.In]: multipleStringValuesEqualsFunc,
1762
- };
1763
- const prepareForStringCompare = (val) => (val?.toString().trim().toLowerCase());
1764
-
1765
- const numberEqalsFunc = (filterInfo) => (val) => {
1766
- return val === filterInfo.filterValue;
1767
- };
1768
- const numberNotEqualFunc = (filterInfo) => (val) => {
1769
- return val !== filterInfo.filterValue;
1770
- };
1771
- const numberGreaterThanFunc = (filterInfo) => (val) => {
1772
- return val > filterInfo.filterValue;
1773
- };
1774
- const numberLessThanFunc = (filterInfo) => (val) => {
1775
- return val < filterInfo.filterValue;
1776
- };
1777
- const numberBetweenFunc = (filterInfo) => {
1778
- const startVal = Number(filterInfo.filterValue.Start);
1779
- const endVal = Number(filterInfo.filterValue.End);
1780
- return ((val) => (val > startVal) && (val < endVal));
1781
- };
1782
- const multipleNumberValuesEqualsFunc = (filterInfo) => {
1783
- return ((val) => filterInfo.filterValue.some((value) => val === value));
1784
- };
1785
- const NumberFilterFuncs = {
1786
- [FilterType.NumberEquals]: numberEqalsFunc,
1787
- [FilterType.NumberNotEqual]: numberNotEqualFunc,
1788
- [FilterType.NumberGreaterThan]: numberGreaterThanFunc,
1789
- [FilterType.NumberLessThan]: numberLessThanFunc,
1790
- [FilterType.NumberBetween]: numberBetweenFunc,
1791
- [FilterType.IsNull]: isNull,
1792
- [FilterType.In]: multipleNumberValuesEqualsFunc,
1793
- };
1794
-
1795
- const dateIsOnFunc = (filterInfo) => {
1796
- const isOnVal = new Date(filterInfo.filterValue).getTime();
1797
- const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
1798
- return ((val) => clean(filterInfo, val).getTime() === isOnVal);
1799
- };
1800
- const dateIsNotOnFunc = (filterInfo) => {
1801
- const isNotOnVal = new Date(filterInfo.filterValue).getTime();
1802
- const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
1803
- return ((val) => clean(filterInfo, val).getTime() !== isNotOnVal);
1804
- };
1805
- const dateIsOnOrAfterFunc = (filterInfo) => {
1806
- const afterVal = new Date(filterInfo.filterValue).getTime();
1807
- const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
1808
- return ((val) => clean(filterInfo, val).getTime() >= afterVal);
1809
- };
1810
- const dateIsOnOrBeforeFunc = (filterInfo) => {
1811
- const beforeVal = new Date(filterInfo.filterValue).getTime();
1812
- const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
1813
- return ((val) => clean(filterInfo, val).getTime() <= beforeVal);
1814
- };
1815
- const dateIsInFunc = (filterInfo) => {
1816
- const filterVals = filterInfo.filterValue.map(v => new Date(v).getTime());
1817
- const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
1818
- return ((val) => {
1819
- const d = clean(filterInfo, val).getTime();
1820
- return filterVals.some((f) => f === d);
1821
- });
1822
- };
1823
- const dateBetweenFunc = (filterInfo) => {
1824
- const startVal = new Date(filterInfo.filterValue.Start);
1825
- const endVal = new Date(filterInfo.filterValue.End);
1826
- const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
1827
- return ((val) => {
1828
- const cleanedVal = clean(filterInfo, val);
1829
- return cleanedVal >= startVal && cleanedVal <= endVal;
1830
- });
1831
- };
1832
- const cleanDateTime = (filterInfo, val) => {
1833
- if (!!DateFilterFuncs[filterInfo.filterType]) {
1834
- const d = new Date(val);
1835
- d.setHours(0, 0, 0, 0);
1836
- return d;
1715
+ class PreventEnterDirective {
1716
+ onKeyDown() {
1717
+ return false;
1837
1718
  }
1838
- return val;
1839
- };
1840
- const DateFilterFuncs = {
1841
- [FilterType.DateIsOn]: dateIsOnFunc,
1842
- [FilterType.DateIsNotOn]: dateIsNotOnFunc,
1843
- [FilterType.DateOnOrAfter]: dateIsOnOrAfterFunc,
1844
- [FilterType.DateOnOrBefore]: dateIsOnOrBeforeFunc,
1845
- [FilterType.DateBetween]: dateBetweenFunc,
1846
- [FilterType.In]: dateIsInFunc,
1847
- [FilterType.IsNull]: isNull,
1848
- };
1849
- const DateTimeFilterFuncs = {
1850
- ...DateFilterFuncs,
1851
- [FilterType.DateTimeIsAt]: dateIsOnFunc,
1852
- [FilterType.DateTimeIsNotAt]: dateIsNotOnFunc,
1853
- [FilterType.DateTimeAtOrAfter]: dateIsOnOrAfterFunc,
1854
- [FilterType.DateTimeAtOrBefore]: dateIsOnOrBeforeFunc,
1855
- [FilterType.DateTimeBetween]: dateBetweenFunc,
1856
- [FilterType.In]: dateIsInFunc,
1857
- [FilterType.IsNull]: isNull,
1858
- };
1859
-
1860
- const booleanEqualsFunc = (filterInfo) => (val) => {
1861
- return filterInfo.filterValue === val;
1862
- };
1863
- const BooleanFilterFuncs = {
1864
- [FilterType.BooleanEquals]: booleanEqualsFunc,
1865
- [FilterType.IsNull]: isNull,
1866
- };
1867
-
1868
- function sortData(data, sorted) {
1869
- return data.sort(compareT(sorted));
1719
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PreventEnterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1720
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: PreventEnterDirective, isStandalone: true, selector: "preventEnter", host: { listeners: { "keydown.enter": "onKeyDown($event)" } }, ngImport: i0 }); }
1870
1721
  }
1871
- function filterData(data, filters, resetAll = false) {
1872
- if (filters.length === 0) {
1873
- if (resetAll) {
1874
- for (let index = 0; index < data.length; index++) {
1875
- const element = data[index];
1876
- element[tbNoShowSymbol] = false;
1877
- }
1878
- }
1879
- return data;
1722
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PreventEnterDirective, decorators: [{
1723
+ type: Directive,
1724
+ args: [{
1725
+ selector: 'preventEnter',
1726
+ }]
1727
+ }], propDecorators: { onKeyDown: [{
1728
+ type: HostListener,
1729
+ args: ['keydown.enter', ['$event']]
1730
+ }] } });
1731
+
1732
+ class StopPropagationDirective {
1733
+ onClick(event) {
1734
+ event.stopPropagation();
1880
1735
  }
1881
- for (let index = 0; index < data.length; index++) {
1882
- const element = data[index];
1883
- const hide = !filters.every(filter => filter(element));
1884
- if (hide || resetAll) {
1885
- element[tbNoShowSymbol] = hide;
1886
- }
1736
+ onMousedown(event) {
1737
+ event.stopPropagation();
1887
1738
  }
1888
- return data;
1739
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1740
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: StopPropagationDirective, isStandalone: true, selector: "[stop-propagation]", host: { listeners: { "click": "onClick($event)", "mousedown": "onMousedown($event)" } }, ngImport: i0 }); }
1889
1741
  }
1890
- const tbNoShowSymbol = Symbol('tb_no_show');
1891
- function compareT(criteria) {
1892
- const transforms = criteria.reduce((acc, c) => {
1893
- acc[c.active] = {
1894
- transform: c.sortBy ? c.sortBy : getFactory(c.active), nulls: c.nulls === 'first' ? -1 : 1
1895
- };
1896
- return acc;
1897
- }, {});
1898
- return function (a, b) {
1899
- for (let index = 0; index < criteria.length; index++) {
1900
- const c = criteria[index];
1901
- const d = transforms[c.active];
1902
- const nullValue = d.nulls;
1903
- if (a == null) {
1904
- if (b == null)
1905
- return 0;
1906
- return nullValue;
1907
- }
1908
- if (b == null)
1909
- return -nullValue;
1910
- const transform = d.transform;
1911
- const aVal = transform(a);
1912
- const bVal = transform(b);
1913
- if (aVal == null) {
1914
- if (bVal == null)
1915
- return 0;
1916
- return nullValue;
1917
- }
1918
- if (bVal == null)
1919
- return -nullValue;
1920
- if (aVal < bVal)
1921
- return c.direction === 'asc' ? -1 : 1;
1922
- if (aVal > bVal)
1923
- return c.direction === 'asc' ? 1 : -1;
1742
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StopPropagationDirective, decorators: [{
1743
+ type: Directive,
1744
+ args: [{
1745
+ selector: "[stop-propagation]",
1746
+ }]
1747
+ }], propDecorators: { onClick: [{
1748
+ type: HostListener,
1749
+ args: ["click", ["$event"]]
1750
+ }], onMousedown: [{
1751
+ type: HostListener,
1752
+ args: ["mousedown", ["$event"]]
1753
+ }] } });
1754
+
1755
+ class AutoFocusDirective {
1756
+ constructor() {
1757
+ this.elementRef = inject(ElementRef);
1758
+ this.autoFocus = true;
1759
+ }
1760
+ ngAfterViewInit() {
1761
+ if (this.autoFocus) {
1762
+ setTimeout(() => {
1763
+ this.elementRef.nativeElement.focus();
1764
+ });
1924
1765
  }
1925
- return 0;
1926
- };
1927
- }
1928
- function getFactory(b) {
1929
- if (typeof b !== 'string')
1930
- return (a) => a[b];
1931
- if (!b.includes('.'))
1932
- return (a) => {
1933
- if (!a)
1934
- return a;
1935
- return a[b];
1936
- };
1937
- const arr = b.split('.');
1938
- return (a) => {
1939
- let val = a;
1940
- if (!a)
1941
- return a;
1942
- for (let index = 0; index < arr.length; index++) {
1943
- val = val[arr[index]];
1944
- if (val == undefined)
1945
- return undefined;
1946
- if (typeof val !== 'object' && index + 1 < arr.length)
1947
- return undefined;
1948
- }
1949
- return val;
1950
- };
1766
+ }
1767
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: AutoFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1768
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: AutoFocusDirective, isStandalone: true, selector: "[autoFocus]", inputs: { autoFocus: "autoFocus" }, ngImport: i0 }); }
1951
1769
  }
1770
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: AutoFocusDirective, decorators: [{
1771
+ type: Directive,
1772
+ args: [{
1773
+ selector: '[autoFocus]',
1774
+ }]
1775
+ }], propDecorators: { autoFocus: [{
1776
+ type: Input
1777
+ }] } });
1952
1778
 
1953
- const filterFactoryMap = {
1954
- [FilterType.And]: (filter) => {
1955
- const filters = createFilterFuncs(filter.filterValue);
1956
- return (obj) => filters.every(f => f(obj));
1957
- },
1958
- [FilterType.In]: (filter) => {
1959
- const filters = createFilterFuncs(filter.filterValue);
1960
- return (obj) => filters.some(f => f(obj));
1961
- },
1962
- };
1963
- const filterTypeFuncMap = {
1964
- [FieldType.Array]: StringFilterFuncs,
1965
- [FieldType.Boolean]: BooleanFilterFuncs,
1966
- [FieldType.Currency]: NumberFilterFuncs,
1967
- [FieldType.Date]: DateFilterFuncs,
1968
- [FieldType.DateTime]: DateTimeFilterFuncs,
1969
- [FieldType.Enum]: EnumFilterFuncs,
1970
- [FieldType.Link]: StringFilterFuncs,
1971
- [FieldType.Number]: NumberFilterFuncs,
1972
- [FieldType.PhoneNumber]: StringFilterFuncs,
1973
- [FieldType.String]: StringFilterFuncs,
1974
- [FieldType.Unknown]: StringFilterFuncs,
1975
- };
1976
- const filterTypeMap = Object.entries(filterTypeFuncMap).reduce((acc, [key, value]) => ({ ...acc, [key]: Object.keys(value) }), {});
1977
- function isCustomFilter(filter) {
1978
- return filter && filter.filterType === FilterType.Custom;
1979
- }
1980
- function isFilterInfo(filter) {
1981
- return filter && typeof filter.key === 'string' && filter.filterType !== FilterType.Custom;
1982
- }
1983
- const defaultPredicate = () => true;
1984
- function createFilterFuncs(filters) {
1985
- return filters.filter(needsFilterCreation).map(createFilterFunc);
1986
- }
1987
- function needsFilterCreation(filter) {
1988
- if (isCustomFilter(filter)) {
1989
- return filter.active !== false;
1990
- }
1991
- return filter.filterValue != undefined && filter.active !== false;
1992
- }
1993
- function createFilterFunc(filter) {
1994
- if (isCustomFilter(filter)) {
1995
- return filter.active ? filter.predicate : defaultPredicate;
1996
- }
1997
- if (filter.filterValue == undefined) {
1998
- return defaultPredicate;
1779
+ class ClickSubjectDirective extends Subject {
1780
+ constructor() {
1781
+ super();
1999
1782
  }
2000
- const func = filterTypeFuncMap[filter.fieldType][filter.filterType](filter);
2001
- if (!func) {
2002
- if (filterFactoryMap[filter.filterType]) {
2003
- return filterFactoryMap[filter.filterType](filter);
2004
- }
1783
+ set clickSubject(val) {
1784
+ this._val = val;
2005
1785
  }
2006
- const cannotBeTrueForNull = !FalseyValueCanBeIncludedFilterTypes.includes(filter.filterType);
2007
- const getter = filter.filterBy || getFactory(filter.key);
2008
- return (rowObj) => {
2009
- const value = getter(rowObj);
2010
- return ((value == undefined) && cannotBeTrueForNull)
2011
- ? false
2012
- : func(value);
2013
- };
1786
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickSubjectDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1787
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: ClickSubjectDirective, isStandalone: true, selector: "[clickSubject]", inputs: { clickSubject: "clickSubject" }, host: { listeners: { "click": "next(this._val)" } }, exportAs: ["clickSubject"], usesInheritance: true, ngImport: i0 }); }
2014
1788
  }
2015
- const FalseyValueCanBeIncludedFilterTypes = [
2016
- FilterType.IsNull,
2017
- FilterType.NumberNotEqual,
2018
- FilterType.DateIsNotOn,
2019
- FilterType.StringDoesNotContain,
2020
- ];
1789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickSubjectDirective, decorators: [{
1790
+ type: Directive,
1791
+ args: [{
1792
+ selector: '[clickSubject]',
1793
+ exportAs: 'clickSubject',
1794
+ host: {
1795
+ '(click)': 'next(this._val)'
1796
+ },
1797
+ }]
1798
+ }], ctorParameters: () => [], propDecorators: { clickSubject: [{
1799
+ type: Input,
1800
+ args: ['clickSubject']
1801
+ }] } });
2021
1802
 
2022
- const replaceInArrayWithClone = (arr, findMeth, actionOnClone = ((t) => { })) => {
2023
- const index = arr.findIndex(findMeth);
2024
- const clonedArray = [...arr];
2025
- const t = clonedArray[index];
2026
- clonedArray[index] =
2027
- t != null && typeof t === 'object' ?
2028
- Array.isArray(t) ?
2029
- [...t]
2030
- : { ...t }
2031
- : t;
2032
- actionOnClone(clonedArray[index]);
2033
- return clonedArray;
2034
- };
1803
+ class ClickEmitterDirective extends Subject {
1804
+ constructor() {
1805
+ super();
1806
+ }
1807
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickEmitterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1808
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: ClickEmitterDirective, isStandalone: true, selector: "[clickEmitter]", host: { listeners: { "click": "next(true)" } }, exportAs: ["clickEmitter"], usesInheritance: true, ngImport: i0 }); }
1809
+ }
1810
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickEmitterDirective, decorators: [{
1811
+ type: Directive,
1812
+ args: [{
1813
+ selector: '[clickEmitter]',
1814
+ exportAs: 'clickEmitter',
1815
+ host: {
1816
+ '(click)': 'next(true)'
1817
+ },
1818
+ }]
1819
+ }], ctorParameters: () => [] });
2035
1820
 
2036
- const orderedStateVisibleMetaData = (state) => {
2037
- const ordered = orderStateMetaData(state);
2038
- const orderedVisible = ordered
2039
- .filter(metaData => !state.hiddenKeys.includes(metaData.key) && state.metaData[metaData.key].fieldType !== FieldType.Hidden);
2040
- return orderedVisible;
2041
- };
2042
- const orderedCodeVisibleMetaData = (state) => orderStateMetaData(state).filter(md => md.fieldType !== FieldType.Hidden);
2043
- const orderStateMetaData = (state) => {
2044
- return orderMetaData(state.metaData, state.userDefined.order);
2045
- };
2046
- const orderMetaData = (metaData, userDefined) => {
2047
- const userOrderArr = Object.entries(userDefined);
2048
- return userOrderArr.length ?
2049
- Object.values(metaData).sort((a, b) => {
2050
- const orderA = userDefined[a.key];
2051
- const orderB = userDefined[b.key];
2052
- return order(orderA, orderB);
2053
- })
2054
- :
2055
- Object.values(metaData).sort((a, b) => {
2056
- const orderA = a.order;
2057
- const orderB = b.order;
2058
- return order(orderA, orderB);
2059
- });
2060
- };
2061
- function order(orderA, orderB) {
2062
- if (orderA == null && orderB == null) {
2063
- return 0;
1821
+ class DialogService {
1822
+ constructor() {
1823
+ this.allOpenOpDialogs = [];
2064
1824
  }
2065
- if (orderA == null) {
2066
- return 1;
1825
+ addDialogRef(ref) {
1826
+ this.allOpenOpDialogs.push(ref);
2067
1827
  }
2068
- if (orderB == null) {
2069
- return -1;
1828
+ removeDialogRef(ref) {
1829
+ this.allOpenOpDialogs = this.allOpenOpDialogs.filter(rf => ref.id !== rf.id);
2070
1830
  }
2071
- return orderA - orderB;
2072
- }
2073
- function cleanPersistedState(state, pState) {
2074
- const metas = Object.values(state.metaData);
2075
- const filters = Object.values(pState.filters).filter(fltr => isCustomFilter(fltr) || metas.some(m => m.key === fltr.key)).reduce((obj, filter) => {
2076
- obj[filter.filterId] = pState.filters[filter.filterId];
2077
- return obj;
2078
- }, {});
2079
- const sorted = pState.sorted.filter(s => metas.some(m => m.key === s.active));
2080
- return ({ ...pState, filters, sorted });
2081
- }
2082
- const mapSaveableState = (s) => {
2083
- const savableState = { ...s };
2084
- keysToDelete.forEach(key => delete savableState[key]);
2085
- return savableState;
2086
- };
2087
- const createPreSort = (metaDatas) => {
2088
- return Object.values(metaDatas).filter((metaData) => !!metaData.preSort)
2089
- .sort(({ preSort: ps1 }, { preSort: ps2 }) => (ps1.precedence || Number.MAX_VALUE) - (ps2.precedence || Number.MAX_VALUE))
2090
- .map(({ key, preSort: { direction } }) => ({ active: key, direction }));
2091
- };
2092
- const mergeMeta = (orig, merge) => {
2093
- return {
2094
- key: orig.key,
2095
- displayName: merge.displayName ?? orig.displayName,
2096
- fieldType: merge.fieldType || orig.fieldType,
2097
- additional: { ...orig.additional, ...merge.additional },
2098
- order: merge.order ?? orig.order,
2099
- preSort: merge.preSort ?? orig.preSort,
2100
- width: merge.width ?? orig.width,
2101
- noExport: merge.noExport || orig.noExport,
2102
- noFilter: merge.noFilter || orig.noFilter,
2103
- customCell: merge.customCell ?? orig.customCell,
2104
- transform: merge.transform ?? orig.transform,
2105
- map: merge.map ?? orig.map,
2106
- click: merge.click ?? orig.click,
2107
- classes: merge.classes ?? orig.classes,
2108
- noSort: merge.noSort ?? orig.noSort,
2109
- template: merge.template ?? orig.template,
2110
- toolTip: merge.toolTip ?? orig.toolTip,
2111
- useIcon: merge.useIcon ?? orig.useIcon,
2112
- filterLogic: merge.filterLogic ?? orig.filterLogic,
2113
- sortLogic: merge.sortLogic ?? orig.sortLogic,
2114
- groupByLogic: merge.groupByLogic ?? orig.groupByLogic,
2115
- };
2116
- };
2117
- const initializeOrder = (state, mds) => {
2118
- const viewableMetaDataArr = Object.values(mds).filter(a => a.fieldType !== FieldType.Hidden);
2119
- let userDefinedOrder = state.userDefined.order;
2120
- if (viewableMetaDataArr.some(meta => userDefinedOrder[meta.key] == null)) {
2121
- return {};
1831
+ closeAllOpDialogs() {
1832
+ this.allOpenOpDialogs.forEach(ref => ref.close());
2122
1833
  }
2123
- return userDefinedOrder;
2124
- };
1834
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1835
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogService, providedIn: 'root' }); }
1836
+ }
1837
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogService, decorators: [{
1838
+ type: Injectable,
1839
+ args: [{ providedIn: 'root' }]
1840
+ }] });
2125
1841
 
2126
- class TableStore extends ComponentStore {
1842
+ class DialogWrapper {
2127
1843
  constructor() {
2128
- const config = inject(TableBuilderConfigToken);
2129
- const settingsFromConfig = {
2130
- persistedTableSettings: new PersistedTableSettings().merge(config.defaultTableSettings),
2131
- notPersistedTableSettings: new NotPersistedTableSettings().merge(config.defaultTableSettings),
1844
+ this.vcr = inject(ViewContainerRef);
1845
+ this.viewEmbedded = false;
1846
+ this.viewContext = {
1847
+ close: () => { },
2132
1848
  };
2133
- if (config.defaultTableSettings?.pageSize) {
2134
- settingsFromConfig.notPersistedTableSettings.paginatorSettings.pageSize = config.defaultTableSettings?.pageSize;
1849
+ }
1850
+ set template(tmpl) {
1851
+ if (this.viewEmbedded) {
1852
+ this.vcr.clear();
2135
1853
  }
2136
- const pageSize = settingsFromConfig.notPersistedTableSettings.paginatorSettings.pageSize || defaultTableState.pageSize;
2137
- const showAll = settingsFromConfig.notPersistedTableSettings.paginatorSettings.defaultAll || defaultTableState.showAll;
2138
- super({ ...defaultTableState, ...settingsFromConfig, pageSize, showAll });
2139
- this.$initializationState = this.selectSignal(state => state.initializationState);
2140
- this.$savableState = computed(() => {
2141
- const state = this.state();
2142
- return mapSaveableState(state);
2143
- });
2144
- this.$userDefinedOrder = this.selectSignal(state => state.userDefined.order);
2145
- this.metaData$ = this.select(state => state.metaData);
2146
- this.$metaData = this.selectSignal(state => state.metaData);
2147
- this.$metaDataArray = this.selectSignal(this.$metaData, this.$userDefinedOrder, orderMetaData);
2148
- this.$orderedCodeVisibleMetaDatas = this.selectSignal(this.$metaDataArray, (mds) => mds.filter(m => m.fieldType !== FieldType.Hidden), { equal: (a, b) => b.length === a.length && b.every((s, i) => a[i].key === s.key) });
2149
- this.$getMetaData = (key) => computed(() => {
2150
- const metaData = this.state().metaData[key];
2151
- if (!metaData)
2152
- console.warn(`Meta data with key ${key} not found`);
2153
- return metaData;
2154
- });
2155
- this.$hiddenKeys = this.selectSignal(state => state.hiddenKeys);
2156
- this.$orderedVisibleColumns = this.selectSignal(this.$orderedCodeVisibleMetaDatas, this.$hiddenKeys, (cs, hiddenKeys) => cs.filter(m => !hiddenKeys.includes(m.key)).map(m => m.key));
2157
- this.$getUserDefinedWidths = this.selectSignal(state => state.userDefined.widths);
2158
- this.$tableSettingsMinWidth = this.selectSignal(state => parseTbSizeToPixels(state.notPersistedTableSettings.minColumnWidth));
2159
- this.$getUserDefinedWidth = (key) => this.selectSignal(this.$getUserDefinedWidths, widths => widths[key]);
2160
- this.$filters = this.selectSignal(state => state.filters);
2161
- this.filters$ = this.select(state => state.filters);
2162
- this.$getFilter = (filterId) => {
2163
- return this.selectSignal(this.$filters, filters => filters[filterId]);
1854
+ this.viewEmbedded = true;
1855
+ this.vcr.createEmbeddedView(tmpl, this.viewContext);
1856
+ }
1857
+ set close(closeMethod) {
1858
+ this.viewContext.close = closeMethod;
1859
+ }
1860
+ set data(value) {
1861
+ this.viewContext.$implicit = value;
1862
+ this.viewContext.opDialog = value;
1863
+ }
1864
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogWrapper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1865
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: DialogWrapper, isStandalone: true, selector: "dialog-wrapper", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1866
+ }
1867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogWrapper, decorators: [{
1868
+ type: Component,
1869
+ args: [{
1870
+ selector: 'dialog-wrapper',
1871
+ template: ``,
1872
+ changeDetection: ChangeDetectionStrategy.OnPush,
1873
+ }]
1874
+ }] });
1875
+ const defaultDialogConfig = {
1876
+ maxHeight: '95vh',
1877
+ };
1878
+ class DialogDirective {
1879
+ constructor() {
1880
+ this.templateRef = inject(TemplateRef);
1881
+ this.dialog = inject(MatDialog);
1882
+ this.dialogConfig = inject(MAT_DIALOG_DEFAULT_OPTIONS, { optional: true }) || {};
1883
+ this.service = inject(DialogService);
1884
+ this.opDialogClosed = new EventEmitter();
1885
+ this._dialogConfig = { ...this.dialogConfig, ...defaultDialogConfig };
1886
+ this.opDialogAddDialogClass = true;
1887
+ this.injector = inject(Injector);
1888
+ this.subscriber = subscriber(this.injector);
1889
+ this._data = new Subject();
1890
+ this.setDataAndState = (data) => {
1891
+ if (data) {
1892
+ this.opDialogConfig.data = data;
1893
+ this.setDialogState(true);
1894
+ }
1895
+ else {
1896
+ this.setDialogState(false);
1897
+ }
2164
1898
  };
2165
- this.$preSort = computed(() => createPreSort(this.$metaData()));
2166
- this._$selectSorted = this.selectSignal(state => state.sorted, {
2167
- equal: sortsAreSame
2168
- });
2169
- this.$selectSorted = computed(() => {
2170
- const metaDict = this.$metaData();
2171
- return this._$selectSorted().map(s => {
2172
- const meta = metaDict[s.active];
2173
- const sortLogic = meta.sortLogic;
2174
- const sortBy = sortLogic?.sortBy === 'use map' ? meta.map : sortLogic?.sortBy;
2175
- return ({ ...s, ...sortLogic, sortBy });
2176
- });
2177
- });
2178
- this.selectSorted$ = this.select(state => state.sorted).pipe(distinctUntilChanged(sortsAreSame));
2179
- this.$getSorts = this.selectSignal(() => this.$initializationState() !== InitializationState.Ready ? [] : this.$selectSorted());
2180
- this.sort$ = toObservable(this.$getSorts);
2181
- this.$getUserDefinedTableWidth = this.selectSignal(state => state.userDefined.table.width);
2182
- this.getUserDefinedTableWidth$ = this.select(state => state.userDefined.table.width);
2183
- this.$userDefinedRowHeight = this.selectSignal(state => (state.userDefined.rowHeight));
2184
- this.$userDefinedHeaderHeight = this.selectSignal(state => (state.userDefined.headerHeight));
2185
- this.$userDefinedPageSize = this.selectSignal(state => (state.userDefined.pageSize));
2186
- this.$footerCollapsed = this.selectSignal(state => state.persistedTableSettings.collapseFooter);
2187
- this.$headerCollapsed = this.selectSignal(state => state.persistedTableSettings.collapseHeader);
2188
- this.$groupBy = this.selectSignal(state => state.groupBy);
2189
- this.$groupByKeys = this.selectSignal(this.$groupBy, this.$metaDataArray, (gb, mds) => gb.map(gbk => gbk.key).filter(bg => mds.some(md => md.key === bg)), {
2190
- equal: (prev, curr) => prev.length === curr.length && curr.every((k, i) => prev[i] === k)
1899
+ }
1900
+ set opDialogConfig(config) {
1901
+ this._dialogConfig = { ...this.dialogConfig, ...defaultDialogConfig, ...config };
1902
+ }
1903
+ get opDialogConfig() {
1904
+ return this._dialogConfig;
1905
+ }
1906
+ set setControl(i) {
1907
+ let o;
1908
+ if (isSignal(i)) {
1909
+ o = toObservable(i, { injector: this.injector });
1910
+ }
1911
+ else {
1912
+ o = i;
1913
+ }
1914
+ untracked(() => {
1915
+ this.subscriber.on(o, this.setDataAndState);
2191
1916
  });
2192
- this.groupByKeys$ = this.select(state => state.groupBy.map(gbk => gbk.key))
2193
- .pipe(distinctUntilChanged((prev, curr) => prev.length === curr.length && curr.every((k, i) => prev[i] === k)));
2194
- this.expandedGroups$ = this.select(state => state.groupBy).pipe(distinctUntilChanged((a, b) => {
2195
- const aa = a.flatMap(g => g.expandedHeaders);
2196
- const bb = b.flatMap(g => g.expandedHeaders);
2197
- return aa.length === bb.length && aa.every((k) => bb.includes(k));
2198
- }));
2199
- this.$expandGroups = this.selectSignal(state => state.groupBy, { equal: (a, b) => {
2200
- const aa = a.flatMap(g => g.expandedHeaders);
2201
- const bb = b.flatMap(g => g.expandedHeaders);
2202
- return aa.length === bb.length && aa.every((k) => bb.includes(k));
2203
- } });
2204
- this.$getIsExpanded = (columnKey, groupUniqueName) => {
2205
- return this.selectSignal(state => !!state.groupBy.filter(g => g.key === columnKey && g.expandedHeaders.includes(groupUniqueName)).length);
2206
- };
2207
- this.$currentPage = this.selectSignal(state => state.currentPage);
2208
- this.$pageSize = this.selectSignal(s => s.userDefined?.pageSize || s.pageSize);
2209
- this.$showAll = this.selectSignal(s => s.userDefined?.showAll ?? s.showAll);
2210
- this.$tableSettings = this.selectSignal(state => {
2211
- const ts = { ...state.persistedTableSettings, ...state.notPersistedTableSettings };
2212
- return ts;
1917
+ }
1918
+ close() {
1919
+ this.dialogRef?.close();
1920
+ }
1921
+ initDialog() {
1922
+ if (this.nativeElement) {
1923
+ const rect = this.nativeElement.getBoundingClientRect();
1924
+ const position = { left: `${rect.left}px`, top: `${rect.bottom - 50}px` };
1925
+ this.opDialogConfig = { ...this.opDialogConfig, position };
1926
+ }
1927
+ if (this.opDialogAddDialogClass) {
1928
+ this.opDialogConfig.panelClass = [...(Array.isArray(this.opDialogConfig.panelClass) ? this.opDialogConfig.panelClass : this.opDialogConfig.panelClass ? [this.opDialogConfig.panelClass] : []), 'opDialog'];
1929
+ }
1930
+ this.dialogRef = this.dialog.open(DialogWrapper, this.opDialogConfig);
1931
+ this.componentWrapper = this.dialogRef.componentInstance;
1932
+ this.componentWrapper.close = () => this.dialogRef?.close();
1933
+ this.componentWrapper.data = this.opDialogConfig.data;
1934
+ this.componentWrapper.template = this.templateRef;
1935
+ if (!this.opDialogConfig.disableClose) {
1936
+ this.service.addDialogRef(this.dialogRef);
1937
+ }
1938
+ const sub = this.dialogRef.afterClosed().subscribe(() => {
1939
+ this.opDialogClosed.emit(true);
1940
+ this.service.removeDialogRef(this.dialogRef);
1941
+ this.dialogRef = undefined;
1942
+ sub.unsubscribe();
2213
1943
  });
2214
- this.$notPersistedTableSettings = this.selectSignal(state => state.notPersistedTableSettings);
2215
- this.tableSettings$ = toObservable(this.$tableSettings);
2216
- this.$props = this.selectSignal(s => s.props);
2217
- this.$getLinkInfo = (md) => this.selectSignal(state => state.linkMaps[md.key]);
2218
- this.$isVirtual = this.selectSignal(state => state.notPersistedTableSettings.useVirtualScroll
2219
- || state.showAll
2220
- || state.userDefined?.showAll);
2221
- this.$viewType = this.selectSignal(state => {
2222
- const usePaginator = state.notPersistedTableSettings.usePaginator;
2223
- const showAll = state.showAll || state.userDefined?.showAll;
2224
- const useVirtualScroll = state.notPersistedTableSettings.useVirtualScroll;
2225
- if (showAll || (useVirtualScroll && !usePaginator)) {
2226
- return 'virtual all';
2227
- }
2228
- else if (useVirtualScroll && usePaginator) {
2229
- return 'virtual paginator';
2230
- }
2231
- else if (usePaginator) {
2232
- return 'paginator';
1944
+ }
1945
+ setDialogState(open) {
1946
+ if (open) {
1947
+ if (!this.dialogRef) {
1948
+ this.initDialog();
2233
1949
  }
2234
1950
  else {
2235
- return 'all';
1951
+ this.componentWrapper.data = this.opDialogConfig.data;
2236
1952
  }
1953
+ }
1954
+ else if (!open && this.dialogRef) {
1955
+ this.dialogRef.close();
1956
+ }
1957
+ }
1958
+ static ngTemplateContextGuard(dir, ctx) {
1959
+ return true;
1960
+ }
1961
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1962
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: DialogDirective, isStandalone: true, selector: "[opDialog]", inputs: { opDialogAddDialogClass: "opDialogAddDialogClass", opDialogConfig: "opDialogConfig", setControl: ["opDialog", "setControl"], nativeElement: ["opDialogOrigin", "nativeElement"] }, outputs: { opDialogClosed: "opDialogClosed" }, ngImport: i0 }); }
1963
+ }
1964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogDirective, decorators: [{
1965
+ type: Directive,
1966
+ args: [{ selector: '[opDialog]', }]
1967
+ }], propDecorators: { opDialogClosed: [{
1968
+ type: Output
1969
+ }], opDialogAddDialogClass: [{
1970
+ type: Input
1971
+ }], opDialogConfig: [{
1972
+ type: Input
1973
+ }], setControl: [{
1974
+ type: Input,
1975
+ args: ['opDialog']
1976
+ }], nativeElement: [{
1977
+ type: Input,
1978
+ args: ['opDialogOrigin']
1979
+ }] } });
1980
+
1981
+ class StylerDirective {
1982
+ constructor() {
1983
+ this.el = inject(ElementRef);
1984
+ this.renderer = inject(Renderer2);
1985
+ this.$stylesApplied = signal({});
1986
+ this.$element = input.required({ alias: 'element' });
1987
+ this.$styler = input.required({ alias: 'styler' });
1988
+ this.#stylerEffect = effect(() => {
1989
+ const styles = this.$styler();
1990
+ untracked(() => {
1991
+ const element = this.$element();
1992
+ const toApply = Object.entries(styles ?? {}).reduce((acc, [key, val]) => {
1993
+ if (!val)
1994
+ return acc;
1995
+ if (typeof (val) === 'string') {
1996
+ acc[key] = val;
1997
+ this.el.nativeElement.style[key] = val;
1998
+ }
1999
+ else if (!val?.condition || val?.condition === true || val?.condition(element)) {
2000
+ const value = typeof (val.value) === 'string' ? val.value : val?.value(element);
2001
+ acc[key] = value;
2002
+ this.el.nativeElement.style[key] = value;
2003
+ }
2004
+ return acc;
2005
+ }, {});
2006
+ Object.keys(this.$stylesApplied()).filter(key => !Object.keys(toApply).includes(key)).forEach(key => {
2007
+ this.renderer.removeStyle(this.el.nativeElement, key);
2008
+ });
2009
+ this.$stylesApplied.set(toApply);
2010
+ });
2237
2011
  });
2238
- this.resetState = this.updater((state) => {
2239
- const sorted = this.$preSort();
2240
- return ({ ...state, hiddenKeys: [], sorted, filters: {}, groupBy: [], userDefined: { widths: {}, order: {}, table: {} } });
2241
- });
2242
- this.resetPart = this.updater((state, part) => {
2243
- const newState = { ...state };
2244
- switch (part) {
2245
- case 'Sorting':
2246
- newState.sorted = this.$preSort();
2247
- return newState;
2248
- case 'Filters':
2249
- newState.filters = {};
2250
- return newState;
2251
- case 'Group By':
2252
- newState.groupBy = [];
2253
- return newState;
2254
- case 'Hidden Columns':
2255
- newState.hiddenKeys = [];
2256
- return newState;
2257
- case 'Column Widths':
2258
- newState.userDefined.widths = {};
2259
- newState.userDefined.table = {};
2260
- return newState;
2261
- case 'Column Order':
2262
- newState.userDefined.order = {};
2263
- return newState;
2264
- case 'Page Size':
2265
- delete newState.userDefined.pageSize;
2266
- return newState;
2267
- case 'Show All':
2268
- delete newState.userDefined.showAll;
2269
- return newState;
2270
- case 'Row Height':
2271
- delete newState.userDefined.rowHeight;
2272
- return newState;
2273
- case 'Header Height':
2274
- delete newState.userDefined.headerHeight;
2275
- return newState;
2012
+ }
2013
+ #stylerEffect;
2014
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StylerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2015
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.3", type: StylerDirective, isStandalone: true, selector: "[styler]", inputs: { $element: { classPropertyName: "$element", publicName: "element", isSignal: true, isRequired: true, transformFunction: null }, $styler: { classPropertyName: "$styler", publicName: "styler", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2016
+ }
2017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StylerDirective, decorators: [{
2018
+ type: Directive,
2019
+ args: [{ selector: '[styler]' }]
2020
+ }] });
2021
+
2022
+ class MatSlideToggleGroupDirective {
2023
+ constructor() {
2024
+ this.allowMultiple = false;
2025
+ this._ready = new ReplaySubject(1);
2026
+ }
2027
+ set toggles(val) {
2028
+ this._toggles = val;
2029
+ this._ready.next(true);
2030
+ }
2031
+ get valueEmitter() {
2032
+ return this._ready.pipe(switchMap$1(_ => this.getObs()));
2033
+ }
2034
+ getInitValue() {
2035
+ const startValue = this._toggles.reduce((prev, cur) => {
2036
+ if (!cur.name) {
2037
+ throw new Error('toggle must have the name attribute set');
2276
2038
  }
2277
- });
2278
- this.updateStateFromPersistedState = this.updater((state, persistedState) => {
2279
- const incomingTableState = cleanPersistedState(state, persistedState);
2280
- const newState = this.updateStateFunc(state, incomingTableState);
2281
- newState.initializationState = state.initializationState <= InitializationState.MetaDataLoaded ? InitializationState.TableSettingsLoaded : state.initializationState;
2282
- return newState;
2283
- });
2284
- this.updateStateFunc = (state, incomingTableState) => {
2285
- const metaData = state.metaData;
2286
- const sorted = incomingTableState.sorted?.length ? incomingTableState.sorted
2287
- : state.initializationState <= InitializationState.Created ? createPreSort(metaData) : state.sorted;
2288
- return { ...state, ...incomingTableState, metaData, sorted };
2289
- };
2290
- this.setTableSettings = this.updater((state, settings) => {
2291
- const s = {
2292
- ...state,
2293
- persistedTableSettings: state.persistedTableSettings.merge(settings),
2294
- notPersistedTableSettings: state.notPersistedTableSettings.merge(settings),
2295
- initializationState: InitializationState.TableSettingsLoaded
2296
- };
2297
- s.pageSize = settings.tableSettings?.paginatorSettings?.pageSize ?? s.pageSize;
2298
- s.showAll = settings.tableSettings?.paginatorSettings?.defaultAll ?? s.showAll;
2299
- return s;
2300
- });
2301
- this.setMetaData = this.updater((state, md) => {
2302
- const metaData = md
2303
- .reduce((prev, curr) => {
2304
- if (prev[curr.key]) {
2305
- prev[curr.key] = mergeMeta(prev[curr.key], curr);
2306
- }
2307
- else {
2308
- prev[curr.key] = curr;
2039
+ prev[cur.name] = cur.checked;
2040
+ return prev;
2041
+ }, {});
2042
+ return startValue;
2043
+ }
2044
+ getObs() {
2045
+ var toggleChanges = merge(...this._toggles.map(toggle => toggle.change));
2046
+ const startValue = this.getInitValue();
2047
+ return toggleChanges.pipe(scan((prev, cur) => {
2048
+ const toggleName = cur.source.name;
2049
+ const newVal = { ...prev, [toggleName]: cur.checked };
2050
+ if (cur.checked && !this.allowMultiple) {
2051
+ Object.keys(prev)
2052
+ .filter(key => key !== toggleName && prev[key])
2053
+ .forEach(key => {
2054
+ newVal[key] = false;
2055
+ this._toggles.find(toggle => toggle.name === key).toggle();
2056
+ });
2057
+ }
2058
+ return newVal;
2059
+ }, startValue), startWith$1(startValue));
2060
+ }
2061
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MatSlideToggleGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2062
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: MatSlideToggleGroupDirective, isStandalone: true, selector: "[opMatSlideToggleGroup]", inputs: { allowMultiple: "allowMultiple" }, outputs: { valueEmitter: "valueEmitter" }, queries: [{ propertyName: "toggles", predicate: MatSlideToggle }], ngImport: i0 }); }
2063
+ }
2064
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MatSlideToggleGroupDirective, decorators: [{
2065
+ type: Directive,
2066
+ args: [{ selector: '[opMatSlideToggleGroup]',
2067
+ }]
2068
+ }], propDecorators: { allowMultiple: [{
2069
+ type: Input
2070
+ }], toggles: [{
2071
+ type: ContentChildren,
2072
+ args: [MatSlideToggle]
2073
+ }], valueEmitter: [{
2074
+ type: Output
2075
+ }] } });
2076
+
2077
+ class TrimWhitespaceDirective {
2078
+ constructor() {
2079
+ this.elem = inject(ElementRef);
2080
+ }
2081
+ onBlur() {
2082
+ const inputString = this.elem.nativeElement.value;
2083
+ if (inputString) {
2084
+ const newValue = inputString.trim().replace(/\t/g, '');
2085
+ if (inputString !== newValue) {
2086
+ this.elem.nativeElement.value = newValue;
2087
+ this.elem.nativeElement.dispatchEvent(new Event('input', { bubbles: true }));
2088
+ }
2089
+ }
2090
+ }
2091
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TrimWhitespaceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2092
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: TrimWhitespaceDirective, isStandalone: true, selector: "input[trimWhitespace]", host: { listeners: { "blur": "onBlur()" } }, ngImport: i0 }); }
2093
+ }
2094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TrimWhitespaceDirective, decorators: [{
2095
+ type: Directive,
2096
+ args: [{
2097
+ selector: 'input[trimWhitespace]',
2098
+ }]
2099
+ }], propDecorators: { onBlur: [{
2100
+ type: HostListener,
2101
+ args: ['blur']
2102
+ }] } });
2103
+
2104
+ class FunctionPipe {
2105
+ transform(func, ...args) {
2106
+ if (typeof func === 'string') {
2107
+ const [instance, ...tail] = args;
2108
+ const method = instance[func].bind(instance);
2109
+ return method(...tail);
2110
+ }
2111
+ return func(...args);
2112
+ }
2113
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FunctionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
2114
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: FunctionPipe, isStandalone: true, name: "func" }); }
2115
+ }
2116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FunctionPipe, decorators: [{
2117
+ type: Pipe,
2118
+ args: [{
2119
+ name: 'func',
2120
+ }]
2121
+ }] });
2122
+
2123
+ class ConditionalClassesDirective {
2124
+ constructor() {
2125
+ this.el = inject(ElementRef);
2126
+ this.renderer = inject(Renderer2);
2127
+ this.$element = input.required({ alias: 'element' });
2128
+ this.$classes = input(undefined, { alias: 'conditionalClasses' });
2129
+ this.classesApplied = [];
2130
+ this.#onClasses = effect(() => {
2131
+ const classes = this.$classes();
2132
+ untracked(() => {
2133
+ const element = this.$element();
2134
+ let toApply = [];
2135
+ if (classes) {
2136
+ toApply = Object.keys(classes)
2137
+ .filter(key => (classes[key] === true) || classes[key](element));
2309
2138
  }
2310
- return prev;
2311
- }, {});
2312
- const sortedInitialized = state.sorted.length > 0;
2313
- const sorted = sortedInitialized ? state.sorted : createPreSort(metaData);
2314
- const order = initializeOrder(state, metaData);
2315
- const initializationState = state.initializationState == InitializationState.Created ? InitializationState.MetaDataLoaded : state.initializationState;
2316
- return { ...state, initializationState, metaData, sorted, userDefined: { ...state.userDefined, order: order } };
2317
- });
2318
- this.showColumn = this.updater((state, key) => ({
2319
- ...state,
2320
- hiddenKeys: state.hiddenKeys.filter(k => k !== key),
2321
- }));
2322
- this.hideColumn = this.updater((state, key) => ({
2323
- ...state,
2324
- hiddenKeys: [...state.hiddenKeys.filter(k => k !== key), key],
2325
- }));
2326
- this.setHiddenColumns = this.updater((state, displayCols) => {
2327
- return ({ ...state, hiddenKeys: displayCols.filter(d => !d.visible).map(d => d.key) });
2328
- });
2329
- this.setUserDefinedWidth = this.updater((state, colWidths) => {
2330
- const userDefinedWidths = { ...state.userDefined.widths };
2331
- colWidths.forEach(cw => {
2332
- userDefinedWidths[cw.key] = cw.widthInPixel;
2139
+ var classesNotYetApplied = toApply.filter(c => !this.classesApplied.includes(c));
2140
+ var classesToRemove = this.classesApplied.filter(c => !toApply.includes(c));
2141
+ classesToRemove.forEach(c => this.renderer.removeClass(this.el.nativeElement, c));
2142
+ classesNotYetApplied.forEach(c => this.renderer.addClass(this.el.nativeElement, c));
2143
+ this.classesApplied = toApply;
2333
2144
  });
2334
- return { ...state, userDefined: { ...state.userDefined, widths: userDefinedWidths } };
2335
2145
  });
2336
- this.setUserDefinedOrder = this.updater((state, moved) => {
2337
- const { newOrder, oldOrder } = moved;
2338
- const mdsArr = orderedStateVisibleMetaData(state);
2339
- moveItemInArray(mdsArr, oldOrder, newOrder);
2340
- const userDefinedOrder = mdsArr.reduce((aggregate, current, index) => {
2341
- aggregate[current.key] = index;
2342
- return aggregate;
2343
- }, {});
2344
- return ({ ...state, userDefined: { ...state.userDefined, order: userDefinedOrder } });
2345
- });
2346
- this.setUserDefinedRowHeight = this.updater((state, rowHeight) => {
2347
- return ({ ...state, userDefined: { ...state.userDefined, rowHeight } });
2348
- });
2349
- this.setUserDefinedHeaderHeight = this.updater((state, headerHeight) => {
2350
- return ({ ...state, userDefined: { ...state.userDefined, headerHeight } });
2351
- });
2352
- this.addFilter = this.updater((state, filter) => {
2353
- return this.addFiltersToState(state, [filter]);
2354
- });
2355
- this.addFilters = this.updater((state, filters) => {
2356
- return this.addFiltersToState(state, filters);
2357
- });
2358
- this.removeFilter = this.updater((state, filterId) => {
2359
- const filtersCopy = { ...state.filters };
2360
- delete filtersCopy[filterId];
2361
- return ({ ...state, filters: filtersCopy });
2362
- });
2363
- this.removeFilters = this.updater((state, filterIds) => {
2364
- const filtersCopy = { ...state.filters };
2365
- filterIds.forEach(id => { delete filtersCopy[id]; });
2366
- return ({ ...state, filters: filtersCopy });
2367
- });
2368
- this.clearFilters = this.updater((state) => ({ ...state, filters: {} }));
2369
- this.addFiltersToState = (state, filters) => {
2370
- var customFilters = filters.filter(isCustomFilter);
2371
- var filterInfos = filters.filter(isFilterInfo);
2372
- const filtersObj = filterInfos
2373
- .filter(fltr => Object.keys(state.metaData).some(key => key === fltr.key) || console.warn(`Meta data with key ${fltr.key} not found`))
2374
- .reduce((filtersObj, filter) => {
2375
- if (!filter.filterId) {
2376
- filter.filterId = crypto.randomUUID();
2377
- }
2378
- filtersObj[filter.filterId] = filter;
2379
- return filtersObj;
2380
- }, {});
2381
- customFilters.forEach(fltr => {
2382
- if (!fltr.filterId) {
2383
- fltr.filterId = crypto.randomUUID();
2384
- }
2385
- filtersObj[fltr.filterId] = fltr;
2386
- });
2387
- return {
2388
- ...state,
2389
- filters: { ...state.filters, ...filtersObj }
2390
- };
2146
+ }
2147
+ #onClasses;
2148
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ConditionalClassesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2149
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.3", type: ConditionalClassesDirective, isStandalone: true, selector: "[conditionalClasses]", inputs: { $element: { classPropertyName: "$element", publicName: "element", isSignal: true, isRequired: true, transformFunction: null }, $classes: { classPropertyName: "$classes", publicName: "conditionalClasses", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
2150
+ }
2151
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ConditionalClassesDirective, decorators: [{
2152
+ type: Directive,
2153
+ args: [{
2154
+ selector: '[conditionalClasses]',
2155
+ }]
2156
+ }] });
2157
+
2158
+ class UtilitiesModule {
2159
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2160
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, imports: [SpaceCasePipe,
2161
+ PhoneNumberPipe,
2162
+ FunctionPipe,
2163
+ StopPropagationDirective,
2164
+ StylerDirective,
2165
+ PreventEnterDirective,
2166
+ AutoFocusDirective,
2167
+ TrimWhitespaceDirective,
2168
+ ClickSubjectDirective,
2169
+ ClickEmitterDirective,
2170
+ DialogDirective,
2171
+ MatSlideToggleGroupDirective,
2172
+ ConditionalClassesDirective], exports: [StopPropagationDirective,
2173
+ PreventEnterDirective,
2174
+ SpaceCasePipe,
2175
+ PhoneNumberPipe,
2176
+ FunctionPipe,
2177
+ TrimWhitespaceDirective,
2178
+ StylerDirective,
2179
+ AutoFocusDirective,
2180
+ ClickSubjectDirective,
2181
+ ClickEmitterDirective,
2182
+ DialogDirective,
2183
+ MatSlideToggleGroupDirective,
2184
+ ConditionalClassesDirective] }); }
2185
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, providers: [
2186
+ DialogService
2187
+ ] }); }
2188
+ }
2189
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, decorators: [{
2190
+ type: NgModule,
2191
+ args: [{
2192
+ exports: [
2193
+ StopPropagationDirective,
2194
+ PreventEnterDirective,
2195
+ SpaceCasePipe,
2196
+ PhoneNumberPipe,
2197
+ FunctionPipe,
2198
+ TrimWhitespaceDirective,
2199
+ StylerDirective,
2200
+ AutoFocusDirective,
2201
+ ClickSubjectDirective,
2202
+ ClickEmitterDirective,
2203
+ DialogDirective,
2204
+ MatSlideToggleGroupDirective,
2205
+ ConditionalClassesDirective,
2206
+ ],
2207
+ imports: [
2208
+ SpaceCasePipe,
2209
+ PhoneNumberPipe,
2210
+ FunctionPipe,
2211
+ StopPropagationDirective,
2212
+ StylerDirective,
2213
+ PreventEnterDirective,
2214
+ AutoFocusDirective,
2215
+ TrimWhitespaceDirective,
2216
+ ClickSubjectDirective,
2217
+ ClickEmitterDirective,
2218
+ DialogDirective,
2219
+ MatSlideToggleGroupDirective,
2220
+ ConditionalClassesDirective,
2221
+ ],
2222
+ providers: [
2223
+ DialogService
2224
+ ]
2225
+ }]
2226
+ }] });
2227
+
2228
+ function sortData(data, sorted) {
2229
+ return data.sort(compareT(sorted));
2230
+ }
2231
+ function filterData(data, filters, resetAll = false) {
2232
+ if (filters.length === 0) {
2233
+ if (resetAll) {
2234
+ for (let index = 0; index < data.length; index++) {
2235
+ const element = data[index];
2236
+ element[tbNoShowSymbol] = false;
2237
+ }
2238
+ }
2239
+ return data;
2240
+ }
2241
+ for (let index = 0; index < data.length; index++) {
2242
+ const element = data[index];
2243
+ const hide = !filters.every(filter => filter(element));
2244
+ if (hide || resetAll) {
2245
+ element[tbNoShowSymbol] = hide;
2246
+ }
2247
+ }
2248
+ return data;
2249
+ }
2250
+ const tbNoShowSymbol = Symbol('tb_no_show');
2251
+ function compareT(criteria) {
2252
+ const transforms = criteria.reduce((acc, c) => {
2253
+ acc[c.active] = {
2254
+ transform: c.sortBy ? c.sortBy : getFactory(c.active), nulls: c.nulls === 'first' ? -1 : 1
2391
2255
  };
2392
- this.setSort = this.updater((state, { key, direction }) => {
2393
- const sortArray = state.sorted.filter(s => s.active !== key);
2394
- if (direction) {
2395
- sortArray.unshift({ active: key, direction });
2256
+ return acc;
2257
+ }, {});
2258
+ return function (a, b) {
2259
+ for (let index = 0; index < criteria.length; index++) {
2260
+ const c = criteria[index];
2261
+ const d = transforms[c.active];
2262
+ const nullValue = d.nulls;
2263
+ if (a == null) {
2264
+ if (b == null)
2265
+ return 0;
2266
+ return nullValue;
2396
2267
  }
2397
- return {
2398
- ...state,
2399
- sorted: sortArray,
2400
- };
2401
- });
2402
- this.setAllSort = this.updater((state, sortArray) => {
2403
- return {
2404
- ...state,
2405
- sorted: sortArray,
2406
- };
2407
- });
2408
- this.setCurrentPage = this.updater((state, currentPage) => ({ ...state, currentPage }));
2409
- this.setPageSize = this.updater((state, pageSize) => ({ ...state, pageSize }));
2410
- this.setUserDefinedPageSize = this.updater((state, pageSize) => ({ ...state, userDefined: { ...state.userDefined, pageSize } }));
2411
- this.setUserDefinedShowAll = this.updater((state, showAll) => ({ ...state, showAll, userDefined: { ...state.userDefined, showAll } }));
2412
- this.setProps = this.updater((state, props) => {
2413
- return ({ ...state, props });
2414
- });
2415
- this.setTableWidth = this.updater((state, widthInPixels) => ({ ...state, userDefined: { ...state.userDefined, table: { width: widthInPixels } } }));
2416
- this.setInitializationState = this.updater((state, initializationState) => {
2417
- return { ...state, initializationState };
2418
- });
2419
- this.toggleCollapseHeader = this.updater((state) => {
2420
- const tableSettings = { ...state.persistedTableSettings };
2421
- tableSettings.collapseHeader = !tableSettings.collapseHeader;
2422
- return ({ ...state, persistedTableSettings: new PersistedTableSettings(tableSettings) });
2423
- });
2424
- this.toggleCollapseFooter = this.updater((state, options) => {
2425
- const tableSettings = { ...state.persistedTableSettings };
2426
- tableSettings.collapseFooter = options?.collapseFooter ?? !tableSettings.collapseFooter;
2427
- return ({ ...state, persistedTableSettings: new PersistedTableSettings(tableSettings) });
2428
- });
2429
- this.addGroupByKey = this.updater((state, metaDataKey) => ({
2430
- ...state,
2431
- groupBy: [...state.groupBy, { key: metaDataKey, expandedHeaders: [] }]
2432
- }));
2433
- this.removeGroupByKey = this.updater((state, groupByKey) => ({
2434
- ...state,
2435
- groupBy: state.groupBy.filter(key => groupByKey !== key.key)
2436
- }));
2437
- this.updateExpandedGroups = this.updater((state, data) => {
2438
- const gbk = replaceInArrayWithClone(state.groupBy, k => k.key === data.key, gk => {
2439
- gk.expandedHeaders = data.isExpanded ? [...gk.expandedHeaders, data.groupUniqueName] : gk.expandedHeaders.filter(g => g !== data.groupUniqueName);
2440
- });
2441
- return ({
2442
- ...state,
2443
- groupBy: gbk
2444
- });
2445
- });
2446
- this.expandAllOfGroup = this.updater((state, data) => {
2447
- const newGroupedData = state.groupBy.map(gb => ({
2448
- key: gb.key,
2449
- expandedHeaders: data.groupHeadersByKey[gb.key]?.map(g => g.uniqueName) ?? gb.expandedHeaders
2450
- }));
2451
- return ({ ...state, groupBy: newGroupedData });
2452
- });
2453
- this.collapseAll = this.updater((state) => ({
2454
- ...state,
2455
- groupBy: state.groupBy.map(gb => ({ key: gb.key, expandedHeaders: [] }))
2456
- }));
2457
- this.collapseAllOfKey = this.updater((state, data) => ({
2458
- ...state,
2459
- groupBy: state.groupBy.map(gb => ({
2460
- key: gb.key,
2461
- expandedHeaders: data.keys.includes(gb.key) ? [] : gb.expandedHeaders
2462
- }))
2463
- }));
2464
- this.setLinkMaps = this.updater((state, maps) => {
2465
- return ({ ...state, linkMaps: maps });
2466
- });
2467
- this.updateRowProps = this.updater((state, updates) => {
2468
- const notPersistedTableSettings = merge$1(new NotPersistedTableSettings(), (state.notPersistedTableSettings));
2469
- if (updates.rowClasses)
2470
- notPersistedTableSettings.rowClasses = updates.rowClasses;
2471
- if (updates.rowClick)
2472
- notPersistedTableSettings.rowClick = updates.rowClick;
2473
- if (updates.rowStyles)
2474
- notPersistedTableSettings.rowStyles = updates.rowStyles;
2475
- return ({ ...state, notPersistedTableSettings });
2476
- });
2477
- this.on = (srcObservable, func) => {
2478
- this.effect(() => srcObservable.pipe(tap(func)));
2479
- return this;
2268
+ if (b == null)
2269
+ return -nullValue;
2270
+ const transform = d.transform;
2271
+ const aVal = transform(a);
2272
+ const bVal = transform(b);
2273
+ if (aVal == null) {
2274
+ if (bVal == null)
2275
+ return 0;
2276
+ return nullValue;
2277
+ }
2278
+ if (bVal == null)
2279
+ return -nullValue;
2280
+ if (aVal < bVal)
2281
+ return c.direction === 'asc' ? -1 : 1;
2282
+ if (aVal > bVal)
2283
+ return c.direction === 'asc' ? 1 : -1;
2284
+ }
2285
+ return 0;
2286
+ };
2287
+ }
2288
+ function getFactory(b) {
2289
+ if (typeof b !== 'string')
2290
+ return (a) => a[b];
2291
+ if (!b.includes('.'))
2292
+ return (a) => {
2293
+ if (!a)
2294
+ return a;
2295
+ return a[b];
2296
+ };
2297
+ const arr = b.split('.');
2298
+ return (a) => {
2299
+ let val = a;
2300
+ if (!a)
2301
+ return a;
2302
+ for (let index = 0; index < arr.length; index++) {
2303
+ val = val[arr[index]];
2304
+ if (val == undefined)
2305
+ return undefined;
2306
+ if (typeof val !== 'object' && index + 1 < arr.length)
2307
+ return undefined;
2308
+ }
2309
+ return val;
2310
+ };
2311
+ }
2312
+
2313
+ function isPipe(o) {
2314
+ return typeof (o.transform) === 'function';
2315
+ }
2316
+ function createTransformer(metaData, config, noIcons = false, forItem = false) {
2317
+ const defaultFunc = getFactory(metaData.key);
2318
+ if (metaData.map && !forItem) {
2319
+ return (value) => {
2320
+ return metaData.map(value);
2480
2321
  };
2481
2322
  }
2482
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TableStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2483
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TableStore }); }
2323
+ if (metaData.mapItem) {
2324
+ return (value) => {
2325
+ return metaData.mapItem(defaultFunc(value));
2326
+ };
2327
+ }
2328
+ if (metaData.transform) {
2329
+ if (isPipe(metaData.transform)) {
2330
+ return (value) => metaData.transform.transform(defaultFunc(value));
2331
+ }
2332
+ return metaData.fieldType === FieldType.Expression ? metaData.transform : (value) => metaData.transform(defaultFunc(value), value);
2333
+ }
2334
+ if (config.transformers && config.transformers[metaData.fieldType]) {
2335
+ var transformer = config.transformers[metaData.fieldType];
2336
+ return (value) => transformer(defaultFunc(value));
2337
+ }
2338
+ const defaultDateFormat = config.dateFormats?.dateFormat ?? 'shortDate';
2339
+ const defaultDateTimeFormat = config.dateFormats?.dateTimeFormat ?? 'short';
2340
+ switch (metaData.fieldType) {
2341
+ case FieldType.Date:
2342
+ const dateFormat = metaData.additional?.dateFormat ?? defaultDateFormat;
2343
+ return (value) => dateFormatter(defaultFunc(value), dateFormat);
2344
+ case FieldType.DateTime:
2345
+ const dateTimeFormat = metaData.additional?.dateTimeOptions?.format ?? defaultDateTimeFormat;
2346
+ return (value) => dateFormatter(defaultFunc(value), dateTimeFormat);
2347
+ case FieldType.Currency:
2348
+ return (value) => currencyFormatter(defaultFunc(value));
2349
+ case FieldType.PhoneNumber:
2350
+ return (value) => phoneFormatter(defaultFunc(value));
2351
+ case FieldType.Enum:
2352
+ return (value) => spaceCase(metaData.additional?.enumMap[defaultFunc(value)]);
2353
+ case FieldType.Boolean:
2354
+ if (noIcons) {
2355
+ return defaultFunc;
2356
+ }
2357
+ let forTrue = 'check';
2358
+ let forFalse = '';
2359
+ if (metaData.additional?.boolean?.forTrue) {
2360
+ forTrue = metaData?.additional.boolean.forTrue.icon;
2361
+ }
2362
+ if (metaData.additional?.boolean?.showForFalse === true) {
2363
+ forFalse = 'clear';
2364
+ }
2365
+ else if (metaData.additional?.boolean?.showForFalse?.icon) {
2366
+ forFalse = metaData.additional?.boolean?.showForFalse?.icon;
2367
+ }
2368
+ return (value) => defaultFunc(value) ? forTrue : forFalse;
2369
+ }
2370
+ return defaultFunc;
2371
+ }
2372
+ function createItemTransformer(metaData, config, noIcons = false, mutate = false) {
2373
+ const transform = createTransformer(metaData, config, noIcons);
2374
+ return (t) => {
2375
+ if (!mutate) {
2376
+ t = { ...t };
2377
+ }
2378
+ t[metaData.key] = transform(t);
2379
+ };
2380
+ }
2381
+ function createItemTransformers(metaDatas, config, noIcons = false, mutate = false) {
2382
+ const transformers = metaDatas.map(meta => createItemTransformer(meta, config, noIcons, true));
2383
+ return (t) => {
2384
+ if (!t)
2385
+ return t;
2386
+ if (!mutate) {
2387
+ t = { ...t };
2388
+ }
2389
+ transformers.forEach(m => m(t));
2390
+ return t;
2391
+ };
2392
+ }
2393
+ function dateFormatter(date, format) {
2394
+ if (!date)
2395
+ return;
2396
+ return formatDate(date, format, 'en-US');
2397
+ }
2398
+ function currencyFormatter(amt) {
2399
+ return formatCurrency(amt, 'en-US', '$');
2484
2400
  }
2485
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TableStore, decorators: [{
2486
- type: Injectable
2487
- }], ctorParameters: () => [] });
2488
- const resetable = [
2489
- 'Sorting',
2490
- 'Filters',
2491
- 'Group By',
2492
- 'Hidden Columns',
2493
- 'Column Widths',
2494
- 'Column Order',
2495
- 'Row Height',
2496
- 'Header Height',
2497
- 'Page Size',
2498
- 'Show All',
2499
- ];
2500
2401
 
2501
- class MultiSortDirective extends MatSort {
2502
- constructor() {
2503
- super();
2504
- this.state = inject(TableStore);
2505
- 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 }))));
2506
- this.state.on(this.state.sort$, (rules) => {
2507
- const topRule = { active: rules[0]?.active || '', direction: rules[0]?.direction || '' };
2508
- const topActiveChanged = topRule.active !== this.active || '';
2509
- const topDirectionChanged = topRule.direction !== this.direction || '';
2510
- if (topActiveChanged || topDirectionChanged) {
2511
- this.active = topRule.active;
2512
- this.direction = topRule.direction;
2513
- this.sortChange.emit(topRule);
2514
- }
2515
- });
2402
+ function buildInAllValuesFilter(config, previousMeta, currentMeta, data, metaTimestamp, dataTimestamp, currentAllFilters) {
2403
+ const currentAll = currentMeta.filter(m => {
2404
+ const filterable = m.additional?.filterOptions?.filterableValues;
2405
+ return filterable === 'all values' || filterable?.allValues === true;
2406
+ });
2407
+ if (dataTimestamp > metaTimestamp) {
2408
+ return currentAll.reduce((dict, md) => {
2409
+ dict[md.key] = buildFilter(data, md, config);
2410
+ return dict;
2411
+ }, {});
2412
+ }
2413
+ const previousAll = previousMeta.filter(m => {
2414
+ const filterable = m.additional?.filterOptions?.filterableValues;
2415
+ return filterable === 'all values' || filterable?.allValues === true;
2416
+ });
2417
+ const newCurrent = currentAll.filter(c => previousAll.every(p => c.key !== p.key));
2418
+ if (newCurrent.length) {
2419
+ const c = { ...currentAllFilters };
2420
+ newCurrent.forEach(md => c[md.key] = buildFilter(data, md, config));
2421
+ return c;
2422
+ }
2423
+ return currentAllFilters;
2424
+ }
2425
+ const blankValueFilter = '__tb_sp_blank';
2426
+ const blankValueAndEmptyStringFilter = '__tb_sp_BLANK';
2427
+ function buildFilter(data, metaData, config) {
2428
+ const map = createTransformer(metaData, config, true, true);
2429
+ const mapped = data.map(v => {
2430
+ const mappedV = map(v);
2431
+ return [mappedV?.toString(), mappedV];
2432
+ });
2433
+ const blankAsOption = metaData?.additional?.filterOptions?.filterableValues?.doNotIncludeBlanks !== true;
2434
+ const stringsAsBlanks = metaData?.additional?.filterOptions?.filterableValues?.doNotTreatEmptyStringsAsBlanks !== true;
2435
+ const blankAsOptionAndHasBlanks = blankAsOption && mapped.some(([, v]) => v == undefined || (stringsAsBlanks && v === ''));
2436
+ if (blankAsOptionAndHasBlanks) {
2437
+ if (stringsAsBlanks) {
2438
+ mapped.push(['BLANK', blankValueAndEmptyStringFilter]);
2439
+ }
2440
+ else {
2441
+ mapped.push(['BLANK', blankValueFilter]);
2442
+ }
2443
+ }
2444
+ return [...new Map(mapped).values()].filter(v => v != undefined && (!blankAsOption || !stringsAsBlanks || v !== '')).sort((a, b) => {
2445
+ const isSymbolA = typeof a === 'symbol';
2446
+ const isSymbolB = typeof b === 'symbol';
2447
+ if (isSymbolA || isSymbolB)
2448
+ return 0; // keep symbols in place
2449
+ return String(a).localeCompare(String(b)); // normal string sort
2450
+ });
2451
+ }
2452
+ const splitOutBlankFilter = (arr) => {
2453
+ const result = Object.groupBy(arr, v => isBlankValueFilter(v) ? 'blank' : 'values');
2454
+ const blank = result.blank?.at(0);
2455
+ const blankFilter = blank === blankValueFilter ?
2456
+ (val) => val == undefined
2457
+ : blank === blankValueAndEmptyStringFilter ? (val) => {
2458
+ return (val === '' || val == null);
2459
+ }
2460
+ : undefined;
2461
+ return ({
2462
+ blankFilter,
2463
+ values: result.values || [],
2464
+ });
2465
+ };
2466
+ function isBlankValueFilter(val) {
2467
+ return val === blankValueFilter || val === blankValueAndEmptyStringFilter;
2468
+ }
2469
+ function isNotBlankValueFilter(val) {
2470
+ return !isBlankValueFilter(val);
2471
+ }
2472
+
2473
+ const isNull = (filterInfo) => {
2474
+ const func = filterInfo.filterValue ?
2475
+ (val) => val == null || val === ''
2476
+ :
2477
+ (val) => val != null && val !== '';
2478
+ return func;
2479
+ };
2480
+
2481
+ const stringEqualFunc = (filterInfo) => {
2482
+ const equalsVal = prepareForStringCompare(filterInfo.filterValue);
2483
+ return ((val) => prepareForStringCompare(val) === equalsVal);
2484
+ };
2485
+ const stringContainsFunc = (filterInfo) => {
2486
+ const containsVal = prepareForStringCompare(filterInfo.filterValue);
2487
+ return ((val) => prepareForStringCompare(val).includes(containsVal));
2488
+ };
2489
+ const stringDoesNotContainFunc = (filterInfo) => {
2490
+ const doesNotContainVal = prepareForStringCompare(filterInfo.filterValue);
2491
+ return ((val) => !prepareForStringCompare(val)?.includes(doesNotContainVal));
2492
+ };
2493
+ const stringStartsWithFunc = (filterInfo) => {
2494
+ const startsWith = prepareForStringCompare(filterInfo.filterValue);
2495
+ return ((val) => prepareForStringCompare(val).startsWith(startsWith));
2496
+ };
2497
+ const stringEndsWithFunc = (filterInfo) => {
2498
+ const startsWith = prepareForStringCompare(filterInfo.filterValue);
2499
+ return ((val) => prepareForStringCompare(val).endsWith(startsWith));
2500
+ };
2501
+ const multipleStringValuesEqualsFunc = (filterInfo) => {
2502
+ const { blankFilter, values } = splitOutBlankFilter(filterInfo.filterValue);
2503
+ const filterVals = values.map((v) => prepareForStringCompare(v));
2504
+ const basicFunc = (val) => filterVals.some((s) => val === s);
2505
+ const func = blankFilter ? ((val) => blankFilter(val) || basicFunc(val)) : basicFunc;
2506
+ return ((val) => {
2507
+ const v = prepareForStringCompare(val);
2508
+ return func(v);
2509
+ });
2510
+ };
2511
+ const StringFilterFuncs = {
2512
+ [FilterType.StringEquals]: stringEqualFunc,
2513
+ [FilterType.StringContains]: stringContainsFunc,
2514
+ [FilterType.StringDoesNotContain]: stringDoesNotContainFunc,
2515
+ [FilterType.StringStartWith]: stringStartsWithFunc,
2516
+ [FilterType.StringEndsWith]: stringEndsWithFunc,
2517
+ [FilterType.IsNull]: isNull,
2518
+ [FilterType.In]: multipleStringValuesEqualsFunc,
2519
+ };
2520
+ const EnumFilterFuncs = {
2521
+ [FilterType.IsNull]: isNull,
2522
+ [FilterType.In]: multipleStringValuesEqualsFunc,
2523
+ };
2524
+ const prepareForStringCompare = (val) => (val?.toString().trim().toLowerCase());
2525
+
2526
+ const numberEqalsFunc = (filterInfo) => (val) => {
2527
+ return val === filterInfo.filterValue;
2528
+ };
2529
+ const numberNotEqualFunc = (filterInfo) => (val) => {
2530
+ return val !== filterInfo.filterValue;
2531
+ };
2532
+ const numberGreaterThanFunc = (filterInfo) => (val) => {
2533
+ return val > filterInfo.filterValue;
2534
+ };
2535
+ const numberLessThanFunc = (filterInfo) => (val) => {
2536
+ return val < filterInfo.filterValue;
2537
+ };
2538
+ const numberBetweenFunc = (filterInfo) => {
2539
+ const startVal = Number(filterInfo.filterValue.Start);
2540
+ const endVal = Number(filterInfo.filterValue.End);
2541
+ return ((val) => (val > startVal) && (val < endVal));
2542
+ };
2543
+ const multipleNumberValuesEqualsFunc = (filterInfo) => {
2544
+ const { blankFilter, values } = splitOutBlankFilter(filterInfo.filterValue);
2545
+ const basicFunc = (val) => values.some((s) => val === s);
2546
+ const func = blankFilter ? ((val) => blankFilter(val) || basicFunc(val)) : basicFunc;
2547
+ return func;
2548
+ };
2549
+ const NumberFilterFuncs = {
2550
+ [FilterType.NumberEquals]: numberEqalsFunc,
2551
+ [FilterType.NumberNotEqual]: numberNotEqualFunc,
2552
+ [FilterType.NumberGreaterThan]: numberGreaterThanFunc,
2553
+ [FilterType.NumberLessThan]: numberLessThanFunc,
2554
+ [FilterType.NumberBetween]: numberBetweenFunc,
2555
+ [FilterType.IsNull]: isNull,
2556
+ [FilterType.In]: multipleNumberValuesEqualsFunc,
2557
+ };
2558
+
2559
+ const dateIsOnFunc = (filterInfo) => {
2560
+ const isOnVal = new Date(filterInfo.filterValue).getTime();
2561
+ const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
2562
+ return ((val) => clean(filterInfo, val).getTime() === isOnVal);
2563
+ };
2564
+ const dateIsNotOnFunc = (filterInfo) => {
2565
+ const isNotOnVal = new Date(filterInfo.filterValue).getTime();
2566
+ const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
2567
+ return ((val) => clean(filterInfo, val).getTime() !== isNotOnVal);
2568
+ };
2569
+ const dateIsOnOrAfterFunc = (filterInfo) => {
2570
+ const afterVal = new Date(filterInfo.filterValue).getTime();
2571
+ const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
2572
+ return ((val) => clean(filterInfo, val).getTime() >= afterVal);
2573
+ };
2574
+ const dateIsOnOrBeforeFunc = (filterInfo) => {
2575
+ const beforeVal = new Date(filterInfo.filterValue).getTime();
2576
+ const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
2577
+ return ((val) => clean(filterInfo, val).getTime() <= beforeVal);
2578
+ };
2579
+ const dateIsInFunc = (filterInfo) => {
2580
+ const { blankFilter, values } = splitOutBlankFilter(filterInfo.filterValue);
2581
+ const filterVals = values.map(v => new Date(v).getTime());
2582
+ const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
2583
+ const basicFunc = (val) => filterVals.some((f) => f === val);
2584
+ const func = blankFilter ? ((val) => blankFilter(val) || basicFunc(val)) : basicFunc;
2585
+ return ((val) => {
2586
+ const d = clean(filterInfo, val)?.getTime();
2587
+ return func(d);
2588
+ });
2589
+ };
2590
+ const dateBetweenFunc = (filterInfo) => {
2591
+ const startVal = new Date(filterInfo.filterValue.Start);
2592
+ const endVal = new Date(filterInfo.filterValue.End);
2593
+ const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
2594
+ return ((val) => {
2595
+ const cleanedVal = clean(filterInfo, val);
2596
+ return cleanedVal >= startVal && cleanedVal <= endVal;
2597
+ });
2598
+ };
2599
+ const cleanDateTime = (filterInfo, val) => {
2600
+ if (!!DateFilterFuncs[filterInfo.filterType]) {
2601
+ const d = new Date(val);
2602
+ d.setHours(0, 0, 0, 0);
2603
+ return d;
2516
2604
  }
2517
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MultiSortDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2518
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: MultiSortDirective, isStandalone: true, selector: "[multiSort]", inputs: { disabled: ["matSortDisabled", "disabled"] }, providers: [
2519
- { provide: MatSort, useExisting: MultiSortDirective }
2520
- ], exportAs: ["multiSort"], usesInheritance: true, ngImport: i0 }); }
2605
+ return val;
2606
+ };
2607
+ const DateFilterFuncs = {
2608
+ [FilterType.DateIsOn]: dateIsOnFunc,
2609
+ [FilterType.DateIsNotOn]: dateIsNotOnFunc,
2610
+ [FilterType.DateOnOrAfter]: dateIsOnOrAfterFunc,
2611
+ [FilterType.DateOnOrBefore]: dateIsOnOrBeforeFunc,
2612
+ [FilterType.DateBetween]: dateBetweenFunc,
2613
+ [FilterType.In]: dateIsInFunc,
2614
+ [FilterType.IsNull]: isNull,
2615
+ };
2616
+ const DateTimeFilterFuncs = {
2617
+ ...DateFilterFuncs,
2618
+ [FilterType.DateTimeIsAt]: dateIsOnFunc,
2619
+ [FilterType.DateTimeIsNotAt]: dateIsNotOnFunc,
2620
+ [FilterType.DateTimeAtOrAfter]: dateIsOnOrAfterFunc,
2621
+ [FilterType.DateTimeAtOrBefore]: dateIsOnOrBeforeFunc,
2622
+ [FilterType.DateTimeBetween]: dateBetweenFunc,
2623
+ [FilterType.In]: dateIsInFunc,
2624
+ [FilterType.IsNull]: isNull,
2625
+ };
2626
+
2627
+ const booleanEqualsFunc = (filterInfo) => (val) => {
2628
+ return filterInfo.filterValue === val;
2629
+ };
2630
+ const BooleanFilterFuncs = {
2631
+ [FilterType.BooleanEquals]: booleanEqualsFunc,
2632
+ [FilterType.IsNull]: isNull,
2633
+ };
2634
+
2635
+ const filterFactoryMap = {
2636
+ [FilterType.And]: (filter) => {
2637
+ const filters = createFilterFuncs(filter.filterValue);
2638
+ return (obj) => filters.every(f => f(obj));
2639
+ },
2640
+ [FilterType.In]: (filter) => {
2641
+ const filters = createFilterFuncs(filter.filterValue);
2642
+ return (obj) => filters.some(f => f(obj));
2643
+ },
2644
+ };
2645
+ const filterTypeFuncMap = {
2646
+ [FieldType.Array]: StringFilterFuncs,
2647
+ [FieldType.Boolean]: BooleanFilterFuncs,
2648
+ [FieldType.Currency]: NumberFilterFuncs,
2649
+ [FieldType.Date]: DateFilterFuncs,
2650
+ [FieldType.DateTime]: DateTimeFilterFuncs,
2651
+ [FieldType.Enum]: EnumFilterFuncs,
2652
+ [FieldType.Link]: StringFilterFuncs,
2653
+ [FieldType.Number]: NumberFilterFuncs,
2654
+ [FieldType.PhoneNumber]: StringFilterFuncs,
2655
+ [FieldType.String]: StringFilterFuncs,
2656
+ [FieldType.Unknown]: StringFilterFuncs,
2657
+ };
2658
+ const filterTypeMap = Object.entries(filterTypeFuncMap).reduce((acc, [key, value]) => ({ ...acc, [key]: Object.keys(value) }), {});
2659
+ function isCustomFilter(filter) {
2660
+ return filter && filter.filterType === FilterType.Custom;
2521
2661
  }
2522
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MultiSortDirective, decorators: [{
2523
- type: Directive,
2524
- args: [{
2525
- selector: '[multiSort]',
2526
- exportAs: 'multiSort',
2527
- inputs: ['disabled: matSortDisabled'],
2528
- providers: [
2529
- { provide: MatSort, useExisting: MultiSortDirective }
2530
- ],
2531
- }]
2532
- }], ctorParameters: () => [] });
2533
- function sortsAreSame(a, b) {
2534
- if (a.length !== b.length) {
2535
- return false;
2536
- }
2537
- for (let i = 0; i < a.length; i++) {
2538
- if (a[i].active !== b[i].active || a[i].direction !== b[i].direction) {
2539
- return false;
2540
- }
2541
- }
2542
- return true;
2662
+ function isFilterInfo(filter) {
2663
+ return filter && typeof filter.key === 'string' && filter.filterType !== FilterType.Custom;
2543
2664
  }
2544
-
2545
- class DateFilterComponent {
2546
- constructor() {
2547
- this.FilterType = FilterType;
2548
- }
2549
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DateFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2550
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.3", type: DateFilterComponent, isStandalone: true, selector: "tb-date-filter", inputs: { info: "info", CurrentFilterType: "CurrentFilterType" }, ngImport: i0, template: "@if (CurrentFilterType !== FilterType.DateBetween && CurrentFilterType !== FilterType.IsNull)\r\n{\r\n <mat-form-field>\r\n <input matInput name=\"filterValue\" [ngModel]=\"info.filterValue\" [matDatepicker]=\"cal\"/>\r\n <mat-datepicker-toggle class=\"small-button date-toggle\" matSuffix preventEnter [for]=\"cal\" />\r\n <mat-datepicker #cal />\r\n </mat-form-field>\r\n}\r\n@if(CurrentFilterType === FilterType.DateBetween)\r\n{\r\n <ng-container ngModelGroup=\"filterValue\">\r\n <mat-form-field class=\"my-filter\" >\r\n <input matInput name=\"Start\" placeholder=\"From\" [ngModel]=\"info.filterValue?.Start\" [matDatepicker]=\"fromVal\"\r\n (click)=\"fromVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"fromVal\" />\r\n <mat-datepicker #fromVal />\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput name=\"End\" placeholder=\"To\" [ngModel]=\"info.filterValue?.End\" [matDatepicker]=\"toVal\" (click)=\"toVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"toVal\" />\r\n <mat-datepicker #toVal />\r\n </mat-form-field>\r\n </ng-container>\r\n}\r\n\r\n", styles: [".filter-name{color:var(tb-filter-name);margin:10px 0;font-weight:600;display:inline-block}.switch{display:inline-block}.head-row{display:flex;width:100%;align-items:center;justify-content:space-between}.filter-row{display:flex;align-items:center;gap:1rem}mat-card.filter-card::ng-deep mat-form-field{width:150px}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper{line-height:0}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper:before{height:0}.inline{display:inline-block}.small-button{height:18px;width:18px;font-size:18px;padding:0;margin:0}.small-button ::ng-deep *{line-height:initial;font-size:initial;height:18px;width:18px;font-size:18px;bottom:initial}.cancel-button{font-weight:700}.date-toggle ::ng-deep svg{position:absolute;left:0;top:0}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgModelGroup, selector: "[ngModelGroup]", inputs: ["ngModelGroup"], exportAs: ["ngModelGroup"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i3.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2665
+ const defaultPredicate = () => true;
2666
+ function createFilterFuncs(filters) {
2667
+ return filters.filter(needsFilterCreation).map(createFilterFunc);
2551
2668
  }
2552
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DateFilterComponent, decorators: [{
2553
- type: Component,
2554
- args: [{ selector: 'tb-date-filter', changeDetection: ChangeDetectionStrategy.OnPush, viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], imports: [
2555
- MatInputModule, FormsModule, MatDatepickerModule
2556
- ], template: "@if (CurrentFilterType !== FilterType.DateBetween && CurrentFilterType !== FilterType.IsNull)\r\n{\r\n <mat-form-field>\r\n <input matInput name=\"filterValue\" [ngModel]=\"info.filterValue\" [matDatepicker]=\"cal\"/>\r\n <mat-datepicker-toggle class=\"small-button date-toggle\" matSuffix preventEnter [for]=\"cal\" />\r\n <mat-datepicker #cal />\r\n </mat-form-field>\r\n}\r\n@if(CurrentFilterType === FilterType.DateBetween)\r\n{\r\n <ng-container ngModelGroup=\"filterValue\">\r\n <mat-form-field class=\"my-filter\" >\r\n <input matInput name=\"Start\" placeholder=\"From\" [ngModel]=\"info.filterValue?.Start\" [matDatepicker]=\"fromVal\"\r\n (click)=\"fromVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"fromVal\" />\r\n <mat-datepicker #fromVal />\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput name=\"End\" placeholder=\"To\" [ngModel]=\"info.filterValue?.End\" [matDatepicker]=\"toVal\" (click)=\"toVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"toVal\" />\r\n <mat-datepicker #toVal />\r\n </mat-form-field>\r\n </ng-container>\r\n}\r\n\r\n", styles: [".filter-name{color:var(tb-filter-name);margin:10px 0;font-weight:600;display:inline-block}.switch{display:inline-block}.head-row{display:flex;width:100%;align-items:center;justify-content:space-between}.filter-row{display:flex;align-items:center;gap:1rem}mat-card.filter-card::ng-deep mat-form-field{width:150px}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper{line-height:0}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper:before{height:0}.inline{display:inline-block}.small-button{height:18px;width:18px;font-size:18px;padding:0;margin:0}.small-button ::ng-deep *{line-height:initial;font-size:initial;height:18px;width:18px;font-size:18px;bottom:initial}.cancel-button{font-weight:700}.date-toggle ::ng-deep svg{position:absolute;left:0;top:0}\n"] }]
2557
- }], propDecorators: { info: [{
2558
- type: Input
2559
- }], CurrentFilterType: [{
2560
- type: Input
2561
- }] } });
2562
-
2563
- class PreventEnterDirective {
2564
- onKeyDown() {
2565
- return false;
2669
+ function needsFilterCreation(filter) {
2670
+ if (isCustomFilter(filter)) {
2671
+ return filter.active !== false;
2566
2672
  }
2567
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PreventEnterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2568
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: PreventEnterDirective, isStandalone: true, selector: "preventEnter", host: { listeners: { "keydown.enter": "onKeyDown($event)" } }, ngImport: i0 }); }
2673
+ return filter.filterValue != undefined && filter.active !== false;
2569
2674
  }
2570
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PreventEnterDirective, decorators: [{
2571
- type: Directive,
2572
- args: [{
2573
- selector: 'preventEnter',
2574
- }]
2575
- }], propDecorators: { onKeyDown: [{
2576
- type: HostListener,
2577
- args: ['keydown.enter', ['$event']]
2578
- }] } });
2579
-
2580
- class StopPropagationDirective {
2581
- onClick(event) {
2582
- event.stopPropagation();
2583
- }
2584
- onMousedown(event) {
2585
- event.stopPropagation();
2675
+ function createFilterFunc(filter) {
2676
+ if (isCustomFilter(filter)) {
2677
+ return filter.active ? filter.predicate : defaultPredicate;
2586
2678
  }
2587
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2588
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: StopPropagationDirective, isStandalone: true, selector: "[stop-propagation]", host: { listeners: { "click": "onClick($event)", "mousedown": "onMousedown($event)" } }, ngImport: i0 }); }
2589
- }
2590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StopPropagationDirective, decorators: [{
2591
- type: Directive,
2592
- args: [{
2593
- selector: "[stop-propagation]",
2594
- }]
2595
- }], propDecorators: { onClick: [{
2596
- type: HostListener,
2597
- args: ["click", ["$event"]]
2598
- }], onMousedown: [{
2599
- type: HostListener,
2600
- args: ["mousedown", ["$event"]]
2601
- }] } });
2602
-
2603
- class AutoFocusDirective {
2604
- constructor() {
2605
- this.elementRef = inject(ElementRef);
2606
- this.autoFocus = true;
2679
+ if (filter.filterValue == undefined) {
2680
+ return defaultPredicate;
2607
2681
  }
2608
- ngAfterViewInit() {
2609
- if (this.autoFocus) {
2610
- setTimeout(() => {
2611
- this.elementRef.nativeElement.focus();
2612
- });
2682
+ const func = filterTypeFuncMap[filter.fieldType][filter.filterType](filter);
2683
+ if (!func) {
2684
+ if (filterFactoryMap[filter.filterType]) {
2685
+ return filterFactoryMap[filter.filterType](filter);
2613
2686
  }
2614
2687
  }
2615
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: AutoFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2616
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: AutoFocusDirective, isStandalone: true, selector: "[autoFocus]", inputs: { autoFocus: "autoFocus" }, ngImport: i0 }); }
2617
- }
2618
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: AutoFocusDirective, decorators: [{
2619
- type: Directive,
2620
- args: [{
2621
- selector: '[autoFocus]',
2622
- }]
2623
- }], propDecorators: { autoFocus: [{
2624
- type: Input
2625
- }] } });
2626
-
2627
- class ClickSubjectDirective extends Subject {
2628
- constructor() {
2629
- super();
2630
- }
2631
- set clickSubject(val) {
2632
- this._val = val;
2633
- }
2634
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickSubjectDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2635
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: ClickSubjectDirective, isStandalone: true, selector: "[clickSubject]", inputs: { clickSubject: "clickSubject" }, host: { listeners: { "click": "next(this._val)" } }, exportAs: ["clickSubject"], usesInheritance: true, ngImport: i0 }); }
2688
+ const canBeTrueForNull = FalseyValueCanBeIncludedFilterTypes.includes(filter.filterType)
2689
+ || (filter.filterType === FilterType.In && filter.filterValue?.some(isBlankValueFilter));
2690
+ const getter = filter.filterBy || getFactory(filter.key);
2691
+ return (rowObj) => {
2692
+ const value = getter(rowObj);
2693
+ return ((value == undefined) && !canBeTrueForNull)
2694
+ ? false
2695
+ : func(value);
2696
+ };
2636
2697
  }
2637
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickSubjectDirective, decorators: [{
2638
- type: Directive,
2639
- args: [{
2640
- selector: '[clickSubject]',
2641
- exportAs: 'clickSubject',
2642
- host: {
2643
- '(click)': 'next(this._val)'
2644
- },
2645
- }]
2646
- }], ctorParameters: () => [], propDecorators: { clickSubject: [{
2647
- type: Input,
2648
- args: ['clickSubject']
2649
- }] } });
2698
+ const FalseyValueCanBeIncludedFilterTypes = [
2699
+ FilterType.IsNull,
2700
+ FilterType.NumberNotEqual,
2701
+ FilterType.DateIsNotOn,
2702
+ FilterType.StringDoesNotContain,
2703
+ ];
2650
2704
 
2651
- class ClickEmitterDirective extends Subject {
2652
- constructor() {
2653
- super();
2654
- }
2655
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickEmitterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2656
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: ClickEmitterDirective, isStandalone: true, selector: "[clickEmitter]", host: { listeners: { "click": "next(true)" } }, exportAs: ["clickEmitter"], usesInheritance: true, ngImport: i0 }); }
2657
- }
2658
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ClickEmitterDirective, decorators: [{
2659
- type: Directive,
2660
- args: [{
2661
- selector: '[clickEmitter]',
2662
- exportAs: 'clickEmitter',
2663
- host: {
2664
- '(click)': 'next(true)'
2665
- },
2666
- }]
2667
- }], ctorParameters: () => [] });
2705
+ const replaceInArrayWithClone = (arr, findMeth, actionOnClone = ((t) => { })) => {
2706
+ const index = arr.findIndex(findMeth);
2707
+ const clonedArray = [...arr];
2708
+ const t = clonedArray[index];
2709
+ clonedArray[index] =
2710
+ t != null && typeof t === 'object' ?
2711
+ Array.isArray(t) ?
2712
+ [...t]
2713
+ : { ...t }
2714
+ : t;
2715
+ actionOnClone(clonedArray[index]);
2716
+ return clonedArray;
2717
+ };
2668
2718
 
2669
- class DialogService {
2670
- constructor() {
2671
- this.allOpenOpDialogs = [];
2672
- }
2673
- addDialogRef(ref) {
2674
- this.allOpenOpDialogs.push(ref);
2719
+ const orderedStateVisibleMetaData = (state) => {
2720
+ const ordered = orderStateMetaData(state);
2721
+ const orderedVisible = ordered
2722
+ .filter(metaData => !state.hiddenKeys.includes(metaData.key) && state.metaData[metaData.key].fieldType !== FieldType.Hidden);
2723
+ return orderedVisible;
2724
+ };
2725
+ const orderedCodeVisibleMetaData = (state) => orderStateMetaData(state).filter(md => md.fieldType !== FieldType.Hidden);
2726
+ const orderStateMetaData = (state) => {
2727
+ return orderMetaData(state.metaData, state.userDefined.order);
2728
+ };
2729
+ const orderMetaData = (metaData, userDefined) => {
2730
+ const userOrderArr = Object.entries(userDefined);
2731
+ return userOrderArr.length ?
2732
+ Object.values(metaData).sort((a, b) => {
2733
+ const orderA = userDefined[a.key];
2734
+ const orderB = userDefined[b.key];
2735
+ return order(orderA, orderB);
2736
+ })
2737
+ :
2738
+ Object.values(metaData).sort((a, b) => {
2739
+ const orderA = a.order;
2740
+ const orderB = b.order;
2741
+ return order(orderA, orderB);
2742
+ });
2743
+ };
2744
+ function order(orderA, orderB) {
2745
+ if (orderA == null && orderB == null) {
2746
+ return 0;
2675
2747
  }
2676
- removeDialogRef(ref) {
2677
- this.allOpenOpDialogs = this.allOpenOpDialogs.filter(rf => ref.id !== rf.id);
2748
+ if (orderA == null) {
2749
+ return 1;
2678
2750
  }
2679
- closeAllOpDialogs() {
2680
- this.allOpenOpDialogs.forEach(ref => ref.close());
2751
+ if (orderB == null) {
2752
+ return -1;
2681
2753
  }
2682
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2683
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogService, providedIn: 'root' }); }
2754
+ return orderA - orderB;
2684
2755
  }
2685
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogService, decorators: [{
2686
- type: Injectable,
2687
- args: [{ providedIn: 'root' }]
2688
- }] });
2756
+ function cleanPersistedState(state, pState) {
2757
+ const metas = Object.values(state.metaData);
2758
+ const filters = Object.values(pState.filters).filter(fltr => isCustomFilter(fltr) || metas.some(m => m.key === fltr.key)).reduce((obj, filter) => {
2759
+ obj[filter.filterId] = pState.filters[filter.filterId];
2760
+ return obj;
2761
+ }, {});
2762
+ const sorted = pState.sorted.filter(s => metas.some(m => m.key === s.active));
2763
+ return ({ ...pState, filters, sorted });
2764
+ }
2765
+ const mapSaveableState = (s) => {
2766
+ const savableState = { ...s };
2767
+ keysToDelete.forEach(key => delete savableState[key]);
2768
+ return savableState;
2769
+ };
2770
+ const createPreSort = (metaDatas) => {
2771
+ return Object.values(metaDatas).filter((metaData) => !!metaData.preSort)
2772
+ .sort(({ preSort: ps1 }, { preSort: ps2 }) => (ps1.precedence || Number.MAX_VALUE) - (ps2.precedence || Number.MAX_VALUE))
2773
+ .map(({ key, preSort: { direction } }) => ({ active: key, direction }));
2774
+ };
2775
+ const mergeMeta = (orig, merge) => {
2776
+ return {
2777
+ key: orig.key,
2778
+ displayName: merge.displayName ?? orig.displayName,
2779
+ fieldType: merge.fieldType || orig.fieldType,
2780
+ additional: { ...orig.additional, ...merge.additional },
2781
+ order: merge.order ?? orig.order,
2782
+ preSort: merge.preSort ?? orig.preSort,
2783
+ width: merge.width ?? orig.width,
2784
+ noExport: merge.noExport || orig.noExport,
2785
+ noFilter: merge.noFilter || orig.noFilter,
2786
+ customCell: merge.customCell ?? orig.customCell,
2787
+ transform: merge.transform ?? orig.transform,
2788
+ map: merge.map ?? orig.map,
2789
+ click: merge.click ?? orig.click,
2790
+ classes: merge.classes ?? orig.classes,
2791
+ noSort: merge.noSort ?? orig.noSort,
2792
+ template: merge.template ?? orig.template,
2793
+ toolTip: merge.toolTip ?? orig.toolTip,
2794
+ useIcon: merge.useIcon ?? orig.useIcon,
2795
+ filterLogic: merge.filterLogic ?? orig.filterLogic,
2796
+ sortLogic: merge.sortLogic ?? orig.sortLogic,
2797
+ groupByLogic: merge.groupByLogic ?? orig.groupByLogic,
2798
+ };
2799
+ };
2800
+ const initializeOrder = (state, mds) => {
2801
+ const viewableMetaDataArr = Object.values(mds).filter(a => a.fieldType !== FieldType.Hidden);
2802
+ let userDefinedOrder = state.userDefined.order;
2803
+ if (viewableMetaDataArr.some(meta => userDefinedOrder[meta.key] == null)) {
2804
+ return {};
2805
+ }
2806
+ return userDefinedOrder;
2807
+ };
2689
2808
 
2690
- class DialogWrapper {
2809
+ class TableStore extends ComponentStore {
2691
2810
  constructor() {
2692
- this.vcr = inject(ViewContainerRef);
2693
- this.viewEmbedded = false;
2694
- this.viewContext = {
2695
- close: () => { },
2811
+ const config = inject(TableBuilderConfigToken);
2812
+ const settingsFromConfig = {
2813
+ persistedTableSettings: new PersistedTableSettings().merge(config.defaultTableSettings),
2814
+ notPersistedTableSettings: new NotPersistedTableSettings().merge(config.defaultTableSettings),
2696
2815
  };
2697
- }
2698
- set template(tmpl) {
2699
- if (this.viewEmbedded) {
2700
- this.vcr.clear();
2816
+ if (config.defaultTableSettings?.pageSize) {
2817
+ settingsFromConfig.notPersistedTableSettings.paginatorSettings.pageSize = config.defaultTableSettings?.pageSize;
2701
2818
  }
2702
- this.viewEmbedded = true;
2703
- this.vcr.createEmbeddedView(tmpl, this.viewContext);
2704
- }
2705
- set close(closeMethod) {
2706
- this.viewContext.close = closeMethod;
2707
- }
2708
- set data(value) {
2709
- this.viewContext.$implicit = value;
2710
- this.viewContext.opDialog = value;
2711
- }
2712
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogWrapper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2713
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.3", type: DialogWrapper, isStandalone: true, selector: "dialog-wrapper", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2714
- }
2715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogWrapper, decorators: [{
2716
- type: Component,
2717
- args: [{
2718
- selector: 'dialog-wrapper',
2719
- template: ``,
2720
- changeDetection: ChangeDetectionStrategy.OnPush,
2721
- }]
2722
- }] });
2723
- const defaultDialogConfig = {
2724
- maxHeight: '95vh',
2725
- };
2726
- class DialogDirective {
2727
- constructor() {
2728
- this.templateRef = inject(TemplateRef);
2729
- this.dialog = inject(MatDialog);
2730
- this.dialogConfig = inject(MAT_DIALOG_DEFAULT_OPTIONS, { optional: true }) || {};
2731
- this.service = inject(DialogService);
2732
- this.opDialogClosed = new EventEmitter();
2733
- this._dialogConfig = { ...this.dialogConfig, ...defaultDialogConfig };
2734
- this.opDialogAddDialogClass = true;
2735
- this.injector = inject(Injector);
2736
- this.subscriber = subscriber(this.injector);
2737
- this._data = new Subject();
2738
- this.setDataAndState = (data) => {
2739
- if (data) {
2740
- this.opDialogConfig.data = data;
2741
- this.setDialogState(true);
2819
+ const pageSize = settingsFromConfig.notPersistedTableSettings.paginatorSettings.pageSize || defaultTableState.pageSize;
2820
+ const showAll = settingsFromConfig.notPersistedTableSettings.paginatorSettings.defaultAll || defaultTableState.showAll;
2821
+ super({ ...defaultTableState, ...settingsFromConfig, pageSize, showAll });
2822
+ this.$initializationState = this.selectSignal(state => state.initializationState);
2823
+ this.$savableState = computed(() => {
2824
+ const state = this.state();
2825
+ return mapSaveableState(state);
2826
+ });
2827
+ this.$userDefinedOrder = this.selectSignal(state => state.userDefined.order);
2828
+ this.metaData$ = this.select(state => state.metaData);
2829
+ this.$metaData = this.selectSignal(state => state.metaData);
2830
+ this.$metaDataArray = this.selectSignal(this.$metaData, this.$userDefinedOrder, orderMetaData);
2831
+ this.$orderedCodeVisibleMetaDatas = this.selectSignal(this.$metaDataArray, (mds) => mds.filter(m => m.fieldType !== FieldType.Hidden), { equal: (a, b) => b.length === a.length && b.every((s, i) => a[i].key === s.key) });
2832
+ this.$getMetaData = (key) => computed(() => {
2833
+ const metaData = this.state().metaData[key];
2834
+ if (!metaData)
2835
+ console.warn(`Meta data with key ${key} not found`);
2836
+ return metaData;
2837
+ });
2838
+ this.$hiddenKeys = this.selectSignal(state => state.hiddenKeys);
2839
+ this.$orderedVisibleColumns = this.selectSignal(this.$orderedCodeVisibleMetaDatas, this.$hiddenKeys, (cs, hiddenKeys) => cs.filter(m => !hiddenKeys.includes(m.key)).map(m => m.key));
2840
+ this.$getUserDefinedWidths = this.selectSignal(state => state.userDefined.widths);
2841
+ this.$tableSettingsMinWidth = this.selectSignal(state => parseTbSizeToPixels(state.notPersistedTableSettings.minColumnWidth));
2842
+ this.$getUserDefinedWidth = (key) => this.selectSignal(this.$getUserDefinedWidths, widths => widths[key]);
2843
+ this.$filters = this.selectSignal(state => state.filters);
2844
+ this.filters$ = this.select(state => state.filters);
2845
+ this.$getFilter = (filterId) => {
2846
+ return this.selectSignal(this.$filters, filters => filters[filterId]);
2847
+ };
2848
+ this.$preSort = computed(() => createPreSort(this.$metaData()));
2849
+ this._$selectSorted = this.selectSignal(state => state.sorted, {
2850
+ equal: sortsAreSame
2851
+ });
2852
+ this.$selectSorted = computed(() => {
2853
+ const metaDict = this.$metaData();
2854
+ return this._$selectSorted().map(s => {
2855
+ const meta = metaDict[s.active];
2856
+ const sortLogic = meta.sortLogic;
2857
+ const sortBy = sortLogic?.sortBy === 'use map' ? meta.map : sortLogic?.sortBy;
2858
+ return ({ ...s, ...sortLogic, sortBy });
2859
+ });
2860
+ });
2861
+ this.selectSorted$ = this.select(state => state.sorted).pipe(distinctUntilChanged(sortsAreSame));
2862
+ this.$getSorts = this.selectSignal(() => this.$initializationState() !== InitializationState.Ready ? [] : this.$selectSorted());
2863
+ this.sort$ = toObservable(this.$getSorts);
2864
+ this.$getUserDefinedTableWidth = this.selectSignal(state => state.userDefined.table.width);
2865
+ this.getUserDefinedTableWidth$ = this.select(state => state.userDefined.table.width);
2866
+ this.$userDefinedRowHeight = this.selectSignal(state => (state.userDefined.rowHeight));
2867
+ this.$userDefinedHeaderHeight = this.selectSignal(state => (state.userDefined.headerHeight));
2868
+ this.$userDefinedPageSize = this.selectSignal(state => (state.userDefined.pageSize));
2869
+ this.$footerCollapsed = this.selectSignal(state => state.persistedTableSettings.collapseFooter);
2870
+ this.$headerCollapsed = this.selectSignal(state => state.persistedTableSettings.collapseHeader);
2871
+ this.$groupBy = this.selectSignal(state => state.groupBy);
2872
+ this.$groupByKeys = this.selectSignal(this.$groupBy, this.$metaDataArray, (gb, mds) => gb.map(gbk => gbk.key).filter(bg => mds.some(md => md.key === bg)), {
2873
+ equal: (prev, curr) => prev.length === curr.length && curr.every((k, i) => prev[i] === k)
2874
+ });
2875
+ this.groupByKeys$ = this.select(state => state.groupBy.map(gbk => gbk.key))
2876
+ .pipe(distinctUntilChanged((prev, curr) => prev.length === curr.length && curr.every((k, i) => prev[i] === k)));
2877
+ this.expandedGroups$ = this.select(state => state.groupBy).pipe(distinctUntilChanged((a, b) => {
2878
+ const aa = a.flatMap(g => g.expandedHeaders);
2879
+ const bb = b.flatMap(g => g.expandedHeaders);
2880
+ return aa.length === bb.length && aa.every((k) => bb.includes(k));
2881
+ }));
2882
+ this.$expandGroups = this.selectSignal(state => state.groupBy, { equal: (a, b) => {
2883
+ const aa = a.flatMap(g => g.expandedHeaders);
2884
+ const bb = b.flatMap(g => g.expandedHeaders);
2885
+ return aa.length === bb.length && aa.every((k) => bb.includes(k));
2886
+ } });
2887
+ this.$getIsExpanded = (columnKey, groupUniqueName) => {
2888
+ return this.selectSignal(state => !!state.groupBy.filter(g => g.key === columnKey && g.expandedHeaders.includes(groupUniqueName)).length);
2889
+ };
2890
+ this.$currentPage = this.selectSignal(state => state.currentPage);
2891
+ this.$pageSize = this.selectSignal(s => s.userDefined?.pageSize || s.pageSize);
2892
+ this.$showAll = this.selectSignal(s => s.userDefined?.showAll ?? s.showAll);
2893
+ this.$tableSettings = this.selectSignal(state => {
2894
+ const ts = { ...state.persistedTableSettings, ...state.notPersistedTableSettings };
2895
+ return ts;
2896
+ });
2897
+ this.$notPersistedTableSettings = this.selectSignal(state => state.notPersistedTableSettings);
2898
+ this.tableSettings$ = toObservable(this.$tableSettings);
2899
+ this.$props = this.selectSignal(s => s.props);
2900
+ this.$getLinkInfo = (md) => this.selectSignal(state => state.linkMaps[md.key]);
2901
+ this.$isVirtual = this.selectSignal(state => state.notPersistedTableSettings.useVirtualScroll
2902
+ || state.showAll
2903
+ || state.userDefined?.showAll);
2904
+ this.$viewType = this.selectSignal(state => {
2905
+ const usePaginator = state.notPersistedTableSettings.usePaginator;
2906
+ const showAll = state.showAll || state.userDefined?.showAll;
2907
+ const useVirtualScroll = state.notPersistedTableSettings.useVirtualScroll;
2908
+ if (showAll || (useVirtualScroll && !usePaginator)) {
2909
+ return 'virtual all';
2910
+ }
2911
+ else if (useVirtualScroll && usePaginator) {
2912
+ return 'virtual paginator';
2913
+ }
2914
+ else if (usePaginator) {
2915
+ return 'paginator';
2742
2916
  }
2743
2917
  else {
2744
- this.setDialogState(false);
2918
+ return 'all';
2745
2919
  }
2746
- };
2747
- }
2748
- set opDialogConfig(config) {
2749
- this._dialogConfig = { ...this.dialogConfig, ...defaultDialogConfig, ...config };
2750
- }
2751
- get opDialogConfig() {
2752
- return this._dialogConfig;
2753
- }
2754
- set setControl(i) {
2755
- let o;
2756
- if (isSignal(i)) {
2757
- o = toObservable(i, { injector: this.injector });
2758
- }
2759
- else {
2760
- o = i;
2761
- }
2762
- untracked(() => {
2763
- this.subscriber.on(o, this.setDataAndState);
2764
2920
  });
2765
- }
2766
- close() {
2767
- this.dialogRef?.close();
2768
- }
2769
- initDialog() {
2770
- if (this.nativeElement) {
2771
- const rect = this.nativeElement.getBoundingClientRect();
2772
- const position = { left: `${rect.left}px`, top: `${rect.bottom - 50}px` };
2773
- this.opDialogConfig = { ...this.opDialogConfig, position };
2774
- }
2775
- if (this.opDialogAddDialogClass) {
2776
- this.opDialogConfig.panelClass = [...(Array.isArray(this.opDialogConfig.panelClass) ? this.opDialogConfig.panelClass : this.opDialogConfig.panelClass ? [this.opDialogConfig.panelClass] : []), 'opDialog'];
2777
- }
2778
- this.dialogRef = this.dialog.open(DialogWrapper, this.opDialogConfig);
2779
- this.componentWrapper = this.dialogRef.componentInstance;
2780
- this.componentWrapper.close = () => this.dialogRef?.close();
2781
- this.componentWrapper.data = this.opDialogConfig.data;
2782
- this.componentWrapper.template = this.templateRef;
2783
- if (!this.opDialogConfig.disableClose) {
2784
- this.service.addDialogRef(this.dialogRef);
2785
- }
2786
- const sub = this.dialogRef.afterClosed().subscribe(() => {
2787
- this.opDialogClosed.emit(true);
2788
- this.service.removeDialogRef(this.dialogRef);
2789
- this.dialogRef = undefined;
2790
- sub.unsubscribe();
2921
+ this.resetState = this.updater((state) => {
2922
+ const sorted = this.$preSort();
2923
+ return ({ ...state, hiddenKeys: [], sorted, filters: {}, groupBy: [], userDefined: { widths: {}, order: {}, table: {} } });
2791
2924
  });
2792
- }
2793
- setDialogState(open) {
2794
- if (open) {
2795
- if (!this.dialogRef) {
2796
- this.initDialog();
2797
- }
2798
- else {
2799
- this.componentWrapper.data = this.opDialogConfig.data;
2925
+ this.resetPart = this.updater((state, part) => {
2926
+ const newState = { ...state };
2927
+ switch (part) {
2928
+ case 'Sorting':
2929
+ newState.sorted = this.$preSort();
2930
+ return newState;
2931
+ case 'Filters':
2932
+ newState.filters = {};
2933
+ return newState;
2934
+ case 'Group By':
2935
+ newState.groupBy = [];
2936
+ return newState;
2937
+ case 'Hidden Columns':
2938
+ newState.hiddenKeys = [];
2939
+ return newState;
2940
+ case 'Column Widths':
2941
+ newState.userDefined.widths = {};
2942
+ newState.userDefined.table = {};
2943
+ return newState;
2944
+ case 'Column Order':
2945
+ newState.userDefined.order = {};
2946
+ return newState;
2947
+ case 'Page Size':
2948
+ delete newState.userDefined.pageSize;
2949
+ return newState;
2950
+ case 'Show All':
2951
+ delete newState.userDefined.showAll;
2952
+ return newState;
2953
+ case 'Row Height':
2954
+ delete newState.userDefined.rowHeight;
2955
+ return newState;
2956
+ case 'Header Height':
2957
+ delete newState.userDefined.headerHeight;
2958
+ return newState;
2800
2959
  }
2801
- }
2802
- else if (!open && this.dialogRef) {
2803
- this.dialogRef.close();
2804
- }
2805
- }
2806
- static ngTemplateContextGuard(dir, ctx) {
2807
- return true;
2808
- }
2809
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2810
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: DialogDirective, isStandalone: true, selector: "[opDialog]", inputs: { opDialogAddDialogClass: "opDialogAddDialogClass", opDialogConfig: "opDialogConfig", setControl: ["opDialog", "setControl"], nativeElement: ["opDialogOrigin", "nativeElement"] }, outputs: { opDialogClosed: "opDialogClosed" }, ngImport: i0 }); }
2811
- }
2812
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DialogDirective, decorators: [{
2813
- type: Directive,
2814
- args: [{ selector: '[opDialog]', }]
2815
- }], propDecorators: { opDialogClosed: [{
2816
- type: Output
2817
- }], opDialogAddDialogClass: [{
2818
- type: Input
2819
- }], opDialogConfig: [{
2820
- type: Input
2821
- }], setControl: [{
2822
- type: Input,
2823
- args: ['opDialog']
2824
- }], nativeElement: [{
2825
- type: Input,
2826
- args: ['opDialogOrigin']
2827
- }] } });
2828
-
2829
- class StylerDirective {
2830
- constructor() {
2831
- this.el = inject(ElementRef);
2832
- this.renderer = inject(Renderer2);
2833
- this.$stylesApplied = signal({});
2834
- this.$element = input.required({ alias: 'element' });
2835
- this.$styler = input.required({ alias: 'styler' });
2836
- this.#stylerEffect = effect(() => {
2837
- const styles = this.$styler();
2838
- untracked(() => {
2839
- const element = this.$element();
2840
- const toApply = Object.entries(styles ?? {}).reduce((acc, [key, val]) => {
2841
- if (!val)
2842
- return acc;
2843
- if (typeof (val) === 'string') {
2844
- acc[key] = val;
2845
- this.el.nativeElement.style[key] = val;
2846
- }
2847
- else if (!val?.condition || val?.condition === true || val?.condition(element)) {
2848
- const value = typeof (val.value) === 'string' ? val.value : val?.value(element);
2849
- acc[key] = value;
2850
- this.el.nativeElement.style[key] = value;
2851
- }
2852
- return acc;
2853
- }, {});
2854
- Object.keys(this.$stylesApplied()).filter(key => !Object.keys(toApply).includes(key)).forEach(key => {
2855
- this.renderer.removeStyle(this.el.nativeElement, key);
2856
- });
2857
- this.$stylesApplied.set(toApply);
2960
+ });
2961
+ this.updateStateFromPersistedState = this.updater((state, persistedState) => {
2962
+ const incomingTableState = cleanPersistedState(state, persistedState);
2963
+ const newState = this.updateStateFunc(state, incomingTableState);
2964
+ newState.initializationState = state.initializationState <= InitializationState.MetaDataLoaded ? InitializationState.TableSettingsLoaded : state.initializationState;
2965
+ return newState;
2966
+ });
2967
+ this.updateStateFunc = (state, incomingTableState) => {
2968
+ const metaData = state.metaData;
2969
+ const sorted = incomingTableState.sorted?.length ? incomingTableState.sorted
2970
+ : state.initializationState <= InitializationState.Created ? createPreSort(metaData) : state.sorted;
2971
+ return { ...state, ...incomingTableState, metaData, sorted };
2972
+ };
2973
+ this.setTableSettings = this.updater((state, settings) => {
2974
+ const s = {
2975
+ ...state,
2976
+ persistedTableSettings: state.persistedTableSettings.merge(settings),
2977
+ notPersistedTableSettings: state.notPersistedTableSettings.merge(settings),
2978
+ initializationState: InitializationState.TableSettingsLoaded
2979
+ };
2980
+ s.pageSize = settings.tableSettings?.paginatorSettings?.pageSize ?? s.pageSize;
2981
+ s.showAll = settings.tableSettings?.paginatorSettings?.defaultAll ?? s.showAll;
2982
+ return s;
2983
+ });
2984
+ this.setMetaData = this.updater((state, md) => {
2985
+ const metaData = md
2986
+ .reduce((prev, curr) => {
2987
+ if (prev[curr.key]) {
2988
+ prev[curr.key] = mergeMeta(prev[curr.key], curr);
2989
+ }
2990
+ else {
2991
+ prev[curr.key] = curr;
2992
+ }
2993
+ return prev;
2994
+ }, {});
2995
+ const sortedInitialized = state.sorted.length > 0;
2996
+ const sorted = sortedInitialized ? state.sorted : createPreSort(metaData);
2997
+ const order = initializeOrder(state, metaData);
2998
+ const initializationState = state.initializationState == InitializationState.Created ? InitializationState.MetaDataLoaded : state.initializationState;
2999
+ return { ...state, initializationState, metaData, sorted, userDefined: { ...state.userDefined, order: order } };
3000
+ });
3001
+ this.showColumn = this.updater((state, key) => ({
3002
+ ...state,
3003
+ hiddenKeys: state.hiddenKeys.filter(k => k !== key),
3004
+ }));
3005
+ this.hideColumn = this.updater((state, key) => ({
3006
+ ...state,
3007
+ hiddenKeys: [...state.hiddenKeys.filter(k => k !== key), key],
3008
+ }));
3009
+ this.setHiddenColumns = this.updater((state, displayCols) => {
3010
+ return ({ ...state, hiddenKeys: displayCols.filter(d => !d.visible).map(d => d.key) });
3011
+ });
3012
+ this.setUserDefinedWidth = this.updater((state, colWidths) => {
3013
+ const userDefinedWidths = { ...state.userDefined.widths };
3014
+ colWidths.forEach(cw => {
3015
+ userDefinedWidths[cw.key] = cw.widthInPixel;
3016
+ });
3017
+ return { ...state, userDefined: { ...state.userDefined, widths: userDefinedWidths } };
3018
+ });
3019
+ this.setUserDefinedOrder = this.updater((state, moved) => {
3020
+ const { newOrder, oldOrder } = moved;
3021
+ const mdsArr = orderedStateVisibleMetaData(state);
3022
+ moveItemInArray(mdsArr, oldOrder, newOrder);
3023
+ const userDefinedOrder = mdsArr.reduce((aggregate, current, index) => {
3024
+ aggregate[current.key] = index;
3025
+ return aggregate;
3026
+ }, {});
3027
+ return ({ ...state, userDefined: { ...state.userDefined, order: userDefinedOrder } });
3028
+ });
3029
+ this.setUserDefinedRowHeight = this.updater((state, rowHeight) => {
3030
+ return ({ ...state, userDefined: { ...state.userDefined, rowHeight } });
3031
+ });
3032
+ this.setUserDefinedHeaderHeight = this.updater((state, headerHeight) => {
3033
+ return ({ ...state, userDefined: { ...state.userDefined, headerHeight } });
3034
+ });
3035
+ this.addFilter = this.updater((state, filter) => {
3036
+ return this.addFiltersToState(state, [filter]);
3037
+ });
3038
+ this.addFilters = this.updater((state, filters) => {
3039
+ return this.addFiltersToState(state, filters);
3040
+ });
3041
+ this.removeFilter = this.updater((state, filterId) => {
3042
+ const filtersCopy = { ...state.filters };
3043
+ delete filtersCopy[filterId];
3044
+ return ({ ...state, filters: filtersCopy });
3045
+ });
3046
+ this.removeFilters = this.updater((state, filterIds) => {
3047
+ const filtersCopy = { ...state.filters };
3048
+ filterIds.forEach(id => { delete filtersCopy[id]; });
3049
+ return ({ ...state, filters: filtersCopy });
3050
+ });
3051
+ this.clearFilters = this.updater((state) => ({ ...state, filters: {} }));
3052
+ this.addFiltersToState = (state, filters) => {
3053
+ var customFilters = filters.filter(isCustomFilter);
3054
+ var filterInfos = filters.filter(isFilterInfo);
3055
+ const filtersObj = filterInfos
3056
+ .filter(fltr => Object.keys(state.metaData).some(key => key === fltr.key) || console.warn(`Meta data with key ${fltr.key} not found`))
3057
+ .reduce((filtersObj, filter) => {
3058
+ if (!filter.filterId) {
3059
+ filter.filterId = crypto.randomUUID();
3060
+ }
3061
+ filtersObj[filter.filterId] = filter;
3062
+ return filtersObj;
3063
+ }, {});
3064
+ customFilters.forEach(fltr => {
3065
+ if (!fltr.filterId) {
3066
+ fltr.filterId = crypto.randomUUID();
3067
+ }
3068
+ filtersObj[fltr.filterId] = fltr;
2858
3069
  });
2859
- });
2860
- }
2861
- #stylerEffect;
2862
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StylerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2863
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.3", type: StylerDirective, isStandalone: true, selector: "[styler]", inputs: { $element: { classPropertyName: "$element", publicName: "element", isSignal: true, isRequired: true, transformFunction: null }, $styler: { classPropertyName: "$styler", publicName: "styler", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2864
- }
2865
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StylerDirective, decorators: [{
2866
- type: Directive,
2867
- args: [{ selector: '[styler]' }]
2868
- }] });
2869
-
2870
- class MatSlideToggleGroupDirective {
2871
- constructor() {
2872
- this.allowMultiple = false;
2873
- this._ready = new ReplaySubject(1);
2874
- }
2875
- set toggles(val) {
2876
- this._toggles = val;
2877
- this._ready.next(true);
2878
- }
2879
- get valueEmitter() {
2880
- return this._ready.pipe(switchMap$1(_ => this.getObs()));
2881
- }
2882
- getInitValue() {
2883
- const startValue = this._toggles.reduce((prev, cur) => {
2884
- if (!cur.name) {
2885
- throw new Error('toggle must have the name attribute set');
2886
- }
2887
- prev[cur.name] = cur.checked;
2888
- return prev;
2889
- }, {});
2890
- return startValue;
2891
- }
2892
- getObs() {
2893
- var toggleChanges = merge(...this._toggles.map(toggle => toggle.change));
2894
- const startValue = this.getInitValue();
2895
- return toggleChanges.pipe(scan((prev, cur) => {
2896
- const toggleName = cur.source.name;
2897
- const newVal = { ...prev, [toggleName]: cur.checked };
2898
- if (cur.checked && !this.allowMultiple) {
2899
- Object.keys(prev)
2900
- .filter(key => key !== toggleName && prev[key])
2901
- .forEach(key => {
2902
- newVal[key] = false;
2903
- this._toggles.find(toggle => toggle.name === key).toggle();
2904
- });
2905
- }
2906
- return newVal;
2907
- }, startValue), startWith$1(startValue));
2908
- }
2909
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MatSlideToggleGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2910
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: MatSlideToggleGroupDirective, isStandalone: true, selector: "[opMatSlideToggleGroup]", inputs: { allowMultiple: "allowMultiple" }, outputs: { valueEmitter: "valueEmitter" }, queries: [{ propertyName: "toggles", predicate: MatSlideToggle }], ngImport: i0 }); }
2911
- }
2912
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MatSlideToggleGroupDirective, decorators: [{
2913
- type: Directive,
2914
- args: [{ selector: '[opMatSlideToggleGroup]',
2915
- }]
2916
- }], propDecorators: { allowMultiple: [{
2917
- type: Input
2918
- }], toggles: [{
2919
- type: ContentChildren,
2920
- args: [MatSlideToggle]
2921
- }], valueEmitter: [{
2922
- type: Output
2923
- }] } });
2924
-
2925
- class TrimWhitespaceDirective {
2926
- constructor() {
2927
- this.elem = inject(ElementRef);
2928
- }
2929
- onBlur() {
2930
- const inputString = this.elem.nativeElement.value;
2931
- if (inputString) {
2932
- const newValue = inputString.trim().replace(/\t/g, '');
2933
- if (inputString !== newValue) {
2934
- this.elem.nativeElement.value = newValue;
2935
- this.elem.nativeElement.dispatchEvent(new Event('input', { bubbles: true }));
3070
+ return {
3071
+ ...state,
3072
+ filters: { ...state.filters, ...filtersObj }
3073
+ };
3074
+ };
3075
+ this.setSort = this.updater((state, { key, direction }) => {
3076
+ const sortArray = state.sorted.filter(s => s.active !== key);
3077
+ if (direction) {
3078
+ sortArray.unshift({ active: key, direction });
2936
3079
  }
2937
- }
2938
- }
2939
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TrimWhitespaceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2940
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: TrimWhitespaceDirective, isStandalone: true, selector: "input[trimWhitespace]", host: { listeners: { "blur": "onBlur()" } }, ngImport: i0 }); }
2941
- }
2942
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TrimWhitespaceDirective, decorators: [{
2943
- type: Directive,
2944
- args: [{
2945
- selector: 'input[trimWhitespace]',
2946
- }]
2947
- }], propDecorators: { onBlur: [{
2948
- type: HostListener,
2949
- args: ['blur']
2950
- }] } });
2951
-
2952
- class FunctionPipe {
2953
- transform(func, ...args) {
2954
- if (typeof func === 'string') {
2955
- const [instance, ...tail] = args;
2956
- const method = instance[func].bind(instance);
2957
- return method(...tail);
2958
- }
2959
- return func(...args);
3080
+ return {
3081
+ ...state,
3082
+ sorted: sortArray,
3083
+ };
3084
+ });
3085
+ this.setAllSort = this.updater((state, sortArray) => {
3086
+ return {
3087
+ ...state,
3088
+ sorted: sortArray,
3089
+ };
3090
+ });
3091
+ this.setCurrentPage = this.updater((state, currentPage) => ({ ...state, currentPage }));
3092
+ this.setPageSize = this.updater((state, pageSize) => ({ ...state, pageSize }));
3093
+ this.setUserDefinedPageSize = this.updater((state, pageSize) => ({ ...state, userDefined: { ...state.userDefined, pageSize } }));
3094
+ this.setUserDefinedShowAll = this.updater((state, showAll) => ({ ...state, showAll, userDefined: { ...state.userDefined, showAll } }));
3095
+ this.setProps = this.updater((state, props) => {
3096
+ return ({ ...state, props });
3097
+ });
3098
+ this.setTableWidth = this.updater((state, widthInPixels) => ({ ...state, userDefined: { ...state.userDefined, table: { width: widthInPixels } } }));
3099
+ this.setInitializationState = this.updater((state, initializationState) => {
3100
+ return { ...state, initializationState };
3101
+ });
3102
+ this.toggleCollapseHeader = this.updater((state) => {
3103
+ const tableSettings = { ...state.persistedTableSettings };
3104
+ tableSettings.collapseHeader = !tableSettings.collapseHeader;
3105
+ return ({ ...state, persistedTableSettings: new PersistedTableSettings(tableSettings) });
3106
+ });
3107
+ this.toggleCollapseFooter = this.updater((state, options) => {
3108
+ const tableSettings = { ...state.persistedTableSettings };
3109
+ tableSettings.collapseFooter = options?.collapseFooter ?? !tableSettings.collapseFooter;
3110
+ return ({ ...state, persistedTableSettings: new PersistedTableSettings(tableSettings) });
3111
+ });
3112
+ this.addGroupByKey = this.updater((state, metaDataKey) => ({
3113
+ ...state,
3114
+ groupBy: [...state.groupBy, { key: metaDataKey, expandedHeaders: [] }]
3115
+ }));
3116
+ this.removeGroupByKey = this.updater((state, groupByKey) => ({
3117
+ ...state,
3118
+ groupBy: state.groupBy.filter(key => groupByKey !== key.key)
3119
+ }));
3120
+ this.updateExpandedGroups = this.updater((state, data) => {
3121
+ const gbk = replaceInArrayWithClone(state.groupBy, k => k.key === data.key, gk => {
3122
+ gk.expandedHeaders = data.isExpanded ? [...gk.expandedHeaders, data.groupUniqueName] : gk.expandedHeaders.filter(g => g !== data.groupUniqueName);
3123
+ });
3124
+ return ({
3125
+ ...state,
3126
+ groupBy: gbk
3127
+ });
3128
+ });
3129
+ this.expandAllOfGroup = this.updater((state, data) => {
3130
+ const newGroupedData = state.groupBy.map(gb => ({
3131
+ key: gb.key,
3132
+ expandedHeaders: data.groupHeadersByKey[gb.key]?.map(g => g.uniqueName) ?? gb.expandedHeaders
3133
+ }));
3134
+ return ({ ...state, groupBy: newGroupedData });
3135
+ });
3136
+ this.collapseAll = this.updater((state) => ({
3137
+ ...state,
3138
+ groupBy: state.groupBy.map(gb => ({ key: gb.key, expandedHeaders: [] }))
3139
+ }));
3140
+ this.collapseAllOfKey = this.updater((state, data) => ({
3141
+ ...state,
3142
+ groupBy: state.groupBy.map(gb => ({
3143
+ key: gb.key,
3144
+ expandedHeaders: data.keys.includes(gb.key) ? [] : gb.expandedHeaders
3145
+ }))
3146
+ }));
3147
+ this.setLinkMaps = this.updater((state, maps) => {
3148
+ return ({ ...state, linkMaps: maps });
3149
+ });
3150
+ this.updateRowProps = this.updater((state, updates) => {
3151
+ const notPersistedTableSettings = merge$1(new NotPersistedTableSettings(), (state.notPersistedTableSettings));
3152
+ if (updates.rowClasses)
3153
+ notPersistedTableSettings.rowClasses = updates.rowClasses;
3154
+ if (updates.rowClick)
3155
+ notPersistedTableSettings.rowClick = updates.rowClick;
3156
+ if (updates.rowStyles)
3157
+ notPersistedTableSettings.rowStyles = updates.rowStyles;
3158
+ return ({ ...state, notPersistedTableSettings });
3159
+ });
3160
+ this.on = (srcObservable, func) => {
3161
+ this.effect(() => srcObservable.pipe(tap(func)));
3162
+ return this;
3163
+ };
2960
3164
  }
2961
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FunctionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
2962
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: FunctionPipe, isStandalone: true, name: "func" }); }
3165
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TableStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3166
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TableStore }); }
2963
3167
  }
2964
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: FunctionPipe, decorators: [{
2965
- type: Pipe,
2966
- args: [{
2967
- name: 'func',
2968
- }]
2969
- }] });
3168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: TableStore, decorators: [{
3169
+ type: Injectable
3170
+ }], ctorParameters: () => [] });
3171
+ const resetable = [
3172
+ 'Sorting',
3173
+ 'Filters',
3174
+ 'Group By',
3175
+ 'Hidden Columns',
3176
+ 'Column Widths',
3177
+ 'Column Order',
3178
+ 'Row Height',
3179
+ 'Header Height',
3180
+ 'Page Size',
3181
+ 'Show All',
3182
+ ];
2970
3183
 
2971
- class ConditionalClassesDirective {
3184
+ class MultiSortDirective extends MatSort {
2972
3185
  constructor() {
2973
- this.el = inject(ElementRef);
2974
- this.renderer = inject(Renderer2);
2975
- this.$element = input.required({ alias: 'element' });
2976
- this.$classes = input(undefined, { alias: 'conditionalClasses' });
2977
- this.classesApplied = [];
2978
- this.#onClasses = effect(() => {
2979
- const classes = this.$classes();
2980
- untracked(() => {
2981
- const element = this.$element();
2982
- let toApply = [];
2983
- if (classes) {
2984
- toApply = Object.keys(classes)
2985
- .filter(key => (classes[key] === true) || classes[key](element));
2986
- }
2987
- var classesNotYetApplied = toApply.filter(c => !this.classesApplied.includes(c));
2988
- var classesToRemove = this.classesApplied.filter(c => !toApply.includes(c));
2989
- classesToRemove.forEach(c => this.renderer.removeClass(this.el.nativeElement, c));
2990
- classesNotYetApplied.forEach(c => this.renderer.addClass(this.el.nativeElement, c));
2991
- this.classesApplied = toApply;
2992
- });
3186
+ super();
3187
+ this.state = inject(TableStore);
3188
+ 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 }))));
3189
+ this.state.on(this.state.sort$, (rules) => {
3190
+ const topRule = { active: rules[0]?.active || '', direction: rules[0]?.direction || '' };
3191
+ const topActiveChanged = topRule.active !== this.active || '';
3192
+ const topDirectionChanged = topRule.direction !== this.direction || '';
3193
+ if (topActiveChanged || topDirectionChanged) {
3194
+ this.active = topRule.active;
3195
+ this.direction = topRule.direction;
3196
+ this.sortChange.emit(topRule);
3197
+ }
2993
3198
  });
2994
3199
  }
2995
- #onClasses;
2996
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ConditionalClassesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2997
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.3", type: ConditionalClassesDirective, isStandalone: true, selector: "[conditionalClasses]", inputs: { $element: { classPropertyName: "$element", publicName: "element", isSignal: true, isRequired: true, transformFunction: null }, $classes: { classPropertyName: "$classes", publicName: "conditionalClasses", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3200
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MultiSortDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3201
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: MultiSortDirective, isStandalone: true, selector: "[multiSort]", inputs: { disabled: ["matSortDisabled", "disabled"] }, providers: [
3202
+ { provide: MatSort, useExisting: MultiSortDirective }
3203
+ ], exportAs: ["multiSort"], usesInheritance: true, ngImport: i0 }); }
2998
3204
  }
2999
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ConditionalClassesDirective, decorators: [{
3205
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: MultiSortDirective, decorators: [{
3000
3206
  type: Directive,
3001
3207
  args: [{
3002
- selector: '[conditionalClasses]',
3208
+ selector: '[multiSort]',
3209
+ exportAs: 'multiSort',
3210
+ inputs: ['disabled: matSortDisabled'],
3211
+ providers: [
3212
+ { provide: MatSort, useExisting: MultiSortDirective }
3213
+ ],
3003
3214
  }]
3004
- }] });
3215
+ }], ctorParameters: () => [] });
3216
+ function sortsAreSame(a, b) {
3217
+ if (a.length !== b.length) {
3218
+ return false;
3219
+ }
3220
+ for (let i = 0; i < a.length; i++) {
3221
+ if (a[i].active !== b[i].active || a[i].direction !== b[i].direction) {
3222
+ return false;
3223
+ }
3224
+ }
3225
+ return true;
3226
+ }
3005
3227
 
3006
- class UtilitiesModule {
3007
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3008
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, imports: [SpaceCasePipe,
3009
- PhoneNumberPipe,
3010
- FunctionPipe,
3011
- StopPropagationDirective,
3012
- StylerDirective,
3013
- PreventEnterDirective,
3014
- AutoFocusDirective,
3015
- TrimWhitespaceDirective,
3016
- ClickSubjectDirective,
3017
- ClickEmitterDirective,
3018
- DialogDirective,
3019
- MatSlideToggleGroupDirective,
3020
- ConditionalClassesDirective], exports: [StopPropagationDirective,
3021
- PreventEnterDirective,
3022
- SpaceCasePipe,
3023
- PhoneNumberPipe,
3024
- FunctionPipe,
3025
- TrimWhitespaceDirective,
3026
- StylerDirective,
3027
- AutoFocusDirective,
3028
- ClickSubjectDirective,
3029
- ClickEmitterDirective,
3030
- DialogDirective,
3031
- MatSlideToggleGroupDirective,
3032
- ConditionalClassesDirective] }); }
3033
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, providers: [
3034
- DialogService
3035
- ] }); }
3228
+ class DateFilterComponent {
3229
+ constructor() {
3230
+ this.FilterType = FilterType;
3231
+ }
3232
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DateFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3233
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.3", type: DateFilterComponent, isStandalone: true, selector: "tb-date-filter", inputs: { info: "info", CurrentFilterType: "CurrentFilterType" }, ngImport: i0, template: "@if (CurrentFilterType !== FilterType.DateBetween && CurrentFilterType !== FilterType.IsNull)\r\n{\r\n <mat-form-field>\r\n <input matInput name=\"filterValue\" [ngModel]=\"info.filterValue\" [matDatepicker]=\"cal\"/>\r\n <mat-datepicker-toggle class=\"small-button date-toggle\" matSuffix preventEnter [for]=\"cal\" />\r\n <mat-datepicker #cal />\r\n </mat-form-field>\r\n}\r\n@if(CurrentFilterType === FilterType.DateBetween)\r\n{\r\n <ng-container ngModelGroup=\"filterValue\">\r\n <mat-form-field class=\"my-filter\" >\r\n <input matInput name=\"Start\" placeholder=\"From\" [ngModel]=\"info.filterValue?.Start\" [matDatepicker]=\"fromVal\"\r\n (click)=\"fromVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"fromVal\" />\r\n <mat-datepicker #fromVal />\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput name=\"End\" placeholder=\"To\" [ngModel]=\"info.filterValue?.End\" [matDatepicker]=\"toVal\" (click)=\"toVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"toVal\" />\r\n <mat-datepicker #toVal />\r\n </mat-form-field>\r\n </ng-container>\r\n}\r\n\r\n", styles: [".filter-name{color:var(tb-filter-name);margin:10px 0;font-weight:600;display:inline-block}.switch{display:inline-block}.head-row{display:flex;width:100%;align-items:center;justify-content:space-between}.filter-row{display:flex;align-items:center;gap:1rem}mat-card.filter-card::ng-deep mat-form-field{width:150px}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper{line-height:0}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper:before{height:0}.inline{display:inline-block}.small-button{height:18px;width:18px;font-size:18px;padding:0;margin:0}.small-button ::ng-deep *{line-height:initial;font-size:initial;height:18px;width:18px;font-size:18px;bottom:initial}.cancel-button{font-weight:700}.date-toggle ::ng-deep svg{position:absolute;left:0;top:0}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgModelGroup, selector: "[ngModelGroup]", inputs: ["ngModelGroup"], exportAs: ["ngModelGroup"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i3.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3036
3234
  }
3037
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: UtilitiesModule, decorators: [{
3038
- type: NgModule,
3039
- args: [{
3040
- exports: [
3041
- StopPropagationDirective,
3042
- PreventEnterDirective,
3043
- SpaceCasePipe,
3044
- PhoneNumberPipe,
3045
- FunctionPipe,
3046
- TrimWhitespaceDirective,
3047
- StylerDirective,
3048
- AutoFocusDirective,
3049
- ClickSubjectDirective,
3050
- ClickEmitterDirective,
3051
- DialogDirective,
3052
- MatSlideToggleGroupDirective,
3053
- ConditionalClassesDirective,
3054
- ],
3055
- imports: [
3056
- SpaceCasePipe,
3057
- PhoneNumberPipe,
3058
- FunctionPipe,
3059
- StopPropagationDirective,
3060
- StylerDirective,
3061
- PreventEnterDirective,
3062
- AutoFocusDirective,
3063
- TrimWhitespaceDirective,
3064
- ClickSubjectDirective,
3065
- ClickEmitterDirective,
3066
- DialogDirective,
3067
- MatSlideToggleGroupDirective,
3068
- ConditionalClassesDirective,
3069
- ],
3070
- providers: [
3071
- DialogService
3072
- ]
3073
- }]
3074
- }] });
3235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: DateFilterComponent, decorators: [{
3236
+ type: Component,
3237
+ args: [{ selector: 'tb-date-filter', changeDetection: ChangeDetectionStrategy.OnPush, viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], imports: [
3238
+ MatInputModule, FormsModule, MatDatepickerModule
3239
+ ], template: "@if (CurrentFilterType !== FilterType.DateBetween && CurrentFilterType !== FilterType.IsNull)\r\n{\r\n <mat-form-field>\r\n <input matInput name=\"filterValue\" [ngModel]=\"info.filterValue\" [matDatepicker]=\"cal\"/>\r\n <mat-datepicker-toggle class=\"small-button date-toggle\" matSuffix preventEnter [for]=\"cal\" />\r\n <mat-datepicker #cal />\r\n </mat-form-field>\r\n}\r\n@if(CurrentFilterType === FilterType.DateBetween)\r\n{\r\n <ng-container ngModelGroup=\"filterValue\">\r\n <mat-form-field class=\"my-filter\" >\r\n <input matInput name=\"Start\" placeholder=\"From\" [ngModel]=\"info.filterValue?.Start\" [matDatepicker]=\"fromVal\"\r\n (click)=\"fromVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"fromVal\" />\r\n <mat-datepicker #fromVal />\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput name=\"End\" placeholder=\"To\" [ngModel]=\"info.filterValue?.End\" [matDatepicker]=\"toVal\" (click)=\"toVal.open()\"/>\r\n <mat-datepicker-toggle matSuffix class=\"small-button date-toggle\" preventEnter [for]=\"toVal\" />\r\n <mat-datepicker #toVal />\r\n </mat-form-field>\r\n </ng-container>\r\n}\r\n\r\n", styles: [".filter-name{color:var(tb-filter-name);margin:10px 0;font-weight:600;display:inline-block}.switch{display:inline-block}.head-row{display:flex;width:100%;align-items:center;justify-content:space-between}.filter-row{display:flex;align-items:center;gap:1rem}mat-card.filter-card::ng-deep mat-form-field{width:150px}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper{line-height:0}mat-card.filter-card::ng-deep .mat-mdc-form-field-subscript-wrapper:before{height:0}.inline{display:inline-block}.small-button{height:18px;width:18px;font-size:18px;padding:0;margin:0}.small-button ::ng-deep *{line-height:initial;font-size:initial;height:18px;width:18px;font-size:18px;bottom:initial}.cancel-button{font-weight:700}.date-toggle ::ng-deep svg{position:absolute;left:0;top:0}\n"] }]
3240
+ }], propDecorators: { info: [{
3241
+ type: Input
3242
+ }], CurrentFilterType: [{
3243
+ type: Input
3244
+ }] } });
3075
3245
 
3076
3246
  class InFilterComponent {
3077
3247
  constructor() {
@@ -3117,7 +3287,7 @@ class InFilterComponent {
3117
3287
  provide: NG_VALUE_ACCESSOR,
3118
3288
  useExisting: InFilterComponent,
3119
3289
  multi: true
3120
- }], ngImport: i0, template: "<div class=inline>\r\n @for (val of value; track $index)\r\n {\r\n <div>\r\n @if($type() === FieldType.Number || $type() === FieldType.Currency)\r\n {\r\n <input type=\"number\" [ngModel]=\"val\"\r\n [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\" [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index, $event)\"/>\r\n }\r\n @else\r\n {\r\n <input #input type=\"string\"\r\n [ngModel]=\"val\" [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\"\r\n [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index ,$event)\" />\r\n }\r\n </div>\r\n <button [disabled]=\"value.length <= 1\" (click)=\"removeInput($index)\">-</button>\r\n @if ($index === value.length - 1)\r\n {\r\n <button [disabled]=\"val == undefined || val === ''\" (click)=\"addInput()\">+</button>\r\n }\r\n }\r\n</div>\r\n", styles: [".inline{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: AutoFocusDirective, selector: "[autoFocus]", inputs: ["autoFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3290
+ }], ngImport: i0, template: "<div class=inline>\r\n @for (val of value; track $index)\r\n {\r\n <div>\r\n @if($type() === FieldType.Number || $type() === FieldType.Currency)\r\n {\r\n <input type=\"number\" [ngModel]=\"val\"\r\n [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\"\r\n [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index, $event)\"/>\r\n }\r\n @else\r\n {\r\n <input #input type=\"string\"\r\n [ngModel]=\"val\" [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\"\r\n [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index ,$event)\" />\r\n }\r\n </div>\r\n <button [disabled]=\"value.length <= 1\" (click)=\"removeInput($index)\">-</button>\r\n @if ($index === value.length - 1)\r\n {\r\n <button [disabled]=\"val == undefined || val === ''\" (click)=\"addInput()\">+</button>\r\n }\r\n }\r\n</div>\r\n", styles: [".inline{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: AutoFocusDirective, selector: "[autoFocus]", inputs: ["autoFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3121
3291
  }
3122
3292
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InFilterComponent, decorators: [{
3123
3293
  type: Component,
@@ -3127,7 +3297,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
3127
3297
  multi: true
3128
3298
  }], imports: [
3129
3299
  FormsModule, AutoFocusDirective
3130
- ], template: "<div class=inline>\r\n @for (val of value; track $index)\r\n {\r\n <div>\r\n @if($type() === FieldType.Number || $type() === FieldType.Currency)\r\n {\r\n <input type=\"number\" [ngModel]=\"val\"\r\n [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\" [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index, $event)\"/>\r\n }\r\n @else\r\n {\r\n <input #input type=\"string\"\r\n [ngModel]=\"val\" [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\"\r\n [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index ,$event)\" />\r\n }\r\n </div>\r\n <button [disabled]=\"value.length <= 1\" (click)=\"removeInput($index)\">-</button>\r\n @if ($index === value.length - 1)\r\n {\r\n <button [disabled]=\"val == undefined || val === ''\" (click)=\"addInput()\">+</button>\r\n }\r\n }\r\n</div>\r\n", styles: [".inline{display:inline-block}\n"] }]
3300
+ ], template: "<div class=inline>\r\n @for (val of value; track $index)\r\n {\r\n <div>\r\n @if($type() === FieldType.Number || $type() === FieldType.Currency)\r\n {\r\n <input type=\"number\" [ngModel]=\"val\"\r\n [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\"\r\n [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index, $event)\"/>\r\n }\r\n @else\r\n {\r\n <input #input type=\"string\"\r\n [ngModel]=\"val\" [readonly]=\"$index + 1 < value.length\" [ngModelOptions]=\"{standalone:true}\"\r\n [autoFocus]=\"$index === value.length - 1\" (ngModelChange)=\"onValueChange($index ,$event)\" />\r\n }\r\n </div>\r\n <button [disabled]=\"value.length <= 1\" (click)=\"removeInput($index)\">-</button>\r\n @if ($index === value.length - 1)\r\n {\r\n <button [disabled]=\"val == undefined || val === ''\" (click)=\"addInput()\">+</button>\r\n }\r\n }\r\n</div>\r\n", styles: [".inline{display:inline-block}\n"] }]
3131
3301
  }], ctorParameters: () => [] });
3132
3302
 
3133
3303
  class NumberFilterComponent {
@@ -3181,10 +3351,21 @@ class InListFilterComponent {
3181
3351
  this.$key = input.required({ alias: 'key' });
3182
3352
  this.$selectedKeys = signal([]);
3183
3353
  this.$metaData = computed(() => this.tableState.$getMetaData(this.$key())());
3354
+ this.$allValues = computed(() => {
3355
+ const filterable = this.$metaData()?.additional?.filterOptions?.filterableValues;
3356
+ return filterable === 'all values' || filterable?.allValues === true;
3357
+ });
3358
+ this.$specialBlank = computed(() => {
3359
+ const specialBlank = this.tableState.selectSignal(s => s.allFilters)()[this.$metaData().key]?.find(k => isBlankValueFilter(k));
3360
+ if (!specialBlank)
3361
+ return;
3362
+ return { key: specialBlank, value: 'BLANK' };
3363
+ });
3364
+ this.$specialBlankSelected = computed(() => this.$selectedKeys().some(k => isBlankValueFilter(k.value)));
3184
3365
  this.$keyValues = computed(() => {
3185
3366
  const metaData = this.$metaData();
3186
- if (metaData?.additional?.filterOptions?.filterableValues === 'all values') {
3187
- return this.tableState.selectSignal(s => s.allFilters)()[metaData.key].map(f => ({ key: f, value: f }));
3367
+ if (this.$allValues()) {
3368
+ return this.tableState.selectSignal(s => s.allFilters)()[metaData.key].filter(isNotBlankValueFilter).map(f => ({ key: f, value: f }));
3188
3369
  }
3189
3370
  else if (metaData?.additional?.filterOptions?.filterableValues) {
3190
3371
  return metaData.additional.filterOptions.filterableValues.map(value => ({ key: value, value }));
@@ -3232,36 +3413,72 @@ class InListFilterComponent {
3232
3413
  useExisting: InListFilterComponent,
3233
3414
  multi: true
3234
3415
  }], ngImport: i0, template: `
3235
- @for (item of $keyValues(); track item.key) {
3236
- <div>
3237
- <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3238
- @switch ($metaData().fieldType)
3416
+ @if($specialBlank(); as specialBlank)
3417
+ {
3418
+ <div>
3419
+ <mat-checkbox [checked]="$specialBlankSelected()" stop-propagation (change)='selectFilterChanged($event, specialBlank)' >
3420
+ {{specialBlank.value}}
3421
+ </mat-checkbox>
3422
+ </div>
3423
+ }
3424
+ @switch ($metaData().fieldType)
3425
+ {
3426
+ @case (FieldType.Enum)
3427
+ {
3428
+ @for (item of $keyValues(); track item.key)
3429
+ {
3430
+ <div>
3431
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3432
+ {{(item.key | spaceCase)}}
3433
+ </mat-checkbox>
3434
+ </div>
3435
+ }
3436
+ }
3437
+ @case (FieldType.Date)
3438
+ {
3439
+ @for (item of $keyValues(); track item.key)
3440
+ {
3441
+ <div>
3442
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3443
+ {{item.value | date: 'shortDate'}}
3444
+ </mat-checkbox>
3445
+ </div>
3446
+ }
3447
+ }
3448
+ @case (FieldType.DateTime)
3449
+ {
3450
+ @for (item of $keyValues(); track item.key)
3239
3451
  {
3240
- @case (FieldType.Enum)
3241
- {
3242
- {{(item.key | spaceCase)}}
3243
- }
3244
- @case (FieldType.Date)
3245
- {
3246
- {{item.value | date: 'shortDate'}}
3247
- }
3248
- @case (FieldType.DateTime)
3249
- {
3250
- {{item.value | date: 'short'}}
3251
- }
3252
- @case (FieldType.Currency)
3253
- {
3254
- {{item.value | currency }}
3255
- }
3256
- @default
3257
- {
3258
- {{item.key}}
3259
- }
3452
+ <div>
3453
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3454
+ {{item.value | date: 'short'}}
3455
+ </mat-checkbox>
3456
+ </div>
3260
3457
  }
3261
- </mat-checkbox>
3262
- </div>
3263
- }
3264
-
3458
+ }
3459
+ @case (FieldType.Currency)
3460
+ {
3461
+ @for (item of $keyValues(); track item.key)
3462
+ {
3463
+ <div>
3464
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3465
+ {{item.value | currency }}
3466
+ </mat-checkbox>
3467
+ </div>
3468
+ }
3469
+ }
3470
+ @default
3471
+ {
3472
+ @for (item of $keyValues(); track item.key)
3473
+ {
3474
+ <div>
3475
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3476
+ {{item.key}}
3477
+ </mat-checkbox>
3478
+ </div>
3479
+ }
3480
+ }
3481
+ }
3265
3482
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i1$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: StopPropagationDirective, selector: "[stop-propagation]" }, { kind: "pipe", type: SpaceCasePipe, name: "spaceCase" }, { kind: "pipe", type: FunctionPipe, name: "func" }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "pipe", type: CurrencyPipe, name: "currency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3266
3483
  }
3267
3484
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InListFilterComponent, decorators: [{
@@ -3269,36 +3486,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
3269
3486
  args: [{
3270
3487
  selector: 'tb-in-list-filter',
3271
3488
  template: `
3272
- @for (item of $keyValues(); track item.key) {
3273
- <div>
3274
- <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3275
- @switch ($metaData().fieldType)
3489
+ @if($specialBlank(); as specialBlank)
3490
+ {
3491
+ <div>
3492
+ <mat-checkbox [checked]="$specialBlankSelected()" stop-propagation (change)='selectFilterChanged($event, specialBlank)' >
3493
+ {{specialBlank.value}}
3494
+ </mat-checkbox>
3495
+ </div>
3496
+ }
3497
+ @switch ($metaData().fieldType)
3498
+ {
3499
+ @case (FieldType.Enum)
3500
+ {
3501
+ @for (item of $keyValues(); track item.key)
3502
+ {
3503
+ <div>
3504
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3505
+ {{(item.key | spaceCase)}}
3506
+ </mat-checkbox>
3507
+ </div>
3508
+ }
3509
+ }
3510
+ @case (FieldType.Date)
3511
+ {
3512
+ @for (item of $keyValues(); track item.key)
3513
+ {
3514
+ <div>
3515
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3516
+ {{item.value | date: 'shortDate'}}
3517
+ </mat-checkbox>
3518
+ </div>
3519
+ }
3520
+ }
3521
+ @case (FieldType.DateTime)
3522
+ {
3523
+ @for (item of $keyValues(); track item.key)
3524
+ {
3525
+ <div>
3526
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3527
+ {{item.value | date: 'short'}}
3528
+ </mat-checkbox>
3529
+ </div>
3530
+ }
3531
+ }
3532
+ @case (FieldType.Currency)
3533
+ {
3534
+ @for (item of $keyValues(); track item.key)
3535
+ {
3536
+ <div>
3537
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3538
+ {{item.value | currency }}
3539
+ </mat-checkbox>
3540
+ </div>
3541
+ }
3542
+ }
3543
+ @default
3544
+ {
3545
+ @for (item of $keyValues(); track item.key)
3276
3546
  {
3277
- @case (FieldType.Enum)
3278
- {
3279
- {{(item.key | spaceCase)}}
3280
- }
3281
- @case (FieldType.Date)
3282
- {
3283
- {{item.value | date: 'shortDate'}}
3284
- }
3285
- @case (FieldType.DateTime)
3286
- {
3287
- {{item.value | date: 'short'}}
3288
- }
3289
- @case (FieldType.Currency)
3290
- {
3291
- {{item.value | currency }}
3292
- }
3293
- @default
3294
- {
3295
- {{item.key}}
3296
- }
3547
+ <div>
3548
+ <mat-checkbox [checked]="includes | func : item : $selectedKeys()" stop-propagation (change)='selectFilterChanged($event, item)' >
3549
+ {{item.key}}
3550
+ </mat-checkbox>
3551
+ </div>
3297
3552
  }
3298
- </mat-checkbox>
3299
- </div>
3300
- }
3301
-
3553
+ }
3554
+ }
3302
3555
  `,
3303
3556
  changeDetection: ChangeDetectionStrategy.OnPush,
3304
3557
  providers: [{
@@ -3461,95 +3714,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
3461
3714
  args: [{ name: 'formatFilterType' }]
3462
3715
  }] });
3463
3716
 
3464
- function isPipe(o) {
3465
- return typeof (o.transform) === 'function';
3466
- }
3467
- function createTransformer(metaData, config, noIcons = false, forItem = false) {
3468
- const defaultFunc = getFactory(metaData.key);
3469
- if (metaData.map && !forItem) {
3470
- return (value) => {
3471
- return metaData.map(value);
3472
- };
3473
- }
3474
- if (metaData.mapItem) {
3475
- return (value) => {
3476
- return metaData.mapItem(defaultFunc(value));
3477
- };
3478
- }
3479
- if (metaData.transform) {
3480
- if (isPipe(metaData.transform)) {
3481
- return (value) => metaData.transform.transform(defaultFunc(value));
3482
- }
3483
- return metaData.fieldType === FieldType.Expression ? metaData.transform : (value) => metaData.transform(defaultFunc(value), value);
3484
- }
3485
- if (config.transformers && config.transformers[metaData.fieldType]) {
3486
- var transformer = config.transformers[metaData.fieldType];
3487
- return (value) => transformer(defaultFunc(value));
3488
- }
3489
- const defaultDateFormat = config.dateFormats?.dateFormat ?? 'shortDate';
3490
- const defaultDateTimeFormat = config.dateFormats?.dateTimeFormat ?? 'short';
3491
- switch (metaData.fieldType) {
3492
- case FieldType.Date:
3493
- const dateFormat = metaData.additional?.dateFormat ?? defaultDateFormat;
3494
- return (value) => dateFormatter(defaultFunc(value), dateFormat);
3495
- case FieldType.DateTime:
3496
- const dateTimeFormat = metaData.additional?.dateTimeOptions?.format ?? defaultDateTimeFormat;
3497
- return (value) => dateFormatter(defaultFunc(value), dateTimeFormat);
3498
- case FieldType.Currency:
3499
- return (value) => currencyFormatter(defaultFunc(value));
3500
- case FieldType.PhoneNumber:
3501
- return (value) => phoneFormatter(defaultFunc(value));
3502
- case FieldType.Enum:
3503
- return (value) => spaceCase(metaData.additional?.enumMap[defaultFunc(value)]);
3504
- case FieldType.Boolean:
3505
- if (noIcons) {
3506
- return defaultFunc;
3507
- }
3508
- let forTrue = 'check';
3509
- let forFalse = '';
3510
- if (metaData.additional?.boolean?.forTrue) {
3511
- forTrue = metaData?.additional.boolean.forTrue.icon;
3512
- }
3513
- if (metaData.additional?.boolean?.showForFalse === true) {
3514
- forFalse = 'clear';
3515
- }
3516
- else if (metaData.additional?.boolean?.showForFalse?.icon) {
3517
- forFalse = metaData.additional?.boolean?.showForFalse?.icon;
3518
- }
3519
- return (value) => defaultFunc(value) ? forTrue : forFalse;
3520
- }
3521
- return defaultFunc;
3522
- }
3523
- function createItemTransformer(metaData, config, noIcons = false, mutate = false) {
3524
- const transform = createTransformer(metaData, config, noIcons);
3525
- return (t) => {
3526
- if (!mutate) {
3527
- t = { ...t };
3528
- }
3529
- t[metaData.key] = transform(t);
3530
- };
3531
- }
3532
- function createItemTransformers(metaDatas, config, noIcons = false, mutate = false) {
3533
- const transformers = metaDatas.map(meta => createItemTransformer(meta, config, noIcons, true));
3534
- return (t) => {
3535
- if (!t)
3536
- return t;
3537
- if (!mutate) {
3538
- t = { ...t };
3539
- }
3540
- transformers.forEach(m => m(t));
3541
- return t;
3542
- };
3543
- }
3544
- function dateFormatter(date, format) {
3545
- if (!date)
3546
- return;
3547
- return formatDate(date, format, 'en-US');
3548
- }
3549
- function currencyFormatter(amt) {
3550
- return formatCurrency(amt, 'en-US', '$');
3551
- }
3552
-
3553
3717
  class FormatFilterValuePipe {
3554
3718
  constructor() {
3555
3719
  this.tableState = inject(TableStore);
@@ -3570,15 +3734,15 @@ const transform = (value, meta, filterType) => {
3570
3734
  }
3571
3735
  if (value && (filterType === FilterType.In)) {
3572
3736
  if (meta.fieldType === FieldType.Enum) {
3573
- return value.map((v) => spaceCase(meta.additional.enumMap[v])).join(', ') ?? value;
3737
+ return value.map((v) => mapSpecial(v) || spaceCase(meta.additional.enumMap[v])).join(', ') ?? value;
3574
3738
  }
3575
3739
  if (meta.fieldType === FieldType.Date || meta.fieldType === FieldType.DateTime) {
3576
- return value.map((v) => mapDate(v, meta, filterType)).join(', ') ?? value;
3740
+ return value.map((v) => mapSpecial(v) || mapDate(v, meta, filterType)).join(', ') ?? value;
3577
3741
  }
3578
3742
  if (meta.fieldType === FieldType.Number || meta.fieldType === FieldType.Currency) {
3579
- return value.map((v) => mapNumber(v, meta)).join(', ') ?? value;
3743
+ return value.map((v) => mapSpecial(v) || mapNumber(v, meta)).join(', ') ?? value;
3580
3744
  }
3581
- return value.join(', ') ?? value;
3745
+ return value.map(v => mapSpecial(v) || v).join(', ') ?? value;
3582
3746
  }
3583
3747
  if (filterType === FilterType.NumberBetween && (meta.fieldType === FieldType.Number || meta.fieldType === FieldType.Currency)) {
3584
3748
  return mapNumber(value.Start, meta) + ' - ' + mapNumber(value.End, meta);
@@ -3609,6 +3773,11 @@ function mapNumber(value, meta) {
3609
3773
  }
3610
3774
  return value;
3611
3775
  }
3776
+ function mapSpecial(value) {
3777
+ if (isBlankValueFilter(value))
3778
+ return 'BLANK';
3779
+ return undefined;
3780
+ }
3612
3781
 
3613
3782
  class FilterChipsComponent {
3614
3783
  constructor() {
@@ -5931,31 +6100,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImpor
5931
6100
  }]
5932
6101
  }], ctorParameters: () => [] });
5933
6102
 
5934
- function buildInAllValuesFilter(config, previousMeta, currentMeta, data, metaTimestamp, dataTimestamp, currentAllFilters) {
5935
- const currentAll = currentMeta.filter(m => m.additional?.filterOptions?.filterableValues === 'all values');
5936
- if (dataTimestamp > metaTimestamp) {
5937
- return currentAll.reduce((dict, md) => {
5938
- dict[md.key] = buildFilter(data, md, config);
5939
- return dict;
5940
- }, {});
5941
- }
5942
- const previousAll = previousMeta.filter(m => m.additional?.filterOptions?.filterableValues === 'all values');
5943
- const newCurrent = currentAll.filter(c => previousAll.every(p => c.key !== p.key));
5944
- if (newCurrent.length) {
5945
- const c = { ...currentAllFilters };
5946
- newCurrent.forEach(md => c[md.key] = buildFilter(data, md, config));
5947
- return c;
5948
- }
5949
- return currentAllFilters;
5950
- }
5951
- function buildFilter(data, metaData, config) {
5952
- const map = createTransformer(metaData, config, true, true);
5953
- return [...new Map(data.map(v => {
5954
- const mappedV = map(v);
5955
- return [mappedV?.toString(), mappedV];
5956
- })).values()].filter(v => v != undefined).sort();
5957
- }
5958
-
5959
6103
  class TableContainerComponent {
5960
6104
  constructor() {
5961
6105
  this.state = inject(TableStore);