@mediusinc/mng-commons 5.1.0-rc.0 → 5.1.0-rc.1
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/README.md +7 -6
- package/core/helpers/coercion.d.ts +1 -0
- package/core/index.d.ts +0 -1
- package/esm2022/core/components/notification/notification-wrapper.component.mjs +5 -6
- 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/directives/component.directive.mjs +3 -3
- package/esm2022/core/directives/template.directive.mjs +3 -3
- package/esm2022/core/helpers/coercion.mjs +4 -1
- package/esm2022/core/index.mjs +1 -2
- package/esm2022/core/pipes/boolean.pipe.mjs +3 -3
- package/esm2022/core/pipes/class-map.pipe.mjs +3 -3
- package/esm2022/core/pipes/enum.pipe.mjs +5 -5
- package/esm2022/core/pipes/enumerate-async.pipe.mjs +3 -3
- package/esm2022/core/pipes/enumerate.pipe.mjs +3 -3
- package/esm2022/core/pipes/getter.pipe.mjs +3 -3
- package/esm2022/core/pipes/i18n-property.pipe.mjs +3 -3
- package/esm2022/core/pipes/json-path.pipe.mjs +3 -3
- package/esm2022/core/pipes/parametrize.pipe.mjs +3 -3
- package/esm2022/core/pipes/template.pipe.mjs +3 -3
- package/esm2022/core/security/permission.service.mjs +3 -3
- package/esm2022/core/services/commons-init.service.mjs +3 -3
- package/esm2022/core/services/commons-router.service.mjs +3 -3
- package/esm2022/core/services/commons.service.mjs +3 -3
- package/esm2022/core/services/local-storage-config.service.mjs +3 -3
- 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/directives/input-trim.directive.mjs +14 -19
- package/esm2022/table/api/models/table.model.mjs +1 -1
- package/esm2022/table/components/column-filter-full/column-filter-full.component.mjs +4 -4
- package/esm2022/table/components/column-value/column-value.component.mjs +43 -53
- package/esm2022/table/components/table/table.component.mjs +300 -365
- package/esm2022/table/pipes/locale-default-row-class.pipe.mjs +3 -3
- package/esm2022/table/pipes/table-column-filter-class.pipe.mjs +3 -3
- package/esm2022/table/services/data-list.service.mjs +3 -3
- package/esm2022/tableview/action/components/action/action.component.mjs +5 -5
- package/esm2022/tableview/action/components/editor/action-editor.component.mjs +6 -7
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +5 -4
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +3 -3
- package/esm2022/tableview/action/components/route/action-route.component.mjs +3 -3
- package/esm2022/tableview/action/components/table/action-table.component.mjs +43 -92
- package/esm2022/tableview/action/services/component-action-executor.service.mjs +3 -3
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +3 -3
- package/esm2022/tableview/action/services/navigation.service.mjs +3 -3
- package/esm2022/tableview/action/services/root-action-executor.service.mjs +3 -3
- package/esm2022/tableview/action/services/view-container.service.mjs +3 -3
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +4 -1
- package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +6 -14
- package/esm2022/tableview/api/editor/models/field-action-context.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/form-editor.interface.mjs +1 -1
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +5 -5
- package/esm2022/tableview/api/editor/models/formly-field.model.mjs +1 -1
- package/esm2022/tableview/api/index.mjs +1 -2
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +17 -17
- 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 +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.mjs +47 -6
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-label/formly-field-label.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +15 -29
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +10 -11
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +18 -22
- package/esm2022/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-type.abstract.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +3 -3
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +14 -2
- package/esm2022/tableview/editor/helpers/editor-validators.mjs +25 -0
- package/esm2022/tableview/editor/helpers/formly-config.mjs +7 -5
- package/esm2022/tableview/editor/services/form-editor.service.mjs +3 -3
- package/esm2022/tableview/index.mjs +2 -1
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +3 -3
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +4 -4
- package/fesm2022/mediusinc-mng-commons-core.mjs +69 -111
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +23 -27
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +357 -431
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +13 -39
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +252 -240
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/form/directives/input-trim.directive.d.ts +5 -8
- package/package.json +15 -15
- package/table/api/models/table.model.d.ts +1 -1
- package/table/components/column-value/column-value.component.d.ts +11 -17
- package/table/components/table/table.component.d.ts +43 -47
- package/tableview/action/components/editor/action-editor.component.d.ts +1 -2
- package/tableview/action/components/table/action-table.component.d.ts +26 -29
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +3 -3
- package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +3 -3
- package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +2 -1
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +13 -9
- package/tableview/api/editor/models/field-action-context.model.d.ts +1 -1
- package/tableview/api/editor/models/form-editor.interface.d.ts +23 -6
- package/tableview/api/editor/models/formly-custom-field.model.d.ts +22 -19
- package/tableview/api/editor/models/formly-field.model.d.ts +20 -0
- package/tableview/api/index.d.ts +0 -1
- package/tableview/editor/components/editor/form-editor.component.d.ts +7 -7
- package/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.d.ts +1 -1
- package/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.d.ts +3 -0
- package/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.d.ts +2 -3
- package/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +3 -6
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +2 -4
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +4 -8
- package/tableview/editor/components/formly/fields/formly-field-type.abstract.component.d.ts +3 -3
- package/tableview/editor/helpers/editor-validators.d.ts +7 -0
- package/tableview/index.d.ts +1 -0
- package/version-info.json +6 -6
- package/core/directives/dialog-keydown-handler.directive.d.ts +0 -12
- package/esm2022/core/directives/dialog-keydown-handler.directive.mjs +0 -49
- package/esm2022/tableview/api/editor/helpers/field-validators.mjs +0 -23
- package/tableview/api/editor/helpers/field-validators.d.ts +0 -7
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
2
2
|
import { NgClass, DecimalPipe, CurrencyPipe, DatePipe, NgStyle, NgTemplateOutlet, AsyncPipe } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { signal, Injectable, inject, ElementRef, Renderer2, ChangeDetectorRef, DestroyRef, computed, effect, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, ViewChild,
|
|
5
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { signal, Injectable, inject, ElementRef, Renderer2, ChangeDetectorRef, DestroyRef, computed, effect, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, ViewChild, input, Pipe, Injector, output, contentChildren, viewChildren, viewChild, afterNextRender } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed, outputFromObservable, toObservable } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i3 from '@angular/forms';
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
|
-
import * as
|
|
8
|
+
import * as i1 from '@ngx-translate/core';
|
|
9
9
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
10
|
-
import * as
|
|
10
|
+
import * as i2$1 from 'primeng/api';
|
|
11
11
|
import { PrimeNGConfig, OverlayService, TranslationKeys, MessageService } from 'primeng/api';
|
|
12
|
-
import * as i2
|
|
12
|
+
import * as i2 from 'primeng/calendar';
|
|
13
13
|
import { CalendarModule } from 'primeng/calendar';
|
|
14
14
|
import { DomHandler, ConnectedOverlayScrollHandler } from 'primeng/dom';
|
|
15
15
|
import { FilterIcon } from 'primeng/icons/filter';
|
|
@@ -18,24 +18,24 @@ import * as i5 from 'primeng/inputnumber';
|
|
|
18
18
|
import { InputNumberModule } from 'primeng/inputnumber';
|
|
19
19
|
import * as i6 from 'primeng/inputtext';
|
|
20
20
|
import { InputTextModule } from 'primeng/inputtext';
|
|
21
|
-
import * as i1$
|
|
21
|
+
import * as i1$2 from 'primeng/table';
|
|
22
22
|
import { Table, TableModule } from 'primeng/table';
|
|
23
23
|
import * as i4 from 'primeng/tristatecheckbox';
|
|
24
24
|
import { TriStateCheckboxModule } from 'primeng/tristatecheckbox';
|
|
25
25
|
import { ZIndexUtils } from 'primeng/utils';
|
|
26
|
-
import { Subject, debounceTime, distinctUntilChanged,
|
|
27
|
-
import { COMMONS_MODULE_CONFIG_IT, FilterMatchMode, dateToIsoString, GetterPipe, TemplatePipe, BooleanPipe, EnumPipe, ComponentDirective, toastMessage, CommonsService, LoggerService, LocalStorageService, TemplateDirective, findTemplateByName, mergeDataListParamsWithDefaults, fromTableLoadToDataListParams, dataListParamsToUrlQuery, toObservable, fromSubscribeError, getErrorLogLevel, fromUrlQueryToDataListParams,
|
|
26
|
+
import { Subject, debounceTime, distinctUntilChanged, switchMap, of, combineLatest, NEVER } from 'rxjs';
|
|
27
|
+
import { COMMONS_MODULE_CONFIG_IT, FilterMatchMode, dateToIsoString, GetterPipe, TemplatePipe, BooleanPipe, EnumPipe, ComponentDirective, toastMessage, CommonsService, LoggerService, LocalStorageService, booleanOrUndefinedAttribute, TemplateDirective, findTemplateByName, mergeDataListParamsWithDefaults, fromTableLoadToDataListParams, dataListParamsToUrlQuery, toObservable as toObservable$1, fromSubscribeError, getErrorLogLevel, fromUrlQueryToDataListParams, I18nPropertyPipe, ClassMapPipe } from '@mediusinc/mng-commons/core';
|
|
28
28
|
import { FilterLookupTypeEnum, FilterTypeEnum } from '@mediusinc/mng-commons/filter';
|
|
29
29
|
import { DateRangeComponent, AutocompleteComponent, DropdownComponent, InputTrimDirective } from '@mediusinc/mng-commons/form';
|
|
30
30
|
import * as i4$1 from 'primeng/button';
|
|
31
31
|
import { ButtonModule } from 'primeng/button';
|
|
32
|
-
import * as
|
|
32
|
+
import * as i4$2 from 'primeng/ripple';
|
|
33
33
|
import { RippleModule } from 'primeng/ripple';
|
|
34
|
-
import * as
|
|
34
|
+
import * as i1$1 from 'primeng/tooltip';
|
|
35
35
|
import { TooltipModule } from 'primeng/tooltip';
|
|
36
|
-
import { ColumnDisplayTypeEnum,
|
|
36
|
+
import { ColumnDisplayTypeEnum, TablePaginationModeEnum, TableSizeEnum, tableDescriptor, TableDynamicDescriptorInst } from '@mediusinc/mng-commons/table/api';
|
|
37
37
|
import { Router, ActivatedRoute, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
38
|
-
import * as i3$
|
|
38
|
+
import * as i3$1 from 'primeng/multiselect';
|
|
39
39
|
import { MultiSelectModule } from 'primeng/multiselect';
|
|
40
40
|
import { filter } from 'rxjs/operators';
|
|
41
41
|
import { getI18nForModel } from '@mediusinc/mng-commons/model';
|
|
@@ -54,10 +54,10 @@ class DataListService {
|
|
|
54
54
|
this.count = signal(0);
|
|
55
55
|
this.loading = signal(true);
|
|
56
56
|
}
|
|
57
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
58
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
57
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: DataListService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
58
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: DataListService }); }
|
|
59
59
|
}
|
|
60
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: DataListService, decorators: [{
|
|
61
61
|
type: Injectable
|
|
62
62
|
}] });
|
|
63
63
|
|
|
@@ -587,15 +587,15 @@ class TableColumnFilterFullComponent {
|
|
|
587
587
|
});
|
|
588
588
|
this.primeTable.filters[this.primeField] = this.filterConstraint();
|
|
589
589
|
}
|
|
590
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
591
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: TableColumnFilterFullComponent, isStandalone: true, selector: "mng-table-column-filter-full", inputs: { descriptor: "descriptor" }, viewQueries: [{ propertyName: "icon", first: true, predicate: ["icon"], descendants: true }], ngImport: i0, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (primeType) {\n @case ('text') {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"descriptor.trimOption\" />\n }\n @case ('numeric') {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor.numberUseGrouping\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits\"\n [disabled]=\"isInputDisabled()\"></p-inputNumber>\n }\n\n @case ('boolean') {\n <p-triStateCheckbox [ngModel]=\"filterConstraint()?.displayValue\" (ngModelChange)=\"onTristateModelChange($event)\"></p-triStateCheckbox>\n }\n @case ('date') {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"dateFilter($event)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [dateFormat]=\"descriptor.datePickerFormat\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"dateFilter($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case ('lookup') {\n @if (lookupDescriptor) {\n @switch (lookupDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [autoClear]=\"lookupDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookupDescriptor.multiselect\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n }\n }\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "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", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: TriStateCheckboxModule }, { kind: "component", type: i4.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabel", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i5.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i6.InputText, selector: "[pInputText]" }, { 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"] }], animations: [
|
|
590
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterFullComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
591
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableColumnFilterFullComponent, isStandalone: true, selector: "mng-table-column-filter-full", inputs: { descriptor: "descriptor" }, viewQueries: [{ propertyName: "icon", first: true, predicate: ["icon"], descendants: true }], ngImport: i0, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (primeType) {\n @case ('text') {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"descriptor.trimOption\" />\n }\n @case ('numeric') {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"descriptor.numberUseGrouping\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits\"\n [disabled]=\"isInputDisabled()\"></p-inputNumber>\n }\n\n @case ('boolean') {\n <p-triStateCheckbox [ngModel]=\"filterConstraint()?.displayValue\" (ngModelChange)=\"onTristateModelChange($event)\"></p-triStateCheckbox>\n }\n @case ('date') {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"dateFilter($event)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [dateFormat]=\"descriptor.datePickerFormat\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"dateFilter($event)\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case ('lookup') {\n @if (lookupDescriptor) {\n @switch (lookupDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [autoClear]=\"lookupDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookupDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupDescriptor.optionsLabelTranslate\"\n [multiselect]=\"lookupDescriptor.multiselect\"\n [placeholder]=\"descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookupDescriptor.className\"\n [dropdownClassName]=\"lookupDescriptor.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"lookupDescriptor.multiselect\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n }\n }\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "disabled"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i2.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: TriStateCheckboxModule }, { kind: "component", type: i4.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabel", "ariaLabelledBy", "variant", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i5.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i6.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: FilterIcon, selector: "FilterIcon" }, { kind: "component", type: FilterSlashIcon, selector: "FilterSlashIcon" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }], animations: [
|
|
592
592
|
trigger('overlayAnimation', [
|
|
593
593
|
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
594
594
|
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
595
595
|
])
|
|
596
596
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
597
597
|
}
|
|
598
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterFullComponent, decorators: [{
|
|
599
599
|
type: Component,
|
|
600
600
|
args: [{ standalone: true, selector: 'mng-table-column-filter-full', imports: [
|
|
601
601
|
TableModule,
|
|
@@ -627,10 +627,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
627
627
|
}] } });
|
|
628
628
|
|
|
629
629
|
class TableColumnValueComponent {
|
|
630
|
-
constructor(
|
|
631
|
-
this.elementRef = elementRef;
|
|
632
|
-
this.messageService = messageService;
|
|
633
|
-
this.translate = translate;
|
|
630
|
+
constructor() {
|
|
634
631
|
this.columnDisplayTypeString = ColumnDisplayTypeEnum.String;
|
|
635
632
|
this.columnDisplayTypeNumber = ColumnDisplayTypeEnum.Number;
|
|
636
633
|
this.columnDisplayTypeCurrency = ColumnDisplayTypeEnum.Currency;
|
|
@@ -639,63 +636,57 @@ class TableColumnValueComponent {
|
|
|
639
636
|
this.columnDisplayTypeEnum = ColumnDisplayTypeEnum.Enum;
|
|
640
637
|
this.columnDisplayTypeComponent = ColumnDisplayTypeEnum.Component;
|
|
641
638
|
this.columnDisplayTypeHtml = ColumnDisplayTypeEnum.Html;
|
|
639
|
+
this.elementRef = inject(ElementRef);
|
|
640
|
+
this.messageService = inject(MessageService);
|
|
641
|
+
this.translate = inject(TranslateService);
|
|
642
642
|
this.getterPipe = new GetterPipe();
|
|
643
643
|
this.templatePipe = new TemplatePipe();
|
|
644
|
-
this.
|
|
645
|
-
this.
|
|
646
|
-
this.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
else if (this.descriptor.columnDisplayType === ColumnDisplayTypeEnum.String) {
|
|
653
|
-
if (this.descriptor.isMultiline) {
|
|
654
|
-
this.className += ' multiline';
|
|
644
|
+
this.descriptor = input.required();
|
|
645
|
+
this.item = input.required();
|
|
646
|
+
this.styleMaxWidth = computed(() => this.descriptor().maxWidth ?? null);
|
|
647
|
+
this.className = computed(() => {
|
|
648
|
+
let className = 'nowrap';
|
|
649
|
+
if (this.descriptor().columnDisplayType === ColumnDisplayTypeEnum.String && this.descriptor().isMultiline) {
|
|
650
|
+
className += ' multiline';
|
|
655
651
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
652
|
+
return className;
|
|
653
|
+
});
|
|
654
|
+
this.value = computed(() => {
|
|
655
|
+
let value = this.item()?.[this.descriptor().property];
|
|
656
|
+
if (typeof this.descriptor().getter === 'function') {
|
|
657
|
+
value = this.getterPipe.transform(this.item(), this.descriptor().getter, value);
|
|
658
|
+
}
|
|
659
|
+
if (this.descriptor().template) {
|
|
660
|
+
value = this.templatePipe.transform(value, this.descriptor().template);
|
|
661
|
+
}
|
|
662
|
+
return value;
|
|
663
|
+
});
|
|
664
|
+
this.currency = computed(() => {
|
|
665
|
+
if (this.descriptor().columnDisplayType === ColumnDisplayTypeEnum.Currency) {
|
|
666
|
+
return this.descriptor().currencyProperty ? this.item()[this.descriptor().currencyProperty] : this.descriptor().currencyCode ?? 'EUR';
|
|
667
|
+
}
|
|
668
|
+
return;
|
|
669
|
+
});
|
|
668
670
|
}
|
|
669
671
|
copyToClipboard(event) {
|
|
670
672
|
event.stopPropagation();
|
|
671
673
|
let value = this.elementRef.nativeElement.innerText.trim();
|
|
672
|
-
|
|
673
|
-
|
|
674
|
+
const clipboardValueGetter = this.descriptor().clipboardValueGetter;
|
|
675
|
+
if (clipboardValueGetter) {
|
|
676
|
+
value = clipboardValueGetter(this.value(), this.item());
|
|
674
677
|
}
|
|
675
678
|
navigator.clipboard.writeText(value);
|
|
676
679
|
const title = this.translate.instant('mngTable.copyNotificationTitle');
|
|
677
680
|
const message = this.translate.instant('mngTable.copyNotificationMessage', { value });
|
|
678
681
|
this.messageService.add({ severity: 'info', summary: title, detail: message });
|
|
679
682
|
}
|
|
680
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
681
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
683
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
684
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: TableColumnValueComponent, isStandalone: true, selector: "mng-table-column-value", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "className()", "style.max-width.px": "styleMaxWidth()" } }, ngImport: i0, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency() : descriptor().currencyDisplay : descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeDate) {\n {{ value() | date: descriptor().displayFormat }}\n }\n @case (columnDisplayTypeBoolean) {\n @if (descriptor().booleanAsIcon) {\n <i [class]=\"value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo : true\"></i>\n } @else {\n {{ value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo | translate }}\n }\n }\n @case (columnDisplayTypeEnum) {\n {{ value() | mngEnum: descriptor().enum | translate }}\n }\n @case (columnDisplayTypeComponent) {\n <ng-container\n [mngComponent]=\"descriptor().customComponentType!\"\n [inputs]=\"{\n value: value(),\n item: item(),\n descriptor: descriptor()\n }\"></ng-container>\n }\n}\n@if (descriptor().hasCopyToClipboard) {\n <div class=\"help-buttons\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n </div>\n}\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host.multiline{white-space:pre-wrap;word-wrap:break-word}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"], dependencies: [{ kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "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 }); }
|
|
682
685
|
}
|
|
683
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
686
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnValueComponent, decorators: [{
|
|
684
687
|
type: Component,
|
|
685
|
-
args: [{ standalone: true, selector: 'mng-table-column-value', imports: [TooltipModule, TranslateModule, BooleanPipe, EnumPipe, ComponentDirective, ButtonModule, RippleModule, DecimalPipe, CurrencyPipe, DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, 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
|
|
686
|
-
}]
|
|
687
|
-
type: Input,
|
|
688
|
-
args: [{ required: true }]
|
|
689
|
-
}], item: [{
|
|
690
|
-
type: Input,
|
|
691
|
-
args: [{ required: true }]
|
|
692
|
-
}], styleMaxWidth: [{
|
|
693
|
-
type: HostBinding,
|
|
694
|
-
args: ['style.max-width.px']
|
|
695
|
-
}], className: [{
|
|
696
|
-
type: HostBinding,
|
|
697
|
-
args: ['class']
|
|
698
|
-
}] } });
|
|
688
|
+
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"] }]
|
|
689
|
+
}] });
|
|
699
690
|
|
|
700
691
|
function tableNotificationError(translate, table, error, messageService) {
|
|
701
692
|
const params = {};
|
|
@@ -732,10 +723,10 @@ class LocaleDefaultRowClassPipe {
|
|
|
732
723
|
}
|
|
733
724
|
return value ?? '';
|
|
734
725
|
}
|
|
735
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
736
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
726
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: LocaleDefaultRowClassPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
727
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: LocaleDefaultRowClassPipe, isStandalone: true, name: "mngLocaleDefaultRowClass" }); }
|
|
737
728
|
}
|
|
738
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
729
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: LocaleDefaultRowClassPipe, decorators: [{
|
|
739
730
|
type: Pipe,
|
|
740
731
|
args: [{
|
|
741
732
|
standalone: true,
|
|
@@ -754,10 +745,10 @@ class TableColumnFilterClassPipe {
|
|
|
754
745
|
return strValue;
|
|
755
746
|
}
|
|
756
747
|
}
|
|
757
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
758
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
748
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
749
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterClassPipe, isStandalone: true, name: "mngTableColumnFilterClass" }); }
|
|
759
750
|
}
|
|
760
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
751
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableColumnFilterClassPipe, decorators: [{
|
|
761
752
|
type: Pipe,
|
|
762
753
|
args: [{
|
|
763
754
|
standalone: true,
|
|
@@ -766,13 +757,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
766
757
|
}]
|
|
767
758
|
}] });
|
|
768
759
|
|
|
769
|
-
// Sorts and Filters must be string by default - Item could be anything
|
|
770
760
|
class TableComponent {
|
|
771
761
|
constructor() {
|
|
772
762
|
this.cmpTypeName = 'TableComponent';
|
|
773
763
|
this.logger = inject(LoggerService).create(this.cmpTypeName);
|
|
774
764
|
this.injector = inject(Injector);
|
|
775
|
-
this.destroyRef = inject(DestroyRef);
|
|
776
765
|
this.router = inject(Router);
|
|
777
766
|
this.route = inject(ActivatedRoute);
|
|
778
767
|
this.translate = inject(TranslateService);
|
|
@@ -780,201 +769,216 @@ class TableComponent {
|
|
|
780
769
|
this.commons = inject(CommonsService);
|
|
781
770
|
this.localStorageService = inject(LocalStorageService);
|
|
782
771
|
this.dataListService = inject((DataListService));
|
|
783
|
-
|
|
772
|
+
// metadata input
|
|
773
|
+
this.descriptorInput = input.required({ alias: 'descriptor' });
|
|
774
|
+
// data source inputs
|
|
775
|
+
this.items = input();
|
|
776
|
+
this.result = input();
|
|
777
|
+
this.loadingInput = input(undefined, { alias: 'loading', transform: booleanOrUndefinedAttribute });
|
|
778
|
+
this.dataProvider = input();
|
|
784
779
|
// extra features input
|
|
785
|
-
this.
|
|
786
|
-
this.
|
|
780
|
+
this.useQueryParamsInput = input(false, { alias: 'useQueryParams' });
|
|
781
|
+
this.cellClickEnabled = input(true);
|
|
782
|
+
this.selectionMode = input('multiple');
|
|
783
|
+
this.selectionEnabled = input(false);
|
|
784
|
+
// styling
|
|
785
|
+
this.columnLastMinWidth = input();
|
|
786
|
+
// component inputs
|
|
787
|
+
this.captionComponent = input();
|
|
788
|
+
this.columnCustomLastComponent = input();
|
|
789
|
+
this.globalFilterFieldsInput = input(undefined, { alias: 'globalFilterFields' });
|
|
790
|
+
// cell click
|
|
791
|
+
this.cellClickSubject = new Subject();
|
|
792
|
+
this.isCellClickObserved = signal(this.cellClickSubject.observed);
|
|
793
|
+
this.isCellClickEnabled = computed(() => this.cellClickEnabled() && this.isCellClickObserved());
|
|
787
794
|
// event outputs
|
|
788
|
-
this.
|
|
789
|
-
this.
|
|
790
|
-
this.
|
|
791
|
-
this.
|
|
792
|
-
this.
|
|
795
|
+
this.tableLoad = output();
|
|
796
|
+
this.cellClick = outputFromObservable(this.cellClickSubject);
|
|
797
|
+
this.selectionChange = output();
|
|
798
|
+
this.captionComponentInstance = output();
|
|
799
|
+
this.columnCustomLastComponentInstance = output();
|
|
793
800
|
// content and view queries
|
|
794
801
|
this.templates = contentChildren(TemplateDirective);
|
|
802
|
+
this.components = viewChildren((ComponentDirective));
|
|
803
|
+
this.primeTable = viewChild.required(Table);
|
|
795
804
|
// templates
|
|
796
805
|
this.captionTemplate = computed(() => findTemplateByName([...this.templates()], 'caption'));
|
|
797
806
|
this.columnCustomLastTemplate = computed(() => findTemplateByName([...this.templates()], 'columnCustomLast'));
|
|
798
807
|
this.footerTemplate = computed(() => findTemplateByName([...this.templates()], 'footer'));
|
|
799
808
|
this.rowExpandTemplate = computed(() => findTemplateByName([...this.templates()], 'rowExpandContent'));
|
|
800
809
|
// data provider and items
|
|
801
|
-
this.
|
|
802
|
-
this.isLazy =
|
|
803
|
-
this.isPagination =
|
|
810
|
+
this.useQueryParams = computed(() => (this.paginationMode() === TablePaginationModeEnum.InfiniteScroll ? false : this.useQueryParamsInput()));
|
|
811
|
+
this.isLazy = computed(() => this.dataProvider()?.isLazy === true);
|
|
812
|
+
this.isPagination = computed(() => this.paginationMode() === TablePaginationModeEnum.Pagination);
|
|
804
813
|
this.useQueryParamsInitialized = signal(false);
|
|
805
|
-
// infinite scroll
|
|
806
|
-
this.infiniteScroll = signal(false);
|
|
807
814
|
// visual
|
|
808
|
-
this.
|
|
809
|
-
|
|
810
|
-
|
|
815
|
+
this.paginationMode = computed(() => {
|
|
816
|
+
if (typeof this.descriptor().paginationMode !== 'undefined') {
|
|
817
|
+
// descriptor choice is the most strong - if defined, use this value
|
|
818
|
+
return this.descriptor().paginationMode;
|
|
819
|
+
}
|
|
820
|
+
else if (typeof this.dataProvider() !== 'undefined') {
|
|
821
|
+
// when data provider is used, use pagination
|
|
822
|
+
return TablePaginationModeEnum.Pagination;
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
return TablePaginationModeEnum.None;
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
this.infiniteScroll = computed(() => this.paginationMode() === TablePaginationModeEnum.InfiniteScroll);
|
|
829
|
+
this.className = computed(() => {
|
|
830
|
+
let className = this.descriptor().className ?? '';
|
|
831
|
+
switch (this.descriptor().size) {
|
|
832
|
+
case TableSizeEnum.Small:
|
|
833
|
+
className += ' p-datatable-sm';
|
|
834
|
+
break;
|
|
835
|
+
case TableSizeEnum.Large:
|
|
836
|
+
className += ' p-datatable-lg';
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
if (this.descriptor().hasGridlines) {
|
|
840
|
+
className += ' p-datatable-gridlines';
|
|
841
|
+
}
|
|
842
|
+
return className;
|
|
843
|
+
});
|
|
844
|
+
this.tableFullHeightOffset = computed(() => (this.paginationMode() === TablePaginationModeEnum.InfiniteScroll ? this.descriptor().tableFullHeightOffset ?? 315 : undefined));
|
|
845
|
+
this.rowHeight = computed(() => (this.paginationMode() === TablePaginationModeEnum.InfiniteScroll ? this.descriptor().rowHeight ?? 45 : undefined));
|
|
811
846
|
// data provider
|
|
812
|
-
this.dataProviderService =
|
|
847
|
+
this.dataProviderService = computed(() => {
|
|
848
|
+
const dataProvider = this.dataProvider();
|
|
849
|
+
return dataProvider?.serviceType ? this.injector.get(dataProvider.serviceType) : null;
|
|
850
|
+
});
|
|
813
851
|
this.latestLazyLoadEventVersion = 0;
|
|
814
852
|
this.latestParamsWithDefaultsVersion = 0;
|
|
815
853
|
// descriptors
|
|
816
854
|
this.descriptor = signal(tableDescriptor());
|
|
817
|
-
this.
|
|
855
|
+
this.localstorageKey = computed(() => {
|
|
856
|
+
const descriptor = this.descriptor();
|
|
857
|
+
return descriptor.model.typeName || descriptor.model.i18nBaseKey
|
|
858
|
+
? generateTableLayoutPrefsKey(descriptor.model.typeName ?? descriptor.model.i18nBaseKey, this.router.url, descriptor.identifier)
|
|
859
|
+
: null;
|
|
860
|
+
});
|
|
861
|
+
this.layoutPrefsSaveCnt = signal(0);
|
|
862
|
+
this.layoutPreferences = computed(() => {
|
|
863
|
+
const lsKey = this.localstorageKey();
|
|
864
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
865
|
+
const cnt = this.layoutPrefsSaveCnt(); // needed to force updates on user changes
|
|
866
|
+
const layoutPrefs = lsKey ? this.localStorageService.getItem(this.cmpTypeName, lsKey) : undefined;
|
|
867
|
+
return layoutPrefs ?? { columnWidths: {} };
|
|
868
|
+
});
|
|
869
|
+
this.columns = computed(() => this.computColumnsWithLayout());
|
|
818
870
|
this.visibleColumns = computed(() => this.columns().filter(col => col.isVisible));
|
|
819
871
|
// filter, sort
|
|
820
872
|
this.hasColumnFilters = computed(() => this.filterDescriptors().length > 0);
|
|
821
873
|
this.filterDescriptors = computed(() => this.descriptor().filters);
|
|
822
|
-
this.defaultParams = computed(() =>
|
|
823
|
-
const params = {
|
|
824
|
-
offset: 0,
|
|
825
|
-
limit: this.dataListService.rowsPerPageOptions()[0],
|
|
826
|
-
sort: this.descriptor()
|
|
827
|
-
.sorts.filter(s => s.defaultIsEnabled)
|
|
828
|
-
.map(s => ({
|
|
829
|
-
property: s.property,
|
|
830
|
-
ascending: s.defaultIsAscending
|
|
831
|
-
})),
|
|
832
|
-
filters: {}
|
|
833
|
-
};
|
|
834
|
-
this.filterDescriptors()
|
|
835
|
-
.filter(d => d.hasDefaultValue)
|
|
836
|
-
.forEach(f => {
|
|
837
|
-
let matchMode = f.defaultMatchMode;
|
|
838
|
-
if (!matchMode) {
|
|
839
|
-
switch (f.filterType) {
|
|
840
|
-
case FilterTypeEnum.String:
|
|
841
|
-
matchMode = FilterMatchMode.Contains;
|
|
842
|
-
break;
|
|
843
|
-
case FilterTypeEnum.Lookup:
|
|
844
|
-
case FilterTypeEnum.LookupEnum: {
|
|
845
|
-
const lookupFilter = f;
|
|
846
|
-
if (lookupFilter.multiselect) {
|
|
847
|
-
matchMode = FilterMatchMode.In;
|
|
848
|
-
}
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
default:
|
|
852
|
-
break;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
if (!matchMode) {
|
|
856
|
-
matchMode = FilterMatchMode.Equals;
|
|
857
|
-
}
|
|
858
|
-
if (f.matchModes && !f.matchModes?.includes(matchMode)) {
|
|
859
|
-
matchMode = f.matchModes[0];
|
|
860
|
-
}
|
|
861
|
-
let value = undefined;
|
|
862
|
-
if (Array.isArray(value)) {
|
|
863
|
-
value = [...value];
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
866
|
-
value = f.defaultValue;
|
|
867
|
-
}
|
|
868
|
-
const property = f.property;
|
|
869
|
-
params.filters[property] = {
|
|
870
|
-
value: value,
|
|
871
|
-
matchMode: matchMode
|
|
872
|
-
};
|
|
873
|
-
});
|
|
874
|
-
return params;
|
|
875
|
-
});
|
|
874
|
+
this.defaultParams = computed(() => this.computeDefaultDataListParams());
|
|
876
875
|
this.isFilterChanged = false;
|
|
877
876
|
this.isSortChanged = false;
|
|
878
877
|
this.anyColumnVisible = computed(() => this.visibleColumns().length > 0);
|
|
879
|
-
this.hasCustomLastColumn =
|
|
878
|
+
this.hasCustomLastColumn = computed(() => this.columnCustomLastComponent || this.columnCustomLastTemplate());
|
|
880
879
|
this.hasLastColumn = computed(() => this.hasCustomLastColumn() || this.areColumnsToggleable() || this.areColumnsReorderable());
|
|
881
880
|
// layout prefs
|
|
882
881
|
this.areColumnsReorderable = computed(() => this.descriptor().columns.some(value => value.isReorderable));
|
|
883
882
|
this.areColumnsToggleable = computed(() => this.descriptor().columns.some(value => value.isToggleable));
|
|
884
|
-
this.layoutPreferences = { columnWidths: {} };
|
|
885
|
-
this.localstorageKey = '';
|
|
886
883
|
// other
|
|
887
884
|
this.routerIsNavigationOutsideInProgress = false;
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
if (descriptor.defaultNumRows) {
|
|
897
|
-
this.dataListService.rows.set(this.dataListService.rowsPerPageOptions().includes(descriptor.defaultNumRows) ? descriptor.defaultNumRows : this.dataListService.rowsPerPageOptions()[0]);
|
|
898
|
-
}
|
|
899
|
-
// other
|
|
900
|
-
this.hasCustomLastColumn.set(this.columnCustomLastComponent !== undefined || this.columnCustomLastTemplate() !== undefined);
|
|
901
|
-
// define all styles
|
|
902
|
-
let className = descriptor.className ?? '';
|
|
903
|
-
switch (descriptor.size) {
|
|
904
|
-
case TableSizeEnum.Small:
|
|
905
|
-
className += ' p-datatable-sm';
|
|
906
|
-
break;
|
|
907
|
-
case TableSizeEnum.Large:
|
|
908
|
-
className += ' p-datatable-lg';
|
|
909
|
-
break;
|
|
910
|
-
}
|
|
911
|
-
if (descriptor.hasGridlines) {
|
|
912
|
-
className += ' p-datatable-gridlines';
|
|
913
|
-
}
|
|
914
|
-
this.className.set(className ?? '');
|
|
915
|
-
// check if infinite scroll
|
|
916
|
-
let paginationMode = TablePaginationModeEnum.None;
|
|
917
|
-
if (typeof descriptor.paginationMode !== 'undefined') {
|
|
918
|
-
// descriptor choice is the most strong - if defined, use this value
|
|
919
|
-
paginationMode = descriptor.paginationMode;
|
|
920
|
-
}
|
|
921
|
-
else if (typeof this.dataProvider !== 'undefined') {
|
|
922
|
-
// when data provider is used, use pagination
|
|
923
|
-
paginationMode = TablePaginationModeEnum.Pagination;
|
|
924
|
-
}
|
|
925
|
-
if (paginationMode === TablePaginationModeEnum.InfiniteScroll) {
|
|
926
|
-
this.infiniteScroll.set(true);
|
|
927
|
-
this.tableFullHeightOffset.set(descriptor?.tableFullHeightOffset ?? 315);
|
|
928
|
-
this.rowHeight.set(descriptor?.rowHeight ?? 45);
|
|
929
|
-
this.useQueryParams = false;
|
|
930
|
-
}
|
|
931
|
-
else if (paginationMode === TablePaginationModeEnum.Pagination) {
|
|
932
|
-
this.isPagination.set(true);
|
|
933
|
-
}
|
|
934
|
-
// check if data provider is supplied, if is, use it primarily
|
|
935
|
-
if (this.dataProvider) {
|
|
936
|
-
// map subjects to observables and initiate data
|
|
937
|
-
this.useDataProvider = true;
|
|
938
|
-
this.isLazy.set(this.dataProvider.isLazy);
|
|
939
|
-
// inject service
|
|
940
|
-
if (this.dataProvider.serviceType) {
|
|
941
|
-
this.dataProviderService = this.injector.get(this.dataProvider.serviceType);
|
|
885
|
+
effect(() => {
|
|
886
|
+
const descriptor = this.descriptor();
|
|
887
|
+
if (Array.isArray(descriptor.rowsPerPageOptions) && descriptor.rowsPerPageOptions.length > 0) {
|
|
888
|
+
this.dataListService.rowsPerPageOptions.set(descriptor.rowsPerPageOptions);
|
|
889
|
+
}
|
|
890
|
+
if (descriptor.defaultNumRows) {
|
|
891
|
+
this.dataListService.rows.set(this.dataListService.rowsPerPageOptions().includes(descriptor.defaultNumRows) ? descriptor.defaultNumRows : this.dataListService.rowsPerPageOptions()[0]);
|
|
942
892
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
893
|
+
}, { allowSignalWrites: true });
|
|
894
|
+
effect(() => {
|
|
895
|
+
const loading = this.loadingInput();
|
|
896
|
+
if (loading !== undefined) {
|
|
897
|
+
this.dataListService.loading.set(loading);
|
|
898
|
+
}
|
|
899
|
+
}, { allowSignalWrites: true });
|
|
900
|
+
effect(() => {
|
|
901
|
+
const result = this.result();
|
|
902
|
+
if (result !== undefined) {
|
|
903
|
+
this.dataListService.data.set(result.data);
|
|
904
|
+
this.dataListService.count.set(result.totalCount ?? result.data.length);
|
|
905
|
+
const loading = this.loadingInput();
|
|
906
|
+
if (loading == undefined) {
|
|
907
|
+
// only set if input is not defined
|
|
908
|
+
this.dataListService.loading.set(false);
|
|
946
909
|
}
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
else {
|
|
950
|
-
// if query result is provided, use it as secondary source or else try to use items
|
|
951
|
-
if (this.result) {
|
|
952
|
-
this.subscribeToQueryInput();
|
|
953
910
|
}
|
|
954
|
-
|
|
955
|
-
|
|
911
|
+
}, { allowSignalWrites: true });
|
|
912
|
+
effect(() => {
|
|
913
|
+
const result = this.result();
|
|
914
|
+
const items = this.items();
|
|
915
|
+
if (result == undefined && items !== undefined) {
|
|
916
|
+
this.dataListService.data.set(items);
|
|
917
|
+
this.dataListService.count.set(items.length);
|
|
918
|
+
const loading = this.loadingInput();
|
|
919
|
+
if (loading == undefined) {
|
|
920
|
+
// only set if input is not defined
|
|
921
|
+
this.dataListService.loading.set(false);
|
|
922
|
+
}
|
|
956
923
|
}
|
|
957
|
-
|
|
958
|
-
|
|
924
|
+
}, { allowSignalWrites: true });
|
|
925
|
+
effect(() => {
|
|
926
|
+
this.dataListService.globalFilterFields.set(this.globalFilterFieldsInput() ?? this.columns().map(c => c.descriptor.property));
|
|
927
|
+
}, { allowSignalWrites: true });
|
|
928
|
+
afterNextRender(() => {
|
|
929
|
+
this.isCellClickObserved.set(this.cellClickSubject.observed);
|
|
930
|
+
});
|
|
931
|
+
toObservable(this.dataProvider)
|
|
932
|
+
.pipe(switchMap(dp => dp?.getAllReload$ ?? of({})))
|
|
933
|
+
.subscribe({
|
|
934
|
+
next: () => {
|
|
935
|
+
this.reload();
|
|
959
936
|
}
|
|
960
|
-
}
|
|
961
|
-
this.
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
937
|
+
});
|
|
938
|
+
combineLatest([toObservable(this.descriptorInput), toObservable(this.dataProvider), toObservable(this.useQueryParams)])
|
|
939
|
+
.pipe(
|
|
940
|
+
// dataProvider is needed to ensure correct order of execution and reload
|
|
941
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
942
|
+
switchMap(([descriptorInput, dataProvider, useQueryParams]) => {
|
|
943
|
+
if (descriptorInput !== this.descriptor()) {
|
|
944
|
+
this.descriptor.set(descriptorInput);
|
|
945
|
+
}
|
|
946
|
+
if (useQueryParams) {
|
|
947
|
+
// trigger table loads from route updates
|
|
948
|
+
return this.route.queryParams;
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
return of(null);
|
|
952
|
+
}
|
|
953
|
+
}))
|
|
954
|
+
.subscribe(qp => {
|
|
955
|
+
if (qp === null) {
|
|
956
|
+
// load data immediately by creating default sorts and filters (primeng will trigger onLazyLoad event on sort&filter metadata change)
|
|
957
|
+
const defaultSort = this.createSortMeta(this.defaultParams());
|
|
958
|
+
if (!defaultSort || defaultSort.length > 0) {
|
|
959
|
+
this.dataListService.sortMeta.set(defaultSort);
|
|
960
|
+
}
|
|
961
|
+
const defaultFilter = this.createFilterMeta();
|
|
962
|
+
if (defaultFilter) {
|
|
963
|
+
this.dataListService.filterMeta.set(defaultFilter);
|
|
964
|
+
}
|
|
965
|
+
this.loadTableWithDataProvider({});
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
this.loadTableFromRouteUpdate(qp);
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
toObservable(this.useQueryParams)
|
|
972
|
+
.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]) ||
|
|
973
|
+
e instanceof NavigationEnd ||
|
|
974
|
+
e instanceof NavigationCancel ||
|
|
975
|
+
e instanceof NavigationError))
|
|
976
|
+
.subscribe(e => {
|
|
977
|
+
this.routerIsNavigationOutsideInProgress = e instanceof NavigationStart;
|
|
978
|
+
});
|
|
973
979
|
}
|
|
974
980
|
ngOnDestroy() {
|
|
975
981
|
this.dataProviderSubscription?.unsubscribe();
|
|
976
|
-
this.resultSubscription?.unsubscribe();
|
|
977
|
-
this.itemsSubscription?.unsubscribe();
|
|
978
982
|
}
|
|
979
983
|
reload(emitEvent = false, resetParams = false) {
|
|
980
984
|
const paramsWithDefaults = resetParams || !this.latestParamsWithDefaults ? this.defaultParams() : mergeDataListParamsWithDefaults(this.latestParamsWithDefaults, this.defaultParams());
|
|
@@ -984,7 +988,7 @@ class TableComponent {
|
|
|
984
988
|
this.dataProviderLatestLazyLoadEvent = event;
|
|
985
989
|
this.latestLazyLoadEventVersion++;
|
|
986
990
|
const params = fromTableLoadToDataListParams(event);
|
|
987
|
-
if (this.useQueryParams) {
|
|
991
|
+
if (this.useQueryParams()) {
|
|
988
992
|
if (!this.routerIsNavigationOutsideInProgress) {
|
|
989
993
|
// this check is necessary: from some reason, primeNG commits one last lazy load event whenever any angular router navigation occurs
|
|
990
994
|
this.router.navigate([], {
|
|
@@ -1007,16 +1011,19 @@ class TableComponent {
|
|
|
1007
1011
|
this.isFilterChanged = true;
|
|
1008
1012
|
}
|
|
1009
1013
|
onCellClick(event, col, item, idx) {
|
|
1014
|
+
if (!this.isCellClickEnabled()) {
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1010
1017
|
const tableEvent = {
|
|
1011
1018
|
column: col,
|
|
1012
1019
|
rowItem: item,
|
|
1013
1020
|
rowIndex: idx,
|
|
1014
1021
|
event: event
|
|
1015
1022
|
};
|
|
1016
|
-
this.
|
|
1023
|
+
this.cellClickSubject.next(tableEvent);
|
|
1017
1024
|
}
|
|
1018
1025
|
onSelectionChange(event) {
|
|
1019
|
-
this.
|
|
1026
|
+
this.selectionChange.emit(event);
|
|
1020
1027
|
}
|
|
1021
1028
|
/**
|
|
1022
1029
|
* Method is called on column resize
|
|
@@ -1025,26 +1032,29 @@ class TableComponent {
|
|
|
1025
1032
|
onTableColumnResize({ element }) {
|
|
1026
1033
|
const fieldId = element.id;
|
|
1027
1034
|
const width = element.offsetWidth;
|
|
1035
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1028
1036
|
const col = this.columns().find(el => el.descriptor.property === fieldId);
|
|
1029
1037
|
if (col)
|
|
1030
1038
|
col.width = width;
|
|
1031
|
-
if (!
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
this.saveLayoutPreferences();
|
|
1039
|
+
if (!layoutPrefs.columnWidths)
|
|
1040
|
+
layoutPrefs.columnWidths = {};
|
|
1041
|
+
layoutPrefs.columnWidths[fieldId] = width;
|
|
1042
|
+
this.saveLayoutPreferences(layoutPrefs);
|
|
1035
1043
|
}
|
|
1036
1044
|
loadTableWithDataProvider(paramsWithDefaults, emitEvent = true) {
|
|
1037
|
-
|
|
1045
|
+
const dataProvider = this.dataProvider();
|
|
1046
|
+
if (!dataProvider || paramsWithDefaults.limit === 0) {
|
|
1038
1047
|
return;
|
|
1039
1048
|
}
|
|
1040
1049
|
this.dataProviderSubscription?.unsubscribe();
|
|
1041
1050
|
this.dataListService.loading.set(true);
|
|
1042
1051
|
this.latestParamsWithDefaults = paramsWithDefaults;
|
|
1043
1052
|
this.latestParamsWithDefaultsVersion++;
|
|
1044
|
-
this.dataProviderSubscription = toObservable(
|
|
1053
|
+
this.dataProviderSubscription = toObservable$1(dataProvider.getAll(paramsWithDefaults, this.dataProviderService(), this.descriptor().isLocalized ? this.commons.appDataLocale() ?? undefined : undefined)).subscribe({
|
|
1045
1054
|
next: res => {
|
|
1046
|
-
|
|
1047
|
-
|
|
1055
|
+
const descriptorInput = this.descriptorInput();
|
|
1056
|
+
if (descriptorInput instanceof TableDynamicDescriptorInst) {
|
|
1057
|
+
this.descriptor.set(descriptorInput.toTableDescriptorFromData(res));
|
|
1048
1058
|
}
|
|
1049
1059
|
if (this.infiniteScroll()) {
|
|
1050
1060
|
let items = this.dataListService.data();
|
|
@@ -1078,7 +1088,7 @@ class TableComponent {
|
|
|
1078
1088
|
originalEvent: this.dataProviderLatestLazyLoadEvent,
|
|
1079
1089
|
params: paramsWithDefaults
|
|
1080
1090
|
};
|
|
1081
|
-
this.
|
|
1091
|
+
this.tableLoad.emit(tableEvent);
|
|
1082
1092
|
}
|
|
1083
1093
|
}
|
|
1084
1094
|
loadTableFromRouteUpdate(urlParams) {
|
|
@@ -1090,57 +1100,6 @@ class TableComponent {
|
|
|
1090
1100
|
this.useQueryParamsInitialized.set(true);
|
|
1091
1101
|
this.loadTableWithDataProvider(paramsWithDefaults);
|
|
1092
1102
|
}
|
|
1093
|
-
setMainAndRelatedDescriptors(descriptor) {
|
|
1094
|
-
if (descriptor instanceof TableDynamicDescriptorInst) {
|
|
1095
|
-
this.descriptor.set(descriptor);
|
|
1096
|
-
this.columns.set([]);
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
// get layout preferences if they exist
|
|
1100
|
-
if (descriptor.model.typeName) {
|
|
1101
|
-
this.localstorageKey = generateTableLayoutPrefsKey(descriptor.model.typeName, this.router.url, descriptor.identifier);
|
|
1102
|
-
const preferences = this.localStorageService.getItem(this.cmpTypeName, this.localstorageKey);
|
|
1103
|
-
if (preferences && typeof preferences === 'object') {
|
|
1104
|
-
if (preferences.columnWidths) {
|
|
1105
|
-
this.layoutPreferences.columnWidths = preferences.columnWidths;
|
|
1106
|
-
}
|
|
1107
|
-
if (preferences.columnOrder && Array.isArray(preferences.columnOrder) && preferences.columnOrder.every((el) => typeof el === 'string')) {
|
|
1108
|
-
this.layoutPreferences.columnOrder = preferences.columnOrder;
|
|
1109
|
-
}
|
|
1110
|
-
if (preferences.columnVisibility && Array.isArray(preferences.columnVisibility) && preferences.columnVisibility.every((el) => typeof el === 'string')) {
|
|
1111
|
-
this.layoutPreferences.columnVisibility = preferences.columnVisibility;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
else {
|
|
1116
|
-
this.localstorageKey = '';
|
|
1117
|
-
this.layoutPreferences = { columnWidths: {} };
|
|
1118
|
-
}
|
|
1119
|
-
// initialize columns with additional properties
|
|
1120
|
-
const timestamp = new Date().getTime();
|
|
1121
|
-
let columns = descriptor.columns.map(col => ({
|
|
1122
|
-
id: `${col.property}-${timestamp}`,
|
|
1123
|
-
descriptor: col,
|
|
1124
|
-
filter: descriptor.filters.find(f => f.showOnColumn === col.property),
|
|
1125
|
-
sort: descriptor.sorts.find(f => f.showOnColumn === col.property),
|
|
1126
|
-
disabled: !col.isToggleable,
|
|
1127
|
-
isVisible: this.layoutPreferences.columnVisibility ? this.layoutPreferences.columnVisibility.includes(col.property) : col.isVisible,
|
|
1128
|
-
width: this.layoutPreferences.columnWidths?.[col.property]
|
|
1129
|
-
}));
|
|
1130
|
-
if (this.layoutPreferences.columnOrder) {
|
|
1131
|
-
for (let i = 0; i < this.layoutPreferences.columnOrder.length; i++) {
|
|
1132
|
-
const colName = this.layoutPreferences.columnOrder[i];
|
|
1133
|
-
const colWithPrefs = columns.find(el => el.descriptor.property === colName);
|
|
1134
|
-
if (colWithPrefs) {
|
|
1135
|
-
colWithPrefs.orderIdx = i;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
columns = columns.sort((a, b) => (a.orderIdx !== undefined && b.orderIdx !== undefined ? a.orderIdx - b.orderIdx : 0));
|
|
1140
|
-
this.descriptor.set(descriptor);
|
|
1141
|
-
this.columns.set(columns);
|
|
1142
|
-
this.dataListService.globalFilterFields.set(this.globalFilterFieldsInput ?? this.columns().map(c => c.descriptor.property));
|
|
1143
|
-
}
|
|
1144
1103
|
updatePrimeSortAndFilter(paramsWithDefaults) {
|
|
1145
1104
|
this.dataListService.sortMeta.set(this.createSortMeta(paramsWithDefaults));
|
|
1146
1105
|
this.dataListService.filterMeta.set(this.createFilterMeta(paramsWithDefaults));
|
|
@@ -1169,66 +1128,32 @@ class TableComponent {
|
|
|
1169
1128
|
}
|
|
1170
1129
|
return null;
|
|
1171
1130
|
}
|
|
1172
|
-
initializeDataLoadingTriggers() {
|
|
1173
|
-
if (this.useQueryParams) {
|
|
1174
|
-
// trigger table loads from route updates
|
|
1175
|
-
this.route.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(qp => {
|
|
1176
|
-
this.loadTableFromRouteUpdate(qp);
|
|
1177
|
-
});
|
|
1178
|
-
this.router.events
|
|
1179
|
-
.pipe(takeUntilDestroyed(this.destroyRef), filter(e => (e instanceof NavigationStart && e.url.split('?')[0].split('#')[0] !== this.router.url.split('?')[0].split('#')[0]) ||
|
|
1180
|
-
e instanceof NavigationEnd ||
|
|
1181
|
-
e instanceof NavigationCancel ||
|
|
1182
|
-
e instanceof NavigationError))
|
|
1183
|
-
.subscribe(e => {
|
|
1184
|
-
this.routerIsNavigationOutsideInProgress = e instanceof NavigationStart;
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
else {
|
|
1188
|
-
// load data immediately by creating default sorts and filters (primeng will trigger onLazyLoad event on sort&filter metadata change)
|
|
1189
|
-
const defaultSort = this.createSortMeta();
|
|
1190
|
-
if (!defaultSort || defaultSort.length > 0) {
|
|
1191
|
-
this.dataListService.sortMeta.set(defaultSort);
|
|
1192
|
-
}
|
|
1193
|
-
const defaultFilter = this.createFilterMeta();
|
|
1194
|
-
if (defaultFilter) {
|
|
1195
|
-
this.dataListService.filterMeta.set(defaultFilter);
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
1131
|
onColumnToggle(event) {
|
|
1200
|
-
const
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
this.columns.set(columns);
|
|
1210
|
-
this.layoutPreferences.columnVisibility = this.visibleColumns().map(el => el.descriptor.property);
|
|
1211
|
-
this.saveLayoutPreferences();
|
|
1132
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1133
|
+
const selectedColumns = event.value.map(v => v.descriptor.property);
|
|
1134
|
+
const hiddenColumns = this.columns()
|
|
1135
|
+
.filter(c => selectedColumns.indexOf(c.descriptor.property) < 0)
|
|
1136
|
+
.map(c => c.descriptor.property);
|
|
1137
|
+
layoutPrefs.columnHidden = hiddenColumns;
|
|
1138
|
+
this.saveLayoutPreferences(layoutPrefs);
|
|
1212
1139
|
}
|
|
1213
1140
|
onColumnToggleAll() {
|
|
1214
|
-
const
|
|
1141
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1215
1142
|
const columns = [...this.columns()];
|
|
1216
|
-
const isVisible = !columns.some(c => c.isVisible);
|
|
1143
|
+
const isVisible = !this.columns().some(c => c.isVisible);
|
|
1217
1144
|
for (const col of columns) {
|
|
1218
1145
|
if (isVisible !== col.isVisible) {
|
|
1219
1146
|
col.isVisible = isVisible;
|
|
1220
|
-
col.id = `${col.descriptor.property}-${timestamp}`;
|
|
1221
1147
|
}
|
|
1222
1148
|
}
|
|
1223
|
-
|
|
1224
|
-
this.
|
|
1225
|
-
this.saveLayoutPreferences();
|
|
1149
|
+
layoutPrefs.columnHidden = columns.filter(c => !c.isVisible).map(c => c.descriptor.property);
|
|
1150
|
+
this.saveLayoutPreferences(layoutPrefs);
|
|
1226
1151
|
}
|
|
1227
1152
|
onColumnReorder(event) {
|
|
1228
1153
|
if (event.dropIndex !== undefined && event.dropIndex >= 0 && event.dragIndex !== undefined && event.dragIndex >= 0 && event.dropIndex !== event.dragIndex) {
|
|
1229
1154
|
const eventDropIndex = event.dropIndex;
|
|
1230
1155
|
const eventDragIndex = event.dragIndex;
|
|
1231
|
-
const prevVisibleColumns = this.columns().filter(
|
|
1156
|
+
const prevVisibleColumns = this.columns().filter(c => c.isVisible);
|
|
1232
1157
|
const colAtDrop = prevVisibleColumns[eventDropIndex];
|
|
1233
1158
|
const colAtDrag = prevVisibleColumns[eventDragIndex];
|
|
1234
1159
|
const colAtDropIndex = this.columns().findIndex(el => el.id === colAtDrop.id);
|
|
@@ -1238,59 +1163,112 @@ class TableComponent {
|
|
|
1238
1163
|
columns.splice(colAtDragIndex, 1);
|
|
1239
1164
|
const dropIndex = columns.findIndex(el => el.id === colAtDrop.id) + (eventDropIndex > eventDragIndex ? 1 : 0);
|
|
1240
1165
|
columns = [...columns.slice(0, dropIndex), colAtDrag, ...columns.slice(dropIndex)];
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1245
|
-
this.columns.set(columns);
|
|
1246
|
-
this.layoutPreferences.columnOrder = columns.map(el => el.descriptor.property);
|
|
1247
|
-
this.saveLayoutPreferences();
|
|
1166
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1167
|
+
layoutPrefs.columnOrder = columns.map(el => el.descriptor.property);
|
|
1168
|
+
this.saveLayoutPreferences(layoutPrefs);
|
|
1248
1169
|
}
|
|
1249
1170
|
}
|
|
1250
1171
|
}
|
|
1251
|
-
saveLayoutPreferences() {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
this.
|
|
1263
|
-
|
|
1264
|
-
|
|
1172
|
+
saveLayoutPreferences(layoutPrefs) {
|
|
1173
|
+
const key = this.localstorageKey();
|
|
1174
|
+
if (key) {
|
|
1175
|
+
this.localStorageService.setItem(this.cmpTypeName, key, layoutPrefs);
|
|
1176
|
+
this.layoutPrefsSaveCnt.update(v => v + 1);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
computeDefaultDataListParams() {
|
|
1180
|
+
const params = {
|
|
1181
|
+
offset: 0,
|
|
1182
|
+
limit: this.dataListService.rowsPerPageOptions()[0],
|
|
1183
|
+
sort: this.descriptor()
|
|
1184
|
+
.sorts.filter(s => s.defaultIsEnabled)
|
|
1185
|
+
.map(s => ({
|
|
1186
|
+
property: s.property,
|
|
1187
|
+
ascending: s.defaultIsAscending
|
|
1188
|
+
})),
|
|
1189
|
+
filters: {}
|
|
1190
|
+
};
|
|
1191
|
+
this.filterDescriptors()
|
|
1192
|
+
.filter(d => d.hasDefaultValue)
|
|
1193
|
+
.forEach(f => {
|
|
1194
|
+
let matchMode = f.defaultMatchMode;
|
|
1195
|
+
if (!matchMode) {
|
|
1196
|
+
switch (f.filterType) {
|
|
1197
|
+
case FilterTypeEnum.String:
|
|
1198
|
+
matchMode = FilterMatchMode.Contains;
|
|
1199
|
+
break;
|
|
1200
|
+
case FilterTypeEnum.Lookup:
|
|
1201
|
+
case FilterTypeEnum.LookupEnum: {
|
|
1202
|
+
const lookupFilter = f;
|
|
1203
|
+
if (lookupFilter.multiselect) {
|
|
1204
|
+
matchMode = FilterMatchMode.In;
|
|
1205
|
+
}
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
default:
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
if (!matchMode) {
|
|
1213
|
+
matchMode = FilterMatchMode.Equals;
|
|
1214
|
+
}
|
|
1215
|
+
if (f.matchModes && !f.matchModes?.includes(matchMode)) {
|
|
1216
|
+
matchMode = f.matchModes[0];
|
|
1217
|
+
}
|
|
1218
|
+
let value = undefined;
|
|
1219
|
+
if (Array.isArray(value)) {
|
|
1220
|
+
value = [...value];
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
value = f.defaultValue;
|
|
1224
|
+
}
|
|
1225
|
+
const property = f.property;
|
|
1226
|
+
params.filters[property] = {
|
|
1227
|
+
value: value,
|
|
1228
|
+
matchMode: matchMode
|
|
1229
|
+
};
|
|
1265
1230
|
});
|
|
1231
|
+
return params;
|
|
1266
1232
|
}
|
|
1267
|
-
|
|
1268
|
-
this.
|
|
1269
|
-
|
|
1270
|
-
|
|
1233
|
+
computColumnsWithLayout() {
|
|
1234
|
+
const descriptor = this.descriptor();
|
|
1235
|
+
const layoutPrefs = this.layoutPreferences();
|
|
1236
|
+
// initialize columns with additional properties
|
|
1237
|
+
const timestamp = new Date().getTime();
|
|
1238
|
+
const columns = descriptor.columns.map(col => ({
|
|
1239
|
+
id: `${col.property}-${timestamp}`,
|
|
1240
|
+
descriptor: col,
|
|
1241
|
+
filter: descriptor.filters.find(f => f.showOnColumn === col.property),
|
|
1242
|
+
sort: descriptor.sorts.find(f => f.showOnColumn === col.property),
|
|
1243
|
+
disabled: !col.isToggleable,
|
|
1244
|
+
isVisible: layoutPrefs.columnHidden ? !layoutPrefs.columnHidden.includes(col.property) : col.isVisible,
|
|
1245
|
+
width: layoutPrefs.columnWidths?.[col.property]
|
|
1246
|
+
}));
|
|
1247
|
+
if (layoutPrefs.columnOrder) {
|
|
1248
|
+
for (let i = 0; i < layoutPrefs.columnOrder.length; i++) {
|
|
1249
|
+
const colName = layoutPrefs.columnOrder[i];
|
|
1250
|
+
const colWithPrefs = columns.find(el => el.descriptor.property === colName);
|
|
1251
|
+
if (colWithPrefs) {
|
|
1252
|
+
colWithPrefs.orderIdx = i;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1271
1255
|
}
|
|
1272
|
-
|
|
1273
|
-
this.dataListService.data.set(qr);
|
|
1274
|
-
this.dataListService.count.set(qr.length);
|
|
1275
|
-
this.dataListService.loading.set(false);
|
|
1276
|
-
});
|
|
1256
|
+
return columns.sort((a, b) => (a.orderIdx !== undefined && b.orderIdx !== undefined ? a.orderIdx - b.orderIdx : 0));
|
|
1277
1257
|
}
|
|
1278
1258
|
/**
|
|
1279
1259
|
* Reset column order and column visibility to default settings
|
|
1280
1260
|
*/
|
|
1281
1261
|
resetDefaultLayout() {
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
this.localStorageService.removeItem(this.cmpTypeName, this.localstorageKey);
|
|
1262
|
+
const key = this.localstorageKey();
|
|
1263
|
+
if (key) {
|
|
1264
|
+
this.localStorageService.removeItem(this.cmpTypeName, key);
|
|
1265
|
+
this.layoutPrefsSaveCnt.update(v => v + 1);
|
|
1287
1266
|
}
|
|
1288
|
-
this.layoutPreferences = {};
|
|
1289
1267
|
}
|
|
1290
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1291
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: TableComponent, isStandalone: true, selector: "mng-table", inputs: { descriptorInput: ["descriptor", "descriptorInput"], items: ["items", "items", (value) => (value == null ? undefined : isObservable(value) ? value : of(value))], result: ["result", "result", (value) => (value == null ? undefined : isObservable(value) ? value : of(value))], loadingInput: ["loading", "loadingInput", boolean$Attribute], dataProvider: "dataProvider", useQueryParams: "useQueryParams", selectionMode: "selectionMode", selectionEnabled: "selectionEnabled", columnLastMinWidth: "columnLastMinWidth", captionComponent: "captionComponent", columnCustomLastComponent: "columnCustomLastComponent", globalFilterFieldsInput: ["globalFilterFields", "globalFilterFieldsInput"] }, outputs: { loadEventEmitter: "tableLoad", cellClickEventEmitter: "cellClick", selectionChangeEventEmitter: "selectionChange", captionCmpInstEventEmitter: "captionComponentInstance", columnCustomLastCmpInstEventEmitter: "columnCustomLastComponentInstance" }, providers: [DataListService], queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "primeTable", first: true, predicate: Table, descendants: true }, { propertyName: "components", predicate: ComponentDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.height]=\"tableFullHeightOffset() ? 'calc(100vh - ' + tableFullHeightOffset() + 'px)' : null\">\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() && !infiniteScroll()\"\n [rows]=\"infiniteScroll() ? 20 : dataListService.rows()\"\n [first]=\"infiniteScroll() ? 0 : dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"infiniteScroll() ? undefined : dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"!infiniteScroll()\"\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 [virtualScroll]=\"infiniteScroll()\"\n [virtualScrollItemSize]=\"rowHeight()\"\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 (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n @if (captionTemplate() || captionComponent || descriptor().title) {\n <ng-template pTemplate=\"caption\">\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent) {\n <div [mngComponent]=\"captionComponent\" (instanceCreated)=\"captionCmpInstEventEmitter.next($event)\"></div>\n } @else {\n <h5 class=\"p-0 m-0\">{{ descriptor().title }}</h5>\n }\n </ng-template>\n }\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n @if (selectionEnabled) {\n @if (selectionMode === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" class=\"col-1\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter-full [descriptor]=\"col.filter\"></mng-table-column-filter-full>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [style.height.px]=\"rowHeight\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled) {\n @if (selectionMode === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td class=\"col-1\">\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @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]=\"cellClickEventEmitter.observed\"\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)=\"columnCustomLastCmpInstEventEmitter.next($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n @if (descriptor().rowExpandable) {\n <ng-template pTemplate=\"rowexpansion\" let-item>\n <tr>\n <td class=\"col-1\"></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </td>\n </tr>\n </ng-template>\n }\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\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 [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: dataListService.data(), totalCount: dataListService.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n", dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "pipe", type: I18nPropertyPipe, name: "mngI18nProperty" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "pipe", type: ClassMapPipe, name: "mngClassMap" }, { kind: "pipe", type: LocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: TableColumnFilterFullComponent, selector: "mng-table-column-filter-full", inputs: ["descriptor"] }, { kind: "pipe", type: TableColumnFilterClassPipe, name: "mngTableColumnFilterClass" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$1.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: i1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$1.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$1.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$1.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$1.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$1.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$1.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$1.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3$2.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "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"] }, { 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", "size", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$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: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1268
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1269
|
+
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 }, useQueryParamsInput: { classPropertyName: "useQueryParamsInput", 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 }, 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" }, 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 [style.height]=\"tableFullHeightOffset() ? 'calc(100vh - ' + tableFullHeightOffset() + 'px)' : null\">\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() && !infiniteScroll()\"\n [rows]=\"infiniteScroll() ? 20 : dataListService.rows()\"\n [first]=\"infiniteScroll() ? 0 : dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"infiniteScroll() ? undefined : dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"!infiniteScroll()\"\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 [virtualScroll]=\"infiniteScroll()\"\n [virtualScrollItemSize]=\"rowHeight()\"\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 (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n @if (captionTemplate() || captionComponent() || descriptor().title) {\n <ng-template pTemplate=\"caption\">\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <div [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></div>\n } @else {\n <h5 class=\"p-0 m-0\">{{ descriptor().title }}</h5>\n }\n </ng-template>\n }\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" class=\"col-1\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter-full [descriptor]=\"col.filter\"></mng-table-column-filter-full>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [style.height.px]=\"rowHeight()\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td class=\"col-1\">\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n @if (descriptor().rowExpandable) {\n <ng-template pTemplate=\"rowexpansion\" let-item>\n <tr>\n <td class=\"col-1\"></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </td>\n </tr>\n </ng-template>\n }\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight()\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled() ? 1 : 0)\">\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 [style.height.px]=\"rowHeight()\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled() ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: dataListService.data(), totalCount: dataListService.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n", dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "pipe", type: I18nPropertyPipe, name: "mngI18nProperty" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "pipe", type: ClassMapPipe, name: "mngClassMap" }, { kind: "pipe", type: LocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: TableColumnFilterFullComponent, selector: "mng-table-column-filter-full", inputs: ["descriptor"] }, { kind: "pipe", type: TableColumnFilterClassPipe, name: "mngTableColumnFilterClass" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$2.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$2.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$2.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$2.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$2.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$2.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$2.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3$1.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i4$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1292
1270
|
}
|
|
1293
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TableComponent, decorators: [{
|
|
1294
1272
|
type: Component,
|
|
1295
1273
|
args: [{ standalone: true, selector: 'mng-table', imports: [
|
|
1296
1274
|
AsyncPipe,
|
|
@@ -1310,60 +1288,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
1310
1288
|
TooltipModule,
|
|
1311
1289
|
TranslateModule,
|
|
1312
1290
|
FormsModule
|
|
1313
|
-
], providers: [DataListService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"tableFullHeightOffset() ? 'calc(100vh - ' + tableFullHeightOffset() + 'px)' : null\">\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() && !infiniteScroll()\"\n [rows]=\"infiniteScroll() ? 20 : dataListService.rows()\"\n [first]=\"infiniteScroll() ? 0 : dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"infiniteScroll() ? undefined : dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"!infiniteScroll()\"\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 [virtualScroll]=\"infiniteScroll()\"\n [virtualScrollItemSize]=\"rowHeight()\"\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 (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n @if (captionTemplate() || captionComponent || descriptor().title) {\n <ng-template pTemplate=\"caption\">\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent) {\n <div [mngComponent]=\"captionComponent\" (instanceCreated)=\"captionCmpInstEventEmitter.next($event)\"></div>\n } @else {\n <h5 class=\"p-0 m-0\">{{ descriptor().title }}</h5>\n }\n </ng-template>\n }\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n @if (selectionEnabled) {\n @if (selectionMode === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" class=\"col-1\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter-full [descriptor]=\"col.filter\"></mng-table-column-filter-full>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [style.height.px]=\"rowHeight\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled) {\n @if (selectionMode === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td class=\"col-1\">\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @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]=\"cellClickEventEmitter.observed\"\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)=\"columnCustomLastCmpInstEventEmitter.next($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n @if (descriptor().rowExpandable) {\n <ng-template pTemplate=\"rowexpansion\" let-item>\n <tr>\n <td class=\"col-1\"></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </td>\n </tr>\n </ng-template>\n }\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\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 [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\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" }]
|
|
1314
|
-
}],
|
|
1315
|
-
type: Input,
|
|
1316
|
-
args: [{ required: true, alias: 'descriptor' }]
|
|
1317
|
-
}], items: [{
|
|
1318
|
-
type: Input,
|
|
1319
|
-
args: [{ transform: (value) => (value == null ? undefined : isObservable(value) ? value : of(value)) }]
|
|
1320
|
-
}], result: [{
|
|
1321
|
-
type: Input,
|
|
1322
|
-
args: [{
|
|
1323
|
-
transform: (value) => (value == null ? undefined : isObservable(value) ? value : of(value))
|
|
1324
|
-
}]
|
|
1325
|
-
}], loadingInput: [{
|
|
1326
|
-
type: Input,
|
|
1327
|
-
args: [{ alias: 'loading', transform: boolean$Attribute }]
|
|
1328
|
-
}], dataProvider: [{
|
|
1329
|
-
type: Input
|
|
1330
|
-
}], useQueryParams: [{
|
|
1331
|
-
type: Input
|
|
1332
|
-
}], selectionMode: [{
|
|
1333
|
-
type: Input
|
|
1334
|
-
}], selectionEnabled: [{
|
|
1335
|
-
type: Input
|
|
1336
|
-
}], columnLastMinWidth: [{
|
|
1337
|
-
type: Input
|
|
1338
|
-
}], captionComponent: [{
|
|
1339
|
-
type: Input
|
|
1340
|
-
}], columnCustomLastComponent: [{
|
|
1341
|
-
type: Input
|
|
1342
|
-
}], globalFilterFieldsInput: [{
|
|
1343
|
-
type: Input,
|
|
1344
|
-
args: ['globalFilterFields']
|
|
1345
|
-
}], loadEventEmitter: [{
|
|
1346
|
-
type: Output,
|
|
1347
|
-
args: ['tableLoad']
|
|
1348
|
-
}], cellClickEventEmitter: [{
|
|
1349
|
-
type: Output,
|
|
1350
|
-
args: ['cellClick']
|
|
1351
|
-
}], selectionChangeEventEmitter: [{
|
|
1352
|
-
type: Output,
|
|
1353
|
-
args: ['selectionChange']
|
|
1354
|
-
}], captionCmpInstEventEmitter: [{
|
|
1355
|
-
type: Output,
|
|
1356
|
-
args: ['captionComponentInstance']
|
|
1357
|
-
}], columnCustomLastCmpInstEventEmitter: [{
|
|
1358
|
-
type: Output,
|
|
1359
|
-
args: ['columnCustomLastComponentInstance']
|
|
1360
|
-
}], components: [{
|
|
1361
|
-
type: ViewChildren,
|
|
1362
|
-
args: [ComponentDirective]
|
|
1363
|
-
}], primeTable: [{
|
|
1364
|
-
type: ViewChild,
|
|
1365
|
-
args: [Table]
|
|
1366
|
-
}] } });
|
|
1291
|
+
], providers: [DataListService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"tableFullHeightOffset() ? 'calc(100vh - ' + tableFullHeightOffset() + 'px)' : null\">\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() && !infiniteScroll()\"\n [rows]=\"infiniteScroll() ? 20 : dataListService.rows()\"\n [first]=\"infiniteScroll() ? 0 : dataListService.offset()\"\n [totalRecords]=\"dataListService.count()\"\n [rowsPerPageOptions]=\"infiniteScroll() ? undefined : dataListService.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"!infiniteScroll()\"\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 [virtualScroll]=\"infiniteScroll()\"\n [virtualScrollItemSize]=\"rowHeight()\"\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 (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\">\n @if (captionTemplate() || captionComponent() || descriptor().title) {\n <ng-template pTemplate=\"caption\">\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <div [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></div>\n } @else {\n <h5 class=\"p-0 m-0\">{{ descriptor().title }}</h5>\n }\n </ng-template>\n }\n <ng-template pTemplate=\"header\">\n @if (!descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (descriptor().rowExpandable) {\n <th scope=\"col\" class=\"col-1\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n <p-sortIcon [field]=\"col.descriptor.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (descriptor().hasResizableColumns) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"columns()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\" [ngClass]=\"{'p-checkbox-disabled': !areColumnsToggleable}\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\"\n [disabled]=\"!areColumnsToggleable\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"resetDefaultLayout()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{ item.descriptor.title ?? (item.descriptor.property | mngI18nProperty: descriptor().model) | translate }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.columnClassName | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : col.filter?.columnWidth ?? col.descriptor.width ?? null\"\n [style.min-width.px]=\"col.width ? null : col.filter?.columnMinWidth ?? col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter-full [descriptor]=\"col.filter\"></mng-table-column-filter-full>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [style.height.px]=\"rowHeight()\"\n [ngClass]=\"descriptor().rowClassName | mngClassMap: descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: descriptor() : item\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (descriptor().rowExpandable) {\n <td class=\"col-1\">\n @if (!descriptor().rowExpandableProperty || item[descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">{{ col.descriptor.title ?? (col.descriptor.property | mngI18nProperty: descriptor().model) | translate }}</span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n @if (descriptor().rowExpandable) {\n <ng-template pTemplate=\"rowexpansion\" let-item>\n <tr>\n <td class=\"col-1\"></td>\n <td [colSpan]=\"descriptor().rowExpandableColSpan\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </td>\n </tr>\n </ng-template>\n }\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + descriptor().loadingIcon\"></i>\n }\n @if (descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': descriptor().loadingIcon}\">\n {{ descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight()\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled() ? 1 : 0)\">\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 [style.height.px]=\"rowHeight()\">\n <td [attr.colspan]=\"visibleColumns().length + (hasLastColumn() ? 1 : 0) + (selectionEnabled() ? 1 : 0)\">\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" }]
|
|
1292
|
+
}], ctorParameters: () => [] });
|
|
1367
1293
|
|
|
1368
1294
|
// components
|
|
1369
1295
|
|