@mediusinc/mng-commons 5.3.0-rc.1 → 5.3.0-rc.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/core/data-list/filter-metadata.model.d.ts +20 -0
- package/core/helpers/number.d.ts +5 -0
- package/core/helpers/type-helpers.d.ts +1 -0
- package/core/index.d.ts +2 -0
- package/core/provide.d.ts +3 -2
- package/core/services/tokens/module-config.token.d.ts +7 -6
- package/esm2022/core/data-list/data-list-params-helpers.mjs +3 -1
- package/esm2022/core/data-list/filter-metadata.model.mjs +2 -0
- package/esm2022/core/helpers/date.mjs +2 -2
- package/esm2022/core/helpers/number.mjs +19 -0
- package/esm2022/core/helpers/type-helpers.mjs +1 -1
- package/esm2022/core/index.mjs +3 -1
- package/esm2022/core/pipes/boolean.pipe.mjs +7 -1
- package/esm2022/core/provide.mjs +4 -3
- package/esm2022/core/services/tokens/module-config.token.mjs +1 -1
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +2 -3
- package/esm2022/filter/descriptors/filter.descriptor.mjs +76 -31
- package/esm2022/filter/models/filter.model.mjs +6 -1
- package/esm2022/form/components/date-range/date-range.component.mjs +45 -14
- package/esm2022/form/components/dropdown/dropdown.component.mjs +77 -93
- package/esm2022/form/components/number-range/number-range.component.mjs +29 -12
- package/esm2022/table/api/descriptors/column.descriptor.mjs +2 -1
- package/esm2022/table/api/descriptors/table.descriptor.mjs +22 -21
- package/esm2022/table/api/index.mjs +2 -1
- package/esm2022/table/api/models/row-expandable-component.model.mjs +2 -0
- package/esm2022/table/api/models/table-columns.model.mjs +1 -1
- package/esm2022/table/api/models/table.model.mjs +1 -1
- package/esm2022/table/components/column-filter/column-filter.component.mjs +396 -0
- package/esm2022/table/components/column-value/column-value.component.mjs +3 -3
- package/esm2022/table/components/filter/filter-active-tag/filter-active-tag.component.mjs +52 -0
- package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +197 -0
- package/esm2022/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.mjs +135 -0
- package/esm2022/table/components/table/table.component.mjs +34 -25
- package/esm2022/table/helpers/filters.mjs +297 -0
- package/esm2022/table/index.mjs +13 -2
- package/esm2022/table/models/filter.model.mjs +2 -0
- package/esm2022/table/pipes/filter-value.pipe.mjs +77 -0
- package/esm2022/table/provide.mjs +19 -0
- package/esm2022/table/services/data-list.service.mjs +1 -1
- package/esm2022/table/services/table-feature-config.token.mjs +3 -0
- package/esm2022/tableview/action/components/action/action.component.mjs +3 -3
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +2 -2
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +2 -2
- package/esm2022/tableview/action/components/table/action-table.component.mjs +3 -3
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +1 -3
- package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +14 -1
- package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/field-image-preview.model.mjs +2 -0
- package/esm2022/tableview/api/index.mjs +2 -1
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +11 -13
- package/esm2022/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +9 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +3 -3
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +3 -4
- package/fesm2022/mediusinc-mng-commons-core.mjs +32 -4
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-filter.mjs +81 -32
- package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +149 -117
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +22 -20
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +833 -360
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +23 -14
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +27 -22
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/filter/descriptors/filter.descriptor.d.ts +60 -16
- package/filter/models/filter.model.d.ts +4 -0
- package/form/components/date-range/date-range.component.d.ts +9 -3
- package/form/components/dropdown/dropdown.component.d.ts +6 -7
- package/form/components/number-range/number-range.component.d.ts +8 -4
- package/i18n/en.json +32 -0
- package/i18n/sl.json +32 -0
- package/package.json +1 -1
- package/table/api/descriptors/table.descriptor.d.ts +15 -8
- package/table/api/index.d.ts +1 -0
- package/table/api/models/row-expandable-component.model.d.ts +4 -0
- package/table/api/models/table-columns.model.d.ts +3 -3
- package/table/api/models/table.model.d.ts +0 -12
- package/table/components/{column-filter-full/column-filter-full.component.d.ts → column-filter/column-filter.component.d.ts} +23 -38
- package/table/components/filter/filter-active-tag/filter-active-tag.component.d.ts +20 -0
- package/table/components/filter/filter-form/filter-form.component.d.ts +53 -0
- package/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.d.ts +35 -0
- package/table/components/table/table.component.d.ts +10 -7
- package/table/helpers/filters.d.ts +31 -0
- package/table/index.d.ts +10 -1
- package/table/models/filter.model.d.ts +24 -0
- package/table/pipes/filter-value.pipe.d.ts +19 -0
- package/table/provide.d.ts +8 -0
- package/table/services/data-list.service.d.ts +3 -2
- package/table/services/table-feature-config.token.d.ts +6 -0
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +4 -4
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +13 -3
- package/tableview/api/editor/models/editor-fields.model.d.ts +4 -4
- package/tableview/api/editor/models/field-image-preview.model.d.ts +4 -0
- package/tableview/api/index.d.ts +1 -0
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +8 -6
- package/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.d.ts +1 -0
- package/version-info.json +5 -5
- package/esm2022/table/components/column-filter-full/column-filter-full.component.mjs +0 -655
|
@@ -1,45 +1,346 @@
|
|
|
1
1
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
2
|
-
import { NgClass, DecimalPipe, CurrencyPipe, DatePipe,
|
|
2
|
+
import { NgClass, NgTemplateOutlet, DecimalPipe, CurrencyPipe, DatePipe, AsyncPipe, NgStyle } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { signal, Injectable, inject, ElementRef, Renderer2, ChangeDetectorRef, DestroyRef, computed, effect, Component, ViewEncapsulation, ChangeDetectionStrategy,
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
4
|
+
import { signal, Injectable, inject, ElementRef, Renderer2, ChangeDetectorRef, DestroyRef, input, computed, viewChild, effect, untracked, Component, ViewEncapsulation, ChangeDetectionStrategy, LOCALE_ID, Pipe, output, contentChildren, InjectionToken, Injector, booleanAttribute, viewChildren, afterNextRender } from '@angular/core';
|
|
5
|
+
import { toSignal, takeUntilDestroyed, toObservable, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
6
|
+
import * as i1$1 from '@angular/forms';
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
8
|
import * as i1 from '@ngx-translate/core';
|
|
9
9
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
10
|
-
import * as i2$
|
|
10
|
+
import * as i2$2 from 'primeng/api';
|
|
11
11
|
import { PrimeNGConfig, OverlayService, TranslationKeys, MessageService } from 'primeng/api';
|
|
12
12
|
import * as i2 from 'primeng/calendar';
|
|
13
13
|
import { CalendarModule } from 'primeng/calendar';
|
|
14
|
+
import * as i6 from 'primeng/checkbox';
|
|
15
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
14
16
|
import { DomHandler, ConnectedOverlayScrollHandler } from 'primeng/dom';
|
|
15
17
|
import { FilterIcon } from 'primeng/icons/filter';
|
|
16
18
|
import { FilterSlashIcon } from 'primeng/icons/filterslash';
|
|
17
|
-
import * as
|
|
19
|
+
import * as i4 from 'primeng/inputnumber';
|
|
18
20
|
import { InputNumberModule } from 'primeng/inputnumber';
|
|
19
|
-
import * as
|
|
21
|
+
import * as i5 from 'primeng/inputtext';
|
|
20
22
|
import { InputTextModule } from 'primeng/inputtext';
|
|
21
|
-
import * as i1$
|
|
23
|
+
import * as i1$4 from 'primeng/table';
|
|
22
24
|
import { Table, TableModule } from 'primeng/table';
|
|
23
|
-
import * as i4 from 'primeng/tristatecheckbox';
|
|
24
|
-
import { TriStateCheckboxModule } from 'primeng/tristatecheckbox';
|
|
25
25
|
import { ZIndexUtils } from 'primeng/utils';
|
|
26
|
-
import { Subject, debounceTime, distinctUntilChanged, switchMap, of, combineLatest
|
|
27
|
-
import {
|
|
28
|
-
import { FilterLookupTypeEnum,
|
|
26
|
+
import { Subject, debounceTime, distinctUntilChanged, ReplaySubject, switchMap, NEVER, of, combineLatest } from 'rxjs';
|
|
27
|
+
import { FilterMatchMode, dateToIsoString, angularDateFormatHasTime, fromAngularDateFormatToPrime, angularDateFormatHasSeconds, fromAngularNumberFormatToFractions, COMMONS_MODULE_CONFIG_IT, GetterPipe, TemplatePipe, BooleanPipe, EnumPipe, ComponentDirective, getI18nTypePropertyKey, TemplateDirective, findTemplateByName, toastMessage, CommonsService, LoggerService, CommonsStorageService, booleanOrUndefinedAttribute, mergeDataListParamsWithDefaults, fromTableLoadToDataListParams, dataListParamsToUrlQuery, toObservable as toObservable$1, fromSubscribeError, getErrorLogLevel, fromUrlQueryToDataListParams, I18nPropertyPipe, ClassMapPipe, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons/core';
|
|
28
|
+
import { FilterTypeEnum, FilterLookupDescriptor, FilterLookupTypeEnum, FilterDisplayTypeEnum } from '@mediusinc/mng-commons/filter';
|
|
29
29
|
import { DateRangeComponent, AutocompleteComponent, DropdownComponent, InputTrimDirective, NumberRangeComponent } from '@mediusinc/mng-commons/form';
|
|
30
30
|
import * as i4$1 from 'primeng/button';
|
|
31
|
-
import { ButtonModule } from 'primeng/button';
|
|
31
|
+
import { ButtonModule, Button } from 'primeng/button';
|
|
32
32
|
import * as i4$2 from 'primeng/ripple';
|
|
33
33
|
import { RippleModule } from 'primeng/ripple';
|
|
34
|
-
import * as i1$
|
|
34
|
+
import * as i1$2 from 'primeng/tooltip';
|
|
35
35
|
import { TooltipModule } from 'primeng/tooltip';
|
|
36
36
|
import { ColumnDisplayTypeEnum, TablePaginationModeEnum, TableSizeEnum, tableDescriptor, TableDynamicDescriptorInst } from '@mediusinc/mng-commons/table/api';
|
|
37
|
+
import * as i2$1 from 'primeng/tag';
|
|
38
|
+
import { TagModule } from 'primeng/tag';
|
|
39
|
+
import * as i7 from 'primeng/messages';
|
|
40
|
+
import { MessagesModule } from 'primeng/messages';
|
|
41
|
+
import * as i1$3 from 'primeng/overlaypanel';
|
|
42
|
+
import { OverlayPanel, OverlayPanelModule } from 'primeng/overlaypanel';
|
|
37
43
|
import { Router, ActivatedRoute, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
38
|
-
import * as i3
|
|
44
|
+
import * as i3 from 'primeng/multiselect';
|
|
39
45
|
import { MultiSelectModule } from 'primeng/multiselect';
|
|
40
46
|
import { filter } from 'rxjs/operators';
|
|
41
47
|
import { getI18nForModel } from '@mediusinc/mng-commons/model';
|
|
42
48
|
|
|
49
|
+
function generateMatchModeOptions(primeConfig, descriptor, cmpSerCfg) {
|
|
50
|
+
let options = undefined;
|
|
51
|
+
if (descriptor == null || descriptor.filterType === FilterTypeEnum.String) {
|
|
52
|
+
options = [
|
|
53
|
+
{ value: FilterMatchMode.Contains, label: primeConfig.getTranslation(FilterMatchMode.Contains) },
|
|
54
|
+
{ value: FilterMatchMode.NotContains, label: primeConfig.getTranslation(FilterMatchMode.NotContains) },
|
|
55
|
+
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
56
|
+
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
57
|
+
{ value: FilterMatchMode.StartsWith, label: primeConfig.getTranslation(FilterMatchMode.StartsWith) },
|
|
58
|
+
{ value: FilterMatchMode.EndsWith, label: primeConfig.getTranslation(FilterMatchMode.EndsWith) }
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
else if (descriptor.filterType === FilterTypeEnum.Boolean) {
|
|
62
|
+
options = [{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) }];
|
|
63
|
+
}
|
|
64
|
+
else if (descriptor.filterType === FilterTypeEnum.Number) {
|
|
65
|
+
options = [
|
|
66
|
+
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
67
|
+
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
68
|
+
{ value: FilterMatchMode.LessThan, label: primeConfig.getTranslation(FilterMatchMode.LessThan) },
|
|
69
|
+
{ value: FilterMatchMode.LessThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
70
|
+
{ value: FilterMatchMode.GreaterThan, label: primeConfig.getTranslation(FilterMatchMode.GreaterThan) },
|
|
71
|
+
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
72
|
+
{ value: FilterMatchMode.Between, label: primeConfig.getTranslation(FilterMatchMode.Between) }
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
else if (descriptor.filterType === FilterTypeEnum.Lookup || descriptor.filterType === FilterTypeEnum.LookupEnum) {
|
|
76
|
+
if (descriptor instanceof FilterLookupDescriptor && descriptor.multiselect) {
|
|
77
|
+
options = [
|
|
78
|
+
{ value: FilterMatchMode.In, label: primeConfig.getTranslation(FilterMatchMode.In) },
|
|
79
|
+
{ value: FilterMatchMode.NotIn, label: primeConfig.getTranslation(FilterMatchMode.NotIn) }
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
options = [
|
|
84
|
+
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
85
|
+
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) }
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (descriptor.filterType === FilterTypeEnum.Date) {
|
|
90
|
+
if (!descriptor.datePickerShowTime && !descriptor.dateValueNoTime && !cmpSerCfg?.filtersDateOnlyDisabled) {
|
|
91
|
+
options = [
|
|
92
|
+
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
93
|
+
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
94
|
+
{ value: FilterMatchMode.LessThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
95
|
+
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
96
|
+
{ value: FilterMatchMode.Between, label: primeConfig.getTranslation(FilterMatchMode.Between) }
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
options = [
|
|
101
|
+
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
102
|
+
{ value: FilterMatchMode.LessThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
103
|
+
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
104
|
+
{ value: FilterMatchMode.Between, label: primeConfig.getTranslation(FilterMatchMode.Between) }
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
options?.push({ value: FilterMatchMode.Exists, label: primeConfig.getTranslation(FilterMatchMode.Exists) }, { value: FilterMatchMode.DoesNotExist, label: primeConfig.getTranslation(FilterMatchMode.DoesNotExist) });
|
|
109
|
+
if (descriptor?.matchModes) {
|
|
110
|
+
options = descriptor.matchModes.map(mm => ({ value: mm, label: primeConfig.getTranslation(mm) }));
|
|
111
|
+
}
|
|
112
|
+
return options || [];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Gets the default match mode for a filter.
|
|
116
|
+
*
|
|
117
|
+
* @param {FilterDescriptor<any, any>} [descriptor] - The filter descriptor.
|
|
118
|
+
* @param {SelectItem[]} [matchModes=[]] - The available match modes options.
|
|
119
|
+
*
|
|
120
|
+
* @return {FilterMatchModeExtendedType} The default match mode for the filter.
|
|
121
|
+
*/
|
|
122
|
+
function filterGetDefaultMatchMode(descriptor, matchModes = []) {
|
|
123
|
+
let defaultMatchMode = FilterMatchMode.Equals;
|
|
124
|
+
if (descriptor?.filterType === FilterTypeEnum.String)
|
|
125
|
+
defaultMatchMode = FilterMatchMode.StartsWith;
|
|
126
|
+
else if (descriptor?.filterType === FilterTypeEnum.Number || descriptor?.filterType === FilterTypeEnum.Date || descriptor?.filterType === FilterTypeEnum.Boolean)
|
|
127
|
+
defaultMatchMode = FilterMatchMode.Equals;
|
|
128
|
+
else if (descriptor?.filterType === FilterTypeEnum.Lookup || descriptor?.filterType === FilterTypeEnum.LookupEnum) {
|
|
129
|
+
if (descriptor instanceof FilterLookupDescriptor) {
|
|
130
|
+
defaultMatchMode = descriptor?.multiselect ? FilterMatchMode.In : FilterMatchMode.Equals;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
defaultMatchMode = FilterMatchMode.Equals;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// overwrite type default set in descriptor
|
|
137
|
+
if (descriptor?.defaultMatchMode) {
|
|
138
|
+
defaultMatchMode = descriptor.defaultMatchMode;
|
|
139
|
+
}
|
|
140
|
+
// check if default mode exists!
|
|
141
|
+
if (matchModes.length > 0 && !matchModes.some(m => m.value === defaultMatchMode)) {
|
|
142
|
+
defaultMatchMode = matchModes[0].value;
|
|
143
|
+
}
|
|
144
|
+
return defaultMatchMode;
|
|
145
|
+
}
|
|
146
|
+
function filterSetMetadataOnChange(filter, matchMode, value, filterType, filterDateCfg) {
|
|
147
|
+
let displayValue = filter?.displayValue ?? value;
|
|
148
|
+
let displayMatchMode = filter?.displayMatchMode ?? matchMode;
|
|
149
|
+
// when equals is used on dates with time, the actual filter will be between, but displayed as equals
|
|
150
|
+
if (filterType === FilterTypeEnum.Date && !filterDateCfg?.valueNoTime) {
|
|
151
|
+
if (matchMode === FilterMatchMode.Between &&
|
|
152
|
+
Array.isArray(value) &&
|
|
153
|
+
value.length === 2 &&
|
|
154
|
+
value.every(v => v instanceof Date || typeof v === 'string' || typeof v === 'number')) {
|
|
155
|
+
if (filterAreDatesEqual(value[0], value[1], filterDateCfg)) {
|
|
156
|
+
displayMatchMode = FilterMatchMode.Equals;
|
|
157
|
+
displayValue = new Date(value[0]);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else if (matchMode === FilterMatchMode.Equals && !value) {
|
|
161
|
+
matchMode = FilterMatchMode.Between;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (filterType === FilterTypeEnum.Date && displayValue) {
|
|
165
|
+
// display value for calendar cannot be string, convert to date
|
|
166
|
+
displayValue = Array.isArray(displayValue)
|
|
167
|
+
? displayValue.map(v => (!(v instanceof Date) ? new Date(v) : v))
|
|
168
|
+
: displayValue instanceof Date
|
|
169
|
+
? displayValue
|
|
170
|
+
: new Date(displayValue);
|
|
171
|
+
}
|
|
172
|
+
if (filterType === FilterTypeEnum.Boolean && displayValue != null && typeof displayValue !== 'boolean') {
|
|
173
|
+
displayValue = (typeof displayValue === 'string' && displayValue.toLowerCase() === 'true') || displayValue === 1;
|
|
174
|
+
}
|
|
175
|
+
if (filterType === FilterTypeEnum.Number && displayValue != null && typeof displayValue !== 'number') {
|
|
176
|
+
const numValue = +displayValue;
|
|
177
|
+
if (!isNaN(numValue)) {
|
|
178
|
+
displayValue = numValue;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
...filter,
|
|
183
|
+
matchMode,
|
|
184
|
+
value: value,
|
|
185
|
+
displayMatchMode,
|
|
186
|
+
displayValue
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function filterSetMetadataOnDisplayChange(filter, displayMatchMode, displayValue, filterType, filterDateCfg) {
|
|
190
|
+
let matchMode = displayMatchMode;
|
|
191
|
+
let value = displayValue;
|
|
192
|
+
if (filterType === FilterTypeEnum.Date) {
|
|
193
|
+
if (!filterDateCfg?.valueNoTime && displayValue !== null) {
|
|
194
|
+
if (displayMatchMode === FilterMatchMode.Equals) {
|
|
195
|
+
if (value instanceof Date || typeof value === 'string' || typeof value === 'number') {
|
|
196
|
+
const fromDate = new Date(value);
|
|
197
|
+
const toDate = new Date(value);
|
|
198
|
+
if (filterDateCfg?.showTime) {
|
|
199
|
+
if (filterDateCfg?.showSeconds) {
|
|
200
|
+
fromDate.setMilliseconds(0);
|
|
201
|
+
toDate.setMilliseconds(999);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
fromDate.setSeconds(0, 0);
|
|
205
|
+
toDate.setSeconds(59, 999);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
fromDate.setHours(0, 0, 0, 0);
|
|
210
|
+
toDate.setHours(23, 59, 59, 999);
|
|
211
|
+
}
|
|
212
|
+
value = [fromDate, toDate];
|
|
213
|
+
matchMode = FilterMatchMode.Between;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
value = null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (displayMatchMode === FilterMatchMode.Between) {
|
|
220
|
+
if (Array.isArray(value) && value.length === 2 && value.every(i => i instanceof Date || typeof i === 'string' || typeof i === 'number')) {
|
|
221
|
+
const fromDate = new Date(value[0]);
|
|
222
|
+
let toDate = new Date(value[1]);
|
|
223
|
+
if (filterAreDatesEqual(fromDate, toDate, filterDateCfg)) {
|
|
224
|
+
toDate = new Date(fromDate);
|
|
225
|
+
if (filterDateCfg?.showTime) {
|
|
226
|
+
if (filterDateCfg?.showSeconds) {
|
|
227
|
+
toDate.setSeconds(toDate.getSeconds() + 1);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
toDate.setMinutes(toDate.getMinutes() + 1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
toDate.setDate(toDate.getDate() + 1);
|
|
235
|
+
}
|
|
236
|
+
value = [fromDate, toDate];
|
|
237
|
+
matchMode = FilterMatchMode.Between;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
value = null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const convertDateType = filterDateCfg?.valueNoTime ? 'date' : 'date-time';
|
|
246
|
+
const convertDateTimeOpts = {
|
|
247
|
+
utc: filterDateCfg?.valueUtc,
|
|
248
|
+
noMillis: filterDateCfg?.valueNoMillis,
|
|
249
|
+
noTimezone: filterDateCfg?.valueNoTimezone
|
|
250
|
+
};
|
|
251
|
+
value =
|
|
252
|
+
value == null
|
|
253
|
+
? value
|
|
254
|
+
: Array.isArray(value)
|
|
255
|
+
? value.filter(i => i != null).map(i => dateToIsoString(i, convertDateType, convertDateTimeOpts))
|
|
256
|
+
: dateToIsoString(value, convertDateType, convertDateTimeOpts);
|
|
257
|
+
}
|
|
258
|
+
if (matchMode === FilterMatchMode.Exists || matchMode === FilterMatchMode.DoesNotExist) {
|
|
259
|
+
value = null;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
...filter,
|
|
263
|
+
displayMatchMode: displayMatchMode,
|
|
264
|
+
matchMode: matchMode,
|
|
265
|
+
displayValue: displayValue,
|
|
266
|
+
value: value
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function filterAreDatesEqual(fromDate, toDate, filterDateCfg) {
|
|
270
|
+
const startDate = dateToIsoString(fromDate);
|
|
271
|
+
const endDate = dateToIsoString(toDate);
|
|
272
|
+
// 2020-11-02T11:12:12.000
|
|
273
|
+
const cmpLength = filterDateCfg?.showTime ? (filterDateCfg?.showSeconds ? 19 : 16) : 10;
|
|
274
|
+
return startDate.substring(0, cmpLength) === endDate.substring(0, cmpLength);
|
|
275
|
+
}
|
|
276
|
+
function filterApplySerializationConfigToCmp(config, cmpSerCfg) {
|
|
277
|
+
// set default
|
|
278
|
+
cmpSerCfg.dateTimeInUtc = false;
|
|
279
|
+
cmpSerCfg.dateTimeWithTimezone = true;
|
|
280
|
+
cmpSerCfg.dateTimeWithMillis = true;
|
|
281
|
+
cmpSerCfg.filtersDateOnlyDisabled = false;
|
|
282
|
+
// set customizations
|
|
283
|
+
if (config?.serialization) {
|
|
284
|
+
if (config.serialization.dateTimeInUtc !== undefined)
|
|
285
|
+
cmpSerCfg.dateTimeInUtc = config.serialization.dateTimeInUtc;
|
|
286
|
+
if (config.serialization.dateTimeWithTimezone !== undefined)
|
|
287
|
+
cmpSerCfg.dateTimeWithTimezone = config.serialization.dateTimeWithTimezone;
|
|
288
|
+
if (config.serialization.dateTimeWithMillis !== undefined)
|
|
289
|
+
cmpSerCfg.dateTimeWithMillis = config.serialization.dateTimeWithMillis;
|
|
290
|
+
if (config.serialization.filtersDateOnlyDisabled !== undefined)
|
|
291
|
+
cmpSerCfg.filtersDateOnlyDisabled = config.serialization.filtersDateOnlyDisabled;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function filterAdjustDisplayValueOnMatchModeChange(matchMode, value) {
|
|
295
|
+
if (matchMode == null || matchMode === FilterMatchMode.Exists || matchMode === FilterMatchMode.DoesNotExist) {
|
|
296
|
+
return value; // never change, only change later if something else changes here
|
|
297
|
+
}
|
|
298
|
+
if (matchMode === FilterMatchMode.Between) {
|
|
299
|
+
if (!Array.isArray(value)) {
|
|
300
|
+
return value != null ? [value, value] : [];
|
|
301
|
+
}
|
|
302
|
+
else if (value.length === 0 || value.length === 2) {
|
|
303
|
+
return value;
|
|
304
|
+
}
|
|
305
|
+
else if (value.length === 1) {
|
|
306
|
+
return [value[0], value[0]];
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
return [value[0], value[1]];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (matchMode === FilterMatchMode.In || matchMode === FilterMatchMode.NotIn) {
|
|
313
|
+
return Array.isArray(value) ? value : value == null ? [] : [value];
|
|
314
|
+
}
|
|
315
|
+
return Array.isArray(value) && value.length > 0 ? value[0] : value;
|
|
316
|
+
}
|
|
317
|
+
function filterGetDateConfig(descriptor, serCfg) {
|
|
318
|
+
if (!descriptor || descriptor.filterType !== FilterTypeEnum.Date) {
|
|
319
|
+
return undefined;
|
|
320
|
+
}
|
|
321
|
+
const showTime = descriptor.datePickerShowTime ?? (descriptor.displayFormatApplyToField && descriptor.displayFormat ? angularDateFormatHasTime(descriptor.displayFormat) : false);
|
|
322
|
+
return {
|
|
323
|
+
valueNoTime: descriptor.dateValueNoTime || (!serCfg?.filtersDateOnlyDisabled && !showTime),
|
|
324
|
+
valueUtc: descriptor.dateValueUtc ?? serCfg?.dateTimeInUtc,
|
|
325
|
+
valueNoTimezone: descriptor.dateValueNoTimezone ?? !serCfg?.dateTimeWithTimezone,
|
|
326
|
+
valueNoMillis: !serCfg?.dateTimeWithMillis,
|
|
327
|
+
format: descriptor.datePickerFormat ?? (descriptor.displayFormatApplyToField && descriptor.displayFormat ? fromAngularDateFormatToPrime(descriptor.displayFormat) : undefined),
|
|
328
|
+
showTime: showTime,
|
|
329
|
+
showSeconds: showTime &&
|
|
330
|
+
(descriptor.datePickerShowSeconds ?? (descriptor.displayFormatApplyToField && descriptor.displayFormat ? angularDateFormatHasSeconds(descriptor.displayFormat) : false))
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function filterGetNumberConfig(descriptor) {
|
|
334
|
+
if (!descriptor || descriptor.filterType !== FilterTypeEnum.Number) {
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
const displayCfg = descriptor.displayFormatApplyToField && descriptor.displayFormat ? fromAngularNumberFormatToFractions(descriptor.displayFormat) : undefined;
|
|
338
|
+
return {
|
|
339
|
+
fractionsMin: descriptor.numberMinFractionDigits ?? displayCfg?.fractionsMin,
|
|
340
|
+
fractionsMax: descriptor.numberMaxFractionDigits ?? displayCfg?.fractionsMax
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
43
344
|
class DataListService {
|
|
44
345
|
constructor() {
|
|
45
346
|
// pagination
|
|
@@ -71,10 +372,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
71
372
|
* Cannot be on push change detection strategy because of filter updates triggered from route which causes to force update values in force metadata
|
|
72
373
|
* and these must be propagated through to this component and beyond to primeNG.
|
|
73
374
|
*/
|
|
74
|
-
class
|
|
375
|
+
class TableColumnFilterComponent {
|
|
75
376
|
constructor() {
|
|
76
377
|
this.lookupTypeDropdown = FilterLookupTypeEnum.Dropdown;
|
|
77
378
|
this.lookupTypeAutocomplete = FilterLookupTypeEnum.Autocomplete;
|
|
379
|
+
this.FilterTypeEnum = FilterTypeEnum;
|
|
380
|
+
this.FilterMatchMode = FilterMatchMode;
|
|
78
381
|
this.el = inject(ElementRef);
|
|
79
382
|
this.primeTable = inject(Table);
|
|
80
383
|
this.dataListService = inject((DataListService));
|
|
@@ -85,136 +388,65 @@ class TableColumnFilterFullComponent {
|
|
|
85
388
|
this.cd = inject(ChangeDetectorRef);
|
|
86
389
|
this.destroyRef = inject(DestroyRef);
|
|
87
390
|
this.document = window.document;
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
this.
|
|
391
|
+
this.descriptor = input.required();
|
|
392
|
+
this.descriptorAsLookup = computed(() => (this.descriptor() instanceof FilterLookupDescriptor ? this.descriptor() : undefined));
|
|
393
|
+
this.icon = viewChild('icon');
|
|
394
|
+
this.translationObserver = toSignal(this.primeConfig.translationObserver);
|
|
395
|
+
this.matchModes = computed(() => {
|
|
396
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
397
|
+
const translationObserver = this.translationObserver();
|
|
398
|
+
return generateMatchModeOptions(this.primeConfig, this.descriptor(), this.serializationCfg);
|
|
399
|
+
});
|
|
91
400
|
this.filterConstraint = signal(undefined);
|
|
92
401
|
this.isFilterSet = computed(() => this.filterConstraint()?.matchMode === FilterMatchMode.Exists ||
|
|
93
402
|
this.filterConstraint()?.matchMode === FilterMatchMode.DoesNotExist ||
|
|
94
403
|
!this.primeTable.isFilterBlank(this.filterConstraint()?.value));
|
|
95
404
|
this.isInputDisabled = computed(() => this.filterConstraint()?.matchMode === FilterMatchMode.Exists || this.filterConstraint()?.matchMode === FilterMatchMode.DoesNotExist);
|
|
96
405
|
this.overlayVisible = signal(false);
|
|
406
|
+
// display configs
|
|
407
|
+
this.dateConfig = computed(() => filterGetDateConfig(this.descriptor(), this.serializationCfg));
|
|
408
|
+
this.numberConfig = computed(() => filterGetNumberConfig(this.descriptor()));
|
|
97
409
|
this.window = this.document.defaultView;
|
|
98
410
|
this.numericValueFromModelChange = null;
|
|
99
411
|
this.dateDebounceSubject = new Subject();
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
this.dateOnlyDisabled = false;
|
|
104
|
-
this.dateDebounceSubject.pipe(debounceTime(500), distinctUntilChanged(), takeUntilDestroyed()).subscribe(v => {
|
|
105
|
-
if (this.filterConstraint()?.displayMatchMode === FilterMatchMode.Equals && this.filterConstraint()?.matchMode === FilterMatchMode.Between && v !== null) {
|
|
106
|
-
const dateValue = Array.isArray(v) ? v[0] : v; // could have empty array
|
|
107
|
-
if (dateValue) {
|
|
108
|
-
const fromDate = new Date(dateValue);
|
|
109
|
-
const toDate = new Date(dateValue);
|
|
110
|
-
if (this.descriptor.datePickerShowTime) {
|
|
111
|
-
if (this.descriptor.datePickerShowSeconds) {
|
|
112
|
-
fromDate.setMilliseconds(0);
|
|
113
|
-
toDate.setMilliseconds(999);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
fromDate.setSeconds(0, 0);
|
|
117
|
-
toDate.setSeconds(59, 0);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
fromDate.setHours(0, 0, 0, 0);
|
|
122
|
-
toDate.setHours(23, 59, 59, 999);
|
|
123
|
-
}
|
|
124
|
-
// adjust to settings
|
|
125
|
-
v = [fromDate, toDate];
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
v = null;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const convertDateType = this.descriptor.datePickerValueNoTime || (!this.dateOnlyDisabled && !this.descriptor.datePickerShowTime) ? 'date' : 'date-time';
|
|
132
|
-
const convertDateTimeOpts = {
|
|
133
|
-
utc: this.descriptor.datePickerValueUtc ?? this.dateTimeInUtc,
|
|
134
|
-
noMillis: !this.dateTimeWithMillis,
|
|
135
|
-
noTimezone: this.descriptor.datePickerValueNoTimezone ?? !this.dateTimeWithTimezone
|
|
136
|
-
};
|
|
137
|
-
this.updateFilterValue(v == null
|
|
138
|
-
? v
|
|
139
|
-
: Array.isArray(v)
|
|
140
|
-
? v.filter(i => i != null).map(i => dateToIsoString(i, convertDateType, convertDateTimeOpts))
|
|
141
|
-
: dateToIsoString(v, convertDateType, convertDateTimeOpts));
|
|
142
|
-
});
|
|
412
|
+
this.serializationCfg = {};
|
|
413
|
+
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
414
|
+
this.dateDebounceSubject.pipe(debounceTime(500), distinctUntilChanged(), takeUntilDestroyed()).subscribe(v => this.updateFilterOnDisplayValueChange(v));
|
|
143
415
|
effect(() => {
|
|
144
|
-
const fieldFilterMeta = this.dataListService.filterMeta()[this.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.setFilterConstraint(fieldFilterMeta);
|
|
416
|
+
const fieldFilterMeta = this.dataListService.filterMeta()[this.descriptor().property];
|
|
417
|
+
const filterConstraint = untracked(() => this.filterConstraint());
|
|
418
|
+
if (fieldFilterMeta && (!filterConstraint || filterConstraint.value !== fieldFilterMeta.value || filterConstraint.matchMode !== fieldFilterMeta.matchMode)) {
|
|
419
|
+
this.setFilterConstraint(filterSetMetadataOnChange(fieldFilterMeta, fieldFilterMeta.matchMode, fieldFilterMeta.value, untracked(() => this.descriptor().filterType), untracked(() => this.dateConfig())));
|
|
148
420
|
}
|
|
149
421
|
}, { allowSignalWrites: true });
|
|
150
422
|
}
|
|
151
|
-
ngOnInit() {
|
|
152
|
-
if (this.moduleConfig?.serialization) {
|
|
153
|
-
if (this.moduleConfig.serialization.dateTimeInUtc !== undefined)
|
|
154
|
-
this.dateTimeInUtc = this.moduleConfig.serialization.dateTimeInUtc;
|
|
155
|
-
if (this.moduleConfig.serialization.dateTimeWithTimezone !== undefined)
|
|
156
|
-
this.dateTimeWithTimezone = this.moduleConfig.serialization.dateTimeWithTimezone;
|
|
157
|
-
if (this.moduleConfig.serialization.dateTimeWithMillis !== undefined)
|
|
158
|
-
this.dateTimeWithMillis = this.moduleConfig.serialization.dateTimeWithMillis;
|
|
159
|
-
if (this.moduleConfig.serialization.filtersDateOnlyDisabled !== undefined)
|
|
160
|
-
this.dateOnlyDisabled = this.moduleConfig.serialization.filtersDateOnlyDisabled;
|
|
161
|
-
}
|
|
162
|
-
this.primeField = this.descriptor.property;
|
|
163
|
-
switch (this.descriptor.filterType) {
|
|
164
|
-
case FilterTypeEnum.Boolean:
|
|
165
|
-
this.primeType = 'boolean';
|
|
166
|
-
break;
|
|
167
|
-
case FilterTypeEnum.Number:
|
|
168
|
-
this.primeType = 'numeric';
|
|
169
|
-
break;
|
|
170
|
-
case FilterTypeEnum.Date:
|
|
171
|
-
this.primeType = 'date';
|
|
172
|
-
break;
|
|
173
|
-
case FilterTypeEnum.Lookup:
|
|
174
|
-
case FilterTypeEnum.LookupEnum:
|
|
175
|
-
this.primeType = 'lookup';
|
|
176
|
-
this.lookupDescriptor = this.descriptor;
|
|
177
|
-
break;
|
|
178
|
-
case FilterTypeEnum.String:
|
|
179
|
-
this.primeType = 'text';
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
// generate match mode options
|
|
183
|
-
this.translationSubscription = this.primeConfig.translationObserver.subscribe(() => {
|
|
184
|
-
this.generateMatchModeOptions();
|
|
185
|
-
});
|
|
186
|
-
this.generateMatchModeOptions();
|
|
187
|
-
this.initFilterConstraint();
|
|
188
|
-
}
|
|
189
423
|
ngOnDestroy() {
|
|
190
424
|
if (this.overlay) {
|
|
191
425
|
this.renderer.appendChild(this.el.nativeElement, this.overlay);
|
|
192
426
|
ZIndexUtils.clear(this.overlay);
|
|
193
427
|
this.onOverlayHide();
|
|
194
428
|
}
|
|
195
|
-
this.translationSubscription?.unsubscribe();
|
|
196
429
|
this.resetSubscription?.unsubscribe();
|
|
197
430
|
this.overlaySubscription?.unsubscribe();
|
|
198
|
-
this.tableFilterMetadataSubscription?.unsubscribe();
|
|
199
431
|
}
|
|
200
432
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
201
433
|
onTextModelChange(event) {
|
|
202
434
|
const value = event.target.value;
|
|
203
435
|
if (value === '') {
|
|
204
|
-
this.
|
|
436
|
+
this.updateFilterOnDisplayValueChange(value);
|
|
205
437
|
}
|
|
206
438
|
}
|
|
207
439
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
208
440
|
onTextInputEnterKeyDown(event) {
|
|
209
441
|
const value = event.target.value;
|
|
210
|
-
this.
|
|
442
|
+
this.updateFilterOnDisplayValueChange(value);
|
|
211
443
|
event.preventDefault();
|
|
212
444
|
}
|
|
213
445
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
214
446
|
onNumericModelChange(value) {
|
|
215
447
|
this.numericValueFromModelChange = value;
|
|
216
448
|
if (value === null) {
|
|
217
|
-
this.
|
|
449
|
+
this.updateFilterOnDisplayValueChange(value);
|
|
218
450
|
}
|
|
219
451
|
}
|
|
220
452
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -226,13 +458,13 @@ class TableColumnFilterFullComponent {
|
|
|
226
458
|
return;
|
|
227
459
|
}
|
|
228
460
|
}
|
|
229
|
-
this.
|
|
461
|
+
this.updateFilterOnDisplayValueChange(this.numericValueFromModelChange);
|
|
230
462
|
event.preventDefault();
|
|
231
463
|
}
|
|
232
464
|
}
|
|
233
465
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
234
|
-
|
|
235
|
-
this.
|
|
466
|
+
onCheckboxModelChange(value) {
|
|
467
|
+
this.updateFilterOnDisplayValueChange(value);
|
|
236
468
|
}
|
|
237
469
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
238
470
|
onDateFilterModelChange(value) {
|
|
@@ -246,62 +478,20 @@ class TableColumnFilterFullComponent {
|
|
|
246
478
|
}
|
|
247
479
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
248
480
|
autocompleteFilter(value) {
|
|
249
|
-
this.
|
|
481
|
+
this.updateFilterOnDisplayValueChange(value);
|
|
250
482
|
}
|
|
251
483
|
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
|
|
252
484
|
dropdownFilter(value) {
|
|
253
485
|
if (Array.isArray(value) && value.length === 0) {
|
|
254
486
|
value = undefined;
|
|
255
487
|
}
|
|
256
|
-
this.
|
|
488
|
+
this.updateFilterOnDisplayValueChange(value);
|
|
257
489
|
}
|
|
258
490
|
onMatchModeChange(displayMatchMode) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (Array.isArray(value) && value.length === 0) {
|
|
262
|
-
value = null;
|
|
263
|
-
}
|
|
264
|
-
if (value != null && previousDisplayMatchMode && displayMatchMode !== previousDisplayMatchMode) {
|
|
265
|
-
// handle values on match mode changes
|
|
266
|
-
const matchModesWithArrayValues = [FilterMatchMode.Between, FilterMatchMode.In, FilterMatchMode.NotIn];
|
|
267
|
-
if (matchModesWithArrayValues.indexOf(previousDisplayMatchMode) >= 0 && matchModesWithArrayValues.indexOf(displayMatchMode) === -1) {
|
|
268
|
-
// from array values to non-array values
|
|
269
|
-
if (Array.isArray(value)) {
|
|
270
|
-
value = value?.[0];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
else if (matchModesWithArrayValues.indexOf(previousDisplayMatchMode) === -1 && displayMatchMode === FilterMatchMode.Between) {
|
|
274
|
-
// from non-array values to between
|
|
275
|
-
// it can already be an array because of "fake" equals for dates with timestamps (that is actually between)
|
|
276
|
-
const fromValue = Array.isArray(value) ? value[0] : value;
|
|
277
|
-
// for to value, add 1 day (if date) or 1 (if number)
|
|
278
|
-
const toValue = fromValue instanceof Date ? new Date(fromValue.getTime() + 24 * 3600 * 1000) : typeof fromValue === 'number' ? fromValue + 1 : fromValue;
|
|
279
|
-
value = [fromValue, toValue];
|
|
280
|
-
}
|
|
281
|
-
else if (matchModesWithArrayValues.indexOf(previousDisplayMatchMode) >= 0 && displayMatchMode === FilterMatchMode.Between) {
|
|
282
|
-
// from array values to between
|
|
283
|
-
if (Array.isArray(value)) {
|
|
284
|
-
if (value.length > 2) {
|
|
285
|
-
value = [value[0], value[1]];
|
|
286
|
-
}
|
|
287
|
-
else if (value.length === 1) {
|
|
288
|
-
value = [value[0], value[0]];
|
|
289
|
-
}
|
|
290
|
-
else if (value.length === 0) {
|
|
291
|
-
value = null;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// filters with equals on dates with timezones are extra, because double value needs to be added and match mode changed
|
|
296
|
-
if (displayMatchMode === FilterMatchMode.Equals &&
|
|
297
|
-
this.descriptor.filterType === FilterTypeEnum.Date &&
|
|
298
|
-
(this.descriptor.datePickerShowTime || this.descriptor.datePickerValueNoTime || this.dateOnlyDisabled)) {
|
|
299
|
-
value = [value, value];
|
|
300
|
-
displayMatchMode = FilterMatchMode.Between;
|
|
301
|
-
}
|
|
491
|
+
if (this.filterConstraint()?.displayMatchMode === displayMatchMode) {
|
|
492
|
+
return;
|
|
302
493
|
}
|
|
303
|
-
this.setFilterConstraint(
|
|
304
|
-
this.updateDtFilter();
|
|
494
|
+
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), displayMatchMode, filterAdjustDisplayValueOnMatchModeChange(displayMatchMode, this.filterConstraint()?.displayValue), this.descriptor().filterType, this.dateConfig()));
|
|
305
495
|
this.hideOverlay();
|
|
306
496
|
}
|
|
307
497
|
onMatchModeKeyDown(event) {
|
|
@@ -371,7 +561,7 @@ class TableColumnFilterFullComponent {
|
|
|
371
561
|
this.overlay = event.element;
|
|
372
562
|
this.renderer.appendChild(this.document.body, this.overlay);
|
|
373
563
|
ZIndexUtils.set('overlay', this.overlay, this.primeConfig.zIndex.overlay);
|
|
374
|
-
DomHandler.absolutePosition(this.overlay, this.icon?.nativeElement);
|
|
564
|
+
DomHandler.absolutePosition(this.overlay, this.icon()?.nativeElement);
|
|
375
565
|
this.bindDocumentClickListener();
|
|
376
566
|
this.bindDocumentResizeListener();
|
|
377
567
|
this.bindScrollListener();
|
|
@@ -404,113 +594,6 @@ class TableColumnFilterFullComponent {
|
|
|
404
594
|
this.primeTable._filter();
|
|
405
595
|
this.hideOverlay();
|
|
406
596
|
}
|
|
407
|
-
generateMatchModeOptions() {
|
|
408
|
-
let options = undefined;
|
|
409
|
-
if (this.descriptor.filterType === FilterTypeEnum.String) {
|
|
410
|
-
options = [
|
|
411
|
-
{ value: FilterMatchMode.Contains, label: this.primeConfig.getTranslation(FilterMatchMode.Contains) },
|
|
412
|
-
{ value: FilterMatchMode.NotContains, label: this.primeConfig.getTranslation(FilterMatchMode.NotContains) },
|
|
413
|
-
{ value: FilterMatchMode.Equals, label: this.primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
414
|
-
{ value: FilterMatchMode.NotEquals, label: this.primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
415
|
-
{ value: FilterMatchMode.StartsWith, label: this.primeConfig.getTranslation(FilterMatchMode.StartsWith) },
|
|
416
|
-
{ value: FilterMatchMode.EndsWith, label: this.primeConfig.getTranslation(FilterMatchMode.EndsWith) },
|
|
417
|
-
{ value: FilterMatchMode.Exists, label: this.primeConfig.getTranslation(FilterMatchMode.Exists) },
|
|
418
|
-
{ value: FilterMatchMode.DoesNotExist, label: this.primeConfig.getTranslation(FilterMatchMode.DoesNotExist) }
|
|
419
|
-
];
|
|
420
|
-
}
|
|
421
|
-
else if (this.descriptor.filterType === FilterTypeEnum.Boolean) {
|
|
422
|
-
options = [{ value: FilterMatchMode.Equals, label: this.primeConfig.getTranslation(FilterMatchMode.Equals) }];
|
|
423
|
-
}
|
|
424
|
-
else if (this.descriptor.filterType === FilterTypeEnum.Number) {
|
|
425
|
-
options = [
|
|
426
|
-
{ value: FilterMatchMode.Equals, label: this.primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
427
|
-
{ value: FilterMatchMode.NotEquals, label: this.primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
428
|
-
{ value: FilterMatchMode.LessThan, label: this.primeConfig.getTranslation(FilterMatchMode.LessThan) },
|
|
429
|
-
{ value: FilterMatchMode.LessThanOrEqualTo, label: this.primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
430
|
-
{ value: FilterMatchMode.GreaterThan, label: this.primeConfig.getTranslation(FilterMatchMode.GreaterThan) },
|
|
431
|
-
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: this.primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
432
|
-
{ value: FilterMatchMode.Between, label: this.primeConfig.getTranslation(FilterMatchMode.Between) },
|
|
433
|
-
{ value: FilterMatchMode.Exists, label: this.primeConfig.getTranslation(FilterMatchMode.Exists) },
|
|
434
|
-
{ value: FilterMatchMode.DoesNotExist, label: this.primeConfig.getTranslation(FilterMatchMode.DoesNotExist) }
|
|
435
|
-
];
|
|
436
|
-
}
|
|
437
|
-
else if (this.descriptor.filterType === FilterTypeEnum.Lookup || this.descriptor.filterType === FilterTypeEnum.LookupEnum) {
|
|
438
|
-
options = [
|
|
439
|
-
{ value: FilterMatchMode.Equals, label: this.primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
440
|
-
{ value: FilterMatchMode.NotEquals, label: this.primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
441
|
-
{ value: FilterMatchMode.Exists, label: this.primeConfig.getTranslation(FilterMatchMode.Exists) },
|
|
442
|
-
{ value: FilterMatchMode.DoesNotExist, label: this.primeConfig.getTranslation(FilterMatchMode.DoesNotExist) }
|
|
443
|
-
];
|
|
444
|
-
if (this.lookupDescriptor?.multiselect) {
|
|
445
|
-
options = [
|
|
446
|
-
{ value: FilterMatchMode.In, label: this.primeConfig.getTranslation(FilterMatchMode.In) },
|
|
447
|
-
{ value: FilterMatchMode.NotIn, label: this.primeConfig.getTranslation(FilterMatchMode.NotIn) }
|
|
448
|
-
];
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
else if (this.descriptor.filterType === FilterTypeEnum.Date) {
|
|
452
|
-
if (!this.descriptor.datePickerShowTime && !this.descriptor.datePickerValueNoTime && !this.dateOnlyDisabled) {
|
|
453
|
-
options = [
|
|
454
|
-
{ value: FilterMatchMode.Equals, label: this.primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
455
|
-
{ value: FilterMatchMode.NotEquals, label: this.primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
456
|
-
{ value: FilterMatchMode.LessThanOrEqualTo, label: this.primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
457
|
-
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: this.primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
458
|
-
{ value: FilterMatchMode.Between, label: this.primeConfig.getTranslation(FilterMatchMode.Between) },
|
|
459
|
-
{ value: FilterMatchMode.Exists, label: this.primeConfig.getTranslation(FilterMatchMode.Exists) },
|
|
460
|
-
{ value: FilterMatchMode.DoesNotExist, label: this.primeConfig.getTranslation(FilterMatchMode.DoesNotExist) }
|
|
461
|
-
];
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
options = [
|
|
465
|
-
{ value: FilterMatchMode.Equals, label: this.primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
466
|
-
{ value: FilterMatchMode.LessThanOrEqualTo, label: this.primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
467
|
-
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: this.primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
468
|
-
{ value: FilterMatchMode.Between, label: this.primeConfig.getTranslation(FilterMatchMode.Between) },
|
|
469
|
-
{ value: FilterMatchMode.Exists, label: this.primeConfig.getTranslation(FilterMatchMode.Exists) },
|
|
470
|
-
{ value: FilterMatchMode.DoesNotExist, label: this.primeConfig.getTranslation(FilterMatchMode.DoesNotExist) }
|
|
471
|
-
];
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
if (this.descriptor.matchModes) {
|
|
475
|
-
options = this.descriptor.matchModes.map(mm => ({ value: mm, label: this.primeConfig.getTranslation(mm) }));
|
|
476
|
-
}
|
|
477
|
-
if (!options) {
|
|
478
|
-
let primeMathcModeOptionByType = undefined;
|
|
479
|
-
if (this.primeType === 'text') {
|
|
480
|
-
primeMathcModeOptionByType = this.primeConfig.filterMatchModeOptions.text;
|
|
481
|
-
}
|
|
482
|
-
else if (this.primeType === 'numeric') {
|
|
483
|
-
primeMathcModeOptionByType = this.primeConfig.filterMatchModeOptions.numeric;
|
|
484
|
-
}
|
|
485
|
-
else if (this.primeType === 'date') {
|
|
486
|
-
primeMathcModeOptionByType = this.primeConfig.filterMatchModeOptions.date;
|
|
487
|
-
}
|
|
488
|
-
if (primeMathcModeOptionByType) {
|
|
489
|
-
options = primeMathcModeOptionByType.map(key => ({ label: this.primeConfig.getTranslation(key), value: key }));
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
this.matchModes.set(options || []);
|
|
493
|
-
}
|
|
494
|
-
getDefaultMatchMode() {
|
|
495
|
-
let defaultMatchMode = FilterMatchMode.Contains;
|
|
496
|
-
if (this.primeType === 'text')
|
|
497
|
-
defaultMatchMode = FilterMatchMode.StartsWith;
|
|
498
|
-
else if (this.primeType === 'numeric')
|
|
499
|
-
defaultMatchMode = FilterMatchMode.Equals;
|
|
500
|
-
else if (this.primeType === 'date')
|
|
501
|
-
defaultMatchMode = FilterMatchMode.Equals;
|
|
502
|
-
else if (this.primeType === 'lookup')
|
|
503
|
-
defaultMatchMode = this.lookupDescriptor?.multiselect ? FilterMatchMode.In : FilterMatchMode.Equals;
|
|
504
|
-
// overwrite type default set in descriptor
|
|
505
|
-
if (this.descriptor.defaultMatchMode) {
|
|
506
|
-
defaultMatchMode = this.descriptor.defaultMatchMode;
|
|
507
|
-
}
|
|
508
|
-
// check if default mode exists!
|
|
509
|
-
if (this.matchModes().length > 0 && !this.matchModes().some(m => m.value === defaultMatchMode)) {
|
|
510
|
-
defaultMatchMode = this.matchModes()[0].value;
|
|
511
|
-
}
|
|
512
|
-
return defaultMatchMode;
|
|
513
|
-
}
|
|
514
597
|
findNextMenuModeItem(item) {
|
|
515
598
|
const nextItem = item.nextElementSibling;
|
|
516
599
|
if (nextItem)
|
|
@@ -528,8 +611,8 @@ class TableColumnFilterFullComponent {
|
|
|
528
611
|
isOutsideClicked(event) {
|
|
529
612
|
return !(this.overlay?.isSameNode(event.target) ||
|
|
530
613
|
this.overlay?.contains(event.target) ||
|
|
531
|
-
this.icon?.nativeElement.isSameNode(event.target) ||
|
|
532
|
-
this.icon?.nativeElement.contains(event.target) ||
|
|
614
|
+
this.icon()?.nativeElement.isSameNode(event.target) ||
|
|
615
|
+
this.icon()?.nativeElement.contains(event.target) ||
|
|
533
616
|
DomHandler.hasClass(event.target, 'p-column-filter-add-button') ||
|
|
534
617
|
DomHandler.hasClass(event.target.parentElement, 'p-column-filter-add-button') ||
|
|
535
618
|
DomHandler.hasClass(event.target, 'p-column-filter-remove-button') ||
|
|
@@ -570,7 +653,7 @@ class TableColumnFilterFullComponent {
|
|
|
570
653
|
}
|
|
571
654
|
bindScrollListener() {
|
|
572
655
|
if (!this.scrollHandler) {
|
|
573
|
-
this.scrollHandler = new ConnectedOverlayScrollHandler(this.icon?.nativeElement, () => {
|
|
656
|
+
this.scrollHandler = new ConnectedOverlayScrollHandler(this.icon()?.nativeElement, () => {
|
|
574
657
|
if (this.overlayVisible()) {
|
|
575
658
|
this.hideOverlay();
|
|
576
659
|
}
|
|
@@ -593,78 +676,41 @@ class TableColumnFilterFullComponent {
|
|
|
593
676
|
this.unbindScrollListener();
|
|
594
677
|
this.overlay = null;
|
|
595
678
|
}
|
|
596
|
-
|
|
597
|
-
this.filterConstraint
|
|
598
|
-
this.updateDtFilter();
|
|
599
|
-
}
|
|
600
|
-
updateDtFilter() {
|
|
601
|
-
this.primeTable.filters[this.primeField] = this.filterConstraint();
|
|
602
|
-
this.primeTable._filter();
|
|
679
|
+
updateFilterOnDisplayValueChange(displayValue) {
|
|
680
|
+
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), this.filterConstraint()?.displayMatchMode ?? filterGetDefaultMatchMode(this.descriptor(), this.matchModes()), displayValue, this.descriptor().filterType, this.dateConfig()));
|
|
603
681
|
}
|
|
604
682
|
initFilterConstraint(reset = false) {
|
|
605
683
|
if (reset) {
|
|
606
|
-
const defaultMatchMode = this.
|
|
607
|
-
this.primeTable.filters[this.
|
|
684
|
+
const defaultMatchMode = filterGetDefaultMatchMode(this.descriptor(), this.matchModes());
|
|
685
|
+
this.primeTable.filters[this.descriptor().property] = { value: null, matchMode: defaultMatchMode };
|
|
608
686
|
}
|
|
609
687
|
// set internal filter constraint
|
|
610
|
-
|
|
688
|
+
let metadata = this.primeTable.filters[this.descriptor().property];
|
|
611
689
|
if (Array.isArray(metadata)) {
|
|
612
|
-
|
|
613
|
-
}
|
|
614
|
-
else {
|
|
615
|
-
this.setFilterConstraint(metadata);
|
|
690
|
+
metadata = metadata[0];
|
|
616
691
|
}
|
|
692
|
+
this.setFilterConstraint(filterSetMetadataOnChange(metadata, metadata?.matchMode, metadata?.value, this.descriptor().filterType, this.dateConfig()));
|
|
617
693
|
}
|
|
618
694
|
setFilterConstraint(metadata) {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
metadata?.value.length === 2 &&
|
|
627
|
-
metadata?.value.every(v => v instanceof Date || typeof v === 'string' || typeof v === 'number')) {
|
|
628
|
-
const startDate = dateToIsoString(metadata.value[0]);
|
|
629
|
-
const endDate = dateToIsoString(metadata.value[1]);
|
|
630
|
-
// 2020-11-02T11:12:12.000
|
|
631
|
-
const cmpLength = this.descriptor.datePickerShowTime ? (this.descriptor.datePickerShowSeconds ? 19 : 16) : 10;
|
|
632
|
-
if (startDate.substring(0, cmpLength) === endDate.substring(0, cmpLength)) {
|
|
633
|
-
displayMatchMode = FilterMatchMode.Equals;
|
|
634
|
-
displayValue = new Date(metadata.value[0]);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
else if (matchMode === FilterMatchMode.Equals && !metadata?.value) {
|
|
638
|
-
matchMode = FilterMatchMode.Between;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
if (this.descriptor.filterType === FilterTypeEnum.Date && displayValue) {
|
|
642
|
-
// display value for calendar cannot be string, convert to date
|
|
643
|
-
displayValue = Array.isArray(displayValue)
|
|
644
|
-
? displayValue.map(v => (!(v instanceof Date) ? new Date(v) : v))
|
|
645
|
-
: displayValue instanceof Date
|
|
646
|
-
? displayValue
|
|
647
|
-
: new Date(displayValue);
|
|
648
|
-
}
|
|
649
|
-
this.filterConstraint.set({
|
|
650
|
-
matchMode,
|
|
651
|
-
value: metadata?.value,
|
|
652
|
-
displayMatchMode,
|
|
653
|
-
displayValue: displayValue ?? null
|
|
654
|
-
});
|
|
655
|
-
this.primeTable.filters[this.primeField] = this.filterConstraint();
|
|
695
|
+
if (metadata && !metadata.displayMatchMode)
|
|
696
|
+
metadata.displayMatchMode = metadata.matchMode;
|
|
697
|
+
if (metadata && !metadata.displayValue)
|
|
698
|
+
metadata.displayValue = metadata.value;
|
|
699
|
+
this.filterConstraint.set(metadata);
|
|
700
|
+
this.primeTable.filters[this.descriptor().property] = this.filterConstraint();
|
|
701
|
+
this.primeTable._filter();
|
|
656
702
|
}
|
|
657
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type:
|
|
658
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableColumnFilterFullComponent, isStandalone: true, selector: "mng-table-column-filter-full", inputs: { descriptor: "descriptor" }, viewQueries: [{ propertyName: "icon", first: true, predicate: ["icon"], descendants: true }], ngImport: i0, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (primeType) {\n @case ('text') {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"descriptor.trimOption\" />\n }\n @case ('numeric') {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (keyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor.numberUseGrouping\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits\"\n [disabled]=\"isInputDisabled()\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor.numberUseGrouping\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits\"\n [disabled]=\"isInputDisabled()\" />\n }\n }\n\n @case ('boolean') {\n <p-triStateCheckbox [ngModel]=\"filterConstraint()?.displayValue\" (ngModelChange)=\"onTristateModelChange($event)\"></p-triStateCheckbox>\n }\n @case ('date') {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [dateFormat]=\"descriptor.datePickerFormat\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case ('lookup') {\n @if (lookupDescriptor) {\n @switch (lookupDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [autoClear]=\"lookupDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookupDescriptor.multiselect\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n }\n }\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "className", "disabled"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i2.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: TriStateCheckboxModule }, { kind: "component", type: i4.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabel", "ariaLabelledBy", "variant", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i5.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i6.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: FilterIcon, selector: "FilterIcon" }, { kind: "component", type: FilterSlashIcon, selector: "FilterSlashIcon" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }, { kind: "component", type: NumberRangeComponent, selector: "mng-number-range", inputs: ["placeholder", "useGrouping", "minFractionDigits", "maxFractionDigits", "disabled", "className"], outputs: ["keyDown"] }], animations: [
|
|
703
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
704
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableColumnFilterComponent, isStandalone: true, selector: "mng-table-column-filter", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "icon", first: true, predicate: ["icon"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (descriptor().filterType) {\n @case (FilterTypeEnum.Number) {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (keyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor().numberUseGrouping\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor().numberUseGrouping\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [ngModel]=\"filterConstraint()?.displayValue\" binary=\"true\" (ngModelChange)=\"onCheckboxModelChange($event)\"></p-checkbox>\n }\n @case (FilterTypeEnum.Date) {\n @if (filterConstraint()?.displayMatchMode === FilterMatchMode.Between) {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @default {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"descriptor().trimOption\" />\n }\n }\n\n <ng-template #lookupFilter>\n @if (descriptorAsLookup(); as lookup) {\n @switch (lookup.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsTrackProperty]=\"lookup.optionsValueProperty\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"lookup.multiselect\"\n [autoClear]=\"lookup.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookup.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookup.autocompleteInlineSearch ?? false\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"descriptor().trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"lookup.multiselect\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookup.multiselect\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n </ng-template>\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "className", "required", "disabled"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i2.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled", "appendTo"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i4.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i5.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: FilterIcon, selector: "FilterIcon" }, { kind: "component", type: FilterSlashIcon, selector: "FilterSlashIcon" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }, { kind: "component", type: NumberRangeComponent, selector: "mng-number-range", inputs: ["placeholder", "useGrouping", "minFractionDigits", "maxFractionDigits", "required", "disabled"], outputs: ["keyDown"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i6.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }], animations: [
|
|
659
705
|
trigger('overlayAnimation', [
|
|
660
706
|
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
661
707
|
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
662
708
|
])
|
|
663
709
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
664
710
|
}
|
|
665
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type:
|
|
711
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterComponent, decorators: [{
|
|
666
712
|
type: Component,
|
|
667
|
-
args: [{ standalone: true, selector: 'mng-table-column-filter
|
|
713
|
+
args: [{ standalone: true, selector: 'mng-table-column-filter', imports: [
|
|
668
714
|
TableModule,
|
|
669
715
|
TranslateModule,
|
|
670
716
|
DateRangeComponent,
|
|
@@ -672,27 +718,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
672
718
|
FormsModule,
|
|
673
719
|
AutocompleteComponent,
|
|
674
720
|
DropdownComponent,
|
|
675
|
-
TriStateCheckboxModule,
|
|
676
721
|
InputNumberModule,
|
|
677
722
|
InputTextModule,
|
|
678
723
|
FilterIcon,
|
|
679
724
|
FilterSlashIcon,
|
|
680
725
|
NgClass,
|
|
681
726
|
InputTrimDirective,
|
|
682
|
-
NumberRangeComponent
|
|
727
|
+
NumberRangeComponent,
|
|
728
|
+
NgTemplateOutlet,
|
|
729
|
+
CheckboxModule
|
|
683
730
|
], animations: [
|
|
684
731
|
trigger('overlayAnimation', [
|
|
685
732
|
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
686
733
|
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
687
734
|
])
|
|
688
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (
|
|
689
|
-
}], ctorParameters: () => []
|
|
690
|
-
type: Input,
|
|
691
|
-
args: [{ required: true }]
|
|
692
|
-
}], icon: [{
|
|
693
|
-
type: ViewChild,
|
|
694
|
-
args: ['icon']
|
|
695
|
-
}] } });
|
|
735
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (descriptor().filterType) {\n @case (FilterTypeEnum.Number) {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (keyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor().numberUseGrouping\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor().numberUseGrouping\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [ngModel]=\"filterConstraint()?.displayValue\" binary=\"true\" (ngModelChange)=\"onCheckboxModelChange($event)\"></p-checkbox>\n }\n @case (FilterTypeEnum.Date) {\n @if (filterConstraint()?.displayMatchMode === FilterMatchMode.Between) {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @default {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"descriptor().placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"descriptor().trimOption\" />\n }\n }\n\n <ng-template #lookupFilter>\n @if (descriptorAsLookup(); as lookup) {\n @switch (lookup.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsTrackProperty]=\"lookup.optionsValueProperty\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"lookup.multiselect\"\n [autoClear]=\"lookup.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookup.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookup.autocompleteInlineSearch ?? false\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"descriptor().trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"lookup.multiselect\"\n [placeholder]=\"descriptor().placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookup.multiselect\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n </ng-template>\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n" }]
|
|
736
|
+
}], ctorParameters: () => [] });
|
|
696
737
|
|
|
697
738
|
class TableColumnValueComponent {
|
|
698
739
|
constructor() {
|
|
@@ -749,13 +790,419 @@ class TableColumnValueComponent {
|
|
|
749
790
|
this.messageService.add({ severity: 'info', summary: title, detail: message });
|
|
750
791
|
}
|
|
751
792
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
752
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableColumnValueComponent, isStandalone: true, selector: "mng-table-column-value", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "className()", "style.max-width.px": "styleMaxWidth()" } }, ngImport: i0, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency()
|
|
793
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableColumnValueComponent, isStandalone: true, selector: "mng-table-column-value", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "className()", "style.max-width.px": "styleMaxWidth()" } }, ngImport: i0, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency() : descriptor().currencyDisplay : descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeDate) {\n {{ value() | date: descriptor().displayFormat }}\n }\n @case (columnDisplayTypeBoolean) {\n @if (descriptor().booleanAsIcon) {\n <i [class]=\"value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo : true\"></i>\n } @else {\n {{ value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo | translate }}\n }\n }\n @case (columnDisplayTypeEnum) {\n {{ value() | mngEnum: descriptor().enum | translate }}\n }\n @case (columnDisplayTypeComponent) {\n <ng-container\n [mngComponent]=\"descriptor().customComponentType!\"\n [inputs]=\"{\n value: value(),\n item: item(),\n descriptor: descriptor()\n }\"></ng-container>\n }\n}\n@if (descriptor().hasCopyToClipboard) {\n <div class=\"help-buttons\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n </div>\n}\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host.multiline{white-space:pre-wrap;word-wrap:break-word}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"], dependencies: [{ kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$2.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "pipe", type: BooleanPipe, name: "mngBoolean" }, { kind: "pipe", type: EnumPipe, name: "mngEnum" }, { kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i4$2.Ripple, selector: "[pRipple]" }, { kind: "pipe", type: DecimalPipe, name: "number" }, { kind: "pipe", type: CurrencyPipe, name: "currency" }, { kind: "pipe", type: DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
753
794
|
}
|
|
754
795
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnValueComponent, decorators: [{
|
|
755
796
|
type: Component,
|
|
756
|
-
args: [{ standalone: true, selector: 'mng-table-column-value', imports: [TooltipModule, TranslateModule, BooleanPipe, EnumPipe, ComponentDirective, ButtonModule, RippleModule, DecimalPipe, CurrencyPipe, DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class]': 'className()', '[style.max-width.px]': 'styleMaxWidth()' }, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency()
|
|
797
|
+
args: [{ standalone: true, selector: 'mng-table-column-value', imports: [TooltipModule, TranslateModule, BooleanPipe, EnumPipe, ComponentDirective, ButtonModule, RippleModule, DecimalPipe, CurrencyPipe, DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class]': 'className()', '[style.max-width.px]': 'styleMaxWidth()' }, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency() : descriptor().currencyDisplay : descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeDate) {\n {{ value() | date: descriptor().displayFormat }}\n }\n @case (columnDisplayTypeBoolean) {\n @if (descriptor().booleanAsIcon) {\n <i [class]=\"value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo : true\"></i>\n } @else {\n {{ value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo | translate }}\n }\n }\n @case (columnDisplayTypeEnum) {\n {{ value() | mngEnum: descriptor().enum | translate }}\n }\n @case (columnDisplayTypeComponent) {\n <ng-container\n [mngComponent]=\"descriptor().customComponentType!\"\n [inputs]=\"{\n value: value(),\n item: item(),\n descriptor: descriptor()\n }\"></ng-container>\n }\n}\n@if (descriptor().hasCopyToClipboard) {\n <div class=\"help-buttons\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n </div>\n}\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host.multiline{white-space:pre-wrap;word-wrap:break-word}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"] }]
|
|
757
798
|
}] });
|
|
758
799
|
|
|
800
|
+
class FilterValuePipe {
|
|
801
|
+
constructor() {
|
|
802
|
+
this.locale = inject(LOCALE_ID);
|
|
803
|
+
this.translate = inject(TranslateService);
|
|
804
|
+
this.enumPipe = new EnumPipe();
|
|
805
|
+
this.subject = new ReplaySubject(1);
|
|
806
|
+
}
|
|
807
|
+
transform(value, descriptor) {
|
|
808
|
+
const valTransform = this.prepareValueTransform(value, descriptor);
|
|
809
|
+
this.subscription?.unsubscribe();
|
|
810
|
+
if (valTransform.translate) {
|
|
811
|
+
this.subscription = this.translate.stream(valTransform.valueArr).subscribe(i18n => {
|
|
812
|
+
this.subject.next(valTransform.valueArr.map(k => i18n[k]).join(', '));
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
this.subject.next(valTransform.valueArr.join(', '));
|
|
817
|
+
}
|
|
818
|
+
return this.subject.asObservable();
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* If returns a string, this represents i18n key that must go through translation. If translation is not needed, undefined is returned.
|
|
822
|
+
*/
|
|
823
|
+
prepareValueTransform(value, descriptor) {
|
|
824
|
+
const result = {
|
|
825
|
+
translate: false,
|
|
826
|
+
valueArr: Array.isArray(value) ? value : [value]
|
|
827
|
+
};
|
|
828
|
+
switch (descriptor?.filterType) {
|
|
829
|
+
case FilterTypeEnum.Date:
|
|
830
|
+
// eslint-disable-next-line no-case-declarations
|
|
831
|
+
const datePipe = new DatePipe(this.locale);
|
|
832
|
+
result.valueArr = result.valueArr.map(v => datePipe.transform(v, descriptor.displayFormat, descriptor.locale));
|
|
833
|
+
break;
|
|
834
|
+
case FilterTypeEnum.Number:
|
|
835
|
+
// eslint-disable-next-line no-case-declarations
|
|
836
|
+
const decimalPipe = new DecimalPipe(this.locale);
|
|
837
|
+
result.valueArr = result.valueArr.map(v => decimalPipe.transform(v, descriptor.displayFormat, descriptor.locale));
|
|
838
|
+
break;
|
|
839
|
+
case FilterTypeEnum.Boolean:
|
|
840
|
+
// eslint-disable-next-line no-case-declarations
|
|
841
|
+
const booleanPipe = new BooleanPipe();
|
|
842
|
+
result.valueArr = result.valueArr.map(v => booleanPipe.transform(v));
|
|
843
|
+
result.translate = true;
|
|
844
|
+
break;
|
|
845
|
+
case FilterTypeEnum.LookupEnum:
|
|
846
|
+
// eslint-disable-next-line no-case-declarations
|
|
847
|
+
const enumPipe = new EnumPipe();
|
|
848
|
+
result.valueArr = result.valueArr.map(v => enumPipe.transform(v, descriptor.enum));
|
|
849
|
+
result.translate = true;
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
return result;
|
|
853
|
+
}
|
|
854
|
+
ngOnDestroy() {
|
|
855
|
+
this.subscription?.unsubscribe();
|
|
856
|
+
this.subject.complete();
|
|
857
|
+
}
|
|
858
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
859
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: FilterValuePipe, isStandalone: true, name: "mngFilterValue" }); }
|
|
860
|
+
}
|
|
861
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterValuePipe, decorators: [{
|
|
862
|
+
type: Pipe,
|
|
863
|
+
args: [{
|
|
864
|
+
name: 'mngFilterValue',
|
|
865
|
+
standalone: true,
|
|
866
|
+
pure: true
|
|
867
|
+
}]
|
|
868
|
+
}] });
|
|
869
|
+
|
|
870
|
+
class FilterActiveTagComponent {
|
|
871
|
+
constructor() {
|
|
872
|
+
this.FilterMatchMode = FilterMatchMode;
|
|
873
|
+
this.model = input.required();
|
|
874
|
+
this.filter = input.required();
|
|
875
|
+
this.edit = output();
|
|
876
|
+
this.remove = output();
|
|
877
|
+
this.label = computed(() => this.getPropertyLabelKey(this.filter().descriptor));
|
|
878
|
+
this.matchMode = computed(() => this.filter().displayMatchMode);
|
|
879
|
+
this.matchModeSymbol = computed(() => `mngFilterActiveTag.matchMode.${this.matchMode()}`);
|
|
880
|
+
this.value = computed(() => this.filter().displayValue);
|
|
881
|
+
}
|
|
882
|
+
onRemove(event) {
|
|
883
|
+
event.stopPropagation();
|
|
884
|
+
this.remove.emit({
|
|
885
|
+
filter: this.filter(),
|
|
886
|
+
event: event
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
onEdit(event) {
|
|
890
|
+
this.edit.emit({
|
|
891
|
+
filter: this.filter(),
|
|
892
|
+
event: event
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
getPropertyLabelKey(filterDescriptor) {
|
|
896
|
+
let labelKey;
|
|
897
|
+
if (filterDescriptor.title !== undefined) {
|
|
898
|
+
labelKey = filterDescriptor.title;
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
labelKey = getI18nTypePropertyKey(this.model().i18nBaseKey, filterDescriptor.property);
|
|
902
|
+
}
|
|
903
|
+
return labelKey;
|
|
904
|
+
}
|
|
905
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterActiveTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
906
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: FilterActiveTagComponent, isStandalone: true, selector: "mng-filter-active-tag", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { edit: "edit", remove: "remove" }, ngImport: i0, template: "<p-tag severity=\"secondary\" styleClass=\"mr-1 p-tag-outlined\">\n <div class=\"flex align-items-center gap-2 p-1 cursor-pointer\" (click)=\"onEdit($event)\">\n <span>{{ label() | translate }}</span>\n @if (matchMode() === FilterMatchMode.Between) {\n <span class=\"font-semibold\">{{ value()?.[0] | mngFilterValue: filter().descriptor | async }}</span>\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value()?.[1] | mngFilterValue: filter().descriptor | async }}</span>\n } @else {\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value() | mngFilterValue: filter().descriptor | async }}</span>\n @if (filter().caseSensitive) {\n <small class=\"border-solid border-1 border-round-sm px-1 text-primary-400\">Aa</small>\n }\n }\n <span class=\"pi pi-times text-xs\" (click)=\"onRemove($event)\"></span>\n </div>\n</p-tag>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i2$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "pipe", type: FilterValuePipe, name: "mngFilterValue" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
907
|
+
}
|
|
908
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterActiveTagComponent, decorators: [{
|
|
909
|
+
type: Component,
|
|
910
|
+
args: [{ standalone: true, selector: 'mng-filter-active-tag', imports: [TranslateModule, TagModule, FilterValuePipe, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p-tag severity=\"secondary\" styleClass=\"mr-1 p-tag-outlined\">\n <div class=\"flex align-items-center gap-2 p-1 cursor-pointer\" (click)=\"onEdit($event)\">\n <span>{{ label() | translate }}</span>\n @if (matchMode() === FilterMatchMode.Between) {\n <span class=\"font-semibold\">{{ value()?.[0] | mngFilterValue: filter().descriptor | async }}</span>\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value()?.[1] | mngFilterValue: filter().descriptor | async }}</span>\n } @else {\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value() | mngFilterValue: filter().descriptor | async }}</span>\n @if (filter().caseSensitive) {\n <small class=\"border-solid border-1 border-round-sm px-1 text-primary-400\">Aa</small>\n }\n }\n <span class=\"pi pi-times text-xs\" (click)=\"onRemove($event)\"></span>\n </div>\n</p-tag>\n" }]
|
|
911
|
+
}] });
|
|
912
|
+
|
|
913
|
+
class FilterFormComponent {
|
|
914
|
+
constructor() {
|
|
915
|
+
this.lookupTypeDropdown = FilterLookupTypeEnum.Dropdown;
|
|
916
|
+
this.lookupTypeAutocomplete = FilterLookupTypeEnum.Autocomplete;
|
|
917
|
+
this.FilterTypeEnum = FilterTypeEnum;
|
|
918
|
+
this.FilterMatchMode = FilterMatchMode;
|
|
919
|
+
this.elementRef = inject(ElementRef);
|
|
920
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
921
|
+
this.primeConfig = inject(PrimeNGConfig);
|
|
922
|
+
this.translate = inject(TranslateService);
|
|
923
|
+
this.title = input();
|
|
924
|
+
this.descriptors = input.required();
|
|
925
|
+
this.model = input.required();
|
|
926
|
+
this.filter = input();
|
|
927
|
+
this.overlay = input();
|
|
928
|
+
this.disabledProperties = input([]);
|
|
929
|
+
this.apply = output();
|
|
930
|
+
this.propertyOptionsWithTranslations = computed(() => {
|
|
931
|
+
const disabledProperties = this.disabledProperties();
|
|
932
|
+
const filter = this.filter();
|
|
933
|
+
return this.descriptors()?.map(d => ({ property: d.property, label: this.getPropertyLabelKey(d), disabled: !filter && disabledProperties.includes(d.property) }));
|
|
934
|
+
});
|
|
935
|
+
this.selectedDescriptor = computed(() => {
|
|
936
|
+
const property = this.propertyModel();
|
|
937
|
+
return this.descriptors().find(filterDescriptor => filterDescriptor.property === property);
|
|
938
|
+
});
|
|
939
|
+
this.selectedDescriptorAsLookup = computed(() => {
|
|
940
|
+
const filterDescriptor = this.selectedDescriptor();
|
|
941
|
+
return filterDescriptor !== undefined && (filterDescriptor.filterType === FilterTypeEnum.Lookup || filterDescriptor.filterType === FilterTypeEnum.LookupEnum)
|
|
942
|
+
? filterDescriptor
|
|
943
|
+
: undefined;
|
|
944
|
+
});
|
|
945
|
+
this.matchModeOptions = computed(() => {
|
|
946
|
+
return generateMatchModeOptions(this.primeConfig, this.selectedDescriptor(), this.serializationCfg);
|
|
947
|
+
});
|
|
948
|
+
this.isEdit = computed(() => this.filter() != null);
|
|
949
|
+
this.formSubmitted = signal(false);
|
|
950
|
+
this.formErrorMessage = signal([]);
|
|
951
|
+
// display configs
|
|
952
|
+
this.dateConfig = computed(() => filterGetDateConfig(this.selectedDescriptor(), this.serializationCfg));
|
|
953
|
+
this.numberConfig = computed(() => filterGetNumberConfig(this.selectedDescriptor()));
|
|
954
|
+
// UI utilities
|
|
955
|
+
this.filterForm = viewChild.required('filterForm');
|
|
956
|
+
// Filter form model and form utilities
|
|
957
|
+
this.propertyModel = signal(null);
|
|
958
|
+
this.matchModeModel = signal(null);
|
|
959
|
+
this.valueModel = signal(null);
|
|
960
|
+
this.caseSensitiveModel = signal(false);
|
|
961
|
+
this.serializationCfg = {};
|
|
962
|
+
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
963
|
+
effect(() => {
|
|
964
|
+
const edit = this.filter();
|
|
965
|
+
if (edit) {
|
|
966
|
+
this.resetForm({
|
|
967
|
+
property: edit.descriptor.property,
|
|
968
|
+
matchMode: edit.displayMatchMode ?? edit.matchMode ?? null,
|
|
969
|
+
value: edit.displayValue ?? edit.value,
|
|
970
|
+
caseSensitive: edit.caseSensitive ?? false
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
this.resetForm();
|
|
975
|
+
}
|
|
976
|
+
}, { allowSignalWrites: true });
|
|
977
|
+
effect(() => {
|
|
978
|
+
const descriptor = this.selectedDescriptor();
|
|
979
|
+
const value = untracked(() => this.valueModel());
|
|
980
|
+
if (value != null) {
|
|
981
|
+
// reset value if filter type and value type mismatch
|
|
982
|
+
if ((descriptor?.filterType === FilterTypeEnum.String &&
|
|
983
|
+
(value === true || value === false || value === 'true' || value === 'false' || value instanceof Date)) ||
|
|
984
|
+
(descriptor?.filterType === FilterTypeEnum.Number && typeof value !== 'number' && isNaN(+value)) ||
|
|
985
|
+
(descriptor?.filterType === FilterTypeEnum.Date && !(value instanceof Date)) ||
|
|
986
|
+
descriptor?.filterType === FilterTypeEnum.Lookup ||
|
|
987
|
+
descriptor?.filterType === FilterTypeEnum.LookupEnum) {
|
|
988
|
+
this.valueModel.set(null);
|
|
989
|
+
}
|
|
990
|
+
else if (descriptor?.filterType === FilterTypeEnum.Boolean && typeof value !== 'boolean') {
|
|
991
|
+
this.valueModel.set(false);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}, { allowSignalWrites: true });
|
|
995
|
+
effect(() => {
|
|
996
|
+
const matchModeOptions = this.matchModeOptions();
|
|
997
|
+
const matchMode = untracked(() => this.matchModeModel());
|
|
998
|
+
const filterForm = untracked(() => this.filterForm());
|
|
999
|
+
if (matchModeOptions.length > 0 &&
|
|
1000
|
+
(!matchMode || filterForm.controls['matchMode']?.pristine || filterForm.controls['matchMode']?.untouched || !matchModeOptions.find(o => o.value === matchMode))) {
|
|
1001
|
+
this.matchModeModel.set(filterGetDefaultMatchMode(this.selectedDescriptor(), matchModeOptions));
|
|
1002
|
+
}
|
|
1003
|
+
}, { allowSignalWrites: true });
|
|
1004
|
+
effect(() => {
|
|
1005
|
+
const currentValue = untracked(() => this.valueModel());
|
|
1006
|
+
this.valueModel.set(filterAdjustDisplayValueOnMatchModeChange(this.matchModeModel() ?? undefined, currentValue));
|
|
1007
|
+
}, { allowSignalWrites: true });
|
|
1008
|
+
toObservable(this.overlay)
|
|
1009
|
+
.pipe(switchMap(o => (o ? o.onShow : NEVER)), takeUntilDestroyed())
|
|
1010
|
+
.subscribe(() => {
|
|
1011
|
+
const formFields = this.elementRef.nativeElement.querySelectorAll('input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role="combobox"]:not([disabled])');
|
|
1012
|
+
const activeEl = document.activeElement;
|
|
1013
|
+
const activeInputIdx = activeEl ? [...formFields].findIndex(el => activeEl.isEqualNode(el)) : 0;
|
|
1014
|
+
if (activeInputIdx <= 0) {
|
|
1015
|
+
formFields[0].focus();
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
onFormSubmit(form) {
|
|
1020
|
+
this.formSubmitted.set(true);
|
|
1021
|
+
// mark all as dirty
|
|
1022
|
+
for (const key in form.controls) {
|
|
1023
|
+
form.controls[key].markAsDirty();
|
|
1024
|
+
}
|
|
1025
|
+
const property = this.propertyModel();
|
|
1026
|
+
const matchMode = this.matchModeModel();
|
|
1027
|
+
if (form.invalid || !property || !matchMode) {
|
|
1028
|
+
this.formErrorMessage.set([
|
|
1029
|
+
{
|
|
1030
|
+
severity: 'warn',
|
|
1031
|
+
summary: this.translate.instant('mngFilter.messages.invalidFormTitle'),
|
|
1032
|
+
detail: this.translate.instant('mngFilter.messages.invalidFormMessage')
|
|
1033
|
+
}
|
|
1034
|
+
]);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
this.apply.emit({
|
|
1038
|
+
property: property,
|
|
1039
|
+
matchMode: matchMode,
|
|
1040
|
+
value: this.valueModel(),
|
|
1041
|
+
caseSensitive: this.caseSensitiveModel()
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
resetForm(value) {
|
|
1045
|
+
this.filterForm().resetForm(value);
|
|
1046
|
+
// somehow have to set case sensitivity manually
|
|
1047
|
+
this.caseSensitiveModel.set(value?.caseSensitive ?? false);
|
|
1048
|
+
this.formSubmitted.set(false);
|
|
1049
|
+
}
|
|
1050
|
+
getPropertyLabelKey(filterDescriptor) {
|
|
1051
|
+
let labelKey;
|
|
1052
|
+
if (filterDescriptor.title !== undefined) {
|
|
1053
|
+
labelKey = filterDescriptor.title;
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
labelKey = getI18nTypePropertyKey(this.model().i18nBaseKey, filterDescriptor.property);
|
|
1057
|
+
}
|
|
1058
|
+
return labelKey;
|
|
1059
|
+
}
|
|
1060
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1061
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: FilterFormComponent, isStandalone: true, selector: "mng-filter-form", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, descriptors: { classPropertyName: "descriptors", publicName: "descriptors", isSignal: true, isRequired: true, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, overlay: { classPropertyName: "overlay", publicName: "overlay", isSignal: true, isRequired: false, transformFunction: null }, disabledProperties: { classPropertyName: "disabledProperties", publicName: "disabledProperties", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply" }, host: { classAttribute: "flex flex-grow-1" }, viewQueries: [{ propertyName: "filterForm", first: true, predicate: ["filterForm"], descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <div>\n <h5>{{ filter() ? ('mngFilter.titleEdit' | translate) : ('mngFilter.titleAdd' | translate) }}</h5>\n </div>\n <form #filterForm=\"ngForm\" (ngSubmit)=\"onFormSubmit(filterForm)\" class=\"flex flex-column align-items-center lg:flex-row gap-3\">\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"property\"\n id=\"property\"\n tabindex=\"1\"\n #propertyControl=\"ngModel\"\n [(ngModel)]=\"propertyModel\"\n [options]=\"propertyOptionsWithTranslations()\"\n optionsValueProperty=\"property\"\n optionsDisabledProperty=\"disabled\"\n optionsLabelProperty=\"label\"\n [placeholder]=\"'mngFilter.property' | translate\"\n optionsLabelTranslate=\"true\"\n required=\"true\"\n className=\"w-full\"\n [disabled]=\"isEdit()\"\n [appendTo]=\"null\" />\n </div>\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"matchMode\"\n id=\"matchMode\"\n [(ngModel)]=\"matchModeModel\"\n className=\"w-full\"\n [options]=\"matchModeOptions()\"\n [placeholder]=\"'mngFilter.matchMode' | translate\"\n [disabled]=\"!propertyControl.value\"\n class=\"align-self-end\"\n required=\"true\"\n [appendTo]=\"null\" />\n </div>\n @if (!(matchModeModel() === FilterMatchMode.Exists || matchModeModel() === FilterMatchMode.DoesNotExist)) {\n <div class=\"w-full lg:w-auto flex flex-column\">\n @switch (selectedDescriptor()?.filterType) {\n @case (FilterTypeEnum.Number) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedDescriptor()?.numberUseGrouping ?? false\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n required=\"true\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedDescriptor()?.numberUseGrouping\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [(ngModel)]=\"valueModel\" [disabled]=\"!matchModeModel()\" name=\"value\" binary=\"true\" required=\"true\" />\n }\n @case (FilterTypeEnum.Date) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-date-range\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [firstDayOfWeek]=\"1\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @default {\n <input\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input w-full\"\n [attr.placeholder]=\"'mngFilter.value' | translate\"\n [mngInputTrim]=\"selectedDescriptor()?.trimOption!\"\n [disabled]=\"!matchModeModel()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\" />\n }\n }\n <ng-template #lookupFilter>\n @if (selectedDescriptorAsLookup(); as lookupFilterDescriptor) {\n @switch (lookupFilterDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupFilterDescriptor.multiselect\"\n [autoClear]=\"lookupFilterDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupFilterDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupFilterDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n [searchTrim]=\"selectedDescriptor()?.trimOption!\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupFilterDescriptor.multiselect\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className + ' w-full'\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n }\n }\n </ng-template>\n </div>\n }\n @if (selectedDescriptor()?.filterType === FilterTypeEnum.String && matchModeModel() !== FilterMatchMode.Exists && matchModeModel() !== FilterMatchMode.DoesNotExist) {\n <div class=\"flex align-items-center gap-2\">\n <p-checkbox [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" binary=\"true\" id=\"caseSensitive\" />\n <label for=\"caseSensitive\">{{ 'mngFilter.caseSensitive' | translate }}</label>\n </div>\n }\n <div class=\"flex justify-content-end\">\n <button pButton type=\"submit\" class=\"align-self-end\">\n {{ (filter() ? 'general.apply' : 'general.add') | translate }}\n </button>\n </div>\n </form>\n @if (formSubmitted() && filterForm.invalid) {\n <p-messages [value]=\"formErrorMessage()\" class=\"w-full\"></p-messages>\n }\n</div>\n", dependencies: [{ kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled", "appendTo"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.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: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }, { kind: "component", type: NumberRangeComponent, selector: "mng-number-range", inputs: ["placeholder", "useGrouping", "minFractionDigits", "maxFractionDigits", "required", "disabled"], outputs: ["keyDown"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i4.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "className", "required", "disabled"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i2.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i6.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessagesModule }, { kind: "component", type: i7.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i5.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1062
|
+
}
|
|
1063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterFormComponent, decorators: [{
|
|
1064
|
+
type: Component,
|
|
1065
|
+
args: [{ standalone: true, selector: 'mng-filter-form', imports: [
|
|
1066
|
+
DropdownComponent,
|
|
1067
|
+
FormsModule,
|
|
1068
|
+
NgClass,
|
|
1069
|
+
TranslateModule,
|
|
1070
|
+
InputTrimDirective,
|
|
1071
|
+
NumberRangeComponent,
|
|
1072
|
+
InputNumberModule,
|
|
1073
|
+
DateRangeComponent,
|
|
1074
|
+
CalendarModule,
|
|
1075
|
+
AutocompleteComponent,
|
|
1076
|
+
CheckboxModule,
|
|
1077
|
+
MessagesModule,
|
|
1078
|
+
InputTextModule,
|
|
1079
|
+
NgTemplateOutlet
|
|
1080
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1081
|
+
class: 'flex flex-grow-1'
|
|
1082
|
+
}, template: "<div>\n <div>\n <h5>{{ filter() ? ('mngFilter.titleEdit' | translate) : ('mngFilter.titleAdd' | translate) }}</h5>\n </div>\n <form #filterForm=\"ngForm\" (ngSubmit)=\"onFormSubmit(filterForm)\" class=\"flex flex-column align-items-center lg:flex-row gap-3\">\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"property\"\n id=\"property\"\n tabindex=\"1\"\n #propertyControl=\"ngModel\"\n [(ngModel)]=\"propertyModel\"\n [options]=\"propertyOptionsWithTranslations()\"\n optionsValueProperty=\"property\"\n optionsDisabledProperty=\"disabled\"\n optionsLabelProperty=\"label\"\n [placeholder]=\"'mngFilter.property' | translate\"\n optionsLabelTranslate=\"true\"\n required=\"true\"\n className=\"w-full\"\n [disabled]=\"isEdit()\"\n [appendTo]=\"null\" />\n </div>\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"matchMode\"\n id=\"matchMode\"\n [(ngModel)]=\"matchModeModel\"\n className=\"w-full\"\n [options]=\"matchModeOptions()\"\n [placeholder]=\"'mngFilter.matchMode' | translate\"\n [disabled]=\"!propertyControl.value\"\n class=\"align-self-end\"\n required=\"true\"\n [appendTo]=\"null\" />\n </div>\n @if (!(matchModeModel() === FilterMatchMode.Exists || matchModeModel() === FilterMatchMode.DoesNotExist)) {\n <div class=\"w-full lg:w-auto flex flex-column\">\n @switch (selectedDescriptor()?.filterType) {\n @case (FilterTypeEnum.Number) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedDescriptor()?.numberUseGrouping ?? false\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n required=\"true\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedDescriptor()?.numberUseGrouping\"\n [minFractionDigits]=\"numberConfig()?.fractionsMin\"\n [maxFractionDigits]=\"numberConfig()?.fractionsMax\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [(ngModel)]=\"valueModel\" [disabled]=\"!matchModeModel()\" name=\"value\" binary=\"true\" required=\"true\" />\n }\n @case (FilterTypeEnum.Date) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-date-range\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"dateConfig()?.showTime ?? false\"\n [showSeconds]=\"dateConfig()?.showSeconds ?? false\"\n [dateFormat]=\"dateConfig()?.format\"\n [firstDayOfWeek]=\"1\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @default {\n <input\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input w-full\"\n [attr.placeholder]=\"'mngFilter.value' | translate\"\n [mngInputTrim]=\"selectedDescriptor()?.trimOption!\"\n [disabled]=\"!matchModeModel()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\" />\n }\n }\n <ng-template #lookupFilter>\n @if (selectedDescriptorAsLookup(); as lookupFilterDescriptor) {\n @switch (lookupFilterDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupFilterDescriptor.multiselect\"\n [autoClear]=\"lookupFilterDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupFilterDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupFilterDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n [searchTrim]=\"selectedDescriptor()?.trimOption!\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupFilterDescriptor.multiselect\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className + ' w-full'\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n }\n }\n </ng-template>\n </div>\n }\n @if (selectedDescriptor()?.filterType === FilterTypeEnum.String && matchModeModel() !== FilterMatchMode.Exists && matchModeModel() !== FilterMatchMode.DoesNotExist) {\n <div class=\"flex align-items-center gap-2\">\n <p-checkbox [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" binary=\"true\" id=\"caseSensitive\" />\n <label for=\"caseSensitive\">{{ 'mngFilter.caseSensitive' | translate }}</label>\n </div>\n }\n <div class=\"flex justify-content-end\">\n <button pButton type=\"submit\" class=\"align-self-end\">\n {{ (filter() ? 'general.apply' : 'general.add') | translate }}\n </button>\n </div>\n </form>\n @if (formSubmitted() && filterForm.invalid) {\n <p-messages [value]=\"formErrorMessage()\" class=\"w-full\"></p-messages>\n }\n</div>\n" }]
|
|
1083
|
+
}], ctorParameters: () => [] });
|
|
1084
|
+
|
|
1085
|
+
class FilterOverlayWithTagComponent {
|
|
1086
|
+
constructor() {
|
|
1087
|
+
this.primeTable = inject(Table);
|
|
1088
|
+
this.dataListService = inject((DataListService));
|
|
1089
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
1090
|
+
this.descriptors = input.required();
|
|
1091
|
+
this.model = input.required();
|
|
1092
|
+
this.filterOverlay = viewChild.required(OverlayPanel);
|
|
1093
|
+
this.templates = contentChildren(TemplateDirective);
|
|
1094
|
+
this.titleTemplate = computed(() => findTemplateByName([...this.templates()], 'title'));
|
|
1095
|
+
this.filters = computed(() => {
|
|
1096
|
+
return this.setInitialFilters(this.dataListService.filterMeta());
|
|
1097
|
+
});
|
|
1098
|
+
this.activeFilters = computed(() => {
|
|
1099
|
+
const filterEntry = this.filters();
|
|
1100
|
+
return this.descriptors()
|
|
1101
|
+
.filter(d => {
|
|
1102
|
+
const filter = filterEntry[d.property];
|
|
1103
|
+
return (filter &&
|
|
1104
|
+
filter.matchMode !== undefined &&
|
|
1105
|
+
filter.displayMatchMode !== undefined &&
|
|
1106
|
+
(filter.matchMode === FilterMatchMode.Exists ||
|
|
1107
|
+
filter.matchMode === FilterMatchMode.DoesNotExist ||
|
|
1108
|
+
(filter.value !== undefined && filter.displayValue !== undefined)));
|
|
1109
|
+
})
|
|
1110
|
+
.map(d => filterEntry[d.property]);
|
|
1111
|
+
});
|
|
1112
|
+
this.activeFilterProperties = computed(() => this.activeFilters().map(f => f.descriptor.property));
|
|
1113
|
+
this.filterEdit = signal(undefined);
|
|
1114
|
+
this.serializationCfg = {};
|
|
1115
|
+
// UI utilities
|
|
1116
|
+
this.clickedOnFilterEvent = undefined;
|
|
1117
|
+
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
1118
|
+
}
|
|
1119
|
+
onFilterFormApply(event) {
|
|
1120
|
+
const descriptor = this.descriptors().find(d => d.property === event.property);
|
|
1121
|
+
if (!descriptor) {
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
this.updatePrimeTableFilter({
|
|
1125
|
+
...filterSetMetadataOnDisplayChange({ caseSensitive: event.caseSensitive }, event.matchMode, event.value, descriptor.filterType, filterGetDateConfig(descriptor, this.serializationCfg)),
|
|
1126
|
+
descriptor: descriptor
|
|
1127
|
+
});
|
|
1128
|
+
// Resetting the form is done in the onOverlayHide callback because resetting the
|
|
1129
|
+
// values here renders empty inputs for a split second before closing the overlay
|
|
1130
|
+
this.filterOverlay().hide();
|
|
1131
|
+
}
|
|
1132
|
+
onFilterRemove(event) {
|
|
1133
|
+
this.updatePrimeTableFilter({
|
|
1134
|
+
...this.filters()[event.filter.descriptor.property],
|
|
1135
|
+
matchMode: undefined,
|
|
1136
|
+
displayMatchMode: undefined,
|
|
1137
|
+
value: undefined,
|
|
1138
|
+
displayValue: undefined
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
onFilterEdit(event) {
|
|
1142
|
+
this.onFilterAddOrEdit(event.filter, event.event);
|
|
1143
|
+
}
|
|
1144
|
+
onFilterAdd(event) {
|
|
1145
|
+
this.onFilterAddOrEdit(undefined, event);
|
|
1146
|
+
}
|
|
1147
|
+
onOverlayHide() {
|
|
1148
|
+
if (this.clickedOnFilterEvent) {
|
|
1149
|
+
// show the overlay again if the user clicked another filter
|
|
1150
|
+
setTimeout(() => {
|
|
1151
|
+
this.filterOverlay().show(this.clickedOnFilterEvent);
|
|
1152
|
+
this.clickedOnFilterEvent = undefined;
|
|
1153
|
+
}, 0);
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
else {
|
|
1157
|
+
// clean state
|
|
1158
|
+
this.filterEdit.set(undefined);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
onFilterAddOrEdit(filter, event) {
|
|
1162
|
+
// If user clicks on the same filter or add that is already open, close the overlay
|
|
1163
|
+
if (this.filterOverlay().overlayVisible && this.filterEdit()?.descriptor.property === filter?.descriptor.property) {
|
|
1164
|
+
this.filterOverlay().hide();
|
|
1165
|
+
this.filterEdit.set(undefined);
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
this.filterEdit.set(filter);
|
|
1169
|
+
if (this.filterOverlay().overlayVisible) {
|
|
1170
|
+
// In case the user clicks another filter, 're-showing' the overlay in
|
|
1171
|
+
// the new position is done in the onOverlayHide callback
|
|
1172
|
+
this.clickedOnFilterEvent = event;
|
|
1173
|
+
this.filterOverlay().hide();
|
|
1174
|
+
}
|
|
1175
|
+
else {
|
|
1176
|
+
this.filterOverlay().show(event);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
setInitialFilters(filtersInit) {
|
|
1180
|
+
const filtersResult = {};
|
|
1181
|
+
for (const property in filtersInit) {
|
|
1182
|
+
const filterInit = filtersInit[property];
|
|
1183
|
+
const descriptor = this.descriptors().find(filterDescriptor => filterDescriptor.property === property);
|
|
1184
|
+
if (!descriptor) {
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
filtersResult[property] = {
|
|
1188
|
+
...filterSetMetadataOnChange(filterInit, filterInit.matchMode, filterInit.value, descriptor.filterType, filterGetDateConfig(descriptor, this.serializationCfg)),
|
|
1189
|
+
descriptor: descriptor
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
return filtersResult;
|
|
1193
|
+
}
|
|
1194
|
+
updatePrimeTableFilter(filter) {
|
|
1195
|
+
this.primeTable.filters[filter.descriptor.property] = { ...filter };
|
|
1196
|
+
this.primeTable._filter();
|
|
1197
|
+
}
|
|
1198
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterOverlayWithTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1199
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: FilterOverlayWithTagComponent, isStandalone: true, selector: "mng-filter-overlay-with-tag", inputs: { descriptors: { classPropertyName: "descriptors", publicName: "descriptors", isSignal: true, isRequired: true, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null } }, queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "filterOverlay", first: true, predicate: OverlayPanel, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex align-items-center flex-grow-1\">\n @if (titleTemplate()) {\n <ng-container *ngTemplateOutlet=\"titleTemplate()\"></ng-container>\n }\n <p-button\n icon=\"pi pi-filter\"\n rounded=\"true\"\n [severity]=\"activeFilters().length > 0 ? 'primary' : 'secondary'\"\n size=\"small\"\n (click)=\"onFilterAdd($event)\"\n [styleClass]=\"'my-1 mr-2' + (titleTemplate() ? ' ml-3' : '')\">\n </p-button>\n</div>\n@if (activeFilters().length > 0) {\n <div class=\"flex align-items-center flex-wrap mt-2\">\n @for (filter of activeFilters(); track filter.descriptor.property) {\n <mng-filter-active-tag [model]=\"model()\" [filter]=\"filter\" (edit)=\"onFilterEdit($event)\" (remove)=\"onFilterRemove($event)\" />\n }\n </div>\n}\n<p-overlayPanel #op [showCloseIcon]=\"true\" (onHide)=\"onOverlayHide()\" appendTo=\"body\">\n <mng-filter-form\n [model]=\"model()\"\n [descriptors]=\"descriptors()\"\n [filter]=\"filterEdit()\"\n [disabledProperties]=\"activeFilterProperties()\"\n [overlay]=\"op\"\n (apply)=\"onFilterFormApply($event)\" />\n</p-overlayPanel>\n", dependencies: [{ kind: "ngmodule", type: OverlayPanelModule }, { kind: "component", type: i1$3.OverlayPanel, selector: "p-overlayPanel", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "showCloseIcon", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: FilterFormComponent, selector: "mng-filter-form", inputs: ["title", "descriptors", "model", "filter", "overlay", "disabledProperties"], outputs: ["apply"] }, { kind: "component", type: Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: FilterActiveTagComponent, selector: "mng-filter-active-tag", inputs: ["model", "filter"], outputs: ["edit", "remove"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1200
|
+
}
|
|
1201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FilterOverlayWithTagComponent, decorators: [{
|
|
1202
|
+
type: Component,
|
|
1203
|
+
args: [{ standalone: true, selector: 'mng-filter-overlay-with-tag', imports: [OverlayPanelModule, TranslateModule, TagModule, FilterFormComponent, Button, FilterActiveTagComponent, NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex align-items-center flex-grow-1\">\n @if (titleTemplate()) {\n <ng-container *ngTemplateOutlet=\"titleTemplate()\"></ng-container>\n }\n <p-button\n icon=\"pi pi-filter\"\n rounded=\"true\"\n [severity]=\"activeFilters().length > 0 ? 'primary' : 'secondary'\"\n size=\"small\"\n (click)=\"onFilterAdd($event)\"\n [styleClass]=\"'my-1 mr-2' + (titleTemplate() ? ' ml-3' : '')\">\n </p-button>\n</div>\n@if (activeFilters().length > 0) {\n <div class=\"flex align-items-center flex-wrap mt-2\">\n @for (filter of activeFilters(); track filter.descriptor.property) {\n <mng-filter-active-tag [model]=\"model()\" [filter]=\"filter\" (edit)=\"onFilterEdit($event)\" (remove)=\"onFilterRemove($event)\" />\n }\n </div>\n}\n<p-overlayPanel #op [showCloseIcon]=\"true\" (onHide)=\"onOverlayHide()\" appendTo=\"body\">\n <mng-filter-form\n [model]=\"model()\"\n [descriptors]=\"descriptors()\"\n [filter]=\"filterEdit()\"\n [disabledProperties]=\"activeFilterProperties()\"\n [overlay]=\"op\"\n (apply)=\"onFilterFormApply($event)\" />\n</p-overlayPanel>\n" }]
|
|
1204
|
+
}], ctorParameters: () => [] });
|
|
1205
|
+
|
|
759
1206
|
function tableNotificationError(translate, table, error, messageService) {
|
|
760
1207
|
const params = {};
|
|
761
1208
|
if (error?.message) {
|
|
@@ -825,6 +1272,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
825
1272
|
}]
|
|
826
1273
|
}] });
|
|
827
1274
|
|
|
1275
|
+
const COMMONS_TABLE_FEATURE_CONFIG_IT = new InjectionToken('COMMONS_TABLE_FEATURE_CONFIG');
|
|
1276
|
+
|
|
828
1277
|
class TableComponent {
|
|
829
1278
|
constructor() {
|
|
830
1279
|
this.cmpTypeName = 'TableComponent';
|
|
@@ -836,7 +1285,9 @@ class TableComponent {
|
|
|
836
1285
|
this.messageService = inject(MessageService);
|
|
837
1286
|
this.commons = inject(CommonsService);
|
|
838
1287
|
this.storageService = inject(CommonsStorageService);
|
|
1288
|
+
this.config = inject(COMMONS_TABLE_FEATURE_CONFIG_IT, { optional: true });
|
|
839
1289
|
this.dataListService = inject((DataListService));
|
|
1290
|
+
this.defaultFilterDisplayType = this.config?.filterDisplayType ?? FilterDisplayTypeEnum.Column;
|
|
840
1291
|
// metadata input
|
|
841
1292
|
this.descriptorInput = input.required({ alias: 'descriptor' });
|
|
842
1293
|
// data source inputs
|
|
@@ -845,15 +1296,17 @@ class TableComponent {
|
|
|
845
1296
|
this.loadingInput = input(undefined, { alias: 'loading', transform: booleanOrUndefinedAttribute });
|
|
846
1297
|
this.dataProvider = input();
|
|
847
1298
|
// extra features input
|
|
848
|
-
this.useQueryParams = input(false);
|
|
849
|
-
this.cellClickEnabled = input(true);
|
|
1299
|
+
this.useQueryParams = input(false, { transform: booleanAttribute });
|
|
1300
|
+
this.cellClickEnabled = input(true, { transform: booleanAttribute });
|
|
850
1301
|
this.selectionMode = input('multiple');
|
|
851
|
-
this.selectionEnabled = input(false);
|
|
852
|
-
this.rowReorderEnabledInput = input(true, { alias: 'rowReorderEnabled' });
|
|
1302
|
+
this.selectionEnabled = input(false, { transform: booleanAttribute });
|
|
1303
|
+
this.rowReorderEnabledInput = input(true, { alias: 'rowReorderEnabled', transform: booleanAttribute });
|
|
853
1304
|
this.rowReorderEnabled = computed(() => this.rowReorderEnabledInput() && this.descriptor().rowReorderable);
|
|
854
1305
|
// styling
|
|
855
1306
|
this.columnLastMinWidth = input();
|
|
856
1307
|
this.columnsColspan = computed(() => this.visibleColumns().length + (this.hasLastColumn() ? 1 : 0) + (this.selectionEnabled() ? 1 : 0) + (this.rowReorderEnabled() ? 1 : 0));
|
|
1308
|
+
this.hasTitleDisplay = computed(() => this.captionTemplate() || this.captionComponent() || this.descriptor().title);
|
|
1309
|
+
this.isCaptionVisible = computed(() => this.hasTitleDisplay() || this.overlayWithTagFilters().length > 0);
|
|
857
1310
|
// component inputs
|
|
858
1311
|
this.captionComponent = input();
|
|
859
1312
|
this.columnCustomLastComponent = input();
|
|
@@ -909,6 +1362,9 @@ class TableComponent {
|
|
|
909
1362
|
if (this.descriptor().hasGridlines) {
|
|
910
1363
|
className += ' p-datatable-gridlines';
|
|
911
1364
|
}
|
|
1365
|
+
if (!this.isCaptionVisible()) {
|
|
1366
|
+
className += ' datatable-no-header';
|
|
1367
|
+
}
|
|
912
1368
|
return className;
|
|
913
1369
|
});
|
|
914
1370
|
// data provider
|
|
@@ -916,8 +1372,6 @@ class TableComponent {
|
|
|
916
1372
|
const dataProvider = this.dataProvider();
|
|
917
1373
|
return dataProvider?.serviceType ? this.injector.get(dataProvider.serviceType) : null;
|
|
918
1374
|
});
|
|
919
|
-
this.latestLazyLoadEventVersion = 0;
|
|
920
|
-
this.latestParamsWithDefaultsVersion = 0;
|
|
921
1375
|
// descriptors
|
|
922
1376
|
this.descriptor = signal(tableDescriptor());
|
|
923
1377
|
this.localstorageKey = computed(() => {
|
|
@@ -935,8 +1389,10 @@ class TableComponent {
|
|
|
935
1389
|
this.columns = computed(() => this.computeColumnsWithLayout());
|
|
936
1390
|
this.visibleColumns = computed(() => this.columns().filter(col => col.isVisible));
|
|
937
1391
|
// filter, sort
|
|
938
|
-
this.hasColumnFilters = computed(() => this.filterDescriptors().length > 0);
|
|
939
1392
|
this.filterDescriptors = computed(() => this.descriptor().filters);
|
|
1393
|
+
this.hasColumnFilters = computed(() => (this.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag && this.filterDescriptors().some(d => d.displayType === FilterDisplayTypeEnum.Column)) ||
|
|
1394
|
+
(this.defaultFilterDisplayType === FilterDisplayTypeEnum.Column && this.filterDescriptors().some(d => d.displayType == null)));
|
|
1395
|
+
this.overlayWithTagFilters = computed(() => this.filterDescriptors().filter(d => (d.displayType == null && this.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag) || d.displayType === FilterDisplayTypeEnum.OverlayWithTag));
|
|
940
1396
|
this.defaultParams = computed(() => this.computeDefaultDataListParams());
|
|
941
1397
|
this.anyColumnVisible = computed(() => this.visibleColumns().length > 0);
|
|
942
1398
|
this.hasCustomLastColumn = computed(() => this.columnCustomLastComponent || this.columnCustomLastTemplate());
|
|
@@ -1048,7 +1504,6 @@ class TableComponent {
|
|
|
1048
1504
|
}
|
|
1049
1505
|
onTableLazyLoad(event) {
|
|
1050
1506
|
this.dataProviderLatestLazyLoadEvent = event;
|
|
1051
|
-
this.latestLazyLoadEventVersion++;
|
|
1052
1507
|
const params = fromTableLoadToDataListParams(event);
|
|
1053
1508
|
if (this.useQueryParams()) {
|
|
1054
1509
|
if (!this.routerIsNavigationOutsideInProgress) {
|
|
@@ -1106,7 +1561,6 @@ class TableComponent {
|
|
|
1106
1561
|
this.dataProviderSubscription?.unsubscribe();
|
|
1107
1562
|
this.dataListService.loading.set(true);
|
|
1108
1563
|
this.latestParamsWithDefaults = paramsWithDefaults;
|
|
1109
|
-
this.latestParamsWithDefaultsVersion++;
|
|
1110
1564
|
this.dataProviderSubscription = toObservable$1(dataProvider.getAll(paramsWithDefaults, this.dataProviderService(), this.descriptor().isLocalized ? this.commons.appDataLocale() ?? undefined : undefined)).subscribe({
|
|
1111
1565
|
next: res => {
|
|
1112
1566
|
const descriptorInput = this.descriptorInput();
|
|
@@ -1136,10 +1590,8 @@ class TableComponent {
|
|
|
1136
1590
|
}
|
|
1137
1591
|
loadTableFromRouteUpdate(urlParams) {
|
|
1138
1592
|
const paramsWithDefaults = mergeDataListParamsWithDefaults(fromUrlQueryToDataListParams(urlParams), this.defaultParams());
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
this.updatePrimeSortAndFilter(paramsWithDefaults);
|
|
1142
|
-
}
|
|
1593
|
+
this.updatePrimeSortAndFilter(paramsWithDefaults);
|
|
1594
|
+
// }
|
|
1143
1595
|
this.useQueryParamsInitialized.set(true);
|
|
1144
1596
|
this.loadTableWithDataProvider(paramsWithDefaults);
|
|
1145
1597
|
}
|
|
@@ -1156,7 +1608,8 @@ class TableComponent {
|
|
|
1156
1608
|
Object.entries(paramsWithDefaults.filters).forEach(([key, value]) => {
|
|
1157
1609
|
primeFilterMeta[key] = {
|
|
1158
1610
|
value: value.value,
|
|
1159
|
-
matchMode: value.matchMode
|
|
1611
|
+
matchMode: value.matchMode,
|
|
1612
|
+
caseSensitive: value.caseSensitive
|
|
1160
1613
|
};
|
|
1161
1614
|
});
|
|
1162
1615
|
}
|
|
@@ -1174,10 +1627,9 @@ class TableComponent {
|
|
|
1174
1627
|
onColumnToggle(event) {
|
|
1175
1628
|
const layoutPrefs = this.layoutPreferences();
|
|
1176
1629
|
const selectedColumns = event.value.map(v => v.descriptor.property);
|
|
1177
|
-
|
|
1630
|
+
layoutPrefs.columnHidden = this.columns()
|
|
1178
1631
|
.filter(c => selectedColumns.indexOf(c.descriptor.property) < 0)
|
|
1179
1632
|
.map(c => c.descriptor.property);
|
|
1180
|
-
layoutPrefs.columnHidden = hiddenColumns;
|
|
1181
1633
|
this.saveLayoutPreferences(layoutPrefs);
|
|
1182
1634
|
}
|
|
1183
1635
|
onColumnToggleAll() {
|
|
@@ -1225,6 +1677,7 @@ class TableComponent {
|
|
|
1225
1677
|
limit: this.dataListService.rowsPerPageOptions()[0],
|
|
1226
1678
|
sort: this.descriptor()
|
|
1227
1679
|
.sorts.filter(s => s.defaultIsEnabled)
|
|
1680
|
+
.sort((s1, s2) => (s1.defaultOrder ?? 1000) - (s2.defaultOrder ?? 1000))
|
|
1228
1681
|
.map(s => ({
|
|
1229
1682
|
property: s.property,
|
|
1230
1683
|
ascending: s.defaultIsAscending
|
|
@@ -1281,7 +1734,8 @@ class TableComponent {
|
|
|
1281
1734
|
const columns = descriptor.columns.map(col => ({
|
|
1282
1735
|
id: `${col.property}-${timestamp}`,
|
|
1283
1736
|
descriptor: col,
|
|
1284
|
-
filter: descriptor.filters.find(f => f.showOnColumn === col.property
|
|
1737
|
+
filter: descriptor.filters.find(f => f.showOnColumn === col.property &&
|
|
1738
|
+
((f.displayType == null && this.defaultFilterDisplayType === FilterDisplayTypeEnum.Column) || f.displayType === FilterDisplayTypeEnum.Column)),
|
|
1285
1739
|
sort: descriptor.sorts.find(f => f.showOnColumn === col.property),
|
|
1286
1740
|
disabled: !col.isToggleable,
|
|
1287
1741
|
isVisible: layoutPrefs.columnHidden ? !layoutPrefs.columnHidden.includes(col.property) : col.isVisible,
|
|
@@ -1309,7 +1763,7 @@ class TableComponent {
|
|
|
1309
1763
|
}
|
|
1310
1764
|
}
|
|
1311
1765
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1312
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableComponent, isStandalone: true, selector: "mng-table", inputs: { descriptorInput: { classPropertyName: "descriptorInput", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, result: { classPropertyName: "result", publicName: "result", isSignal: true, isRequired: false, transformFunction: null }, loadingInput: { classPropertyName: "loadingInput", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null }, useQueryParams: { classPropertyName: "useQueryParams", publicName: "useQueryParams", isSignal: true, isRequired: false, transformFunction: null }, cellClickEnabled: { classPropertyName: "cellClickEnabled", publicName: "cellClickEnabled", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectionEnabled: { classPropertyName: "selectionEnabled", publicName: "selectionEnabled", isSignal: true, isRequired: false, transformFunction: null }, rowReorderEnabledInput: { classPropertyName: "rowReorderEnabledInput", publicName: "rowReorderEnabled", isSignal: true, isRequired: false, transformFunction: null }, columnLastMinWidth: { classPropertyName: "columnLastMinWidth", publicName: "columnLastMinWidth", isSignal: true, isRequired: false, transformFunction: null }, captionComponent: { classPropertyName: "captionComponent", publicName: "captionComponent", isSignal: true, isRequired: false, transformFunction: null }, columnCustomLastComponent: { classPropertyName: "columnCustomLastComponent", publicName: "columnCustomLastComponent", isSignal: true, isRequired: false, transformFunction: null }, globalFilterFieldsInput: { classPropertyName: "globalFilterFieldsInput", publicName: "globalFilterFields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tableLoad: "tableLoad", cellClick: "cellClick", selectionChange: "selectionChange", captionComponentInstance: "captionComponentInstance", columnCustomLastComponentInstance: "columnCustomLastComponentInstance", rowReorder: "rowReorder" }, providers: [DataListService], queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "components", predicate: (ComponentDirective), descendants: true, isSignal: true }, { propertyName: "primeTable", first: true, predicate: Table, descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (!useQueryParams() || useQueryParamsInitialized()) {\n <p-table\n [value]=\"dataListService.data()\"\n [dataKey]=\"descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"dataListService.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"dataListService.rows()\"\n [first]=\"dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"dataListService.sortMeta()\"\n [filters]=\"dataListService.filterMeta()\"\n [globalFilterFields]=\"dataListService.globalFilterFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"descriptor().hasResizableColumns\"\n [columnResizeMode]=\"descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n @if (captionTemplate() || captionComponent() || descriptor().title) {\n <ng-template pTemplate=\"caption\">\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <div [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></div>\n } @else {\n <h5 class=\"p-0 m-0\">{{ descriptor().title }}</h5>\n }\n </ng-template>\n }\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" class=\"col-1\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter-full [descriptor]=\"col.filter\"></mng-table-column-filter-full>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [pReorderableRow]=\"idx\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td class=\"col-1\">\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @if (rowReorderEnabled()) {\n <td>\n <span class=\"pi pi-bars\" pReorderableRowHandle></span>\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n @if (descriptor().rowExpandable) {\n <ng-template pTemplate=\"rowexpansion\" let-item>\n <tr>\n <td class=\"col-1\"></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </td>\n </tr>\n </ng-template>\n }\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: dataListService.data(), totalCount: dataListService.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n", dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "pipe", type: I18nPropertyPipe, name: "mngI18nProperty" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "pipe", type: ClassMapPipe, name: "mngClassMap" }, { kind: "pipe", type: LocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: TableColumnFilterFullComponent, selector: "mng-table-column-filter-full", inputs: ["descriptor"] }, { kind: "pipe", type: TableColumnFilterClassPipe, name: "mngTableColumnFilterClass" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$2.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$2.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$2.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$2.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$2.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$2.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$2.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "directive", type: i1$2.ReorderableRowHandle, selector: "[pReorderableRowHandle]" }, { kind: "directive", type: i1$2.ReorderableRow, selector: "[pReorderableRow]", inputs: ["pReorderableRow", "pReorderableRowDisabled"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3$1.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i4$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1766
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableComponent, isStandalone: true, selector: "mng-table", inputs: { descriptorInput: { classPropertyName: "descriptorInput", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, result: { classPropertyName: "result", publicName: "result", isSignal: true, isRequired: false, transformFunction: null }, loadingInput: { classPropertyName: "loadingInput", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null }, useQueryParams: { classPropertyName: "useQueryParams", publicName: "useQueryParams", isSignal: true, isRequired: false, transformFunction: null }, cellClickEnabled: { classPropertyName: "cellClickEnabled", publicName: "cellClickEnabled", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectionEnabled: { classPropertyName: "selectionEnabled", publicName: "selectionEnabled", isSignal: true, isRequired: false, transformFunction: null }, rowReorderEnabledInput: { classPropertyName: "rowReorderEnabledInput", publicName: "rowReorderEnabled", isSignal: true, isRequired: false, transformFunction: null }, columnLastMinWidth: { classPropertyName: "columnLastMinWidth", publicName: "columnLastMinWidth", isSignal: true, isRequired: false, transformFunction: null }, captionComponent: { classPropertyName: "captionComponent", publicName: "captionComponent", isSignal: true, isRequired: false, transformFunction: null }, columnCustomLastComponent: { classPropertyName: "columnCustomLastComponent", publicName: "columnCustomLastComponent", isSignal: true, isRequired: false, transformFunction: null }, globalFilterFieldsInput: { classPropertyName: "globalFilterFieldsInput", publicName: "globalFilterFields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tableLoad: "tableLoad", cellClick: "cellClick", selectionChange: "selectionChange", captionComponentInstance: "captionComponentInstance", columnCustomLastComponentInstance: "columnCustomLastComponentInstance", rowReorder: "rowReorder" }, providers: [DataListService], queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "components", predicate: (ComponentDirective), descendants: true, isSignal: true }, { propertyName: "primeTable", first: true, predicate: Table, descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (!useQueryParams() || useQueryParamsInitialized()) {\n <p-table\n [value]=\"dataListService.data()\"\n [dataKey]=\"descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"dataListService.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"dataListService.rows()\"\n [first]=\"dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"dataListService.sortMeta()\"\n [filters]=\"dataListService.filterMeta()\"\n [globalFilterFields]=\"dataListService.globalFilterFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"descriptor().hasResizableColumns\"\n [columnResizeMode]=\"descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0) {\n <mng-filter-overlay-with-tag [title]=\"descriptor().title\" [descriptors]=\"overlayWithTagFilters()\" [model]=\"descriptor().model\">\n @if (hasTitleDisplay()) {\n <ng-template mngTemplate=\"title\">\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n </ng-template>\n }\n </mng-filter-overlay-with-tag>\n } @else {\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n }\n <ng-template #captionTemplateOrComponentOrTitle>\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <ng-container [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></ng-container>\n } @else if (descriptor().title) {\n <h5 class=\"p-0 m-0\">{{ descriptor().title! | translate }}</h5>\n }\n </ng-template>\n </div>\n }\n </ng-template>\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter [descriptor]=\"col.filter\"></mng-table-column-filter>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [pReorderableRow]=\"idx\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td>\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain mng-table-row-expand-button\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @if (rowReorderEnabled()) {\n <td>\n <span class=\"pi pi-bars\" pReorderableRowHandle></span>\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template pTemplate=\"rowexpansion\" let-item>\n @if (descriptor().rowExpandable) {\n <tr>\n <td></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n @if (descriptor().rowExpandableComponentType !== undefined) {\n <ng-container\n [mngComponent]=\"descriptor().rowExpandableComponentType\"\n [inputs]=\"{item}\">\n </ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n }\n </td>\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: dataListService.data(), totalCount: dataListService.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n", dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "pipe", type: I18nPropertyPipe, name: "mngI18nProperty" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "pipe", type: ClassMapPipe, name: "mngClassMap" }, { kind: "pipe", type: LocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: TableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor"] }, { kind: "pipe", type: TableColumnFilterClassPipe, name: "mngTableColumnFilterClass" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$4.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$4.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$4.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$4.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$4.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$4.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$4.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$4.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$4.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$4.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "directive", type: i1$4.ReorderableRowHandle, selector: "[pReorderableRowHandle]" }, { kind: "directive", type: i1$4.ReorderableRow, selector: "[pReorderableRow]", inputs: ["pReorderableRow", "pReorderableRowDisabled"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i4$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$2.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: FilterOverlayWithTagComponent, selector: "mng-filter-overlay-with-tag", inputs: ["descriptors", "model"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: TemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1313
1767
|
}
|
|
1314
1768
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableComponent, decorators: [{
|
|
1315
1769
|
type: Component,
|
|
@@ -1323,22 +1777,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
1323
1777
|
TableColumnValueComponent,
|
|
1324
1778
|
ClassMapPipe,
|
|
1325
1779
|
LocaleDefaultRowClassPipe,
|
|
1326
|
-
|
|
1780
|
+
TableColumnFilterComponent,
|
|
1327
1781
|
TableColumnFilterClassPipe,
|
|
1328
1782
|
TableModule,
|
|
1329
1783
|
MultiSelectModule,
|
|
1330
1784
|
ButtonModule,
|
|
1331
1785
|
TooltipModule,
|
|
1332
1786
|
TranslateModule,
|
|
1333
|
-
|
|
1334
|
-
], providers: [DataListService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (!useQueryParams() || useQueryParamsInitialized()) {\n <p-table\n [value]=\"dataListService.data()\"\n [dataKey]=\"descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"dataListService.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"dataListService.rows()\"\n [first]=\"dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"dataListService.sortMeta()\"\n [filters]=\"dataListService.filterMeta()\"\n [globalFilterFields]=\"dataListService.globalFilterFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"descriptor().hasResizableColumns\"\n [columnResizeMode]=\"descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n @if (captionTemplate() || captionComponent() || descriptor().title) {\n <ng-template pTemplate=\"caption\">\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <div [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></div>\n } @else {\n <h5 class=\"p-0 m-0\">{{ descriptor().title }}</h5>\n }\n </ng-template>\n }\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" class=\"col-1\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter-full [descriptor]=\"col.filter\"></mng-table-column-filter-full>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [pReorderableRow]=\"idx\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td class=\"col-1\">\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @if (rowReorderEnabled()) {\n <td>\n <span class=\"pi pi-bars\" pReorderableRowHandle></span>\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n @if (descriptor().rowExpandable) {\n <ng-template pTemplate=\"rowexpansion\" let-item>\n <tr>\n <td class=\"col-1\"></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </td>\n </tr>\n </ng-template>\n }\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: dataListService.data(), totalCount: dataListService.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n" }]
|
|
1787
|
+
FilterOverlayWithTagComponent,
|
|
1788
|
+
FormsModule,
|
|
1789
|
+
TemplateDirective
|
|
1790
|
+
], providers: [DataListService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (!useQueryParams() || useQueryParamsInitialized()) {\n <p-table\n [value]=\"dataListService.data()\"\n [dataKey]=\"descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"dataListService.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"dataListService.rows()\"\n [first]=\"dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"dataListService.sortMeta()\"\n [filters]=\"dataListService.filterMeta()\"\n [globalFilterFields]=\"dataListService.globalFilterFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"descriptor().hasResizableColumns\"\n [columnResizeMode]=\"descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n (onColResize)=\"onTableColumnResize($event)\"\n (onColReorder)=\"onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0) {\n <mng-filter-overlay-with-tag [title]=\"descriptor().title\" [descriptors]=\"overlayWithTagFilters()\" [model]=\"descriptor().model\">\n @if (hasTitleDisplay()) {\n <ng-template mngTemplate=\"title\">\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n </ng-template>\n }\n </mng-filter-overlay-with-tag>\n } @else {\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n }\n <ng-template #captionTemplateOrComponentOrTitle>\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <ng-container [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></ng-container>\n } @else if (descriptor().title) {\n <h5 class=\"p-0 m-0\">{{ descriptor().title! | translate }}</h5>\n }\n </ng-template>\n </div>\n }\n </ng-template>\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter [descriptor]=\"col.filter\"></mng-table-column-filter>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [pReorderableRow]=\"idx\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td>\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain mng-table-row-expand-button\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @if (rowReorderEnabled()) {\n <td>\n <span class=\"pi pi-bars\" pReorderableRowHandle></span>\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template pTemplate=\"rowexpansion\" let-item>\n @if (descriptor().rowExpandable) {\n <tr>\n <td></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n @if (descriptor().rowExpandableComponentType !== undefined) {\n <ng-container\n [mngComponent]=\"descriptor().rowExpandableComponentType\"\n [inputs]=\"{item}\">\n </ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n }\n </td>\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: dataListService.data(), totalCount: dataListService.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n" }]
|
|
1335
1791
|
}], ctorParameters: () => [] });
|
|
1336
1792
|
|
|
1793
|
+
/**
|
|
1794
|
+
* Prepares providers for usage of the tableview functionalities.
|
|
1795
|
+
*
|
|
1796
|
+
* @returns {CommonsFeature} The `CommonsFeature` object with the layout configuration.
|
|
1797
|
+
*/
|
|
1798
|
+
function withTable(config) {
|
|
1799
|
+
return {
|
|
1800
|
+
type: CommonsFeatureTypeEnum.Table,
|
|
1801
|
+
providers: [
|
|
1802
|
+
{
|
|
1803
|
+
provide: COMMONS_TABLE_FEATURE_CONFIG_IT,
|
|
1804
|
+
useValue: config
|
|
1805
|
+
}
|
|
1806
|
+
]
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1337
1810
|
// components
|
|
1338
1811
|
|
|
1339
1812
|
/**
|
|
1340
1813
|
* Generated bundle index. Do not edit.
|
|
1341
1814
|
*/
|
|
1342
1815
|
|
|
1343
|
-
export { DataListService, LocaleDefaultRowClassPipe, TableColumnFilterClassPipe,
|
|
1816
|
+
export { COMMONS_TABLE_FEATURE_CONFIG_IT, DataListService, FilterActiveTagComponent, FilterFormComponent, FilterOverlayWithTagComponent, FilterValuePipe, LocaleDefaultRowClassPipe, TableColumnFilterClassPipe, TableColumnFilterComponent, TableColumnValueComponent, TableComponent, filterAdjustDisplayValueOnMatchModeChange, filterApplySerializationConfigToCmp, filterAreDatesEqual, filterGetDateConfig, filterGetDefaultMatchMode, filterGetNumberConfig, filterSetMetadataOnChange, filterSetMetadataOnDisplayChange, generateMatchModeOptions, generateTableLayoutPrefsKey, tableNotificationError, withTable };
|
|
1344
1817
|
//# sourceMappingURL=mediusinc-mng-commons-table.mjs.map
|