@one-paragon/angular-utilities 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/one-paragon-angular-utilities.mjs +159 -80
- package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -1
- package/package.json +1 -1
- package/table-builder/components/filter/in-list/in-list-filter.component.d.ts +5 -6
- package/table-builder/enums/filterTypes.d.ts +1 -1
- package/table-builder/interfaces/report-def.d.ts +67 -15
- package/table-builder/services/transform-creator.d.ts +2 -0
|
@@ -19,7 +19,7 @@ import * as i3 from '@angular/forms';
|
|
|
19
19
|
import { NgControl, NgForm, ControlContainer, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
20
20
|
import * as i9 from '@angular/material/core';
|
|
21
21
|
import { MatOption } from '@angular/material/core';
|
|
22
|
-
import { DatePipe, CurrencyPipe,
|
|
22
|
+
import { DatePipe, CurrencyPipe, NgTemplateOutlet, formatDate, formatCurrency, DecimalPipe, formatNumber, CommonModule, AsyncPipe } from '@angular/common';
|
|
23
23
|
import { ComponentStore } from '@ngrx/component-store';
|
|
24
24
|
import * as i5 from '@angular/cdk/drag-drop';
|
|
25
25
|
import { moveItemInArray, DragDropModule, CdkDropList, CDK_DROP_LIST, transferArrayItem } from '@angular/cdk/drag-drop';
|
|
@@ -1701,7 +1701,10 @@ const stringEndsWithFunc = (filterInfo) => {
|
|
|
1701
1701
|
};
|
|
1702
1702
|
const multipleStringValuesEqualsFunc = (filterInfo) => {
|
|
1703
1703
|
const filterVals = filterInfo.filterValue.map((v) => prepareForStringCompare(v));
|
|
1704
|
-
return ((val) =>
|
|
1704
|
+
return ((val) => {
|
|
1705
|
+
const v = prepareForStringCompare(val);
|
|
1706
|
+
return filterVals.some((s) => v === s);
|
|
1707
|
+
});
|
|
1705
1708
|
};
|
|
1706
1709
|
const StringFilterFuncs = {
|
|
1707
1710
|
[FilterType.StringEquals]: stringEqualFunc,
|
|
@@ -1768,6 +1771,14 @@ const dateIsOnOrBeforeFunc = (filterInfo) => {
|
|
|
1768
1771
|
const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
|
|
1769
1772
|
return ((val) => clean(filterInfo, val).getTime() <= beforeVal);
|
|
1770
1773
|
};
|
|
1774
|
+
const dateIsInFunc = (filterInfo) => {
|
|
1775
|
+
const filterVals = filterInfo.filterValue.map(v => new Date(v).getTime());
|
|
1776
|
+
const clean = filterInfo.fieldType === FieldType.Date ? (a, b) => b : cleanDateTime;
|
|
1777
|
+
return ((val) => {
|
|
1778
|
+
const d = clean(filterInfo, val).getTime();
|
|
1779
|
+
return filterVals.some((f) => f === d);
|
|
1780
|
+
});
|
|
1781
|
+
};
|
|
1771
1782
|
const dateBetweenFunc = (filterInfo) => {
|
|
1772
1783
|
const startVal = new Date(filterInfo.filterValue.Start);
|
|
1773
1784
|
const endVal = new Date(filterInfo.filterValue.End);
|
|
@@ -1791,6 +1802,7 @@ const DateFilterFuncs = {
|
|
|
1791
1802
|
[FilterType.DateOnOrAfter]: dateIsOnOrAfterFunc,
|
|
1792
1803
|
[FilterType.DateOnOrBefore]: dateIsOnOrBeforeFunc,
|
|
1793
1804
|
[FilterType.DateBetween]: dateBetweenFunc,
|
|
1805
|
+
[FilterType.In]: dateIsInFunc,
|
|
1794
1806
|
[FilterType.IsNull]: isNull,
|
|
1795
1807
|
};
|
|
1796
1808
|
const DateTimeFilterFuncs = {
|
|
@@ -1800,6 +1812,7 @@ const DateTimeFilterFuncs = {
|
|
|
1800
1812
|
[FilterType.DateTimeAtOrAfter]: dateIsOnOrAfterFunc,
|
|
1801
1813
|
[FilterType.DateTimeAtOrBefore]: dateIsOnOrBeforeFunc,
|
|
1802
1814
|
[FilterType.DateTimeBetween]: dateBetweenFunc,
|
|
1815
|
+
[FilterType.In]: dateIsInFunc,
|
|
1803
1816
|
[FilterType.IsNull]: isNull,
|
|
1804
1817
|
};
|
|
1805
1818
|
|
|
@@ -3115,14 +3128,12 @@ class InListFilterComponent {
|
|
|
3115
3128
|
this.$keyValues = computed(() => {
|
|
3116
3129
|
const metaData = this.$metaData();
|
|
3117
3130
|
if (metaData?.additional?.filterOptions?.filterableValues) {
|
|
3118
|
-
return metaData.additional.filterOptions.filterableValues.
|
|
3131
|
+
return metaData.additional.filterOptions.filterableValues.map(value => ({ key: value, value }));
|
|
3119
3132
|
}
|
|
3120
|
-
else {
|
|
3121
|
-
|
|
3122
|
-
return metaData.additional.enumMap;
|
|
3123
|
-
}
|
|
3133
|
+
else if (metaData?.fieldType === FieldType.Enum) {
|
|
3134
|
+
return Object.entries(metaData.additional.enumMap).map(([key, value]) => ({ key: value, value: +key }));
|
|
3124
3135
|
}
|
|
3125
|
-
return
|
|
3136
|
+
return [];
|
|
3126
3137
|
});
|
|
3127
3138
|
}
|
|
3128
3139
|
writeValue(obj) {
|
|
@@ -3154,25 +3165,69 @@ class InListFilterComponent {
|
|
|
3154
3165
|
useExisting: InListFilterComponent,
|
|
3155
3166
|
multi: true
|
|
3156
3167
|
}], ngImport: i0, template: `
|
|
3157
|
-
@for (item of $keyValues()
|
|
3168
|
+
@for (item of $keyValues(); track item.key) {
|
|
3158
3169
|
<div>
|
|
3159
|
-
<mat-checkbox [checked]="'includes' | func : $selectedKeys() : item.key" stop-propagation (change)='selectFilterChanged($event, item.
|
|
3160
|
-
|
|
3170
|
+
<mat-checkbox [checked]="'includes' | func : $selectedKeys() : item.key" stop-propagation (change)='selectFilterChanged($event, item.value)' >
|
|
3171
|
+
@switch ($metaData().fieldType)
|
|
3172
|
+
{
|
|
3173
|
+
@case (FieldType.Enum)
|
|
3174
|
+
{
|
|
3175
|
+
{{(item.key | spaceCase)}}
|
|
3176
|
+
}
|
|
3177
|
+
@case (FieldType.Date)
|
|
3178
|
+
{
|
|
3179
|
+
{{item.value | date: 'shortDate'}}
|
|
3180
|
+
}
|
|
3181
|
+
@case (FieldType.DateTime)
|
|
3182
|
+
{
|
|
3183
|
+
{{item.value | date: 'short'}}
|
|
3184
|
+
}
|
|
3185
|
+
@case (FieldType.Currency)
|
|
3186
|
+
{
|
|
3187
|
+
{{item.value | currency }}
|
|
3188
|
+
}
|
|
3189
|
+
@default
|
|
3190
|
+
{
|
|
3191
|
+
{{item.key}}
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3161
3194
|
</mat-checkbox>
|
|
3162
3195
|
</div>
|
|
3163
3196
|
}
|
|
3164
3197
|
|
|
3165
|
-
`, isInline: true, dependencies: [{ kind: "
|
|
3198
|
+
`, 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 }); }
|
|
3166
3199
|
}
|
|
3167
3200
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: InListFilterComponent, decorators: [{
|
|
3168
3201
|
type: Component,
|
|
3169
3202
|
args: [{
|
|
3170
3203
|
selector: 'tb-in-list-filter , [tb-in-list-filter]',
|
|
3171
3204
|
template: `
|
|
3172
|
-
@for (item of $keyValues()
|
|
3205
|
+
@for (item of $keyValues(); track item.key) {
|
|
3173
3206
|
<div>
|
|
3174
|
-
<mat-checkbox [checked]="'includes' | func : $selectedKeys() : item.key" stop-propagation (change)='selectFilterChanged($event, item.
|
|
3175
|
-
|
|
3207
|
+
<mat-checkbox [checked]="'includes' | func : $selectedKeys() : item.key" stop-propagation (change)='selectFilterChanged($event, item.value)' >
|
|
3208
|
+
@switch ($metaData().fieldType)
|
|
3209
|
+
{
|
|
3210
|
+
@case (FieldType.Enum)
|
|
3211
|
+
{
|
|
3212
|
+
{{(item.key | spaceCase)}}
|
|
3213
|
+
}
|
|
3214
|
+
@case (FieldType.Date)
|
|
3215
|
+
{
|
|
3216
|
+
{{item.value | date: 'shortDate'}}
|
|
3217
|
+
}
|
|
3218
|
+
@case (FieldType.DateTime)
|
|
3219
|
+
{
|
|
3220
|
+
{{item.value | date: 'short'}}
|
|
3221
|
+
}
|
|
3222
|
+
@case (FieldType.Currency)
|
|
3223
|
+
{
|
|
3224
|
+
{{item.value | currency }}
|
|
3225
|
+
}
|
|
3226
|
+
@default
|
|
3227
|
+
{
|
|
3228
|
+
{{item.key}}
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3176
3231
|
</mat-checkbox>
|
|
3177
3232
|
</div>
|
|
3178
3233
|
}
|
|
@@ -3185,7 +3240,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
3185
3240
|
multi: true
|
|
3186
3241
|
}],
|
|
3187
3242
|
imports: [
|
|
3188
|
-
|
|
3243
|
+
MatCheckboxModule, StopPropagationDirective, SpaceCasePipe, FunctionPipe, DatePipe, CurrencyPipe
|
|
3189
3244
|
]
|
|
3190
3245
|
}]
|
|
3191
3246
|
}] });
|
|
@@ -3339,70 +3394,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
3339
3394
|
args: [{ name: 'formatFilterType' }]
|
|
3340
3395
|
}] });
|
|
3341
3396
|
|
|
3342
|
-
class FormatFilterValuePipe {
|
|
3343
|
-
constructor() {
|
|
3344
|
-
this.tableState = inject(TableStore);
|
|
3345
|
-
this.datePipe = inject(DatePipe);
|
|
3346
|
-
}
|
|
3347
|
-
transform(value, key, filterType) {
|
|
3348
|
-
return computed(() => transform(value, this.tableState.$getMetaData(key)(), filterType));
|
|
3349
|
-
}
|
|
3350
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatFilterValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
3351
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: FormatFilterValuePipe, isStandalone: true, name: "formatFilterValue" }); }
|
|
3352
|
-
}
|
|
3353
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatFilterValuePipe, decorators: [{
|
|
3354
|
-
type: Pipe,
|
|
3355
|
-
args: [{ name: 'formatFilterValue' }]
|
|
3356
|
-
}] });
|
|
3357
|
-
const transform = (value, meta, filterType) => {
|
|
3358
|
-
if (filterType === FilterType.IsNull) {
|
|
3359
|
-
return '';
|
|
3360
|
-
}
|
|
3361
|
-
if (value && (filterType === FilterType.In)) {
|
|
3362
|
-
if (meta.fieldType === FieldType.Enum) {
|
|
3363
|
-
return value.map((v) => spaceCase(meta.additional.enumMap[v])).join(', ') ?? value;
|
|
3364
|
-
}
|
|
3365
|
-
return value.join(', ') ?? value;
|
|
3366
|
-
}
|
|
3367
|
-
if (filterType === FilterType.NumberBetween) {
|
|
3368
|
-
return value.Start + ' - ' + value.End;
|
|
3369
|
-
}
|
|
3370
|
-
if (meta.fieldType === FieldType.Date) {
|
|
3371
|
-
return new DatePipe('en-US').transform(value, 'MM/dd/yy') || '';
|
|
3372
|
-
}
|
|
3373
|
-
if (meta.fieldType === FieldType.DateTime) {
|
|
3374
|
-
return (!!DateTimeFilterFuncs[filterType] ? new DatePipe('en-US').transform(value, 'short') : new DatePipe('en-US').transform(value, 'MM/dd/yy')) || '';
|
|
3375
|
-
}
|
|
3376
|
-
return value;
|
|
3377
|
-
};
|
|
3378
|
-
|
|
3379
|
-
class FilterChipsComponent {
|
|
3380
|
-
constructor() {
|
|
3381
|
-
this.tableState = inject(TableStore);
|
|
3382
|
-
this.filterStore = inject(WrapperFilterStore);
|
|
3383
|
-
this.$filters = computed(() => Object.values(this.tableState.$filters()).filter(f => isFilterInfo(f) && !f._isExternallyManaged));
|
|
3384
|
-
this.$currentFilters = this.filterStore.$currentFilters;
|
|
3385
|
-
}
|
|
3386
|
-
deleteByIndex(index) {
|
|
3387
|
-
this.filterStore.deleteByIndex(index);
|
|
3388
|
-
}
|
|
3389
|
-
addFilter(filter) {
|
|
3390
|
-
this.filterStore.addFilter(filter);
|
|
3391
|
-
}
|
|
3392
|
-
clearAll() {
|
|
3393
|
-
this.filterStore.clearAll();
|
|
3394
|
-
}
|
|
3395
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FilterChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3396
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: FilterChipsComponent, isStandalone: true, selector: "lib-filter-list", ngImport: i0, template: "<div class=\"d-w\">\r\n\r\n @if ($currentFilters().length)\r\n {\r\n <button class=\"cancel-button\" mat-icon-button matTooltip=\"Close all Filters Cards\" (click)=\"clearAll()\">\r\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\r\n </button>\r\n <div class=\"float\">\r\n @for (filter of $currentFilters(); track filter.key)\r\n {\r\n <div class=\"filter\">\r\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <mat-chip-set>\r\n @for (filter of $filters(); track filter.key)\r\n {\r\n <mat-chip (dblclick)=\"addFilter(filter)\" (removed)=\"tableState.removeFilter(filter.filterId!)\">\r\n {{ (filter.key | keyDisplay)() }} {{filter.filterType | formatFilterType : filter.filterValue}} {{ (filter.filterValue | formatFilterValue: filter.key : filter.filterType)() }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n @if ($filters().length > 1)\r\n {\r\n <mat-chip (removed)=\"tableState.clearFilters()\">\r\n Clear All\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n </mat-chip-set>\r\n\r\n</div>\r\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FilterComponent, selector: "tb-filter", inputs: ["filter"], outputs: ["close"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i4$2.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "directive", type: i4$2.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i4$2.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "pipe", type: KeyDisplayPipe, name: "keyDisplay" }, { kind: "pipe", type: FormatFilterTypePipe, name: "formatFilterType" }, { kind: "pipe", type: FormatFilterValuePipe, name: "formatFilterValue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3397
|
-
}
|
|
3398
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FilterChipsComponent, decorators: [{
|
|
3399
|
-
type: Component,
|
|
3400
|
-
args: [{ selector: 'lib-filter-list', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3401
|
-
MatButtonModule, MatTooltipModule, MatIconModule, FilterComponent,
|
|
3402
|
-
MatChipsModule, KeyDisplayPipe, FormatFilterTypePipe, FormatFilterValuePipe
|
|
3403
|
-
], template: "<div class=\"d-w\">\r\n\r\n @if ($currentFilters().length)\r\n {\r\n <button class=\"cancel-button\" mat-icon-button matTooltip=\"Close all Filters Cards\" (click)=\"clearAll()\">\r\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\r\n </button>\r\n <div class=\"float\">\r\n @for (filter of $currentFilters(); track filter.key)\r\n {\r\n <div class=\"filter\">\r\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <mat-chip-set>\r\n @for (filter of $filters(); track filter.key)\r\n {\r\n <mat-chip (dblclick)=\"addFilter(filter)\" (removed)=\"tableState.removeFilter(filter.filterId!)\">\r\n {{ (filter.key | keyDisplay)() }} {{filter.filterType | formatFilterType : filter.filterValue}} {{ (filter.filterValue | formatFilterValue: filter.key : filter.filterType)() }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n @if ($filters().length > 1)\r\n {\r\n <mat-chip (removed)=\"tableState.clearFilters()\">\r\n Clear All\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n </mat-chip-set>\r\n\r\n</div>\r\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
|
|
3404
|
-
}] });
|
|
3405
|
-
|
|
3406
3397
|
function isPipe(o) {
|
|
3407
3398
|
return typeof (o.transform) === 'function';
|
|
3408
3399
|
}
|
|
@@ -3492,6 +3483,94 @@ function currencyFormatter(amt) {
|
|
|
3492
3483
|
return formatCurrency(amt, 'en-US', '$');
|
|
3493
3484
|
}
|
|
3494
3485
|
|
|
3486
|
+
class FormatFilterValuePipe {
|
|
3487
|
+
constructor() {
|
|
3488
|
+
this.tableState = inject(TableStore);
|
|
3489
|
+
this.datePipe = inject(DatePipe);
|
|
3490
|
+
}
|
|
3491
|
+
transform(value, key, filterType) {
|
|
3492
|
+
return computed(() => transform(value, this.tableState.$getMetaData(key)(), filterType));
|
|
3493
|
+
}
|
|
3494
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatFilterValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
3495
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: FormatFilterValuePipe, isStandalone: true, name: "formatFilterValue" }); }
|
|
3496
|
+
}
|
|
3497
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatFilterValuePipe, decorators: [{
|
|
3498
|
+
type: Pipe,
|
|
3499
|
+
args: [{ name: 'formatFilterValue' }]
|
|
3500
|
+
}] });
|
|
3501
|
+
const transform = (value, meta, filterType) => {
|
|
3502
|
+
if (filterType === FilterType.IsNull) {
|
|
3503
|
+
return '';
|
|
3504
|
+
}
|
|
3505
|
+
if (value && (filterType === FilterType.In)) {
|
|
3506
|
+
if (meta.fieldType === FieldType.Enum) {
|
|
3507
|
+
return value.map((v) => spaceCase(meta.additional.enumMap[v])).join(', ') ?? value;
|
|
3508
|
+
}
|
|
3509
|
+
if (meta.fieldType === FieldType.Date || meta.fieldType === FieldType.DateTime) {
|
|
3510
|
+
return value.map((v) => mapDate(v, meta, filterType)).join(', ') ?? value;
|
|
3511
|
+
}
|
|
3512
|
+
if (meta.fieldType === FieldType.Number || meta.fieldType === FieldType.Currency) {
|
|
3513
|
+
return value.map((v) => mapNumber(v, meta)).join(', ') ?? value;
|
|
3514
|
+
}
|
|
3515
|
+
return value.join(', ') ?? value;
|
|
3516
|
+
}
|
|
3517
|
+
if (filterType === FilterType.NumberBetween && (meta.fieldType === FieldType.Number || meta.fieldType === FieldType.Currency)) {
|
|
3518
|
+
return mapNumber(value.Start, meta) + ' - ' + mapNumber(value.End, meta);
|
|
3519
|
+
}
|
|
3520
|
+
if (filterType === FilterType.DateBetween) {
|
|
3521
|
+
return mapDate(value.Start, meta, filterType) + ' - ' + mapDate(value.End, meta, filterType);
|
|
3522
|
+
}
|
|
3523
|
+
if (meta.fieldType === FieldType.Date || meta.fieldType === FieldType.DateTime) {
|
|
3524
|
+
return mapDate(value, meta, filterType);
|
|
3525
|
+
}
|
|
3526
|
+
if (meta.fieldType === FieldType.Currency) {
|
|
3527
|
+
return mapNumber(value, meta);
|
|
3528
|
+
}
|
|
3529
|
+
return value;
|
|
3530
|
+
};
|
|
3531
|
+
function mapDate(value, meta, filterType) {
|
|
3532
|
+
if (meta.fieldType === FieldType.Date) {
|
|
3533
|
+
return dateFormatter(value, 'shortDate');
|
|
3534
|
+
}
|
|
3535
|
+
if (meta.fieldType === FieldType.DateTime) {
|
|
3536
|
+
return (!!DateTimeFilterFuncs[filterType] ? dateFormatter(value, 'shortDate') : dateFormatter(value, 'short')) || '';
|
|
3537
|
+
}
|
|
3538
|
+
return value;
|
|
3539
|
+
}
|
|
3540
|
+
function mapNumber(value, meta) {
|
|
3541
|
+
if (meta.fieldType === FieldType.Currency) {
|
|
3542
|
+
return currencyFormatter(value);
|
|
3543
|
+
}
|
|
3544
|
+
return value;
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
class FilterChipsComponent {
|
|
3548
|
+
constructor() {
|
|
3549
|
+
this.tableState = inject(TableStore);
|
|
3550
|
+
this.filterStore = inject(WrapperFilterStore);
|
|
3551
|
+
this.$filters = computed(() => Object.values(this.tableState.$filters()).filter(f => isFilterInfo(f) && !f._isExternallyManaged));
|
|
3552
|
+
this.$currentFilters = this.filterStore.$currentFilters;
|
|
3553
|
+
}
|
|
3554
|
+
deleteByIndex(index) {
|
|
3555
|
+
this.filterStore.deleteByIndex(index);
|
|
3556
|
+
}
|
|
3557
|
+
addFilter(filter) {
|
|
3558
|
+
this.filterStore.addFilter(filter);
|
|
3559
|
+
}
|
|
3560
|
+
clearAll() {
|
|
3561
|
+
this.filterStore.clearAll();
|
|
3562
|
+
}
|
|
3563
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FilterChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3564
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: FilterChipsComponent, isStandalone: true, selector: "lib-filter-list", ngImport: i0, template: "<div class=\"d-w\">\r\n\r\n @if ($currentFilters().length)\r\n {\r\n <button class=\"cancel-button\" mat-icon-button matTooltip=\"Close all Filters Cards\" (click)=\"clearAll()\">\r\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\r\n </button>\r\n <div class=\"float\">\r\n @for (filter of $currentFilters(); track filter.key)\r\n {\r\n <div class=\"filter\">\r\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <mat-chip-set>\r\n @for (filter of $filters(); track filter.key)\r\n {\r\n <mat-chip (dblclick)=\"addFilter(filter)\" (removed)=\"tableState.removeFilter(filter.filterId!)\">\r\n {{ (filter.key | keyDisplay)() }} {{filter.filterType | formatFilterType : filter.filterValue}} {{ (filter.filterValue | formatFilterValue: filter.key : filter.filterType)() }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n @if ($filters().length > 1)\r\n {\r\n <mat-chip (removed)=\"tableState.clearFilters()\">\r\n Clear All\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n </mat-chip-set>\r\n\r\n</div>\r\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FilterComponent, selector: "tb-filter", inputs: ["filter"], outputs: ["close"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i4$2.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "directive", type: i4$2.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i4$2.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "pipe", type: KeyDisplayPipe, name: "keyDisplay" }, { kind: "pipe", type: FormatFilterTypePipe, name: "formatFilterType" }, { kind: "pipe", type: FormatFilterValuePipe, name: "formatFilterValue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3565
|
+
}
|
|
3566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FilterChipsComponent, decorators: [{
|
|
3567
|
+
type: Component,
|
|
3568
|
+
args: [{ selector: 'lib-filter-list', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3569
|
+
MatButtonModule, MatTooltipModule, MatIconModule, FilterComponent,
|
|
3570
|
+
MatChipsModule, KeyDisplayPipe, FormatFilterTypePipe, FormatFilterValuePipe
|
|
3571
|
+
], template: "<div class=\"d-w\">\r\n\r\n @if ($currentFilters().length)\r\n {\r\n <button class=\"cancel-button\" mat-icon-button matTooltip=\"Close all Filters Cards\" (click)=\"clearAll()\">\r\n <mat-icon class=\"cancel-button\" color=\"primary\">close</mat-icon>\r\n </button>\r\n <div class=\"float\">\r\n @for (filter of $currentFilters(); track filter.key)\r\n {\r\n <div class=\"filter\">\r\n <tb-filter [filter]=\"filter\" (close)=\"deleteByIndex($index)\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <mat-chip-set>\r\n @for (filter of $filters(); track filter.key)\r\n {\r\n <mat-chip (dblclick)=\"addFilter(filter)\" (removed)=\"tableState.removeFilter(filter.filterId!)\">\r\n {{ (filter.key | keyDisplay)() }} {{filter.filterType | formatFilterType : filter.filterValue}} {{ (filter.filterValue | formatFilterValue: filter.key : filter.filterType)() }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n @if ($filters().length > 1)\r\n {\r\n <mat-chip (removed)=\"tableState.clearFilters()\">\r\n Clear All\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n }\r\n </mat-chip-set>\r\n\r\n</div>\r\n", styles: [".filter{margin:15px;display:inline-block}.filter-button{font-size:22px;font-weight:700}.cancel-button{margin-right:30px;font-weight:700}.filter-wrapper{margin-top:1em;margin-bottom:1em;float:right}.menu{margin-bottom:10px;width:109.1%}.filter-labels{font-size:17px;font-weight:600}.float{position:absolute;width:fit-content;z-index:101;top:10px;right:180px;max-width:90vw}.d-w{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
|
|
3572
|
+
}] });
|
|
3573
|
+
|
|
3495
3574
|
class RouterLinkColumnComponent {
|
|
3496
3575
|
constructor() {
|
|
3497
3576
|
this.additional = input.required();
|