@mediusinc/mng-commons 5.5.0-rc.0 → 5.5.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/descriptors/table.descriptor.d.ts +4 -2
- package/core/directives/rerender.directive.d.ts +9 -0
- package/core/helpers/route.d.ts +25 -25
- package/core/index.d.ts +2 -0
- package/core/reactivity/effect.d.ts +16 -0
- package/esm2022/core/components/notification/notification-wrapper.component.mjs +4 -4
- package/esm2022/core/components/pages/error/error.page.component.mjs +4 -4
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +4 -4
- package/esm2022/core/data-list/data-list-params-helpers.mjs +18 -3
- package/esm2022/core/descriptors/table.descriptor.mjs +1 -1
- package/esm2022/core/directives/component.directive.mjs +4 -4
- package/esm2022/core/directives/rerender.directive.mjs +25 -0
- package/esm2022/core/directives/template.directive.mjs +4 -4
- package/esm2022/core/index.mjs +4 -1
- package/esm2022/core/pipes/boolean.pipe.mjs +6 -6
- package/esm2022/core/pipes/class-map.pipe.mjs +4 -4
- package/esm2022/core/pipes/enum.pipe.mjs +4 -4
- package/esm2022/core/pipes/enumerate-async.pipe.mjs +4 -4
- package/esm2022/core/pipes/enumerate.pipe.mjs +4 -4
- package/esm2022/core/pipes/getter.pipe.mjs +5 -5
- package/esm2022/core/pipes/i18n-property.pipe.mjs +4 -4
- package/esm2022/core/pipes/json-path.pipe.mjs +4 -4
- package/esm2022/core/pipes/parametrize.pipe.mjs +4 -4
- package/esm2022/core/pipes/template.pipe.mjs +4 -4
- package/esm2022/core/reactivity/effect.mjs +22 -0
- package/esm2022/core/security/permission.service.mjs +4 -4
- package/esm2022/core/services/commons-init.service.mjs +4 -4
- package/esm2022/core/services/commons-router.service.mjs +4 -4
- package/esm2022/core/services/commons-storage.service.mjs +4 -4
- package/esm2022/core/services/commons.service.mjs +8 -8
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +32 -25
- package/esm2022/filter/descriptors/filter.descriptor.mjs +53 -1
- package/esm2022/form/components/autocomplete/autocomplete.component.mjs +4 -4
- package/esm2022/form/components/date-range/date-range.component.mjs +4 -4
- package/esm2022/form/components/dropdown/dropdown.component.mjs +4 -4
- package/esm2022/form/components/number-range/number-range.component.mjs +4 -4
- package/esm2022/form/directives/input-trim.directive.mjs +4 -4
- package/esm2022/table/api/descriptors/sort.descriptor.mjs +2 -2
- package/esm2022/table/api/descriptors/table.descriptor.mjs +32 -8
- package/esm2022/table/components/column-filter/column-filter.component.mjs +33 -40
- package/esm2022/table/components/column-value/column-value.component.mjs +6 -6
- package/esm2022/table/components/filter/filter-active-tag/filter-active-tag.component.mjs +7 -7
- package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +24 -34
- package/esm2022/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.mjs +44 -45
- package/esm2022/table/components/table/table.component.mjs +114 -430
- package/esm2022/table/helpers/filters.mjs +9 -25
- package/esm2022/table/helpers/table.mjs +24 -0
- package/esm2022/table/index.mjs +2 -2
- package/esm2022/table/models/column-preferences.model.mjs +1 -1
- package/esm2022/table/models/filter.model.mjs +1 -1
- package/esm2022/table/pipes/filter-value.pipe.mjs +4 -4
- package/esm2022/table/pipes/locale-default-row-class.pipe.mjs +4 -4
- package/esm2022/table/pipes/table-column-filter-class.pipe.mjs +4 -4
- package/esm2022/table/services/table-data.service.mjs +194 -0
- package/esm2022/table/services/table-metadata.service.mjs +136 -0
- package/esm2022/table/services/table-preferences.service.mjs +142 -0
- package/esm2022/tableview/action/components/action/action.component.mjs +6 -7
- package/esm2022/tableview/action/components/editor/action-editor.component.mjs +4 -4
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +69 -46
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +4 -4
- package/esm2022/tableview/action/components/route/action-route.component.mjs +5 -6
- package/esm2022/tableview/action/components/table/action-table.component.mjs +4 -4
- package/esm2022/tableview/action/helpers/action-execution.mjs +25 -0
- package/esm2022/tableview/action/models/execution/action-instance.model.mjs +2 -3
- package/esm2022/tableview/action/services/action-executor.service.mjs +12 -79
- package/esm2022/tableview/action/services/component-action-executor.service.mjs +4 -4
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +4 -4
- package/esm2022/tableview/action/services/navigation.service.mjs +4 -4
- package/esm2022/tableview/action/services/root-action-executor.service.mjs +4 -4
- package/esm2022/tableview/action/services/view-container.service.mjs +4 -4
- package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +13 -1
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +67 -10
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +2 -2
- package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +17 -1
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +32 -7
- package/esm2022/tableview/api/action/models/execution/action-instance-state.model.mjs +2 -2
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +20 -1
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +2 -1
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +4 -4
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +13 -5
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +3 -2
- package/esm2022/tableview/api/tableview/helpers/tableview-descriptor-helpers.mjs +2 -2
- package/esm2022/tableview/editor/components/editor/auto-save-status/auto-save-status.component.mjs +4 -4
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +31 -38
- package/esm2022/tableview/editor/components/formly/constants.mjs +2 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +7 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.mjs +7 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +7 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +5 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-label/formly-field-label.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +5 -6
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +10 -6
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +11 -7
- package/esm2022/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-type.abstract.component.mjs +6 -5
- package/esm2022/tableview/editor/components/formly/pipes/formly-field-label.pipe.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +10 -5
- package/esm2022/tableview/editor/helpers/editor-autosave.mjs +2 -2
- package/esm2022/tableview/editor/services/form-editor.service.mjs +4 -4
- package/esm2022/tableview/index.mjs +1 -2
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +4 -4
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +4 -4
- package/fesm2022/mediusinc-mng-commons-core.mjs +130 -71
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-filter.mjs +83 -24
- package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +15 -15
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +32 -8
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +700 -603
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +165 -26
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +265 -317
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/filter/descriptors/filter-lookup.descriptor.d.ts +17 -20
- package/filter/descriptors/filter.descriptor.d.ts +32 -2
- package/form/components/date-range/date-range.component.d.ts +3 -3
- package/form/components/number-range/number-range.component.d.ts +2 -2
- package/package.json +4 -4
- package/table/api/descriptors/column.descriptor.d.ts +1 -1
- package/table/api/descriptors/sort.descriptor.d.ts +2 -2
- package/table/api/descriptors/table.descriptor.d.ts +21 -7
- package/table/components/column-filter/column-filter.component.d.ts +8 -14
- package/table/components/filter/filter-active-tag/filter-active-tag.component.d.ts +5 -5
- package/table/components/filter/filter-form/filter-form.component.d.ts +10 -19
- package/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.d.ts +11 -13
- package/table/components/table/table.component.d.ts +20 -64
- package/table/helpers/filters.d.ts +4 -7
- package/table/helpers/table.d.ts +6 -0
- package/table/index.d.ts +1 -1
- package/table/models/column-preferences.model.d.ts +2 -2
- package/table/models/filter.model.d.ts +14 -2
- package/table/services/table-data.service.d.ts +36 -0
- package/table/services/table-metadata.service.d.ts +31 -0
- package/table/services/table-preferences.service.d.ts +25 -0
- package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +4 -7
- package/tableview/action/components/localization/data-language-dropdown.component.d.ts +1 -1
- package/tableview/action/helpers/action-execution.d.ts +7 -0
- package/tableview/action/models/execution/action-instance.model.d.ts +1 -2
- package/tableview/action/services/action-executor.service.d.ts +1 -2
- package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +1 -0
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +12 -4
- package/tableview/api/action/descriptors/action-link.descriptor.d.ts +1 -0
- package/tableview/api/action/descriptors/action.descriptor.d.ts +5 -3
- package/tableview/api/action/models/execution/action-instance-state.model.d.ts +1 -1
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +15 -10
- package/tableview/api/editor/descriptors/field-group.descriptor.d.ts +1 -1
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +6 -4
- package/tableview/editor/components/editor/form-editor.component.d.ts +3 -2
- package/tableview/editor/components/formly/constants.d.ts +1 -0
- package/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +1 -1
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +1 -0
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +1 -0
- package/tableview/editor/components/formly/fields/formly-field-type.abstract.component.d.ts +2 -1
- package/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +1 -0
- package/tableview/index.d.ts +0 -1
- package/version-info.json +5 -5
- package/esm2022/table/services/data-list.service.mjs +0 -29
- package/esm2022/tableview/action/models/execution/action-instance-state.model.mjs +0 -32
- package/table/services/data-list.service.d.ts +0 -19
- package/tableview/action/models/execution/action-instance-state.model.d.ts +0 -30
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
2
2
|
import { NgClass, NgTemplateOutlet, DecimalPipe, CurrencyPipe, DatePipe, AsyncPipe, NgStyle } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { signal,
|
|
5
|
-
import { toSignal,
|
|
4
|
+
import { InjectionToken, inject, Injector, signal, computed, Injectable, ElementRef, Renderer2, ChangeDetectorRef, DestroyRef, input, viewChild, effect, untracked, Component, ViewEncapsulation, ChangeDetectionStrategy, LOCALE_ID, Pipe, output, booleanAttribute, contentChildren, viewChildren, afterNextRender } from '@angular/core';
|
|
5
|
+
import { toSignal, toObservable, takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i1 from '@angular/forms';
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
8
|
import * as i2 from '@ngx-translate/core';
|
|
@@ -23,17 +23,17 @@ import { InputTextModule } from 'primeng/inputtext';
|
|
|
23
23
|
import * as i1$3 from 'primeng/table';
|
|
24
24
|
import { Table, TableModule } from 'primeng/table';
|
|
25
25
|
import { ZIndexUtils } from 'primeng/utils';
|
|
26
|
-
import { Subject, debounceTime, distinctUntilChanged, ReplaySubject,
|
|
27
|
-
import { FilterMatchMode, dateToIsoString, angularDateFormatHasTime, fromAngularDateFormatToPrime, angularDateFormatHasSeconds, fromAngularNumberFormatToFractions, COMMONS_MODULE_CONFIG_IT, GetterPipe, TemplatePipe, BooleanPipe, EnumPipe, ComponentDirective, getI18nTypePropertyKey, TemplateDirective, findTemplateByName, toastMessage,
|
|
28
|
-
import { FilterTypeEnum,
|
|
26
|
+
import { combineLatest, switchMap, of, Subject, debounceTime, distinctUntilChanged, ReplaySubject, NEVER, BehaviorSubject, skip, filter } from 'rxjs';
|
|
27
|
+
import { FilterMatchMode, dateToIsoString, angularDateFormatHasTime, fromAngularDateFormatToPrime, angularDateFormatHasSeconds, fromAngularNumberFormatToFractions, COMMONS_MODULE_CONFIG_IT, effectWithDeps, toObservable as toObservable$1, CommonsService, RerenderDirective, GetterPipe, TemplatePipe, BooleanPipe, EnumPipe, ComponentDirective, getI18nTypePropertyKey, TemplateDirective, findTemplateByName, toastMessage, CommonsStorageService, LoggerService, booleanOrUndefinedAttribute, mergeDataListParamsWithDefaults, fromTableLoadToDataListParams, dataListParamsToUrlQuery, fromSubscribeError, getErrorLogLevel, fromUrlQueryToDataListParams, I18nPropertyPipe, ClassMapPipe, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons/core';
|
|
28
|
+
import { FilterTypeEnum, FilterDescriptor, FilterDisplayTypeEnum, FilterLookupTypeEnum, FilterLookupDescriptor } from '@mediusinc/mng-commons/filter';
|
|
29
29
|
import { DateRangeComponent, AutocompleteComponent, DropdownComponent, InputTrimDirective, NumberRangeComponent } from '@mediusinc/mng-commons/form';
|
|
30
|
+
import { tableDescriptor, TableDynamicDescriptorInst, TablePaginationModeEnum, ColumnDisplayTypeEnum, TableSizeEnum } from '@mediusinc/mng-commons/table/api';
|
|
30
31
|
import * as i4$1 from 'primeng/button';
|
|
31
32
|
import { ButtonModule, Button } from 'primeng/button';
|
|
32
33
|
import * as i4$2 from 'primeng/ripple';
|
|
33
34
|
import { RippleModule } from 'primeng/ripple';
|
|
34
35
|
import * as i1$1 from 'primeng/tooltip';
|
|
35
36
|
import { TooltipModule } from 'primeng/tooltip';
|
|
36
|
-
import { ColumnDisplayTypeEnum, TablePaginationModeEnum, TableSizeEnum, tableDescriptor, TableDynamicDescriptorInst } from '@mediusinc/mng-commons/table/api';
|
|
37
37
|
import * as i2$2 from 'primeng/tag';
|
|
38
38
|
import { TagModule } from 'primeng/tag';
|
|
39
39
|
import { DropdownModule } from 'primeng/dropdown';
|
|
@@ -50,10 +50,9 @@ import { PaginatorModule } from 'primeng/paginator';
|
|
|
50
50
|
import { Router, ActivatedRoute, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
51
51
|
import * as i3 from 'primeng/multiselect';
|
|
52
52
|
import { MultiSelectModule } from 'primeng/multiselect';
|
|
53
|
-
import { filter } from 'rxjs/operators';
|
|
54
53
|
import { getI18nForModel } from '@mediusinc/mng-commons/model';
|
|
55
54
|
|
|
56
|
-
function
|
|
55
|
+
function filterGenerateMatchModeOptions(primeConfig, descriptor, cmpSerCfg) {
|
|
57
56
|
let options = undefined;
|
|
58
57
|
if (descriptor == null || descriptor.filterType === FilterTypeEnum.String) {
|
|
59
58
|
options = [
|
|
@@ -80,18 +79,12 @@ function generateMatchModeOptions(primeConfig, descriptor, cmpSerCfg) {
|
|
|
80
79
|
];
|
|
81
80
|
}
|
|
82
81
|
else if (descriptor.filterType === FilterTypeEnum.Lookup || descriptor.filterType === FilterTypeEnum.LookupEnum) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
else {
|
|
90
|
-
options = [
|
|
91
|
-
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
92
|
-
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) }
|
|
93
|
-
];
|
|
94
|
-
}
|
|
82
|
+
options = [
|
|
83
|
+
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
84
|
+
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
85
|
+
{ value: FilterMatchMode.In, label: primeConfig.getTranslation(FilterMatchMode.In) },
|
|
86
|
+
{ value: FilterMatchMode.NotIn, label: primeConfig.getTranslation(FilterMatchMode.NotIn) }
|
|
87
|
+
];
|
|
95
88
|
}
|
|
96
89
|
else if (descriptor.filterType === FilterTypeEnum.Date) {
|
|
97
90
|
if (!descriptor.datePickerShowTime && !descriptor.dateValueNoTime && !cmpSerCfg?.filtersDateOnlyDisabled) {
|
|
@@ -130,16 +123,6 @@ function filterGetDefaultMatchMode(descriptor, matchModes = []) {
|
|
|
130
123
|
let defaultMatchMode = FilterMatchMode.Equals;
|
|
131
124
|
if (descriptor?.filterType === FilterTypeEnum.String)
|
|
132
125
|
defaultMatchMode = FilterMatchMode.StartsWith;
|
|
133
|
-
else if (descriptor?.filterType === FilterTypeEnum.Number || descriptor?.filterType === FilterTypeEnum.Date || descriptor?.filterType === FilterTypeEnum.Boolean)
|
|
134
|
-
defaultMatchMode = FilterMatchMode.Equals;
|
|
135
|
-
else if (descriptor?.filterType === FilterTypeEnum.Lookup || descriptor?.filterType === FilterTypeEnum.LookupEnum) {
|
|
136
|
-
if (descriptor instanceof FilterLookupDescriptor) {
|
|
137
|
-
defaultMatchMode = descriptor?.multiselect ? FilterMatchMode.In : FilterMatchMode.Equals;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
defaultMatchMode = FilterMatchMode.Equals;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
126
|
// overwrite type default set in descriptor
|
|
144
127
|
if (descriptor?.defaultMatchMode) {
|
|
145
128
|
defaultMatchMode = descriptor.defaultMatchMode;
|
|
@@ -379,30 +362,343 @@ function createFilterDescriptorsFromGeneric(properties, valueLookup) {
|
|
|
379
362
|
}, []);
|
|
380
363
|
}
|
|
381
364
|
|
|
382
|
-
|
|
365
|
+
function tableCreateFilterMeta(paramsWithDefaults) {
|
|
366
|
+
const primeFilterMeta = {};
|
|
367
|
+
// if any filter is present, no default filters should be applied!
|
|
368
|
+
if (paramsWithDefaults?.filters) {
|
|
369
|
+
Object.entries(paramsWithDefaults.filters).forEach(([key, value]) => {
|
|
370
|
+
primeFilterMeta[key] = {
|
|
371
|
+
value: value?.value,
|
|
372
|
+
matchMode: value?.matchMode,
|
|
373
|
+
caseSensitive: value?.caseSensitive
|
|
374
|
+
};
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
return primeFilterMeta;
|
|
378
|
+
}
|
|
379
|
+
function tableCreateSortMeta(paramsWithDefaults) {
|
|
380
|
+
if (paramsWithDefaults?.sort !== undefined && Array.isArray(paramsWithDefaults?.sort) && paramsWithDefaults?.sort.length > 0) {
|
|
381
|
+
return paramsWithDefaults?.sort.map(s => ({
|
|
382
|
+
field: s.property,
|
|
383
|
+
order: s.ascending ? 1 : -1
|
|
384
|
+
}));
|
|
385
|
+
}
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const COMMONS_TABLE_FEATURE_CONFIG_IT = new InjectionToken('COMMONS_TABLE_FEATURE_CONFIG');
|
|
390
|
+
|
|
391
|
+
class TableMetadataService {
|
|
392
|
+
static { this.cmpTypeName = 'TableComponent'; }
|
|
393
|
+
#injector;
|
|
394
|
+
#translationObserver;
|
|
395
|
+
// signal sources
|
|
396
|
+
#signalSources;
|
|
397
|
+
#descriptor;
|
|
398
|
+
#updateDescriptorFromSourceEffect;
|
|
399
|
+
#genericFilters;
|
|
400
|
+
// search
|
|
401
|
+
#searchFieldsFromSignalSource;
|
|
402
|
+
#searchFields;
|
|
403
|
+
#searchFieldsEffect;
|
|
383
404
|
constructor() {
|
|
405
|
+
this.#injector = inject(Injector);
|
|
406
|
+
this.primeConfig = inject(PrimeNGConfig);
|
|
407
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
408
|
+
this.tableModuleConfig = inject(COMMONS_TABLE_FEATURE_CONFIG_IT, { optional: true });
|
|
409
|
+
this.serializationCfg = {};
|
|
410
|
+
this.#translationObserver = toSignal(this.primeConfig.translationObserver);
|
|
411
|
+
this.defaultFilterDisplayType = this.tableModuleConfig?.filterDisplayType ?? FilterDisplayTypeEnum.Column;
|
|
412
|
+
// signal sources
|
|
413
|
+
this.#signalSources = signal({});
|
|
414
|
+
// descriptors
|
|
415
|
+
this.descriptorFromSource = computed(() => this.#signalSources().descriptor?.());
|
|
416
|
+
this.#descriptor = signal(tableDescriptor());
|
|
417
|
+
this.descriptor = this.#descriptor.asReadonly();
|
|
418
|
+
this.#updateDescriptorFromSourceEffect = effectWithDeps([this.descriptorFromSource], ([d]) => {
|
|
419
|
+
if (d != null) {
|
|
420
|
+
this.#descriptor.set(d);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
384
423
|
// pagination
|
|
385
|
-
this.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
424
|
+
this.rowsPerPageOptions = computed(() => {
|
|
425
|
+
const descriptor = this.descriptor();
|
|
426
|
+
if (Array.isArray(descriptor.rowsPerPageOptions) && descriptor.rowsPerPageOptions.length > 0) {
|
|
427
|
+
return descriptor.rowsPerPageOptions;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
return [25, 50, 100];
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
// filters
|
|
434
|
+
this.filterDescriptors = computed(() => this.descriptor().filters);
|
|
435
|
+
this.filters = computed(() => {
|
|
436
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
437
|
+
const observer = this.#translationObserver(); // need this one to track language changes
|
|
438
|
+
return this.filterDescriptors().map(d => this.mapDescriptorToMetadata(d));
|
|
439
|
+
});
|
|
440
|
+
this.genericFilterDescriptor = computed(() => this.descriptor().genericFilter);
|
|
441
|
+
this.#genericFilters = signal([]);
|
|
442
|
+
this.genericFilters = this.#genericFilters.asReadonly();
|
|
443
|
+
// search
|
|
444
|
+
this.#searchFieldsFromSignalSource = computed(() => this.#signalSources().searchFields?.());
|
|
445
|
+
this.#searchFields = signal([]);
|
|
446
|
+
this.searchFields = this.#searchFields.asReadonly();
|
|
447
|
+
this.#searchFieldsEffect = effectWithDeps([this.descriptor, this.#searchFieldsFromSignalSource], ([descriptor, searchFieldsFromSignalSource]) => {
|
|
448
|
+
this.#searchFields.set(searchFieldsFromSignalSource ?? (descriptor.search && descriptor.searchFields ? descriptor.searchFields : this.descriptor().columns.map(c => c.property)));
|
|
449
|
+
});
|
|
450
|
+
// params
|
|
451
|
+
this.defaultParams = computed(() => {
|
|
452
|
+
const params = {
|
|
453
|
+
offset: 0,
|
|
454
|
+
limit: this.rowsPerPageOptions()[0],
|
|
455
|
+
sort: this.descriptor()
|
|
456
|
+
.sorts.filter(s => s.defaultIsEnabled)
|
|
457
|
+
.sort((s1, s2) => (s1.defaultOrder ?? 1000) - (s2.defaultOrder ?? 1000))
|
|
458
|
+
.map(s => ({
|
|
459
|
+
property: s.property,
|
|
460
|
+
ascending: s.defaultIsAscending
|
|
461
|
+
})),
|
|
462
|
+
filters: {}
|
|
463
|
+
};
|
|
464
|
+
this.filters()
|
|
465
|
+
.filter(f => f.descriptor.hasDefaultValue)
|
|
466
|
+
.forEach(f => {
|
|
467
|
+
params.filters[f.descriptor.property] = {
|
|
468
|
+
value: f.descriptor.defaultValue,
|
|
469
|
+
matchMode: f.defaultMatchMode
|
|
470
|
+
};
|
|
471
|
+
});
|
|
472
|
+
return params;
|
|
473
|
+
});
|
|
474
|
+
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
475
|
+
combineLatest([toObservable(this.genericFilterDescriptor), toObservable(this.#translationObserver)])
|
|
476
|
+
.pipe(switchMap(([genericFilterDescriptor]) => {
|
|
477
|
+
if (genericFilterDescriptor) {
|
|
478
|
+
const dataProvider = this.genericFilterDescriptor()?.propertyLookup;
|
|
479
|
+
const genericFilterService = dataProvider?.serviceType ? this.#injector.get(dataProvider.serviceType) : null;
|
|
480
|
+
// fetch filterable properties
|
|
481
|
+
return toObservable$1(genericFilterDescriptor.propertyLookup.lookup({}, genericFilterService));
|
|
482
|
+
}
|
|
483
|
+
return of([]);
|
|
484
|
+
}), takeUntilDestroyed())
|
|
485
|
+
.subscribe({
|
|
486
|
+
next: genericFilters => {
|
|
487
|
+
// set descriptors from generic filter data
|
|
488
|
+
this.#genericFilters.set(createFilterDescriptorsFromGeneric(genericFilters, this.genericFilterDescriptor()?.valueLookup).map(d => this.mapDescriptorToMetadata(d)));
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
setSignalSources(descriptor, searchFields) {
|
|
493
|
+
this.#signalSources.set({ descriptor, searchFields });
|
|
494
|
+
}
|
|
495
|
+
setDescriptor(descriptor) {
|
|
496
|
+
if (this.descriptorFromSource() instanceof TableDynamicDescriptorInst) {
|
|
497
|
+
this.#descriptor.set(descriptor);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
mapDescriptorToMetadata(descriptor) {
|
|
501
|
+
const matchModes = filterGenerateMatchModeOptions(this.primeConfig, descriptor, this.serializationCfg);
|
|
502
|
+
return {
|
|
503
|
+
descriptor: descriptor,
|
|
504
|
+
matchModes: matchModes,
|
|
505
|
+
defaultMatchMode: filterGetDefaultMatchMode(descriptor, matchModes),
|
|
506
|
+
dateConfig: filterGetDateConfig(descriptor, this.serializationCfg),
|
|
507
|
+
numberConfig: filterGetNumberConfig(descriptor)
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableMetadataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
511
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableMetadataService }); }
|
|
512
|
+
}
|
|
513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableMetadataService, decorators: [{
|
|
514
|
+
type: Injectable
|
|
515
|
+
}], ctorParameters: () => [] });
|
|
516
|
+
|
|
517
|
+
class TableDataService {
|
|
518
|
+
constructor() {
|
|
519
|
+
this.#injector = inject(Injector);
|
|
520
|
+
this.#commons = inject(CommonsService);
|
|
521
|
+
this.#metadata = inject(TableMetadataService);
|
|
522
|
+
// signal sources
|
|
523
|
+
this.#dataSources = signal({});
|
|
524
|
+
// data sources
|
|
525
|
+
this.#manualLoading = computed(() => this.#dataSources()?.manualLoading?.());
|
|
526
|
+
// results that are set directly via input and are not result of a asynchronous operation (aka data provider)
|
|
527
|
+
this.#synchronousResult = computed(() => {
|
|
528
|
+
const dataSources = this.#dataSources();
|
|
529
|
+
if (dataSources?.dataProvider?.() !== undefined) {
|
|
530
|
+
return undefined;
|
|
531
|
+
}
|
|
532
|
+
if (dataSources?.dataListResult?.() !== undefined) {
|
|
533
|
+
return dataSources?.dataListResult();
|
|
534
|
+
}
|
|
535
|
+
if (dataSources?.arrayItems?.() !== undefined) {
|
|
536
|
+
return { data: dataSources.arrayItems(), totalCount: dataSources.arrayItems()?.length ?? 0 };
|
|
537
|
+
}
|
|
538
|
+
return undefined;
|
|
539
|
+
});
|
|
540
|
+
this.#dataProvider = computed(() => this.#dataSources()?.dataProvider?.());
|
|
541
|
+
this.#dataProviderService = computed(() => {
|
|
542
|
+
const dataProvider = this.#dataProvider();
|
|
543
|
+
return dataProvider?.serviceType ? this.#injector.get(dataProvider.serviceType) : null;
|
|
544
|
+
});
|
|
545
|
+
this.#synchronousResultEffect = effectWithDeps([this.#synchronousResult], ([res]) => {
|
|
546
|
+
if (res != null) {
|
|
547
|
+
this.#setData(res.data ?? [], res.totalCount);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
this.#synchronousLoadingEffect = effectWithDeps([this.#synchronousResult, this.#manualLoading], ([res, manualLoading]) => {
|
|
551
|
+
if (res != null && manualLoading == null) {
|
|
552
|
+
this.#loading.set(false);
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
this.#manualLoadingEffect = effectWithDeps([this.#manualLoading], ([manualLoading]) => {
|
|
556
|
+
if (manualLoading != null) {
|
|
557
|
+
this.#loading.set(manualLoading);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
// pagination
|
|
561
|
+
this.#params = signal(undefined);
|
|
562
|
+
this.params = this.#params.asReadonly();
|
|
563
|
+
this.#sortMeta = signal(undefined);
|
|
564
|
+
this.sortMeta = this.#sortMeta.asReadonly();
|
|
565
|
+
this.#filterMeta = signal({});
|
|
566
|
+
this.filterMeta = this.#filterMeta.asReadonly();
|
|
567
|
+
this.#isSortAndFilterMetaInitialized = signal(false);
|
|
568
|
+
this.#defaultParamsEffect = effectWithDeps([this.#metadata.defaultParams], ([defaultParams]) => {
|
|
569
|
+
this.#sortMeta.set(tableCreateSortMeta(defaultParams));
|
|
570
|
+
this.#filterMeta.set(tableCreateFilterMeta(defaultParams));
|
|
571
|
+
this.#isSortAndFilterMetaInitialized.set(true);
|
|
572
|
+
}, { firstOnly: true });
|
|
573
|
+
this.#isSearchMetaInitialized = signal(false);
|
|
574
|
+
this.#searchMeta = signal(undefined);
|
|
575
|
+
this.searchMeta = this.#searchMeta.asReadonly();
|
|
576
|
+
this.isAllPaginationMetaInitialized = computed(() => this.#isSortAndFilterMetaInitialized() && this.#isSortAndFilterMetaInitialized());
|
|
577
|
+
this.paginationMode = computed(() => {
|
|
578
|
+
const descriptor = this.#metadata.descriptor();
|
|
579
|
+
if (descriptor.paginationMode != null) {
|
|
580
|
+
// descriptor choice is the strongest - if defined, use this value
|
|
581
|
+
return descriptor.paginationMode;
|
|
582
|
+
}
|
|
583
|
+
else if (this.#dataProvider() != null) {
|
|
584
|
+
// when data provider is used, use pagination
|
|
585
|
+
return TablePaginationModeEnum.Pagination;
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
return TablePaginationModeEnum.None;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
this.offset = computed(() => this.params()?.offset ?? 0);
|
|
592
|
+
this.rows = computed(() => {
|
|
593
|
+
if (this.params()?.limit) {
|
|
594
|
+
return this.params()?.limit;
|
|
595
|
+
}
|
|
596
|
+
const descriptor = this.#metadata.descriptor();
|
|
597
|
+
const rowsPerPageOptions = this.#metadata.rowsPerPageOptions();
|
|
598
|
+
if (descriptor.defaultNumRows && rowsPerPageOptions.includes(descriptor.defaultNumRows)) {
|
|
599
|
+
return descriptor.defaultNumRows;
|
|
600
|
+
}
|
|
601
|
+
return rowsPerPageOptions[0];
|
|
602
|
+
});
|
|
391
603
|
// data
|
|
392
|
-
this
|
|
393
|
-
this.
|
|
394
|
-
this
|
|
395
|
-
this.count = this.
|
|
396
|
-
this
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
604
|
+
this.#data = signal([]);
|
|
605
|
+
this.data = this.#data.asReadonly();
|
|
606
|
+
this.#count = signal(0);
|
|
607
|
+
this.count = this.#count.asReadonly();
|
|
608
|
+
this.#loading = signal(true);
|
|
609
|
+
this.loading = this.#loading.asReadonly();
|
|
610
|
+
}
|
|
611
|
+
#injector;
|
|
612
|
+
#commons;
|
|
613
|
+
#metadata;
|
|
614
|
+
// signal sources
|
|
615
|
+
#dataSources;
|
|
616
|
+
// data sources
|
|
617
|
+
#manualLoading;
|
|
618
|
+
// results that are set directly via input and are not result of a asynchronous operation (aka data provider)
|
|
619
|
+
#synchronousResult;
|
|
620
|
+
#dataProvider;
|
|
621
|
+
#dataProviderService;
|
|
622
|
+
#synchronousResultEffect;
|
|
623
|
+
#synchronousLoadingEffect;
|
|
624
|
+
#manualLoadingEffect;
|
|
625
|
+
#dataProviderSubscription;
|
|
626
|
+
// pagination
|
|
627
|
+
#params;
|
|
628
|
+
#sortMeta;
|
|
629
|
+
#filterMeta;
|
|
630
|
+
#isSortAndFilterMetaInitialized;
|
|
631
|
+
#defaultParamsEffect;
|
|
632
|
+
#isSearchMetaInitialized;
|
|
633
|
+
#searchMeta;
|
|
634
|
+
// data
|
|
635
|
+
#data;
|
|
636
|
+
#count;
|
|
637
|
+
#loading;
|
|
638
|
+
setDataSources(arrayItems, dataListResult, dataProvider, manualLoading) {
|
|
639
|
+
this.#dataSources.set({ arrayItems, dataListResult, dataProvider, manualLoading });
|
|
640
|
+
}
|
|
641
|
+
fetchWithDataProvider(params, onErrorFn) {
|
|
642
|
+
const dataProvider = this.#dataProvider();
|
|
643
|
+
if (!dataProvider || params.limit === 0) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
this.#dataProviderSubscription?.unsubscribe();
|
|
647
|
+
this.#loading.set(true);
|
|
648
|
+
this.#dataProviderSubscription = toObservable$1(dataProvider.getAll(params, this.#dataProviderService(), this.#metadata.descriptor().isLocalized ? (this.#commons.appDataLocale() ?? undefined) : undefined)).subscribe({
|
|
649
|
+
next: res => {
|
|
650
|
+
const descriptorInput = this.#metadata.descriptorFromSource();
|
|
651
|
+
if (descriptorInput instanceof TableDynamicDescriptorInst) {
|
|
652
|
+
this.#metadata.setDescriptor(descriptorInput.toTableDescriptorFromData(res));
|
|
653
|
+
}
|
|
654
|
+
this.#setData(res?.data ?? [], res?.totalCount);
|
|
655
|
+
this.#loading.set(false);
|
|
656
|
+
},
|
|
657
|
+
error: err => {
|
|
658
|
+
onErrorFn(err);
|
|
659
|
+
this.#setData([]);
|
|
660
|
+
this.#loading.set(false);
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
return true;
|
|
664
|
+
}
|
|
665
|
+
setParams(params, fromQueryParams = false) {
|
|
666
|
+
if (!fromQueryParams && this.compareWithCurrentParams(params)) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
this.#params.set(params);
|
|
670
|
+
this.#sortMeta.set(tableCreateSortMeta(params));
|
|
671
|
+
this.#filterMeta.set(tableCreateFilterMeta(params));
|
|
672
|
+
this.#isSortAndFilterMetaInitialized.set(true);
|
|
673
|
+
if (fromQueryParams && !this.#isSearchMetaInitialized() && params?.search) {
|
|
674
|
+
this.#searchMeta.set({ value: params.search, caseSensitive: params.filters?.['global']?.caseSensitive ?? false });
|
|
675
|
+
}
|
|
676
|
+
this.#isSearchMetaInitialized.set(true);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Compare the given params with the stored params in the DataListService.
|
|
680
|
+
*
|
|
681
|
+
* @param {DataListParams} params - The params to compare with the stored params.
|
|
682
|
+
*
|
|
683
|
+
* @return {boolean} - True if the given params match the stored params, otherwise false.
|
|
684
|
+
*/
|
|
685
|
+
compareWithCurrentParams(params) {
|
|
686
|
+
return (params.offset === this.offset() &&
|
|
687
|
+
params.limit === this.rows() &&
|
|
688
|
+
JSON.stringify(tableCreateSortMeta(params)) === JSON.stringify(this.#sortMeta()) &&
|
|
689
|
+
JSON.stringify(tableCreateFilterMeta(params)) === JSON.stringify(this.#filterMeta()));
|
|
690
|
+
}
|
|
691
|
+
#setData(data, count) {
|
|
692
|
+
this.#data.set([...data]);
|
|
693
|
+
this.#count.set(count ?? data.length);
|
|
694
|
+
}
|
|
695
|
+
ngOnDestroy() {
|
|
696
|
+
this.#dataProviderSubscription?.unsubscribe();
|
|
697
|
+
}
|
|
698
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
699
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableDataService }); }
|
|
404
700
|
}
|
|
405
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
701
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableDataService, decorators: [{
|
|
406
702
|
type: Injectable
|
|
407
703
|
}] });
|
|
408
704
|
|
|
@@ -418,23 +714,17 @@ class TableColumnFilterComponent {
|
|
|
418
714
|
this.FilterMatchMode = FilterMatchMode;
|
|
419
715
|
this.el = inject(ElementRef);
|
|
420
716
|
this.primeTable = inject(Table);
|
|
421
|
-
this.dataListService = inject((DataListService));
|
|
422
|
-
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
423
717
|
this.renderer = inject(Renderer2);
|
|
424
|
-
this.primeConfig = inject(PrimeNGConfig);
|
|
425
718
|
this.overlayService = inject(OverlayService);
|
|
426
719
|
this.cd = inject(ChangeDetectorRef);
|
|
427
720
|
this.destroyRef = inject(DestroyRef);
|
|
721
|
+
this.tableData = inject((TableDataService));
|
|
722
|
+
this.tableMetadata = inject(TableMetadataService);
|
|
428
723
|
this.document = window.document;
|
|
429
|
-
this.
|
|
430
|
-
this.descriptorAsLookup = computed(() =>
|
|
724
|
+
this.metadata = input.required();
|
|
725
|
+
this.descriptorAsLookup = computed(() => this.metadata().descriptor instanceof FilterLookupDescriptor ? this.metadata().descriptor : undefined);
|
|
431
726
|
this.icon = viewChild('icon');
|
|
432
|
-
this.
|
|
433
|
-
this.matchModes = computed(() => {
|
|
434
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
435
|
-
const translationObserver = this.translationObserver();
|
|
436
|
-
return generateMatchModeOptions(this.primeConfig, this.descriptor(), this.serializationCfg);
|
|
437
|
-
});
|
|
727
|
+
this.matchModes = computed(() => this.metadata().matchModes);
|
|
438
728
|
this.filterConstraint = signal(undefined);
|
|
439
729
|
this.isFilterSet = computed(() => this.filterConstraint()?.matchMode === FilterMatchMode.Exists ||
|
|
440
730
|
this.filterConstraint()?.matchMode === FilterMatchMode.DoesNotExist ||
|
|
@@ -442,19 +732,20 @@ class TableColumnFilterComponent {
|
|
|
442
732
|
this.isInputDisabled = computed(() => this.filterConstraint()?.matchMode === FilterMatchMode.Exists || this.filterConstraint()?.matchMode === FilterMatchMode.DoesNotExist);
|
|
443
733
|
this.overlayVisible = signal(false);
|
|
444
734
|
// display configs
|
|
445
|
-
this.
|
|
446
|
-
|
|
735
|
+
this.isMultiselect = computed(() => {
|
|
736
|
+
const ft = this.filterConstraint();
|
|
737
|
+
const matchMode = ft?.displayMatchMode ?? this.metadata().defaultMatchMode;
|
|
738
|
+
return (matchMode === FilterMatchMode.In || matchMode === FilterMatchMode.NotIn) && (ft?.displayValue == null || Array.isArray(ft.displayValue));
|
|
739
|
+
});
|
|
447
740
|
this.window = this.document.defaultView;
|
|
448
741
|
this.numericValueFromModelChange = null;
|
|
449
742
|
this.dateDebounceSubject = new Subject();
|
|
450
|
-
this.serializationCfg = {};
|
|
451
|
-
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
452
743
|
this.dateDebounceSubject.pipe(debounceTime(500), distinctUntilChanged(), takeUntilDestroyed()).subscribe(v => this.updateFilterOnDisplayValueChange(v));
|
|
453
744
|
effect(() => {
|
|
454
|
-
const fieldFilterMeta = this.
|
|
745
|
+
const fieldFilterMeta = this.tableData.filterMeta()?.[this.metadata().descriptor.property];
|
|
455
746
|
const filterConstraint = untracked(() => this.filterConstraint());
|
|
456
747
|
if (fieldFilterMeta && (!filterConstraint || filterConstraint.value !== fieldFilterMeta.value || filterConstraint.matchMode !== fieldFilterMeta.matchMode)) {
|
|
457
|
-
this.setFilterConstraint(filterSetMetadataOnChange(fieldFilterMeta, fieldFilterMeta.matchMode, fieldFilterMeta.value, untracked(() => this.
|
|
748
|
+
this.setFilterConstraint(filterSetMetadataOnChange(fieldFilterMeta, fieldFilterMeta.matchMode, fieldFilterMeta.value, untracked(() => this.metadata().descriptor.filterType), untracked(() => this.metadata().dateConfig)));
|
|
458
749
|
}
|
|
459
750
|
}, { allowSignalWrites: true });
|
|
460
751
|
}
|
|
@@ -520,16 +811,13 @@ class TableColumnFilterComponent {
|
|
|
520
811
|
}
|
|
521
812
|
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
|
|
522
813
|
dropdownFilter(value) {
|
|
523
|
-
if (Array.isArray(value) && value.length === 0) {
|
|
524
|
-
value = undefined;
|
|
525
|
-
}
|
|
526
814
|
this.updateFilterOnDisplayValueChange(value);
|
|
527
815
|
}
|
|
528
816
|
onMatchModeChange(displayMatchMode) {
|
|
529
817
|
if (this.filterConstraint()?.displayMatchMode === displayMatchMode) {
|
|
530
818
|
return;
|
|
531
819
|
}
|
|
532
|
-
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), displayMatchMode, filterAdjustDisplayValueOnMatchModeChange(displayMatchMode, this.filterConstraint()?.displayValue), this.
|
|
820
|
+
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), displayMatchMode, filterAdjustDisplayValueOnMatchModeChange(displayMatchMode, this.filterConstraint()?.displayValue), this.metadata().descriptor.filterType, this.metadata().dateConfig));
|
|
533
821
|
this.hideOverlay();
|
|
534
822
|
}
|
|
535
823
|
onMatchModeKeyDown(event) {
|
|
@@ -598,7 +886,7 @@ class TableColumnFilterComponent {
|
|
|
598
886
|
case 'visible':
|
|
599
887
|
this.overlay = event.element;
|
|
600
888
|
this.renderer.appendChild(this.document.body, this.overlay);
|
|
601
|
-
ZIndexUtils.set('overlay', this.overlay, this.primeConfig.zIndex.overlay);
|
|
889
|
+
ZIndexUtils.set('overlay', this.overlay, this.tableMetadata.primeConfig.zIndex.overlay);
|
|
602
890
|
DomHandler.absolutePosition(this.overlay, this.icon()?.nativeElement);
|
|
603
891
|
this.bindDocumentClickListener();
|
|
604
892
|
this.bindDocumentResizeListener();
|
|
@@ -625,7 +913,7 @@ class TableColumnFilterComponent {
|
|
|
625
913
|
}
|
|
626
914
|
}
|
|
627
915
|
get noFilterLabel() {
|
|
628
|
-
return this.primeConfig.getTranslation(TranslationKeys.NO_FILTER);
|
|
916
|
+
return this.tableMetadata.primeConfig.getTranslation(TranslationKeys.NO_FILTER);
|
|
629
917
|
}
|
|
630
918
|
clearFilter() {
|
|
631
919
|
this.initFilterConstraint(true);
|
|
@@ -715,19 +1003,18 @@ class TableColumnFilterComponent {
|
|
|
715
1003
|
this.overlay = null;
|
|
716
1004
|
}
|
|
717
1005
|
updateFilterOnDisplayValueChange(displayValue) {
|
|
718
|
-
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), this.filterConstraint()?.displayMatchMode ??
|
|
1006
|
+
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), this.filterConstraint()?.displayMatchMode ?? this.metadata().defaultMatchMode, displayValue, this.metadata().descriptor.filterType, this.metadata().dateConfig));
|
|
719
1007
|
}
|
|
720
1008
|
initFilterConstraint(reset = false) {
|
|
721
1009
|
if (reset) {
|
|
722
|
-
|
|
723
|
-
this.primeTable.filters[this.descriptor().property] = { value: null, matchMode: defaultMatchMode };
|
|
1010
|
+
this.primeTable.filters[this.metadata().descriptor.property] = { value: null, matchMode: this.metadata().defaultMatchMode };
|
|
724
1011
|
}
|
|
725
1012
|
// set internal filter constraint
|
|
726
|
-
let metadata = this.primeTable.filters[this.
|
|
1013
|
+
let metadata = this.primeTable.filters[this.metadata().descriptor.property];
|
|
727
1014
|
if (Array.isArray(metadata)) {
|
|
728
1015
|
metadata = metadata[0];
|
|
729
1016
|
}
|
|
730
|
-
this.setFilterConstraint(filterSetMetadataOnChange(metadata, metadata?.matchMode, metadata?.value, this.
|
|
1017
|
+
this.setFilterConstraint(filterSetMetadataOnChange(metadata, metadata?.matchMode, metadata?.value, this.metadata().descriptor.filterType, this.metadata().dateConfig));
|
|
731
1018
|
}
|
|
732
1019
|
setFilterConstraint(metadata) {
|
|
733
1020
|
if (metadata && !metadata.displayMatchMode)
|
|
@@ -735,18 +1022,18 @@ class TableColumnFilterComponent {
|
|
|
735
1022
|
if (metadata && !metadata.displayValue)
|
|
736
1023
|
metadata.displayValue = metadata.value;
|
|
737
1024
|
this.filterConstraint.set(metadata);
|
|
738
|
-
this.primeTable.filters[this.
|
|
1025
|
+
this.primeTable.filters[this.metadata().descriptor.property] = this.filterConstraint();
|
|
739
1026
|
this.primeTable._filter();
|
|
740
1027
|
}
|
|
741
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
742
|
-
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: i2.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$1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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", "allowInput", "appendTo", "inlineSearch", "searchTrim"], 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: [
|
|
1028
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1029
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableColumnFilterComponent, isStandalone: true, selector: "mng-table-column-filter", inputs: { metadata: { classPropertyName: "metadata", publicName: "metadata", 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 (metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().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]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().dateConfig?.format\"\n [placeholder]=\"metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"metadata().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 *mngRerender=\"isMultiselect()\"\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]=\"isMultiselect()\"\n [autoClear]=\"lookup.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookup.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookup.autocompleteInlineSearch ?? false\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"metadata().descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n *mngRerender=\"isMultiselect()\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"isMultiselect()\"\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: i2.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$1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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", "allowInput", "appendTo", "inlineSearch", "searchTrim"], 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"] }, { kind: "directive", type: RerenderDirective, selector: "[mngRerender]", inputs: ["mngRerender"] }], animations: [
|
|
743
1030
|
trigger('overlayAnimation', [
|
|
744
1031
|
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
745
1032
|
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
746
1033
|
])
|
|
747
1034
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
748
1035
|
}
|
|
749
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterComponent, decorators: [{
|
|
750
1037
|
type: Component,
|
|
751
1038
|
args: [{ standalone: true, selector: 'mng-table-column-filter', imports: [
|
|
752
1039
|
TableModule,
|
|
@@ -764,13 +1051,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
764
1051
|
InputTrimDirective,
|
|
765
1052
|
NumberRangeComponent,
|
|
766
1053
|
NgTemplateOutlet,
|
|
767
|
-
CheckboxModule
|
|
1054
|
+
CheckboxModule,
|
|
1055
|
+
RerenderDirective
|
|
768
1056
|
], animations: [
|
|
769
1057
|
trigger('overlayAnimation', [
|
|
770
1058
|
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
771
1059
|
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
772
1060
|
])
|
|
773
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (
|
|
1061
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().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]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().dateConfig?.format\"\n [placeholder]=\"metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().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]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"metadata().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 *mngRerender=\"isMultiselect()\"\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]=\"isMultiselect()\"\n [autoClear]=\"lookup.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookup.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookup.autocompleteInlineSearch ?? false\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"metadata().descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n *mngRerender=\"isMultiselect()\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"isMultiselect()\"\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" }]
|
|
774
1062
|
}], ctorParameters: () => [] });
|
|
775
1063
|
|
|
776
1064
|
class TableColumnValueComponent {
|
|
@@ -801,7 +1089,7 @@ class TableColumnValueComponent {
|
|
|
801
1089
|
this.value = computed(() => {
|
|
802
1090
|
let value = this.item()?.[this.descriptor().property];
|
|
803
1091
|
if (typeof this.descriptor().getter === 'function') {
|
|
804
|
-
value = this.getterPipe.transform(
|
|
1092
|
+
value = this.getterPipe.transform(value, this.descriptor().getter, this.item());
|
|
805
1093
|
}
|
|
806
1094
|
if (this.descriptor().template) {
|
|
807
1095
|
value = this.templatePipe.transform(value, this.descriptor().template);
|
|
@@ -810,7 +1098,7 @@ class TableColumnValueComponent {
|
|
|
810
1098
|
});
|
|
811
1099
|
this.currency = computed(() => {
|
|
812
1100
|
if (this.descriptor().columnDisplayType === ColumnDisplayTypeEnum.Currency) {
|
|
813
|
-
return this.descriptor().currencyProperty ? this.item()[this.descriptor().currencyProperty] : this.descriptor().currencyCode ?? 'EUR';
|
|
1101
|
+
return this.descriptor().currencyProperty ? this.item()[this.descriptor().currencyProperty] : (this.descriptor().currencyCode ?? 'EUR');
|
|
814
1102
|
}
|
|
815
1103
|
return;
|
|
816
1104
|
});
|
|
@@ -827,10 +1115,10 @@ class TableColumnValueComponent {
|
|
|
827
1115
|
const message = this.translate.instant('mngTable.copyNotificationMessage', { value });
|
|
828
1116
|
this.messageService.add({ severity: 'info', summary: title, detail: message });
|
|
829
1117
|
}
|
|
830
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
831
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.
|
|
1118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1119
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", 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$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: i2.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 }); }
|
|
832
1120
|
}
|
|
833
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnValueComponent, decorators: [{
|
|
834
1122
|
type: Component,
|
|
835
1123
|
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"] }]
|
|
836
1124
|
}] });
|
|
@@ -893,10 +1181,10 @@ class FilterValuePipe {
|
|
|
893
1181
|
this.subscription?.unsubscribe();
|
|
894
1182
|
this.subject.complete();
|
|
895
1183
|
}
|
|
896
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
897
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.
|
|
1184
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: FilterValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1185
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: FilterValuePipe, isStandalone: true, name: "mngFilterValue" }); }
|
|
898
1186
|
}
|
|
899
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: FilterValuePipe, decorators: [{
|
|
900
1188
|
type: Pipe,
|
|
901
1189
|
args: [{
|
|
902
1190
|
name: 'mngFilterValue',
|
|
@@ -905,14 +1193,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
905
1193
|
}]
|
|
906
1194
|
}] });
|
|
907
1195
|
|
|
908
|
-
class
|
|
1196
|
+
class TableFilterActiveTagComponent {
|
|
909
1197
|
constructor() {
|
|
910
1198
|
this.FilterMatchMode = FilterMatchMode;
|
|
911
1199
|
this.model = input.required();
|
|
912
1200
|
this.filter = input.required();
|
|
913
1201
|
this.edit = output();
|
|
914
1202
|
this.remove = output();
|
|
915
|
-
this.label = computed(() => this.getPropertyLabelKey(this.filter().descriptor));
|
|
1203
|
+
this.label = computed(() => this.getPropertyLabelKey(this.filter().metadata.descriptor));
|
|
916
1204
|
this.matchMode = computed(() => this.filter().displayMatchMode);
|
|
917
1205
|
this.matchModeSymbol = computed(() => `mngFilterActiveTag.matchMode.${this.matchMode()}`);
|
|
918
1206
|
this.value = computed(() => this.filter().displayValue);
|
|
@@ -943,26 +1231,24 @@ class FilterActiveTagComponent {
|
|
|
943
1231
|
}
|
|
944
1232
|
return labelKey;
|
|
945
1233
|
}
|
|
946
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
947
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.
|
|
1234
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterActiveTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1235
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableFilterActiveTagComponent, isStandalone: true, selector: "mng-table-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().metadata.descriptor | async }}</span>\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value()?.[1] | mngFilterValue: filter().metadata.descriptor | async }}</span>\n } @else {\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value() | mngFilterValue: filter().metadata.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: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i2$2.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 }); }
|
|
948
1236
|
}
|
|
949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterActiveTagComponent, decorators: [{
|
|
950
1238
|
type: Component,
|
|
951
|
-
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" }]
|
|
1239
|
+
args: [{ standalone: true, selector: 'mng-table-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().metadata.descriptor | async }}</span>\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value()?.[1] | mngFilterValue: filter().metadata.descriptor | async }}</span>\n } @else {\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value() | mngFilterValue: filter().metadata.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" }]
|
|
952
1240
|
}] });
|
|
953
1241
|
|
|
954
|
-
class
|
|
1242
|
+
class TableFilterFormComponent {
|
|
955
1243
|
constructor() {
|
|
956
1244
|
this.lookupTypeDropdown = FilterLookupTypeEnum.Dropdown;
|
|
957
1245
|
this.lookupTypeAutocomplete = FilterLookupTypeEnum.Autocomplete;
|
|
958
1246
|
this.FilterTypeEnum = FilterTypeEnum;
|
|
959
1247
|
this.FilterMatchMode = FilterMatchMode;
|
|
960
1248
|
this.elementRef = inject(ElementRef);
|
|
961
|
-
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
962
|
-
this.primeConfig = inject(PrimeNGConfig);
|
|
963
1249
|
this.translate = inject(TranslateService);
|
|
964
1250
|
this.title = input();
|
|
965
|
-
this.
|
|
1251
|
+
this.metadata = input.required();
|
|
966
1252
|
this.genericDescriptor = input();
|
|
967
1253
|
this.model = input.required();
|
|
968
1254
|
this.filter = input();
|
|
@@ -974,17 +1260,17 @@ class FilterFormComponent {
|
|
|
974
1260
|
this.propertyOptionsWithTranslations = computed(() => {
|
|
975
1261
|
const disabledProperties = this.disabledProperties();
|
|
976
1262
|
const filter = this.filter();
|
|
977
|
-
return (this.
|
|
1263
|
+
return (this.metadata()?.map(d => {
|
|
978
1264
|
return {
|
|
979
|
-
property: d.property,
|
|
980
|
-
label: d.isGenericFilter ? d.property : this.getPropertyLabelKey(d),
|
|
981
|
-
disabled: !filter && disabledProperties.includes(d.property)
|
|
1265
|
+
property: d.descriptor.property,
|
|
1266
|
+
label: d.descriptor.isGenericFilter ? d.descriptor.property : this.getPropertyLabelKey(d.descriptor),
|
|
1267
|
+
disabled: !filter && disabledProperties.includes(d.descriptor.property)
|
|
982
1268
|
};
|
|
983
1269
|
}) ?? []);
|
|
984
1270
|
});
|
|
985
|
-
this.
|
|
1271
|
+
this.selectedFilterMetadata = computed(() => {
|
|
986
1272
|
const property = this.propertyModel();
|
|
987
|
-
return this.
|
|
1273
|
+
return this.metadata().find(d => d.descriptor.property === property);
|
|
988
1274
|
});
|
|
989
1275
|
// change value lookup function to include the property name of the generic filter
|
|
990
1276
|
this.genericValueDataProvider = computed(() => {
|
|
@@ -997,8 +1283,8 @@ class FilterFormComponent {
|
|
|
997
1283
|
filters: {
|
|
998
1284
|
...params?.filters,
|
|
999
1285
|
field: {
|
|
1000
|
-
value: this.
|
|
1001
|
-
matchMode: this.
|
|
1286
|
+
value: this.selectedFilterMetadata()?.descriptor.property,
|
|
1287
|
+
matchMode: this.selectedFilterMetadata()?.descriptor.filterType === FilterTypeEnum.LookupEnum ? FilterMatchMode.In : FilterMatchMode.StartsWith
|
|
1002
1288
|
}
|
|
1003
1289
|
}
|
|
1004
1290
|
};
|
|
@@ -1008,22 +1294,16 @@ class FilterFormComponent {
|
|
|
1008
1294
|
return;
|
|
1009
1295
|
});
|
|
1010
1296
|
this.selectedDescriptorAsLookup = computed(() => {
|
|
1011
|
-
const filterDescriptor = this.
|
|
1297
|
+
const filterDescriptor = this.selectedFilterMetadata()?.descriptor;
|
|
1012
1298
|
return filterDescriptor !== undefined &&
|
|
1013
1299
|
!filterDescriptor.isGenericFilter &&
|
|
1014
1300
|
(filterDescriptor.filterType === FilterTypeEnum.Lookup || filterDescriptor.filterType === FilterTypeEnum.LookupEnum)
|
|
1015
1301
|
? filterDescriptor
|
|
1016
1302
|
: undefined;
|
|
1017
1303
|
});
|
|
1018
|
-
this.matchModeOptions = computed(() => {
|
|
1019
|
-
return generateMatchModeOptions(this.primeConfig, this.selectedDescriptor(), this.serializationCfg);
|
|
1020
|
-
});
|
|
1021
1304
|
this.isEdit = computed(() => this.filter() != null);
|
|
1022
1305
|
this.formSubmitted = signal(false);
|
|
1023
1306
|
this.formErrorMessage = signal([]);
|
|
1024
|
-
// display configs
|
|
1025
|
-
this.dateConfig = computed(() => filterGetDateConfig(this.selectedDescriptor(), this.serializationCfg));
|
|
1026
|
-
this.numberConfig = computed(() => filterGetNumberConfig(this.selectedDescriptor()));
|
|
1027
1307
|
// UI utilities
|
|
1028
1308
|
this.filterForm = viewChild.required('filterForm');
|
|
1029
1309
|
// Filter form model and form utilities
|
|
@@ -1031,13 +1311,12 @@ class FilterFormComponent {
|
|
|
1031
1311
|
this.matchModeModel = signal(null);
|
|
1032
1312
|
this.valueModel = signal(null);
|
|
1033
1313
|
this.caseSensitiveModel = signal(false);
|
|
1034
|
-
this.
|
|
1035
|
-
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
1314
|
+
this.isMultiselect = computed(() => this.matchModeModel() === FilterMatchMode.In || this.matchModeModel() === FilterMatchMode.NotIn);
|
|
1036
1315
|
effect(() => {
|
|
1037
1316
|
const edit = this.filter();
|
|
1038
1317
|
if (edit) {
|
|
1039
1318
|
this.resetForm({
|
|
1040
|
-
property: edit.descriptor.property,
|
|
1319
|
+
property: edit.metadata.descriptor.property,
|
|
1041
1320
|
matchMode: edit.displayMatchMode ?? edit.matchMode ?? null,
|
|
1042
1321
|
value: edit.displayValue ?? edit.value,
|
|
1043
1322
|
caseSensitive: edit.caseSensitive ?? false
|
|
@@ -1048,7 +1327,7 @@ class FilterFormComponent {
|
|
|
1048
1327
|
}
|
|
1049
1328
|
}, { allowSignalWrites: true });
|
|
1050
1329
|
effect(() => {
|
|
1051
|
-
const descriptor = this.
|
|
1330
|
+
const descriptor = this.selectedFilterMetadata()?.descriptor;
|
|
1052
1331
|
const value = untracked(() => this.valueModel());
|
|
1053
1332
|
if (value != null) {
|
|
1054
1333
|
// reset value if filter type and value type mismatch
|
|
@@ -1066,12 +1345,12 @@ class FilterFormComponent {
|
|
|
1066
1345
|
}
|
|
1067
1346
|
}, { allowSignalWrites: true });
|
|
1068
1347
|
effect(() => {
|
|
1069
|
-
const matchModeOptions = this.
|
|
1348
|
+
const matchModeOptions = this.selectedFilterMetadata()?.matchModes ?? [];
|
|
1070
1349
|
const matchMode = untracked(() => this.matchModeModel());
|
|
1071
1350
|
const filterForm = untracked(() => this.filterForm());
|
|
1072
1351
|
if (matchModeOptions.length > 0 &&
|
|
1073
1352
|
(!matchMode || filterForm.controls['matchMode']?.pristine || filterForm.controls['matchMode']?.untouched || !matchModeOptions.find(o => o.value === matchMode))) {
|
|
1074
|
-
this.matchModeModel.set(filterGetDefaultMatchMode(this.
|
|
1353
|
+
this.matchModeModel.set(filterGetDefaultMatchMode(this.selectedFilterMetadata()?.descriptor, matchModeOptions));
|
|
1075
1354
|
}
|
|
1076
1355
|
}, { allowSignalWrites: true });
|
|
1077
1356
|
effect(() => {
|
|
@@ -1131,12 +1410,12 @@ class FilterFormComponent {
|
|
|
1131
1410
|
}
|
|
1132
1411
|
return labelKey;
|
|
1133
1412
|
}
|
|
1134
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1135
|
-
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 }, genericDescriptor: { classPropertyName: "genericDescriptor", publicName: "genericDescriptor", isSignal: true, isRequired: false, 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 }, enableCaseSensitive: { classPropertyName: "enableCaseSensitive", publicName: "enableCaseSensitive", isSignal: true, isRequired: false, transformFunction: null }, propertySearch: { classPropertyName: "propertySearch", publicName: "propertySearch", 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]=\"!propertySearch()\"\n [inlineSearch]=\"propertySearch()\"\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 @if (selectedDescriptor()?.genericValueProvider && genericValueDataProvider()) {\n <!-- conditional rendering on the placeholder is there because of styling issues with PrimeNG -->\n <!-- (PrimeNG applies the .p-placeholder class to programmatically set values, making them greyed out) -->\n <span class=\"flex align-items-center\">\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [className]=\"selectedDescriptor()?.className\"\n [dropdownClassName]=\"selectedDescriptor()?.dropdownClassName\"\n [placeholder]=\"valueModel() ? undefined : ('mngFilter.value' | translate)\"\n allowInput=\"true\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\"></mng-dropdown>\n @if (enableCaseSensitive()) {\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-2 p-1 p-button\" onLabel=\"Aa\" offLabel=\"Aa\" />\n }\n </span>\n } @else {\n <span class=\"p-input-icon-right\">\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 @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-1 p-1 p-button-sm\" onLabel=\"Aa\" offLabel=\"Aa\" />\n </span>\n }\n </span>\n }\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 } @else if (selectedDescriptor()?.isGenericFilter && genericValueDataProvider()) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n </ng-template>\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", styles: [".toggle-button-input{position:absolute;right:.25rem;top:50%;transform:translateY(-50%)}\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", "allowInput", "appendTo", "inlineSearch", "searchTrim"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.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$1.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"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i9.ToggleButton, selector: "p-toggleButton", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "iconPos", "autofocus"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1413
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1414
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableFilterFormComponent, isStandalone: true, selector: "mng-table-filter-form", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: true, transformFunction: null }, genericDescriptor: { classPropertyName: "genericDescriptor", publicName: "genericDescriptor", isSignal: true, isRequired: false, 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 }, enableCaseSensitive: { classPropertyName: "enableCaseSensitive", publicName: "enableCaseSensitive", isSignal: true, isRequired: false, transformFunction: null }, propertySearch: { classPropertyName: "propertySearch", publicName: "propertySearch", 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]=\"!propertySearch()\"\n [inlineSearch]=\"propertySearch()\"\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]=\"selectedFilterMetadata()?.matchModes ?? []\"\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 (selectedFilterMetadata()?.descriptor?.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]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping ?? false\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.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]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.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]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.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]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.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 @if (selectedFilterMetadata()?.descriptor?.genericValueProvider && genericValueDataProvider()) {\n <!-- conditional rendering on the placeholder is there because of styling issues with PrimeNG -->\n <!-- (PrimeNG applies the .p-placeholder class to programmatically set values, making them greyed out) -->\n <span class=\"flex align-items-center\">\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [className]=\"selectedFilterMetadata()?.descriptor?.className\"\n [dropdownClassName]=\"selectedFilterMetadata()?.descriptor?.dropdownClassName\"\n [placeholder]=\"valueModel() ? undefined : ('mngFilter.value' | translate)\"\n allowInput=\"true\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\"></mng-dropdown>\n @if (enableCaseSensitive()) {\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-2 p-1 p-button\" onLabel=\"Aa\" offLabel=\"Aa\" />\n }\n </span>\n } @else {\n <span class=\"p-input-icon-right\">\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]=\"selectedFilterMetadata()?.descriptor?.trimOption\"\n [disabled]=\"!matchModeModel()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-1 p-1 p-button-sm\" onLabel=\"Aa\" offLabel=\"Aa\" />\n </span>\n }\n </span>\n }\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]=\"isMultiselect()\"\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]=\"selectedFilterMetadata()?.descriptor?.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]=\"isMultiselect()\"\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 } @else if (selectedFilterMetadata()?.descriptor?.isGenericFilter && genericValueDataProvider()) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n </ng-template>\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", styles: [".toggle-button-input{position:absolute;right:.25rem;top:50%;transform:translateY(-50%)}\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", "allowInput", "appendTo", "inlineSearch", "searchTrim"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.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$1.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"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i9.ToggleButton, selector: "p-toggleButton", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "iconPos", "autofocus"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1136
1415
|
}
|
|
1137
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterFormComponent, decorators: [{
|
|
1138
1417
|
type: Component,
|
|
1139
|
-
args: [{ standalone: true, selector: 'mng-filter-form', imports: [
|
|
1418
|
+
args: [{ standalone: true, selector: 'mng-table-filter-form', imports: [
|
|
1140
1419
|
DropdownComponent,
|
|
1141
1420
|
FormsModule,
|
|
1142
1421
|
NgClass,
|
|
@@ -1155,19 +1434,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
1155
1434
|
ToggleButtonModule
|
|
1156
1435
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1157
1436
|
class: 'flex flex-grow-1'
|
|
1158
|
-
}, 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]=\"!propertySearch()\"\n [inlineSearch]=\"propertySearch()\"\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 @if (selectedDescriptor()?.genericValueProvider && genericValueDataProvider()) {\n <!-- conditional rendering on the placeholder is there because of styling issues with PrimeNG -->\n <!-- (PrimeNG applies the .p-placeholder class to programmatically set values, making them greyed out) -->\n <span class=\"flex align-items-center\">\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [className]=\"selectedDescriptor()?.className\"\n [dropdownClassName]=\"selectedDescriptor()?.dropdownClassName\"\n [placeholder]=\"valueModel() ? undefined : ('mngFilter.value' | translate)\"\n allowInput=\"true\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\"></mng-dropdown>\n @if (enableCaseSensitive()) {\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-2 p-1 p-button\" onLabel=\"Aa\" offLabel=\"Aa\" />\n }\n </span>\n } @else {\n <span class=\"p-input-icon-right\">\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 @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-1 p-1 p-button-sm\" onLabel=\"Aa\" offLabel=\"Aa\" />\n </span>\n }\n </span>\n }\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 } @else if (selectedDescriptor()?.isGenericFilter && genericValueDataProvider()) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n </ng-template>\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", styles: [".toggle-button-input{position:absolute;right:.25rem;top:50%;transform:translateY(-50%)}\n"] }]
|
|
1437
|
+
}, 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]=\"!propertySearch()\"\n [inlineSearch]=\"propertySearch()\"\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]=\"selectedFilterMetadata()?.matchModes ?? []\"\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 (selectedFilterMetadata()?.descriptor?.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]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping ?? false\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.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]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.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]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.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]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.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 @if (selectedFilterMetadata()?.descriptor?.genericValueProvider && genericValueDataProvider()) {\n <!-- conditional rendering on the placeholder is there because of styling issues with PrimeNG -->\n <!-- (PrimeNG applies the .p-placeholder class to programmatically set values, making them greyed out) -->\n <span class=\"flex align-items-center\">\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [className]=\"selectedFilterMetadata()?.descriptor?.className\"\n [dropdownClassName]=\"selectedFilterMetadata()?.descriptor?.dropdownClassName\"\n [placeholder]=\"valueModel() ? undefined : ('mngFilter.value' | translate)\"\n allowInput=\"true\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\"></mng-dropdown>\n @if (enableCaseSensitive()) {\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-2 p-1 p-button\" onLabel=\"Aa\" offLabel=\"Aa\" />\n }\n </span>\n } @else {\n <span class=\"p-input-icon-right\">\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]=\"selectedFilterMetadata()?.descriptor?.trimOption\"\n [disabled]=\"!matchModeModel()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-1 p-1 p-button-sm\" onLabel=\"Aa\" offLabel=\"Aa\" />\n </span>\n }\n </span>\n }\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]=\"isMultiselect()\"\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]=\"selectedFilterMetadata()?.descriptor?.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]=\"isMultiselect()\"\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 } @else if (selectedFilterMetadata()?.descriptor?.isGenericFilter && genericValueDataProvider()) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n </ng-template>\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", styles: [".toggle-button-input{position:absolute;right:.25rem;top:50%;transform:translateY(-50%)}\n"] }]
|
|
1159
1438
|
}], ctorParameters: () => [] });
|
|
1160
1439
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
class FilterOverlayWithTagComponent {
|
|
1440
|
+
class TableFilterOverlayWithTagComponent {
|
|
1164
1441
|
static { this.SEARCH_WORD_LIMIT_MAX = 4; }
|
|
1165
1442
|
constructor() {
|
|
1166
1443
|
this.primeTable = inject(Table);
|
|
1167
|
-
this.
|
|
1168
|
-
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
1444
|
+
this.tableData = inject((TableDataService));
|
|
1169
1445
|
this.tableConfig = inject(COMMONS_TABLE_FEATURE_CONFIG_IT, { optional: true });
|
|
1170
|
-
this.
|
|
1446
|
+
this.metadata = input.required();
|
|
1171
1447
|
this.genericFilterDescriptor = input();
|
|
1172
1448
|
this.model = input.required();
|
|
1173
1449
|
this.enableSearch = input(false, { transform: booleanAttribute });
|
|
@@ -1175,18 +1451,18 @@ class FilterOverlayWithTagComponent {
|
|
|
1175
1451
|
this.searchLimitWordMax = input(undefined);
|
|
1176
1452
|
this.enableCaseSensitive = input(true, { transform: booleanAttribute });
|
|
1177
1453
|
this.filterOverlay = viewChild.required(OverlayPanel);
|
|
1178
|
-
this.filterFormComponent = viewChild(
|
|
1454
|
+
this.filterFormComponent = viewChild(TableFilterFormComponent);
|
|
1179
1455
|
this.templates = contentChildren(TemplateDirective);
|
|
1180
1456
|
this.titleTemplate = computed(() => findTemplateByName([...this.templates()], 'title'));
|
|
1181
1457
|
this.filters = computed(() => {
|
|
1182
|
-
return this.
|
|
1458
|
+
return this.getInitialFilters(this.tableData.filterMeta(), this.metadata());
|
|
1183
1459
|
});
|
|
1184
|
-
this.showFilterButton = computed(() => this.
|
|
1460
|
+
this.showFilterButton = computed(() => this.metadata().length > 0);
|
|
1185
1461
|
this.activeFilters = computed(() => {
|
|
1186
1462
|
const filterEntry = this.filters();
|
|
1187
|
-
return this.
|
|
1463
|
+
return this.metadata()
|
|
1188
1464
|
.filter(d => {
|
|
1189
|
-
const filter = filterEntry[d.property];
|
|
1465
|
+
const filter = filterEntry[d.descriptor.property];
|
|
1190
1466
|
return (filter &&
|
|
1191
1467
|
filter.matchMode !== undefined &&
|
|
1192
1468
|
filter.displayMatchMode !== undefined &&
|
|
@@ -1194,11 +1470,10 @@ class FilterOverlayWithTagComponent {
|
|
|
1194
1470
|
filter.matchMode === FilterMatchMode.DoesNotExist ||
|
|
1195
1471
|
(filter.value !== undefined && filter.displayValue !== undefined)));
|
|
1196
1472
|
})
|
|
1197
|
-
.map(d => filterEntry[d.property]);
|
|
1473
|
+
.map(d => filterEntry[d.descriptor.property]);
|
|
1198
1474
|
});
|
|
1199
|
-
this.activeFilterProperties = computed(() => this.activeFilters().map(f => f.descriptor.property));
|
|
1475
|
+
this.activeFilterProperties = computed(() => this.activeFilters().map(f => f.metadata.descriptor.property));
|
|
1200
1476
|
this.filterEdit = signal(undefined);
|
|
1201
|
-
this.serializationCfg = {};
|
|
1202
1477
|
// global search model
|
|
1203
1478
|
this.searchValue = computed(() => this.search()?.value);
|
|
1204
1479
|
this.searchCaseSensitive = computed(() => this.search()?.caseSensitive);
|
|
@@ -1208,28 +1483,27 @@ class FilterOverlayWithTagComponent {
|
|
|
1208
1483
|
if (inputLimit !== undefined) {
|
|
1209
1484
|
return inputLimit;
|
|
1210
1485
|
}
|
|
1211
|
-
return this.tableConfig?.searchLimitMaxWords !== undefined ? this.tableConfig?.searchLimitMaxWords :
|
|
1486
|
+
return this.tableConfig?.searchLimitMaxWords !== undefined ? this.tableConfig?.searchLimitMaxWords : TableFilterOverlayWithTagComponent.SEARCH_WORD_LIMIT_MAX;
|
|
1212
1487
|
});
|
|
1213
1488
|
this.searchValueSubject = new BehaviorSubject(undefined);
|
|
1214
1489
|
this.searchCaseSensitiveSubject = new BehaviorSubject(undefined);
|
|
1215
1490
|
// UI utilities
|
|
1216
1491
|
this.clickedOnFilterEvent = undefined;
|
|
1217
|
-
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
1218
1492
|
combineLatest([this.searchValueSubject.pipe(debounceTime(500), distinctUntilChanged()), this.searchCaseSensitiveSubject])
|
|
1219
1493
|
// NOTE: skip is used to ignore propagating the initial value of the subjects
|
|
1220
1494
|
.pipe(skip(1), takeUntilDestroyed())
|
|
1221
1495
|
.subscribe(([value, caseSensitive]) => {
|
|
1222
|
-
this.updatePrimeTableGlobalFilter(value == null ? this.search()?.value ?? '' : value, caseSensitive == null ? this.search()?.caseSensitive ?? undefined : caseSensitive);
|
|
1496
|
+
this.updatePrimeTableGlobalFilter(value == null ? (this.search()?.value ?? '') : value, caseSensitive == null ? (this.search()?.caseSensitive ?? undefined) : caseSensitive);
|
|
1223
1497
|
});
|
|
1224
1498
|
}
|
|
1225
1499
|
onFilterFormApply(event) {
|
|
1226
|
-
const
|
|
1227
|
-
if (!
|
|
1500
|
+
const filterMetadata = this.metadata().find(d => d.descriptor.property === event.property);
|
|
1501
|
+
if (!filterMetadata) {
|
|
1228
1502
|
return;
|
|
1229
1503
|
}
|
|
1230
1504
|
const filterData = {
|
|
1231
|
-
...filterSetMetadataOnDisplayChange({ caseSensitive: event.caseSensitive }, event.matchMode, event.value, descriptor.filterType,
|
|
1232
|
-
|
|
1505
|
+
...filterSetMetadataOnDisplayChange({ caseSensitive: event.caseSensitive }, event.matchMode, event.value, filterMetadata.descriptor.filterType, filterMetadata.dateConfig),
|
|
1506
|
+
metadata: filterMetadata
|
|
1233
1507
|
};
|
|
1234
1508
|
this.updatePrimeTableFilter(filterData);
|
|
1235
1509
|
// this keeps the UI updated properly before closing the overlay
|
|
@@ -1240,7 +1514,7 @@ class FilterOverlayWithTagComponent {
|
|
|
1240
1514
|
}
|
|
1241
1515
|
onFilterRemove(event) {
|
|
1242
1516
|
this.updatePrimeTableFilter({
|
|
1243
|
-
...this.filters()[event.filter.descriptor.property],
|
|
1517
|
+
...this.filters()[event.filter.metadata.descriptor.property],
|
|
1244
1518
|
matchMode: undefined,
|
|
1245
1519
|
displayMatchMode: undefined,
|
|
1246
1520
|
value: undefined,
|
|
@@ -1290,7 +1564,7 @@ class FilterOverlayWithTagComponent {
|
|
|
1290
1564
|
}
|
|
1291
1565
|
onFilterAddOrEdit(filter, event) {
|
|
1292
1566
|
// If user clicks on the same filter or add that is already open, close the overlay
|
|
1293
|
-
if (this.filterOverlay().overlayVisible && this.filterEdit()?.descriptor.property === filter?.descriptor.property) {
|
|
1567
|
+
if (this.filterOverlay().overlayVisible && this.filterEdit()?.metadata.descriptor.property === filter?.metadata.descriptor.property) {
|
|
1294
1568
|
this.filterOverlay().hide();
|
|
1295
1569
|
return;
|
|
1296
1570
|
}
|
|
@@ -1305,23 +1579,25 @@ class FilterOverlayWithTagComponent {
|
|
|
1305
1579
|
this.filterOverlay().show(event);
|
|
1306
1580
|
}
|
|
1307
1581
|
}
|
|
1308
|
-
|
|
1582
|
+
getInitialFilters(filtersInit, metadata) {
|
|
1309
1583
|
const filtersResult = {};
|
|
1310
|
-
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1584
|
+
if (filtersInit) {
|
|
1585
|
+
for (const property in filtersInit) {
|
|
1586
|
+
const filterInit = filtersInit[property];
|
|
1587
|
+
const filterMetadata = metadata.find(m => m.descriptor.property === property);
|
|
1588
|
+
if (!filterMetadata) {
|
|
1589
|
+
continue;
|
|
1590
|
+
}
|
|
1591
|
+
filtersResult[property] = {
|
|
1592
|
+
...filterSetMetadataOnChange(filterInit, filterInit.matchMode, filterInit.value, filterMetadata.descriptor.filterType, filterMetadata.dateConfig),
|
|
1593
|
+
metadata: filterMetadata
|
|
1594
|
+
};
|
|
1315
1595
|
}
|
|
1316
|
-
filtersResult[property] = {
|
|
1317
|
-
...filterSetMetadataOnChange(filterInit, filterInit.matchMode, filterInit.value, descriptor.filterType, filterGetDateConfig(descriptor, this.serializationCfg)),
|
|
1318
|
-
descriptor: descriptor
|
|
1319
|
-
};
|
|
1320
1596
|
}
|
|
1321
1597
|
return filtersResult;
|
|
1322
1598
|
}
|
|
1323
1599
|
updatePrimeTableFilter(filter) {
|
|
1324
|
-
this.primeTable.filters[filter.descriptor.property] = { ...filter };
|
|
1600
|
+
this.primeTable.filters[filter.metadata.descriptor.property] = { ...filter };
|
|
1325
1601
|
this.primeTable._filter();
|
|
1326
1602
|
}
|
|
1327
1603
|
updatePrimeTableGlobalFilter(searchQuery, caseSensitive = false) {
|
|
@@ -1329,18 +1605,18 @@ class FilterOverlayWithTagComponent {
|
|
|
1329
1605
|
this.primeTable.filters['global'] = { ...{ value: searchQuery, matchMode: 'contains', caseSensitive: caseSensitive } };
|
|
1330
1606
|
this.primeTable._filter();
|
|
1331
1607
|
}
|
|
1332
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1333
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.
|
|
1608
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterOverlayWithTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1609
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableFilterOverlayWithTagComponent, isStandalone: true, selector: "mng-table-filter-overlay-with-tag", inputs: { metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: true, transformFunction: null }, genericFilterDescriptor: { classPropertyName: "genericFilterDescriptor", publicName: "genericFilterDescriptor", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, enableSearch: { classPropertyName: "enableSearch", publicName: "enableSearch", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, searchLimitWordMax: { classPropertyName: "searchLimitWordMax", publicName: "searchLimitWordMax", isSignal: true, isRequired: false, transformFunction: null }, enableCaseSensitive: { classPropertyName: "enableCaseSensitive", publicName: "enableCaseSensitive", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "filterOverlay", first: true, predicate: OverlayPanel, descendants: true, isSignal: true }, { propertyName: "filterFormComponent", first: true, predicate: TableFilterFormComponent, 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 @if (showFilterButton()) {\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 }\n @if (enableSearch()) {\n <div class=\"col-4\" [ngClass]=\"{'ml-3': !showFilterButton() && titleTemplate()}\">\n <span class=\"p-input-icon-left w-full\">\n <i class=\"pi pi-search\"></i>\n <input\n [ngModel]=\"searchValue()\"\n (ngModelChange)=\"onSearchChange($event)\"\n name=\"globalSearch\"\n type=\"text\"\n pInputText\n class=\"search-input w-full\"\n [ngClass]=\"{'ng-invalid': searchWordLimitMaxError()}\"\n [attr.placeholder]=\"'mngFilter.search.input' | translate\"\n [placeholder]=\"'mngFilter.search.input' | translate\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton\n styleClass=\"ml-1 p-1 p-button-sm\"\n [ngModel]=\"searchCaseSensitive()\"\n (ngModelChange)=\"onSearchCaseSensitiveChange($event)\"\n onLabel=\"Aa\"\n offLabel=\"Aa\" />\n </span>\n }\n </span>\n @if (searchWordLimitMaxError()) {\n <small class=\"p-error block\">\n {{ 'mngFilter.search.maxWordsExceededMessage' | translate }}\n </small>\n }\n </div>\n }\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.metadata.descriptor.property) {\n <mng-table-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-table-filter-form\n [model]=\"model()\"\n [metadata]=\"metadata()\"\n [genericDescriptor]=\"genericFilterDescriptor()\"\n [filter]=\"filterEdit()\"\n [disabledProperties]=\"activeFilterProperties()\"\n [propertySearch]=\"genericFilterDescriptor()?.propertySearch\"\n [overlay]=\"op\"\n [enableCaseSensitive]=\"enableCaseSensitive()\"\n (apply)=\"onFilterFormApply($event)\" />\n</p-overlayPanel>\n", styles: [".toggle-button-input{position:absolute;right:.35rem;top:50%;transform:translateY(-50%)}\n"], dependencies: [{ kind: "ngmodule", type: OverlayPanelModule }, { kind: "component", type: i1$2.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: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: TableFilterFormComponent, selector: "mng-table-filter-form", inputs: ["title", "metadata", "genericDescriptor", "model", "filter", "overlay", "disabledProperties", "enableCaseSensitive", "propertySearch"], 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: TableFilterActiveTagComponent, selector: "mng-table-filter-active-tag", inputs: ["model", "filter"], outputs: ["edit", "remove"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i5.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "ngmodule", type: PaginatorModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i9.ToggleButton, selector: "p-toggleButton", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "iconPos", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "ngmodule", type: CheckboxModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1334
1610
|
}
|
|
1335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterOverlayWithTagComponent, decorators: [{
|
|
1336
1612
|
type: Component,
|
|
1337
|
-
args: [{ standalone: true, selector: 'mng-filter-overlay-with-tag', imports: [
|
|
1613
|
+
args: [{ standalone: true, selector: 'mng-table-filter-overlay-with-tag', imports: [
|
|
1338
1614
|
OverlayPanelModule,
|
|
1339
1615
|
TranslateModule,
|
|
1340
1616
|
TagModule,
|
|
1341
|
-
|
|
1617
|
+
TableFilterFormComponent,
|
|
1342
1618
|
Button,
|
|
1343
|
-
|
|
1619
|
+
TableFilterActiveTagComponent,
|
|
1344
1620
|
NgTemplateOutlet,
|
|
1345
1621
|
InputTextModule,
|
|
1346
1622
|
PaginatorModule,
|
|
@@ -1350,7 +1626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
1350
1626
|
InputGroupAddonModule,
|
|
1351
1627
|
CheckboxModule,
|
|
1352
1628
|
NgStyle
|
|
1353
|
-
], 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 @if (showFilterButton()) {\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 }\n @if (enableSearch()) {\n <div class=\"col-4\" [ngClass]=\"{'ml-3': !showFilterButton() && titleTemplate()}\">\n <span class=\"p-input-icon-left w-full\">\n <i class=\"pi pi-search\"></i>\n <input\n [ngModel]=\"searchValue()\"\n (ngModelChange)=\"onSearchChange($event)\"\n name=\"globalSearch\"\n type=\"text\"\n pInputText\n class=\"search-input w-full\"\n [ngClass]=\"{'ng-invalid': searchWordLimitMaxError()}\"\n [attr.placeholder]=\"'mngFilter.search.input' | translate\"\n [placeholder]=\"'mngFilter.search.input' | translate\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton\n styleClass=\"ml-1 p-1 p-button-sm\"\n [ngModel]=\"searchCaseSensitive()\"\n (ngModelChange)=\"onSearchCaseSensitiveChange($event)\"\n onLabel=\"Aa\"\n offLabel=\"Aa\" />\n </span>\n }\n </span>\n @if (searchWordLimitMaxError()) {\n <small class=\"p-error block\">\n {{ 'mngFilter.search.maxWordsExceededMessage' | translate }}\n </small>\n }\n </div>\n }\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 [
|
|
1629
|
+
], 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 @if (showFilterButton()) {\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 }\n @if (enableSearch()) {\n <div class=\"col-4\" [ngClass]=\"{'ml-3': !showFilterButton() && titleTemplate()}\">\n <span class=\"p-input-icon-left w-full\">\n <i class=\"pi pi-search\"></i>\n <input\n [ngModel]=\"searchValue()\"\n (ngModelChange)=\"onSearchChange($event)\"\n name=\"globalSearch\"\n type=\"text\"\n pInputText\n class=\"search-input w-full\"\n [ngClass]=\"{'ng-invalid': searchWordLimitMaxError()}\"\n [attr.placeholder]=\"'mngFilter.search.input' | translate\"\n [placeholder]=\"'mngFilter.search.input' | translate\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton\n styleClass=\"ml-1 p-1 p-button-sm\"\n [ngModel]=\"searchCaseSensitive()\"\n (ngModelChange)=\"onSearchCaseSensitiveChange($event)\"\n onLabel=\"Aa\"\n offLabel=\"Aa\" />\n </span>\n }\n </span>\n @if (searchWordLimitMaxError()) {\n <small class=\"p-error block\">\n {{ 'mngFilter.search.maxWordsExceededMessage' | translate }}\n </small>\n }\n </div>\n }\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.metadata.descriptor.property) {\n <mng-table-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-table-filter-form\n [model]=\"model()\"\n [metadata]=\"metadata()\"\n [genericDescriptor]=\"genericFilterDescriptor()\"\n [filter]=\"filterEdit()\"\n [disabledProperties]=\"activeFilterProperties()\"\n [propertySearch]=\"genericFilterDescriptor()?.propertySearch\"\n [overlay]=\"op\"\n [enableCaseSensitive]=\"enableCaseSensitive()\"\n (apply)=\"onFilterFormApply($event)\" />\n</p-overlayPanel>\n", styles: [".toggle-button-input{position:absolute;right:.35rem;top:50%;transform:translateY(-50%)}\n"] }]
|
|
1354
1630
|
}], ctorParameters: () => [] });
|
|
1355
1631
|
|
|
1356
1632
|
function tableNotificationError(translate, table, error, messageService) {
|
|
@@ -1366,16 +1642,6 @@ function tableNotificationError(translate, table, error, messageService) {
|
|
|
1366
1642
|
return toastMessage(messageService, tableErrorTitle, tableErrorMessage, 'error', 'pi-exclamation-triangle');
|
|
1367
1643
|
}
|
|
1368
1644
|
|
|
1369
|
-
/**
|
|
1370
|
-
* generates table layout preferences key used when saving preferences to localstorage
|
|
1371
|
-
* @param typeName string, required
|
|
1372
|
-
* @param url string, required
|
|
1373
|
-
* @param trackProperty string, not required
|
|
1374
|
-
*/
|
|
1375
|
-
function generateTableLayoutPrefsKey(typeName, url, trackProperty) {
|
|
1376
|
-
return `commonsTableLayoutPrefs~~${typeName}~~${trackProperty ?? url.split('?')[0].split('#')[0]}`;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
1645
|
class LocaleDefaultRowClassPipe {
|
|
1380
1646
|
constructor(injector) {
|
|
1381
1647
|
this.injector = injector;
|
|
@@ -1388,10 +1654,10 @@ class LocaleDefaultRowClassPipe {
|
|
|
1388
1654
|
}
|
|
1389
1655
|
return value ?? '';
|
|
1390
1656
|
}
|
|
1391
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1392
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.
|
|
1657
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: LocaleDefaultRowClassPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1658
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: LocaleDefaultRowClassPipe, isStandalone: true, name: "mngLocaleDefaultRowClass" }); }
|
|
1393
1659
|
}
|
|
1394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: LocaleDefaultRowClassPipe, decorators: [{
|
|
1395
1661
|
type: Pipe,
|
|
1396
1662
|
args: [{
|
|
1397
1663
|
standalone: true,
|
|
@@ -1410,10 +1676,10 @@ class TableColumnFilterClassPipe {
|
|
|
1410
1676
|
return strValue;
|
|
1411
1677
|
}
|
|
1412
1678
|
}
|
|
1413
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1414
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.
|
|
1679
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1680
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterClassPipe, isStandalone: true, name: "mngTableColumnFilterClass" }); }
|
|
1415
1681
|
}
|
|
1416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1682
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterClassPipe, decorators: [{
|
|
1417
1683
|
type: Pipe,
|
|
1418
1684
|
args: [{
|
|
1419
1685
|
standalone: true,
|
|
@@ -1422,22 +1688,173 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
1422
1688
|
}]
|
|
1423
1689
|
}] });
|
|
1424
1690
|
|
|
1691
|
+
/**
|
|
1692
|
+
* generates table layout preferences key used when saving preferences to localstorage
|
|
1693
|
+
* @param typeName string, required
|
|
1694
|
+
* @param url string, required
|
|
1695
|
+
* @param trackProperty string, not required
|
|
1696
|
+
*/
|
|
1697
|
+
function generateTableLayoutPrefsKey(typeName, url, trackProperty) {
|
|
1698
|
+
return `commonsTableLayoutPrefs~~${typeName}~~${trackProperty ?? url.split('?')[0].split('#')[0]}`;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
class TablePreferencesService {
|
|
1702
|
+
constructor() {
|
|
1703
|
+
this.#router = inject(Router);
|
|
1704
|
+
this.#storageService = inject(CommonsStorageService);
|
|
1705
|
+
this.#metadata = inject(TableMetadataService);
|
|
1706
|
+
this.localstorageKey = computed(() => {
|
|
1707
|
+
const descriptor = this.#metadata.descriptor();
|
|
1708
|
+
return descriptor.model.i18nBaseKey ? generateTableLayoutPrefsKey(descriptor.model.i18nBaseKey, this.#router.url, descriptor.identifier) : null;
|
|
1709
|
+
});
|
|
1710
|
+
this.#layoutPrefsSaveCnt = signal(0);
|
|
1711
|
+
this.layoutPreferences = computed(() => {
|
|
1712
|
+
const lsKey = this.localstorageKey();
|
|
1713
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1714
|
+
const cnt = this.#layoutPrefsSaveCnt(); // needed to force updates on user changes
|
|
1715
|
+
const layoutPrefs = lsKey ? this.#storageService.getItem(TableMetadataService.cmpTypeName, lsKey) : undefined;
|
|
1716
|
+
return layoutPrefs ?? { columnWidths: {} };
|
|
1717
|
+
});
|
|
1718
|
+
// columns
|
|
1719
|
+
this.columnsWithPrefs = computed(() => this.#computeColumnsWithLayout());
|
|
1720
|
+
}
|
|
1721
|
+
#router;
|
|
1722
|
+
#storageService;
|
|
1723
|
+
#metadata;
|
|
1724
|
+
#layoutPrefsSaveCnt;
|
|
1725
|
+
/**
|
|
1726
|
+
* Method is called on column resize
|
|
1727
|
+
* @param element event's element
|
|
1728
|
+
*/
|
|
1729
|
+
onColumnResize({ element }) {
|
|
1730
|
+
const fieldId = element.id;
|
|
1731
|
+
const width = element.offsetWidth;
|
|
1732
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1733
|
+
const col = this.columnsWithPrefs().find(el => el.descriptor.property === fieldId);
|
|
1734
|
+
if (col)
|
|
1735
|
+
col.width = width;
|
|
1736
|
+
if (!layoutPrefs.columnWidths)
|
|
1737
|
+
layoutPrefs.columnWidths = {};
|
|
1738
|
+
layoutPrefs.columnWidths[fieldId] = width;
|
|
1739
|
+
this.#saveLayoutPreferences(layoutPrefs);
|
|
1740
|
+
}
|
|
1741
|
+
onColumnToggle(event) {
|
|
1742
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1743
|
+
const selectedColumns = event.value.map(v => v.descriptor.property);
|
|
1744
|
+
layoutPrefs.columnHidden = this.columnsWithPrefs()
|
|
1745
|
+
.filter(c => selectedColumns.indexOf(c.descriptor.property) < 0)
|
|
1746
|
+
.map(c => c.descriptor.property);
|
|
1747
|
+
this.#saveLayoutPreferences(layoutPrefs, true);
|
|
1748
|
+
}
|
|
1749
|
+
onColumnToggleAll() {
|
|
1750
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1751
|
+
const columns = [...this.columnsWithPrefs()];
|
|
1752
|
+
const isVisible = !this.columnsWithPrefs().some(c => c.isVisible);
|
|
1753
|
+
for (const col of columns) {
|
|
1754
|
+
if (isVisible !== col.isVisible) {
|
|
1755
|
+
col.isVisible = isVisible;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
layoutPrefs.columnHidden = columns.filter(c => !c.isVisible).map(c => c.descriptor.property);
|
|
1759
|
+
this.#saveLayoutPreferences(layoutPrefs);
|
|
1760
|
+
}
|
|
1761
|
+
onColumnReorder(event) {
|
|
1762
|
+
if (event.dropIndex !== undefined && event.dropIndex >= 0 && event.dragIndex !== undefined && event.dragIndex >= 0 && event.dropIndex !== event.dragIndex) {
|
|
1763
|
+
const eventDropIndex = event.dropIndex;
|
|
1764
|
+
const eventDragIndex = event.dragIndex;
|
|
1765
|
+
const prevVisibleColumns = this.columnsWithPrefs().filter(c => c.isVisible);
|
|
1766
|
+
const colAtDrop = prevVisibleColumns[eventDropIndex];
|
|
1767
|
+
const colAtDrag = prevVisibleColumns[eventDragIndex];
|
|
1768
|
+
const colAtDropIndex = this.columnsWithPrefs().findIndex(el => el.id === colAtDrop.id);
|
|
1769
|
+
const colAtDragIndex = this.columnsWithPrefs().findIndex(el => el.id === colAtDrag.id);
|
|
1770
|
+
if (colAtDropIndex > -1 && colAtDragIndex > -1) {
|
|
1771
|
+
let columns = [...this.columnsWithPrefs()];
|
|
1772
|
+
columns.splice(colAtDragIndex, 1);
|
|
1773
|
+
const dropIndex = columns.findIndex(el => el.id === colAtDrop.id) + (eventDropIndex > eventDragIndex ? 1 : 0);
|
|
1774
|
+
columns = [...columns.slice(0, dropIndex), colAtDrag, ...columns.slice(dropIndex)];
|
|
1775
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1776
|
+
layoutPrefs.columnOrder = columns.map(el => el.descriptor.property);
|
|
1777
|
+
this.#saveLayoutPreferences(layoutPrefs);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Reset column order and column visibility to default settings
|
|
1783
|
+
*/
|
|
1784
|
+
clearLayoutPreferences() {
|
|
1785
|
+
const key = this.localstorageKey();
|
|
1786
|
+
if (key) {
|
|
1787
|
+
this.#storageService.removeItem(TableMetadataService.cmpTypeName, key);
|
|
1788
|
+
this.#layoutPrefsSaveCnt.update(v => v + 1);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
#saveLayoutPreferences(layoutPrefs, forceUpdate = false) {
|
|
1792
|
+
const key = this.localstorageKey();
|
|
1793
|
+
if (key) {
|
|
1794
|
+
this.#storageService.setItem(TableMetadataService.cmpTypeName, key, layoutPrefs);
|
|
1795
|
+
if (forceUpdate) {
|
|
1796
|
+
this.#layoutPrefsSaveCnt.update(v => v + 1);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
#computeColumnsWithLayout() {
|
|
1801
|
+
const descriptor = this.#metadata.descriptor();
|
|
1802
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1803
|
+
// initialize columns with additional properties
|
|
1804
|
+
const timestamp = new Date().getTime();
|
|
1805
|
+
const columns = descriptor.columns.map(col => ({
|
|
1806
|
+
id: `${col.property}-${timestamp}`,
|
|
1807
|
+
descriptor: col,
|
|
1808
|
+
filter: this.#metadata
|
|
1809
|
+
.filters()
|
|
1810
|
+
.find(f => f.descriptor.showOnColumn === col.property &&
|
|
1811
|
+
((f.descriptor.displayType == null && this.#metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.Column) ||
|
|
1812
|
+
f.descriptor.displayType === FilterDisplayTypeEnum.Column)),
|
|
1813
|
+
sort: descriptor.sorts.find(f => f.showOnColumn === col.property),
|
|
1814
|
+
disabled: !col.isToggleable,
|
|
1815
|
+
isVisible: layoutPrefs.columnHidden ? !layoutPrefs.columnHidden.includes(col.property) : col.isVisible,
|
|
1816
|
+
width: layoutPrefs.columnWidths?.[col.property]
|
|
1817
|
+
}));
|
|
1818
|
+
if (layoutPrefs.columnOrder) {
|
|
1819
|
+
for (let i = 0; i < layoutPrefs.columnOrder.length; i++) {
|
|
1820
|
+
const colName = layoutPrefs.columnOrder[i];
|
|
1821
|
+
const colWithPrefs = columns.find(el => el.descriptor.property === colName);
|
|
1822
|
+
if (colWithPrefs) {
|
|
1823
|
+
colWithPrefs.orderIdx = i;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
return columns.sort((a, b) => (a.orderIdx !== undefined && b.orderIdx !== undefined ? a.orderIdx - b.orderIdx : 0));
|
|
1828
|
+
}
|
|
1829
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TablePreferencesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1830
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TablePreferencesService }); }
|
|
1831
|
+
}
|
|
1832
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TablePreferencesService, decorators: [{
|
|
1833
|
+
type: Injectable
|
|
1834
|
+
}] });
|
|
1835
|
+
|
|
1425
1836
|
class TableComponent {
|
|
1837
|
+
// subscriptions and refs
|
|
1838
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1839
|
+
#dataProviderEagerFirstLoad;
|
|
1840
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1841
|
+
#dataProviderReloadSubscription;
|
|
1842
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1843
|
+
#routeQueryParamsSubscription;
|
|
1844
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1845
|
+
#routerEventsSubscription;
|
|
1846
|
+
#afterNextRenderRef;
|
|
1426
1847
|
constructor() {
|
|
1427
1848
|
this.filterKeyPrepend = 'f_';
|
|
1428
|
-
this.
|
|
1429
|
-
this.logger = inject(LoggerService).create(this.cmpTypeName);
|
|
1430
|
-
this.injector = inject(Injector);
|
|
1849
|
+
this.logger = inject(LoggerService).create(TableMetadataService.cmpTypeName);
|
|
1431
1850
|
this.router = inject(Router);
|
|
1432
1851
|
this.route = inject(ActivatedRoute);
|
|
1433
1852
|
this.translate = inject(TranslateService);
|
|
1434
1853
|
this.messageService = inject(MessageService);
|
|
1435
|
-
this.
|
|
1436
|
-
this.
|
|
1437
|
-
this.
|
|
1438
|
-
|
|
1439
|
-
this.defaultFilterDisplayType = this.config?.filterDisplayType ?? FilterDisplayTypeEnum.Column;
|
|
1440
|
-
// metadata input
|
|
1854
|
+
this.metadata = inject(TableMetadataService);
|
|
1855
|
+
this.prefs = inject(TablePreferencesService);
|
|
1856
|
+
this.data = inject((TableDataService));
|
|
1857
|
+
// descriptor
|
|
1441
1858
|
this.descriptorInput = input.required({ alias: 'descriptor' });
|
|
1442
1859
|
// data source inputs
|
|
1443
1860
|
this.items = input();
|
|
@@ -1450,12 +1867,28 @@ class TableComponent {
|
|
|
1450
1867
|
this.selectionMode = input('multiple');
|
|
1451
1868
|
this.selectionEnabled = input(false, { transform: booleanAttribute });
|
|
1452
1869
|
this.rowReorderEnabledInput = input(true, { alias: 'rowReorderEnabled', transform: booleanAttribute });
|
|
1453
|
-
this.rowReorderEnabled = computed(() => this.rowReorderEnabledInput() && this.descriptor().rowReorderable);
|
|
1870
|
+
this.rowReorderEnabled = computed(() => this.rowReorderEnabledInput() && this.metadata.descriptor().rowReorderable);
|
|
1871
|
+
this.expandedRowKeys = computed(() => {
|
|
1872
|
+
const descriptor = this.metadata.descriptor();
|
|
1873
|
+
if (typeof descriptor.isRowExpanded === 'string') {
|
|
1874
|
+
return this.data.data()?.reduce((acc, item) => {
|
|
1875
|
+
acc[item[descriptor.trackProperty]] = !!item[descriptor.isRowExpanded];
|
|
1876
|
+
return acc;
|
|
1877
|
+
}, {});
|
|
1878
|
+
}
|
|
1879
|
+
else if (typeof descriptor.isRowExpanded === 'function') {
|
|
1880
|
+
return this.data.data()?.reduce((acc, item) => {
|
|
1881
|
+
acc[item[descriptor.trackProperty]] = descriptor.isRowExpanded(item);
|
|
1882
|
+
return acc;
|
|
1883
|
+
}, {});
|
|
1884
|
+
}
|
|
1885
|
+
return {};
|
|
1886
|
+
});
|
|
1454
1887
|
// styling
|
|
1455
1888
|
this.columnLastMinWidth = input();
|
|
1456
1889
|
this.columnsColspan = computed(() => this.visibleColumns().length + (this.hasLastColumn() ? 1 : 0) + (this.selectionEnabled() ? 1 : 0) + (this.rowReorderEnabled() ? 1 : 0));
|
|
1457
|
-
this.hasTitleDisplay = computed(() => this.captionTemplate() || this.captionComponent() || this.descriptor().title);
|
|
1458
|
-
this.isCaptionVisible = computed(() => this.hasTitleDisplay() || this.overlayWithTagFilters().length > 0 || this.descriptor().search);
|
|
1890
|
+
this.hasTitleDisplay = computed(() => this.captionTemplate() || this.captionComponent() || this.metadata.descriptor().title);
|
|
1891
|
+
this.isCaptionVisible = computed(() => this.hasTitleDisplay() || this.overlayWithTagFilters().length > 0 || this.metadata.descriptor().search);
|
|
1459
1892
|
// component inputs
|
|
1460
1893
|
this.captionComponent = input();
|
|
1461
1894
|
this.columnCustomLastComponent = input();
|
|
@@ -1474,7 +1907,7 @@ class TableComponent {
|
|
|
1474
1907
|
// content and view queries
|
|
1475
1908
|
this.templates = contentChildren(TemplateDirective);
|
|
1476
1909
|
this.components = viewChildren((ComponentDirective));
|
|
1477
|
-
this.primeTable = viewChild
|
|
1910
|
+
this.primeTable = viewChild(Table);
|
|
1478
1911
|
// templates
|
|
1479
1912
|
this.captionTemplate = computed(() => findTemplateByName([...this.templates()], 'caption'));
|
|
1480
1913
|
this.columnCustomLastTemplate = computed(() => findTemplateByName([...this.templates()], 'columnCustomLast'));
|
|
@@ -1482,25 +1915,12 @@ class TableComponent {
|
|
|
1482
1915
|
this.rowExpandTemplate = computed(() => findTemplateByName([...this.templates()], 'rowExpandContent'));
|
|
1483
1916
|
// data provider and items
|
|
1484
1917
|
this.isLazy = computed(() => this.dataProvider()?.isLazy === true);
|
|
1485
|
-
this.isPagination = computed(() => this.paginationMode() === TablePaginationModeEnum.Pagination);
|
|
1918
|
+
this.isPagination = computed(() => this.data.paginationMode() === TablePaginationModeEnum.Pagination);
|
|
1486
1919
|
this.useQueryParamsInitialized = signal(false);
|
|
1487
1920
|
// visual
|
|
1488
|
-
this.paginationMode = computed(() => {
|
|
1489
|
-
if (typeof this.descriptor().paginationMode !== 'undefined') {
|
|
1490
|
-
// descriptor choice is the strongest - if defined, use this value
|
|
1491
|
-
return this.descriptor().paginationMode;
|
|
1492
|
-
}
|
|
1493
|
-
else if (typeof this.dataProvider() !== 'undefined') {
|
|
1494
|
-
// when data provider is used, use pagination
|
|
1495
|
-
return TablePaginationModeEnum.Pagination;
|
|
1496
|
-
}
|
|
1497
|
-
else {
|
|
1498
|
-
return TablePaginationModeEnum.None;
|
|
1499
|
-
}
|
|
1500
|
-
});
|
|
1501
1921
|
this.className = computed(() => {
|
|
1502
|
-
let className = this.descriptor().className ?? '';
|
|
1503
|
-
switch (this.descriptor().size) {
|
|
1922
|
+
let className = this.metadata.descriptor().className ?? '';
|
|
1923
|
+
switch (this.metadata.descriptor().size) {
|
|
1504
1924
|
case TableSizeEnum.Small:
|
|
1505
1925
|
className += ' p-datatable-sm';
|
|
1506
1926
|
break;
|
|
@@ -1508,7 +1928,7 @@ class TableComponent {
|
|
|
1508
1928
|
className += ' p-datatable-lg';
|
|
1509
1929
|
break;
|
|
1510
1930
|
}
|
|
1511
|
-
if (this.descriptor().hasGridlines) {
|
|
1931
|
+
if (this.metadata.descriptor().hasGridlines) {
|
|
1512
1932
|
className += ' p-datatable-gridlines';
|
|
1513
1933
|
}
|
|
1514
1934
|
if (!this.isCaptionVisible()) {
|
|
@@ -1516,188 +1936,86 @@ class TableComponent {
|
|
|
1516
1936
|
}
|
|
1517
1937
|
return className;
|
|
1518
1938
|
});
|
|
1519
|
-
//
|
|
1520
|
-
this.
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
});
|
|
1524
|
-
// descriptors
|
|
1525
|
-
this.descriptor = signal(tableDescriptor());
|
|
1526
|
-
this.localstorageKey = computed(() => {
|
|
1527
|
-
const descriptor = this.descriptor();
|
|
1528
|
-
return descriptor.model.i18nBaseKey ? generateTableLayoutPrefsKey(descriptor.model.i18nBaseKey, this.router.url, descriptor.identifier) : null;
|
|
1529
|
-
});
|
|
1530
|
-
this.layoutPrefsSaveCnt = signal(0);
|
|
1531
|
-
this.layoutPreferences = computed(() => {
|
|
1532
|
-
const lsKey = this.localstorageKey();
|
|
1533
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1534
|
-
const cnt = this.layoutPrefsSaveCnt(); // needed to force updates on user changes
|
|
1535
|
-
const layoutPrefs = lsKey ? this.storageService.getItem(this.cmpTypeName, lsKey) : undefined;
|
|
1536
|
-
return layoutPrefs ?? { columnWidths: {} };
|
|
1537
|
-
});
|
|
1538
|
-
this.columns = computed(() => this.computeColumnsWithLayout());
|
|
1539
|
-
this.visibleColumns = computed(() => this.columns().filter(col => col.isVisible));
|
|
1939
|
+
// columns
|
|
1940
|
+
this.visibleColumns = computed(() => this.prefs.columnsWithPrefs().filter(col => col.isVisible));
|
|
1941
|
+
this.areColumnsReorderable = computed(() => this.prefs.columnsWithPrefs().some(col => col.descriptor.isReorderable));
|
|
1942
|
+
this.areColumnsToggleable = computed(() => this.prefs.columnsWithPrefs().some(col => col.descriptor.isToggleable));
|
|
1540
1943
|
// filter, sort
|
|
1541
|
-
this.
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
this.hasColumnFilters = computed(() => (this.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag && this.filterDescriptors().some(d => d.displayType === FilterDisplayTypeEnum.Column)) ||
|
|
1545
|
-
(this.defaultFilterDisplayType === FilterDisplayTypeEnum.Column && this.filterDescriptors().some(d => d.displayType == null)));
|
|
1944
|
+
this.hasColumnFilters = computed(() => (this.metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag &&
|
|
1945
|
+
this.metadata.filterDescriptors().some(d => d.displayType === FilterDisplayTypeEnum.Column)) ||
|
|
1946
|
+
(this.metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.Column && this.metadata.filterDescriptors().some(d => d.displayType == null)));
|
|
1546
1947
|
this.overlayWithTagFilters = computed(() => {
|
|
1547
|
-
|
|
1548
|
-
|
|
1948
|
+
// statically defined filters AND generic filters
|
|
1949
|
+
const filters = this.metadata
|
|
1950
|
+
.filters()
|
|
1951
|
+
.filter(d => (d.descriptor.displayType == null && this.metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag) ||
|
|
1952
|
+
d.descriptor.displayType === FilterDisplayTypeEnum.OverlayWithTag);
|
|
1953
|
+
return filters.concat(this.metadata.genericFilters());
|
|
1549
1954
|
});
|
|
1550
|
-
this.defaultParams = computed(() => this.computeDefaultDataListParams());
|
|
1551
1955
|
this.anyColumnVisible = computed(() => this.visibleColumns().length > 0);
|
|
1552
1956
|
this.hasCustomLastColumn = computed(() => this.columnCustomLastComponent() || this.columnCustomLastTemplate());
|
|
1553
1957
|
this.hasLastColumn = computed(() => this.hasCustomLastColumn() || this.areColumnsToggleable() || this.areColumnsReorderable());
|
|
1554
|
-
// layout prefs
|
|
1555
|
-
this.areColumnsReorderable = computed(() => this.columns().some(col => col.descriptor.isReorderable));
|
|
1556
|
-
this.areColumnsToggleable = computed(() => this.columns().some(col => col.descriptor.isToggleable));
|
|
1557
|
-
this.globalSearchParamFromUrl = signal(undefined);
|
|
1558
1958
|
// other
|
|
1559
1959
|
this.lastQueryParams = this.route.snapshot.queryParams;
|
|
1560
1960
|
this.navigationOutOfTableInProgress = false;
|
|
1561
1961
|
this.navigationInTableInProgress = false;
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
if (descriptor.defaultNumRows) {
|
|
1568
|
-
this.dataListService.rows.set(this.dataListService.rowsPerPageOptions().includes(descriptor.defaultNumRows) ? descriptor.defaultNumRows : this.dataListService.rowsPerPageOptions()[0]);
|
|
1569
|
-
}
|
|
1570
|
-
}, { allowSignalWrites: true });
|
|
1571
|
-
effect(() => {
|
|
1572
|
-
const loading = this.loadingInput();
|
|
1573
|
-
if (loading !== undefined) {
|
|
1574
|
-
this.dataListService.loading.set(loading);
|
|
1575
|
-
}
|
|
1576
|
-
}, { allowSignalWrites: true });
|
|
1577
|
-
effect(() => {
|
|
1578
|
-
const result = this.result();
|
|
1579
|
-
if (result !== undefined) {
|
|
1580
|
-
this.dataListService.setData(result.data, result.totalCount);
|
|
1581
|
-
const loading = this.loadingInput();
|
|
1582
|
-
if (loading == undefined) {
|
|
1583
|
-
// only set if input is not defined
|
|
1584
|
-
this.dataListService.loading.set(false);
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
}, { allowSignalWrites: true });
|
|
1588
|
-
effect(() => {
|
|
1589
|
-
const result = this.result();
|
|
1590
|
-
const items = this.items();
|
|
1591
|
-
if (result == undefined && items !== undefined) {
|
|
1592
|
-
this.dataListService.setData(items);
|
|
1593
|
-
const loading = this.loadingInput();
|
|
1594
|
-
if (loading == undefined) {
|
|
1595
|
-
// only set if input is not defined
|
|
1596
|
-
this.dataListService.loading.set(false);
|
|
1597
|
-
}
|
|
1962
|
+
// subscriptions and refs
|
|
1963
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1964
|
+
this.#dataProviderEagerFirstLoad = effectWithDeps([this.dataProvider], ([dataProvider]) => {
|
|
1965
|
+
if (dataProvider?.isLazy === false) {
|
|
1966
|
+
this.loadTableWithDataProvider(this.metadata.defaultParams());
|
|
1598
1967
|
}
|
|
1599
|
-
}, {
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
(this.descriptor().search && descriptor.searchFields ? descriptor.searchFields : this.columns().map(c => c.descriptor.property)));
|
|
1604
|
-
}, { allowSignalWrites: true });
|
|
1605
|
-
afterNextRender(() => {
|
|
1606
|
-
this.isCellClickObserved.set(this.cellClickSubject.observed);
|
|
1607
|
-
});
|
|
1608
|
-
toObservable(this.dataProvider)
|
|
1609
|
-
.pipe(switchMap(dp => dp?.tableReload$ ?? of({})))
|
|
1968
|
+
}, { firstOnly: true });
|
|
1969
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1970
|
+
this.#dataProviderReloadSubscription = toObservable(this.dataProvider)
|
|
1971
|
+
.pipe(switchMap(dp => dp?.tableReload$ ?? of({})), takeUntilDestroyed())
|
|
1610
1972
|
.subscribe({
|
|
1611
1973
|
next: e => {
|
|
1612
1974
|
this.reload(e);
|
|
1613
1975
|
}
|
|
1614
1976
|
});
|
|
1615
|
-
combineLatest([toObservable(this.descriptorInput), toObservable(this.dataProvider), toObservable(this.useQueryParams)])
|
|
1616
|
-
.pipe(
|
|
1617
|
-
// dataProvider is needed to ensure correct order of execution and reload
|
|
1618
1977
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
this.descriptor.set(descriptorInput);
|
|
1622
|
-
}
|
|
1623
|
-
if (useQueryParams) {
|
|
1624
|
-
// trigger table loads from route updates
|
|
1625
|
-
return this.route.queryParams;
|
|
1626
|
-
}
|
|
1627
|
-
else {
|
|
1628
|
-
return of(null);
|
|
1629
|
-
}
|
|
1630
|
-
}))
|
|
1978
|
+
this.#routeQueryParamsSubscription = toObservable(this.useQueryParams)
|
|
1979
|
+
.pipe(switchMap(useQp => (useQp ? this.route.queryParams : NEVER)), takeUntilDestroyed())
|
|
1631
1980
|
.subscribe(qp => {
|
|
1632
|
-
|
|
1633
|
-
// load data immediately by creating default sorts and filters (primeng will trigger onLazyLoad event on sort&filter metadata change)
|
|
1634
|
-
const defaultSort = this.createSortMeta(this.defaultParams());
|
|
1635
|
-
if (!defaultSort || defaultSort.length > 0) {
|
|
1636
|
-
this.dataListService.sortMeta.set(defaultSort);
|
|
1637
|
-
}
|
|
1638
|
-
const defaultFilter = this.createFilterMeta();
|
|
1639
|
-
if (defaultFilter) {
|
|
1640
|
-
this.dataListService.filterMeta.set(defaultFilter);
|
|
1641
|
-
}
|
|
1642
|
-
this.loadTableWithDataProvider({});
|
|
1643
|
-
}
|
|
1644
|
-
else {
|
|
1645
|
-
this.loadTableFromRouteUpdate(qp);
|
|
1646
|
-
}
|
|
1981
|
+
this.loadTableFromRouteUpdate(qp);
|
|
1647
1982
|
});
|
|
1648
|
-
|
|
1983
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1984
|
+
this.#routerEventsSubscription = toObservable(this.useQueryParams)
|
|
1649
1985
|
.pipe(switchMap(useQp => (useQp ? this.router.events : NEVER)), filter(e => (e instanceof NavigationStart && e.url.split('?')[0].split('#')[0] !== this.router.url.split('?')[0].split('#')[0]) ||
|
|
1650
1986
|
e instanceof NavigationEnd ||
|
|
1651
1987
|
e instanceof NavigationCancel ||
|
|
1652
|
-
e instanceof NavigationError))
|
|
1988
|
+
e instanceof NavigationError), takeUntilDestroyed())
|
|
1653
1989
|
.subscribe(e => {
|
|
1654
1990
|
this.navigationOutOfTableInProgress = e instanceof NavigationStart;
|
|
1655
1991
|
});
|
|
1656
|
-
|
|
1657
|
-
.
|
|
1658
|
-
if (genericFilterDescriptor) {
|
|
1659
|
-
const dataProvider = this.genericFilterDescriptor()?.propertyLookup;
|
|
1660
|
-
const genericFilterService = dataProvider?.serviceType ? this.injector.get(dataProvider.serviceType) : null;
|
|
1661
|
-
// fetch filterable properties
|
|
1662
|
-
return toObservable$1(genericFilterDescriptor.propertyLookup.lookup({}, genericFilterService));
|
|
1663
|
-
}
|
|
1664
|
-
return of([]);
|
|
1665
|
-
}), takeUntilDestroyed())
|
|
1666
|
-
.subscribe({
|
|
1667
|
-
next: genericFilters => {
|
|
1668
|
-
// set descriptors from generic filter data
|
|
1669
|
-
this.filterDescriptorsFromGeneric.set(createFilterDescriptorsFromGeneric(genericFilters, this.genericFilterDescriptor()?.valueLookup));
|
|
1670
|
-
}
|
|
1992
|
+
this.#afterNextRenderRef = afterNextRender(() => {
|
|
1993
|
+
this.isCellClickObserved.set(this.cellClickSubject.observed);
|
|
1671
1994
|
});
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
this.dataProviderSubscription?.unsubscribe();
|
|
1995
|
+
this.metadata.setSignalSources(this.descriptorInput, this.globalFilterFieldsInput);
|
|
1996
|
+
this.data.setDataSources(this.items, this.result, this.dataProvider, this.loadingInput);
|
|
1675
1997
|
}
|
|
1676
1998
|
reload(emitEventOrEvent = false, resetParamsParam = false) {
|
|
1677
|
-
const emitEvent = typeof emitEventOrEvent === 'boolean' ? emitEventOrEvent : emitEventOrEvent?.emitEvent ?? false;
|
|
1999
|
+
const emitEvent = typeof emitEventOrEvent === 'boolean' ? emitEventOrEvent : (emitEventOrEvent?.emitEvent ?? false);
|
|
1678
2000
|
const resetParams = typeof emitEventOrEvent === 'object' ? emitEventOrEvent?.resetParams : resetParamsParam;
|
|
1679
|
-
const params = typeof emitEventOrEvent === 'object' && emitEventOrEvent?.params
|
|
1680
|
-
|
|
1681
|
-
: resetParams
|
|
1682
|
-
? undefined
|
|
1683
|
-
: this.latestParamsWithDefaults;
|
|
1684
|
-
const reloadParams = mergeDataListParamsWithDefaults(params ?? {}, this.defaultParams());
|
|
2001
|
+
const params = typeof emitEventOrEvent === 'object' && emitEventOrEvent?.params ? emitEventOrEvent?.params : resetParams ? undefined : this.lastParamsWithDefaults;
|
|
2002
|
+
const reloadParams = mergeDataListParamsWithDefaults(params ?? {}, this.metadata.defaultParams());
|
|
1685
2003
|
this.loadTableWithDataProvider(reloadParams, emitEvent);
|
|
1686
2004
|
}
|
|
1687
2005
|
onTableLazyLoad(event) {
|
|
1688
|
-
this.
|
|
2006
|
+
this.lastLazyLoadEvent = event;
|
|
1689
2007
|
const params = fromTableLoadToDataListParams(event);
|
|
1690
2008
|
if (this.useQueryParams()) {
|
|
1691
2009
|
if (!this.navigationOutOfTableInProgress && !this.navigationInTableInProgress) {
|
|
2010
|
+
// this check is necessary: from some reason, primeNG commits one last lazy load event whenever any angular router navigation occurs
|
|
1692
2011
|
this.navigationInTableInProgress = true;
|
|
1693
|
-
const newParams = dataListParamsToUrlQuery(params, this.defaultParams(), { prependFilterName: this.filterKeyPrepend });
|
|
2012
|
+
const newParams = dataListParamsToUrlQuery(params, this.metadata.defaultParams(), { prependFilterName: this.filterKeyPrepend });
|
|
1694
2013
|
const newParamsWithParamsToRemove = { ...newParams };
|
|
1695
2014
|
if (this.lastQueryParams) {
|
|
1696
2015
|
Object.keys(this.lastQueryParams)
|
|
1697
2016
|
.filter(k => (k.startsWith(this.filterKeyPrepend) || ['offset', 'limit', 'sort', 'q'].indexOf(k) >= 0) && newParams[k] === undefined)
|
|
1698
2017
|
.forEach(k => (newParamsWithParamsToRemove[k] = null));
|
|
1699
2018
|
}
|
|
1700
|
-
// this check is necessary: from some reason, primeNG commits one last lazy load event whenever any angular router navigation occurs
|
|
1701
2019
|
this.router
|
|
1702
2020
|
.navigate([], {
|
|
1703
2021
|
relativeTo: this.route,
|
|
@@ -1714,10 +2032,8 @@ class TableComponent {
|
|
|
1714
2032
|
}
|
|
1715
2033
|
}
|
|
1716
2034
|
else {
|
|
1717
|
-
const paramsWithDefaults = mergeDataListParamsWithDefaults(params, this.defaultParams());
|
|
1718
|
-
|
|
1719
|
-
this.updatePrimeSortAndFilter(paramsWithDefaults);
|
|
1720
|
-
}
|
|
2035
|
+
const paramsWithDefaults = mergeDataListParamsWithDefaults(params, this.metadata.defaultParams());
|
|
2036
|
+
this.data.setParams(paramsWithDefaults);
|
|
1721
2037
|
this.loadTableWithDataProvider(paramsWithDefaults);
|
|
1722
2038
|
}
|
|
1723
2039
|
}
|
|
@@ -1726,13 +2042,11 @@ class TableComponent {
|
|
|
1726
2042
|
return;
|
|
1727
2043
|
}
|
|
1728
2044
|
const params = fromTableLoadToDataListParams({ filters: event.filters });
|
|
1729
|
-
const paramsWithDefaults = mergeDataListParamsWithDefaults(params, this.defaultParams());
|
|
2045
|
+
const paramsWithDefaults = mergeDataListParamsWithDefaults(params, this.metadata.defaultParams());
|
|
1730
2046
|
// if table doesn't use lazy loading, filter params need to be set here
|
|
1731
2047
|
// because the onTableLazyLoad event is not emitted
|
|
1732
2048
|
if (!this.isLazy()) {
|
|
1733
|
-
|
|
1734
|
-
this.updatePrimeSortAndFilter(paramsWithDefaults);
|
|
1735
|
-
}
|
|
2049
|
+
this.data.setParams(paramsWithDefaults);
|
|
1736
2050
|
}
|
|
1737
2051
|
}
|
|
1738
2052
|
onCellClick(event, col, item, idx) {
|
|
@@ -1753,256 +2067,39 @@ class TableComponent {
|
|
|
1753
2067
|
onRowReorder(event) {
|
|
1754
2068
|
this.rowReorder.emit(event);
|
|
1755
2069
|
}
|
|
1756
|
-
/**
|
|
1757
|
-
* Method is called on column resize
|
|
1758
|
-
* @param element event's element
|
|
1759
|
-
*/
|
|
1760
|
-
onTableColumnResize({ element }) {
|
|
1761
|
-
const fieldId = element.id;
|
|
1762
|
-
const width = element.offsetWidth;
|
|
1763
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1764
|
-
const col = this.columns().find(el => el.descriptor.property === fieldId);
|
|
1765
|
-
if (col)
|
|
1766
|
-
col.width = width;
|
|
1767
|
-
if (!layoutPrefs.columnWidths)
|
|
1768
|
-
layoutPrefs.columnWidths = {};
|
|
1769
|
-
layoutPrefs.columnWidths[fieldId] = width;
|
|
1770
|
-
this.saveLayoutPreferences(layoutPrefs);
|
|
1771
|
-
}
|
|
1772
2070
|
loadTableWithDataProvider(paramsWithDefaults, emitEvent = true) {
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
}
|
|
1777
|
-
this.dataProviderSubscription?.unsubscribe();
|
|
1778
|
-
this.dataListService.loading.set(true);
|
|
1779
|
-
this.latestParamsWithDefaults = paramsWithDefaults;
|
|
1780
|
-
this.dataProviderSubscription = toObservable$1(dataProvider.getAll(paramsWithDefaults, this.dataProviderService(), this.descriptor().isLocalized ? this.commons.appDataLocale() ?? undefined : undefined)).subscribe({
|
|
1781
|
-
next: res => {
|
|
1782
|
-
const descriptorInput = this.descriptorInput();
|
|
1783
|
-
if (descriptorInput instanceof TableDynamicDescriptorInst) {
|
|
1784
|
-
this.descriptor.set(descriptorInput.toTableDescriptorFromData(res));
|
|
1785
|
-
}
|
|
1786
|
-
this.dataListService.setData(res?.data ?? [], res?.totalCount);
|
|
1787
|
-
this.dataListService.loading.set(false);
|
|
1788
|
-
},
|
|
1789
|
-
error: err => {
|
|
1790
|
-
tableNotificationError(this.translate, this.descriptor(), err, this.messageService);
|
|
1791
|
-
this.dataListService.setData([]);
|
|
1792
|
-
this.dataListService.loading.set(false);
|
|
1793
|
-
const error = fromSubscribeError(err, 'TableComponentError', {
|
|
1794
|
-
queryParam: paramsWithDefaults
|
|
1795
|
-
});
|
|
1796
|
-
this.logger.log(error, getErrorLogLevel(error));
|
|
1797
|
-
}
|
|
1798
|
-
});
|
|
1799
|
-
if (emitEvent) {
|
|
1800
|
-
const tableEvent = {
|
|
1801
|
-
originalEvent: this.dataProviderLatestLazyLoadEvent,
|
|
2071
|
+
const isFetched = this.data.fetchWithDataProvider(paramsWithDefaults, error => {
|
|
2072
|
+
tableNotificationError(this.translate, this.metadata.descriptor(), error, this.messageService);
|
|
2073
|
+
const commonsError = fromSubscribeError(error, 'TableComponentError', {
|
|
1802
2074
|
params: paramsWithDefaults
|
|
1803
|
-
};
|
|
1804
|
-
this.
|
|
2075
|
+
});
|
|
2076
|
+
this.logger.log(commonsError, getErrorLogLevel(commonsError));
|
|
2077
|
+
});
|
|
2078
|
+
if (isFetched) {
|
|
2079
|
+
this.lastParamsWithDefaults = paramsWithDefaults;
|
|
2080
|
+
if (emitEvent) {
|
|
2081
|
+
const tableEvent = {
|
|
2082
|
+
originalEvent: this.lastLazyLoadEvent,
|
|
2083
|
+
params: paramsWithDefaults
|
|
2084
|
+
};
|
|
2085
|
+
this.tableLoad.emit(tableEvent);
|
|
2086
|
+
}
|
|
1805
2087
|
}
|
|
1806
2088
|
}
|
|
1807
2089
|
loadTableFromRouteUpdate(urlParams) {
|
|
1808
2090
|
const paramsWithDefaults = mergeDataListParamsWithDefaults(fromUrlQueryToDataListParams(urlParams, {
|
|
1809
2091
|
prependFilterName: this.filterKeyPrepend,
|
|
1810
2092
|
searchAsGlobal: true
|
|
1811
|
-
}), this.defaultParams());
|
|
1812
|
-
this.
|
|
1813
|
-
if (!this.useQueryParamsInitialized() && paramsWithDefaults?.search) {
|
|
1814
|
-
this.globalSearchParamFromUrl.set({ value: paramsWithDefaults?.search, caseSensitive: paramsWithDefaults.filters?.['global']?.caseSensitive ?? false });
|
|
1815
|
-
}
|
|
1816
|
-
this.useQueryParamsInitialized.set(true);
|
|
2093
|
+
}), this.metadata.defaultParams());
|
|
2094
|
+
this.data.setParams(paramsWithDefaults, true);
|
|
1817
2095
|
this.loadTableWithDataProvider(paramsWithDefaults);
|
|
1818
2096
|
}
|
|
1819
|
-
|
|
1820
|
-
this.dataListService.sortMeta.set(this.createSortMeta(paramsWithDefaults));
|
|
1821
|
-
this.dataListService.filterMeta.set(this.createFilterMeta(paramsWithDefaults));
|
|
1822
|
-
this.dataListService.rows.set(paramsWithDefaults?.limit ?? this.dataListService.rows());
|
|
1823
|
-
this.dataListService.offset.set(paramsWithDefaults?.offset ?? 0);
|
|
1824
|
-
}
|
|
1825
|
-
createFilterMeta(paramsWithDefaults) {
|
|
1826
|
-
const primeFilterMeta = {};
|
|
1827
|
-
// if any filter is present, no default filters should be applied!
|
|
1828
|
-
if (paramsWithDefaults?.filters) {
|
|
1829
|
-
Object.entries(paramsWithDefaults.filters).forEach(([key, value]) => {
|
|
1830
|
-
primeFilterMeta[key] = {
|
|
1831
|
-
value: value?.value,
|
|
1832
|
-
matchMode: value?.matchMode,
|
|
1833
|
-
caseSensitive: value?.caseSensitive
|
|
1834
|
-
};
|
|
1835
|
-
});
|
|
1836
|
-
}
|
|
1837
|
-
return primeFilterMeta;
|
|
1838
|
-
}
|
|
1839
|
-
createSortMeta(paramsWithDefaults) {
|
|
1840
|
-
if (paramsWithDefaults?.sort !== undefined && Array.isArray(paramsWithDefaults?.sort) && paramsWithDefaults?.sort.length > 0) {
|
|
1841
|
-
return paramsWithDefaults?.sort.map(s => ({
|
|
1842
|
-
field: s.property,
|
|
1843
|
-
order: s.ascending ? 1 : -1
|
|
1844
|
-
}));
|
|
1845
|
-
}
|
|
1846
|
-
return null;
|
|
1847
|
-
}
|
|
1848
|
-
onColumnToggle(event) {
|
|
1849
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1850
|
-
const selectedColumns = event.value.map(v => v.descriptor.property);
|
|
1851
|
-
layoutPrefs.columnHidden = this.columns()
|
|
1852
|
-
.filter(c => selectedColumns.indexOf(c.descriptor.property) < 0)
|
|
1853
|
-
.map(c => c.descriptor.property);
|
|
1854
|
-
this.saveLayoutPreferences(layoutPrefs);
|
|
1855
|
-
}
|
|
1856
|
-
onColumnToggleAll() {
|
|
1857
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1858
|
-
const columns = [...this.columns()];
|
|
1859
|
-
const isVisible = !this.columns().some(c => c.isVisible);
|
|
1860
|
-
for (const col of columns) {
|
|
1861
|
-
if (isVisible !== col.isVisible) {
|
|
1862
|
-
col.isVisible = isVisible;
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
layoutPrefs.columnHidden = columns.filter(c => !c.isVisible).map(c => c.descriptor.property);
|
|
1866
|
-
this.saveLayoutPreferences(layoutPrefs);
|
|
1867
|
-
}
|
|
1868
|
-
onColumnReorder(event) {
|
|
1869
|
-
if (event.dropIndex !== undefined && event.dropIndex >= 0 && event.dragIndex !== undefined && event.dragIndex >= 0 && event.dropIndex !== event.dragIndex) {
|
|
1870
|
-
const eventDropIndex = event.dropIndex;
|
|
1871
|
-
const eventDragIndex = event.dragIndex;
|
|
1872
|
-
const prevVisibleColumns = this.columns().filter(c => c.isVisible);
|
|
1873
|
-
const colAtDrop = prevVisibleColumns[eventDropIndex];
|
|
1874
|
-
const colAtDrag = prevVisibleColumns[eventDragIndex];
|
|
1875
|
-
const colAtDropIndex = this.columns().findIndex(el => el.id === colAtDrop.id);
|
|
1876
|
-
const colAtDragIndex = this.columns().findIndex(el => el.id === colAtDrag.id);
|
|
1877
|
-
if (colAtDropIndex > -1 && colAtDragIndex > -1) {
|
|
1878
|
-
let columns = [...this.columns()];
|
|
1879
|
-
columns.splice(colAtDragIndex, 1);
|
|
1880
|
-
const dropIndex = columns.findIndex(el => el.id === colAtDrop.id) + (eventDropIndex > eventDragIndex ? 1 : 0);
|
|
1881
|
-
columns = [...columns.slice(0, dropIndex), colAtDrag, ...columns.slice(dropIndex)];
|
|
1882
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1883
|
-
layoutPrefs.columnOrder = columns.map(el => el.descriptor.property);
|
|
1884
|
-
this.saveLayoutPreferences(layoutPrefs);
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
saveLayoutPreferences(layoutPrefs) {
|
|
1889
|
-
const key = this.localstorageKey();
|
|
1890
|
-
if (key) {
|
|
1891
|
-
this.storageService.setItem(this.cmpTypeName, key, layoutPrefs);
|
|
1892
|
-
this.layoutPrefsSaveCnt.update(v => v + 1);
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
computeDefaultDataListParams() {
|
|
1896
|
-
const params = {
|
|
1897
|
-
offset: 0,
|
|
1898
|
-
limit: this.dataListService.rowsPerPageOptions()[0],
|
|
1899
|
-
sort: this.descriptor()
|
|
1900
|
-
.sorts.filter(s => s.defaultIsEnabled)
|
|
1901
|
-
.sort((s1, s2) => (s1.defaultOrder ?? 1000) - (s2.defaultOrder ?? 1000))
|
|
1902
|
-
.map(s => ({
|
|
1903
|
-
property: s.property,
|
|
1904
|
-
ascending: s.defaultIsAscending
|
|
1905
|
-
})),
|
|
1906
|
-
filters: {}
|
|
1907
|
-
};
|
|
1908
|
-
this.filterDescriptors()
|
|
1909
|
-
.filter(d => d.hasDefaultValue)
|
|
1910
|
-
.forEach(f => {
|
|
1911
|
-
let matchMode = f.defaultMatchMode;
|
|
1912
|
-
if (!matchMode) {
|
|
1913
|
-
switch (f.filterType) {
|
|
1914
|
-
case FilterTypeEnum.String:
|
|
1915
|
-
matchMode = FilterMatchMode.Contains;
|
|
1916
|
-
break;
|
|
1917
|
-
case FilterTypeEnum.Lookup:
|
|
1918
|
-
case FilterTypeEnum.LookupEnum: {
|
|
1919
|
-
const lookupFilter = f;
|
|
1920
|
-
if (lookupFilter.multiselect) {
|
|
1921
|
-
matchMode = FilterMatchMode.In;
|
|
1922
|
-
}
|
|
1923
|
-
break;
|
|
1924
|
-
}
|
|
1925
|
-
default:
|
|
1926
|
-
break;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
if (!matchMode) {
|
|
1930
|
-
matchMode = FilterMatchMode.Equals;
|
|
1931
|
-
}
|
|
1932
|
-
if (f.matchModes && !f.matchModes?.includes(matchMode)) {
|
|
1933
|
-
matchMode = f.matchModes[0];
|
|
1934
|
-
}
|
|
1935
|
-
let value = undefined;
|
|
1936
|
-
if (Array.isArray(value)) {
|
|
1937
|
-
value = [...value];
|
|
1938
|
-
}
|
|
1939
|
-
else {
|
|
1940
|
-
value = f.defaultValue;
|
|
1941
|
-
}
|
|
1942
|
-
const property = f.property;
|
|
1943
|
-
params.filters[property] = {
|
|
1944
|
-
value: value,
|
|
1945
|
-
matchMode: matchMode
|
|
1946
|
-
};
|
|
1947
|
-
});
|
|
1948
|
-
return params;
|
|
1949
|
-
}
|
|
1950
|
-
computeColumnsWithLayout() {
|
|
1951
|
-
const descriptor = this.descriptor();
|
|
1952
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1953
|
-
// initialize columns with additional properties
|
|
1954
|
-
const timestamp = new Date().getTime();
|
|
1955
|
-
const columns = descriptor.columns.map(col => ({
|
|
1956
|
-
id: `${col.property}-${timestamp}`,
|
|
1957
|
-
descriptor: col,
|
|
1958
|
-
filter: descriptor.filters.find(f => f.showOnColumn === col.property &&
|
|
1959
|
-
((f.displayType == null && this.defaultFilterDisplayType === FilterDisplayTypeEnum.Column) || f.displayType === FilterDisplayTypeEnum.Column)),
|
|
1960
|
-
sort: descriptor.sorts.find(f => f.showOnColumn === col.property),
|
|
1961
|
-
disabled: !col.isToggleable,
|
|
1962
|
-
isVisible: layoutPrefs.columnHidden ? !layoutPrefs.columnHidden.includes(col.property) : col.isVisible,
|
|
1963
|
-
width: layoutPrefs.columnWidths?.[col.property]
|
|
1964
|
-
}));
|
|
1965
|
-
if (layoutPrefs.columnOrder) {
|
|
1966
|
-
for (let i = 0; i < layoutPrefs.columnOrder.length; i++) {
|
|
1967
|
-
const colName = layoutPrefs.columnOrder[i];
|
|
1968
|
-
const colWithPrefs = columns.find(el => el.descriptor.property === colName);
|
|
1969
|
-
if (colWithPrefs) {
|
|
1970
|
-
colWithPrefs.orderIdx = i;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
return columns.sort((a, b) => (a.orderIdx !== undefined && b.orderIdx !== undefined ? a.orderIdx - b.orderIdx : 0));
|
|
1975
|
-
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Reset column order and column visibility to default settings
|
|
1978
|
-
*/
|
|
1979
|
-
resetDefaultLayout() {
|
|
1980
|
-
const key = this.localstorageKey();
|
|
1981
|
-
if (key) {
|
|
1982
|
-
this.storageService.removeItem(this.cmpTypeName, key);
|
|
1983
|
-
this.layoutPrefsSaveCnt.update(v => v + 1);
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
/**
|
|
1987
|
-
* Compare the given params with the stored params in the DataListService.
|
|
1988
|
-
*
|
|
1989
|
-
* @param {DataListParams} params - The params to compare with the stored params.
|
|
1990
|
-
*
|
|
1991
|
-
* @return {boolean} - True if the given params match the stored params, otherwise false.
|
|
1992
|
-
*/
|
|
1993
|
-
compareWithCurrentParams(params) {
|
|
1994
|
-
return (params.offset === this.dataListService.offset() &&
|
|
1995
|
-
params.limit === this.dataListService.rows() &&
|
|
1996
|
-
JSON.stringify(this.createSortMeta(params)) === JSON.stringify(this.dataListService.sortMeta()) &&
|
|
1997
|
-
JSON.stringify(this.createFilterMeta(params)) === JSON.stringify(this.dataListService.filterMeta()));
|
|
1998
|
-
}
|
|
1999
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2000
|
-
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 (onFilter)=\"onTableFilter($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0 || descriptor().search) {\n <mng-filter-overlay-with-tag\n [title]=\"descriptor().title\"\n [descriptors]=\"overlayWithTagFilters()\"\n [genericFilterDescriptor]=\"genericFilterDescriptor()\"\n [model]=\"descriptor().model\"\n [enableSearch]=\"descriptor().search\"\n [search]=\"globalSearchParamFromUrl()\"\n [searchLimitWordMax]=\"descriptor().searchLimitMaxWords\"\n [enableCaseSensitive]=\"isLazy()\">\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 (areColumnsToggleable()) {\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\">\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 </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 [mngComponent]=\"descriptor().rowExpandableComponentType\" [inputs]=\"{item}\"> </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$3.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$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$3.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$3.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$3.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$3.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$3.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$3.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "directive", type: i1$3.ReorderableRowHandle, selector: "[pReorderableRowHandle]" }, { kind: "directive", type: i1$3.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$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: i2.TranslatePipe, name: "translate" }, { kind: "component", type: FilterOverlayWithTagComponent, selector: "mng-filter-overlay-with-tag", inputs: ["descriptors", "genericFilterDescriptor", "model", "enableSearch", "search", "searchLimitWordMax", "enableCaseSensitive"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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 }); }
|
|
2097
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2098
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", 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: [TableMetadataService, TableDataService, TablePreferencesService], 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 (data.isAllPaginationMetaInitialized()) {\n <p-table\n [value]=\"data.data()\"\n [dataKey]=\"metadata.descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"data.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"data.rows()\"\n [first]=\"data.offset()\"\n [totalRecords]=\"data.count()\"\n [rowsPerPageOptions]=\"metadata.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"data.sortMeta()\"\n [filters]=\"data.filterMeta()\"\n [globalFilterFields]=\"metadata.searchFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"metadata.descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"metadata.descriptor().hasResizableColumns\"\n [columnResizeMode]=\"metadata.descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n [expandedRowKeys]=\"expandedRowKeys()\"\n (onColResize)=\"prefs.onColumnResize($event)\"\n (onColReorder)=\"prefs.onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onFilter)=\"onTableFilter($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0 || metadata.descriptor().search) {\n <mng-table-filter-overlay-with-tag\n [title]=\"metadata.descriptor().title\"\n [metadata]=\"overlayWithTagFilters()\"\n [genericFilterDescriptor]=\"metadata.genericFilterDescriptor()\"\n [model]=\"metadata.descriptor().model\"\n [enableSearch]=\"metadata.descriptor().search\"\n [search]=\"data.searchMeta()\"\n [searchLimitWordMax]=\"metadata.descriptor().searchLimitMaxWords\"\n [enableCaseSensitive]=\"isLazy()\">\n @if (hasTitleDisplay()) {\n <ng-template mngTemplate=\"title\">\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n </ng-template>\n }\n </mng-table-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 (metadata.descriptor().title) {\n <h5 class=\"p-0 m-0\">{{ metadata.descriptor().title! | translate }}</h5>\n }\n </ng-template>\n </div>\n }\n </ng-template>\n <ng-template pTemplate=\"header\">\n @if (!metadata.descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"metadata.descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.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]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (metadata.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: metadata.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: metadata.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?.descriptor : 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?.descriptor : 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]=\"metadata.descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (areColumnsToggleable()) {\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]=\"prefs.columnsWithPrefs()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"prefs.onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\">\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 </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)=\"prefs.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)=\"prefs.clearLayoutPreferences()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: metadata.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]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @if (metadata.descriptor().rowExpandable) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.descriptor?.columnClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : (col.filter?.descriptor?.columnWidth ?? col.descriptor.width ?? null)\"\n [style.min-width.px]=\"col.width ? null : (col.filter?.descriptor?.columnMinWidth ?? col.descriptor.minWidth)\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter [metadata]=\"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]=\"\n metadata.descriptor().rowClassName | mngClassMap: metadata.descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: metadata.descriptor() : item\n \">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (metadata.descriptor().rowExpandable) {\n <td>\n @if (!metadata.descriptor().rowExpandableProperty || item[metadata.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?.descriptor : 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: metadata.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]=\"metadata.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 (metadata.descriptor().rowExpandable) {\n <tr>\n <td></td>\n <td [colSpan]=\"metadata.descriptor().rowExpandableColSpan\">\n @if (metadata.descriptor().rowExpandableComponentType !== undefined) {\n <ng-container [mngComponent]=\"metadata.descriptor().rowExpandableComponentType\" [inputs]=\"{item}\"> </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 (metadata.descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + metadata.descriptor().loadingIcon\"></i>\n }\n @if (metadata.descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': metadata.descriptor().loadingIcon}\">\n {{ metadata.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: data.data(), totalCount: data.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: ["metadata"] }, { kind: "pipe", type: TableColumnFilterClassPipe, name: "mngTableColumnFilterClass" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$3.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$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$3.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$3.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$3.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$3.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$3.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$3.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "directive", type: i1$3.ReorderableRowHandle, selector: "[pReorderableRowHandle]" }, { kind: "directive", type: i1$3.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$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: i2.TranslatePipe, name: "translate" }, { kind: "component", type: TableFilterOverlayWithTagComponent, selector: "mng-table-filter-overlay-with-tag", inputs: ["metadata", "genericFilterDescriptor", "model", "enableSearch", "search", "searchLimitWordMax", "enableCaseSensitive"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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 }); }
|
|
2001
2099
|
}
|
|
2002
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
2100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableComponent, decorators: [{
|
|
2003
2101
|
type: Component,
|
|
2004
2102
|
args: [{ standalone: true, selector: 'mng-table', imports: [
|
|
2005
|
-
AsyncPipe,
|
|
2006
2103
|
ComponentDirective,
|
|
2007
2104
|
I18nPropertyPipe,
|
|
2008
2105
|
NgClass,
|
|
@@ -2018,10 +2115,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
|
|
|
2018
2115
|
ButtonModule,
|
|
2019
2116
|
TooltipModule,
|
|
2020
2117
|
TranslateModule,
|
|
2021
|
-
|
|
2118
|
+
TableFilterOverlayWithTagComponent,
|
|
2022
2119
|
FormsModule,
|
|
2023
2120
|
TemplateDirective
|
|
2024
|
-
], 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 (onFilter)=\"onTableFilter($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0 || descriptor().search) {\n <mng-filter-overlay-with-tag\n [title]=\"descriptor().title\"\n [descriptors]=\"overlayWithTagFilters()\"\n [genericFilterDescriptor]=\"genericFilterDescriptor()\"\n [model]=\"descriptor().model\"\n [enableSearch]=\"descriptor().search\"\n [search]=\"globalSearchParamFromUrl()\"\n [searchLimitWordMax]=\"descriptor().searchLimitMaxWords\"\n [enableCaseSensitive]=\"isLazy()\">\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 (areColumnsToggleable()) {\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\">\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 </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 [mngComponent]=\"descriptor().rowExpandableComponentType\" [inputs]=\"{item}\"> </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" }]
|
|
2121
|
+
], providers: [TableMetadataService, TableDataService, TablePreferencesService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (data.isAllPaginationMetaInitialized()) {\n <p-table\n [value]=\"data.data()\"\n [dataKey]=\"metadata.descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"data.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"data.rows()\"\n [first]=\"data.offset()\"\n [totalRecords]=\"data.count()\"\n [rowsPerPageOptions]=\"metadata.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"data.sortMeta()\"\n [filters]=\"data.filterMeta()\"\n [globalFilterFields]=\"metadata.searchFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"metadata.descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"metadata.descriptor().hasResizableColumns\"\n [columnResizeMode]=\"metadata.descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n [expandedRowKeys]=\"expandedRowKeys()\"\n (onColResize)=\"prefs.onColumnResize($event)\"\n (onColReorder)=\"prefs.onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onFilter)=\"onTableFilter($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0 || metadata.descriptor().search) {\n <mng-table-filter-overlay-with-tag\n [title]=\"metadata.descriptor().title\"\n [metadata]=\"overlayWithTagFilters()\"\n [genericFilterDescriptor]=\"metadata.genericFilterDescriptor()\"\n [model]=\"metadata.descriptor().model\"\n [enableSearch]=\"metadata.descriptor().search\"\n [search]=\"data.searchMeta()\"\n [searchLimitWordMax]=\"metadata.descriptor().searchLimitMaxWords\"\n [enableCaseSensitive]=\"isLazy()\">\n @if (hasTitleDisplay()) {\n <ng-template mngTemplate=\"title\">\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n </ng-template>\n }\n </mng-table-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 (metadata.descriptor().title) {\n <h5 class=\"p-0 m-0\">{{ metadata.descriptor().title! | translate }}</h5>\n }\n </ng-template>\n </div>\n }\n </ng-template>\n <ng-template pTemplate=\"header\">\n @if (!metadata.descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"metadata.descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.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]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (metadata.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: metadata.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: metadata.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?.descriptor : 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?.descriptor : 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]=\"metadata.descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (areColumnsToggleable()) {\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]=\"prefs.columnsWithPrefs()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"prefs.onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\">\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 </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)=\"prefs.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)=\"prefs.clearLayoutPreferences()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: metadata.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]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @if (metadata.descriptor().rowExpandable) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.descriptor?.columnClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : (col.filter?.descriptor?.columnWidth ?? col.descriptor.width ?? null)\"\n [style.min-width.px]=\"col.width ? null : (col.filter?.descriptor?.columnMinWidth ?? col.descriptor.minWidth)\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter [metadata]=\"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]=\"\n metadata.descriptor().rowClassName | mngClassMap: metadata.descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: metadata.descriptor() : item\n \">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (metadata.descriptor().rowExpandable) {\n <td>\n @if (!metadata.descriptor().rowExpandableProperty || item[metadata.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?.descriptor : 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: metadata.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]=\"metadata.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 (metadata.descriptor().rowExpandable) {\n <tr>\n <td></td>\n <td [colSpan]=\"metadata.descriptor().rowExpandableColSpan\">\n @if (metadata.descriptor().rowExpandableComponentType !== undefined) {\n <ng-container [mngComponent]=\"metadata.descriptor().rowExpandableComponentType\" [inputs]=\"{item}\"> </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 (metadata.descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + metadata.descriptor().loadingIcon\"></i>\n }\n @if (metadata.descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': metadata.descriptor().loadingIcon}\">\n {{ metadata.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: data.data(), totalCount: data.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n" }]
|
|
2025
2122
|
}], ctorParameters: () => [] });
|
|
2026
2123
|
|
|
2027
2124
|
/**
|
|
@@ -2047,5 +2144,5 @@ function withTable(config) {
|
|
|
2047
2144
|
* Generated bundle index. Do not edit.
|
|
2048
2145
|
*/
|
|
2049
2146
|
|
|
2050
|
-
export { COMMONS_TABLE_FEATURE_CONFIG_IT,
|
|
2147
|
+
export { COMMONS_TABLE_FEATURE_CONFIG_IT, FilterValuePipe, LocaleDefaultRowClassPipe, TableColumnFilterClassPipe, TableColumnFilterComponent, TableColumnValueComponent, TableComponent, TableDataService, TableFilterActiveTagComponent, TableFilterFormComponent, TableFilterOverlayWithTagComponent, createFilterDescriptorsFromGeneric, filterAdjustDisplayValueOnMatchModeChange, filterApplySerializationConfigToCmp, filterAreDatesEqual, filterGenerateMatchModeOptions, filterGetDateConfig, filterGetDefaultMatchMode, filterGetNumberConfig, filterSetMetadataOnChange, filterSetMetadataOnDisplayChange, generateTableLayoutPrefsKey, tableNotificationError, withTable };
|
|
2051
2148
|
//# sourceMappingURL=mediusinc-mng-commons-table.mjs.map
|