@mediusinc/mng-commons 0.2.9 → 0.2.11

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.
@@ -6,7 +6,7 @@ import { Injectable, InjectionToken, Inject, Component, ChangeDetectionStrategy,
6
6
  import * as i2$3 from '@angular/forms';
7
7
  import { Validators, FormGroup, NG_VALUE_ACCESSOR, FormControl, ReactiveFormsModule } from '@angular/forms';
8
8
  import * as i1 from '@angular/router';
9
- import { NavigationEnd, RouterModule } from '@angular/router';
9
+ import { NavigationEnd, GuardsCheckEnd, RouterModule } from '@angular/router';
10
10
  import * as i3 from '@ngx-formly/core';
11
11
  import { FieldType, FieldWrapper, FORMLY_CONFIG, FormlyModule } from '@ngx-formly/core';
12
12
  import * as i2$2 from '@ngx-translate/core';
@@ -36,14 +36,15 @@ import { DynamicDialogModule, DialogService } from 'primeng/dynamicdialog';
36
36
  import * as i1$5 from 'primeng/fieldset';
37
37
  import { FieldsetModule } from 'primeng/fieldset';
38
38
  import { FileUploadModule } from 'primeng/fileupload';
39
+ import * as i6$1 from 'primeng/inputmask';
39
40
  import { InputMaskModule } from 'primeng/inputmask';
40
41
  import * as i1$3 from 'primeng/inputnumber';
41
42
  import { InputNumberModule } from 'primeng/inputnumber';
42
43
  import * as i2$5 from 'primeng/inputswitch';
43
44
  import { InputSwitchModule } from 'primeng/inputswitch';
44
- import * as i9$1 from 'primeng/inputtext';
45
+ import * as i10$1 from 'primeng/inputtext';
45
46
  import { InputTextModule } from 'primeng/inputtext';
46
- import * as i8$1 from 'primeng/inputtextarea';
47
+ import * as i9$1 from 'primeng/inputtextarea';
47
48
  import { InputTextareaModule } from 'primeng/inputtextarea';
48
49
  import * as i3$1 from 'primeng/messages';
49
50
  import { MessagesModule } from 'primeng/messages';
@@ -67,11 +68,11 @@ import { TagModule } from 'primeng/tag';
67
68
  import * as i7$1 from 'primeng/toast';
68
69
  import { ToastModule } from 'primeng/toast';
69
70
  import { ToggleButtonModule } from 'primeng/togglebutton';
70
- import * as i8$2 from 'primeng/toolbar';
71
+ import * as i8$1 from 'primeng/toolbar';
71
72
  import { ToolbarModule } from 'primeng/toolbar';
72
73
  import * as i10 from 'primeng/tooltip';
73
74
  import { TooltipModule } from 'primeng/tooltip';
74
- import { of, throwError, Observable, from, BehaviorSubject, Subject, ReplaySubject } from 'rxjs';
75
+ import { of, throwError, Observable, from, BehaviorSubject, Subject, ReplaySubject, distinctUntilChanged, combineLatest } from 'rxjs';
75
76
  import 'reflect-metadata';
76
77
  import { mergeMap, map, first, catchError, filter, finalize, startWith } from 'rxjs/operators';
77
78
  import * as i4 from '@angular/platform-browser';
@@ -1038,6 +1039,15 @@ class FieldInputDescriptor extends AFieldDescriptor {
1038
1039
  get pattern() {
1039
1040
  return this._pattern;
1040
1041
  }
1042
+ get mask() {
1043
+ return this._mask;
1044
+ }
1045
+ get slotChar() {
1046
+ return this._slotChar;
1047
+ }
1048
+ get customComponentName() {
1049
+ return this._customComponentName;
1050
+ }
1041
1051
  asText(minLength, maxLength, pattern, isEmail) {
1042
1052
  this._fieldType = FieldInputDescriptor.TypeEnum.Text;
1043
1053
  this._minLength = minLength;
@@ -1092,6 +1102,17 @@ class FieldInputDescriptor extends AFieldDescriptor {
1092
1102
  this._datePickerShowTime = showTime ?? false;
1093
1103
  return this;
1094
1104
  }
1105
+ asMask(mask, slotChar) {
1106
+ this._fieldType = FieldInputDescriptor.TypeEnum.Mask;
1107
+ this._mask = mask;
1108
+ this._slotChar = slotChar;
1109
+ return this;
1110
+ }
1111
+ asCustomComponent(customComponentName) {
1112
+ this._fieldType = FieldInputDescriptor.TypeEnum.Custom;
1113
+ this._customComponentName = customComponentName;
1114
+ return this;
1115
+ }
1095
1116
  copy() {
1096
1117
  const field = new FieldInputDescriptor(this._editor, this._property);
1097
1118
  this.copyFieldsTo(field);
@@ -1110,6 +1131,9 @@ class FieldInputDescriptor extends AFieldDescriptor {
1110
1131
  field._maxLength = this._maxLength;
1111
1132
  field._minLength = this._minLength;
1112
1133
  field._pattern = this._pattern;
1134
+ field._mask = this._mask;
1135
+ field._slotChar = this._slotChar;
1136
+ field._customComponentName = this._customComponentName;
1113
1137
  return field;
1114
1138
  }
1115
1139
  }
@@ -1122,6 +1146,8 @@ class FieldInputDescriptor extends AFieldDescriptor {
1122
1146
  TypeEnum[TypeEnum["Switch"] = 3] = "Switch";
1123
1147
  TypeEnum[TypeEnum["Radio"] = 4] = "Radio";
1124
1148
  TypeEnum[TypeEnum["Datepicker"] = 5] = "Datepicker";
1149
+ TypeEnum[TypeEnum["Mask"] = 6] = "Mask";
1150
+ TypeEnum[TypeEnum["Custom"] = 7] = "Custom";
1125
1151
  })(TypeEnum = FieldInputDescriptor.TypeEnum || (FieldInputDescriptor.TypeEnum = {}));
1126
1152
  })(FieldInputDescriptor || (FieldInputDescriptor = {}));
1127
1153
  class FieldLookupDescriptor extends AFieldDescriptor {
@@ -2166,6 +2192,12 @@ class EditorFormlyUtil {
2166
2192
  case FieldInputDescriptor.TypeEnum.Datepicker:
2167
2193
  field.type = 'datepicker';
2168
2194
  break;
2195
+ case FieldInputDescriptor.TypeEnum.Mask:
2196
+ field.type = 'mask';
2197
+ break;
2198
+ case FieldInputDescriptor.TypeEnum.Custom:
2199
+ field.type = descriptor.customComponentName;
2200
+ break;
2169
2201
  default:
2170
2202
  field.type = 'input';
2171
2203
  field.templateOptions.minLength = descriptor.minLength;
@@ -4486,10 +4518,10 @@ class MngFormlyFieldInputComponent extends FieldType {
4486
4518
  }
4487
4519
  }
4488
4520
  MngFormlyFieldInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngFormlyFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4489
- MngFormlyFieldInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngFormlyFieldInputComponent, selector: "mng-formly-field-input", usesInheritance: true, ngImport: i0, template: "<ng-container [ngSwitch]=\"to.type\">\n <p-inputNumber\n *ngSwitchCase=\"'number'\"\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [min]=\"$any(descriptor.numberMin)\"\n [max]=\"$any(descriptor.numberMax)\"\n [step]=\"$any(descriptor.numberStep)\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits || 0\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits || 0\">\n </p-inputNumber>\n\n <div *ngSwitchCase=\"'switch'\" class=\"flex flex-column\">\n <label [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <p-inputSwitch [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-inputSwitch>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n </div>\n\n <ng-container *ngSwitchCase=\"'radio'\">\n <div *ngFor=\"let option of descriptor.radioOptions\" [id]=\"$any(key)\" class=\"field-radiobutton\">\n <p-radioButton [name]=\"$any(key)\" [value]=\"option.value\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-radioButton>\n <label [for]=\"option.value\" class=\"mng-radio-button-label\">{{ option.title | translate }}</label>\n </div>\n </ng-container>\n\n <textarea *ngSwitchCase=\"'textarea'\" [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [rows]=\"descriptor.rows ?? 3\" pInputTextarea> </textarea>\n\n <p-calendar\n *ngSwitchCase=\"'datepicker'\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [dateFormat]=\"$any(descriptor.datePickerFormat)\"\n [minDate]=\"$any(descriptor.datePickerMin)\"\n [maxDate]=\"$any(descriptor.datePickerMax)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [showIcon]=\"true\">\n </p-calendar>\n\n <input *ngSwitchDefault pInputText [id]=\"$any(key)\" [type]=\"to.type || 'text'\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" />\n</ng-container>\n", components: [{ type: i1$3.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "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", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }, { type: i2$5.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabelledBy"], outputs: ["onChange"] }, { type: i3.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i4$3.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i5.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "view", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }], directives: [{ type: i4$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i8$1.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { type: i4$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i9$1.InputText, selector: "[pInputText]" }], pipes: { "translate": i2$2.TranslatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
4521
+ MngFormlyFieldInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngFormlyFieldInputComponent, selector: "mng-formly-field-input", usesInheritance: true, ngImport: i0, template: "<ng-container [ngSwitch]=\"to.type\">\n <p-inputNumber\n *ngSwitchCase=\"'number'\"\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [min]=\"$any(descriptor.numberMin)\"\n [max]=\"$any(descriptor.numberMax)\"\n [step]=\"$any(descriptor.numberStep)\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits || 0\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits || 0\">\n </p-inputNumber>\n\n <div *ngSwitchCase=\"'switch'\" class=\"flex flex-column\">\n <label [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <p-inputSwitch [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-inputSwitch>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n </div>\n\n <ng-container *ngSwitchCase=\"'radio'\">\n <div *ngFor=\"let option of descriptor.radioOptions\" [id]=\"$any(key)\" class=\"field-radiobutton\">\n <p-radioButton [name]=\"$any(key)\" [value]=\"option.value\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-radioButton>\n <label [for]=\"option.value\" class=\"mng-radio-button-label\">{{ option.title | translate }}</label>\n </div>\n </ng-container>\n\n <textarea *ngSwitchCase=\"'textarea'\" [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [rows]=\"descriptor.rows ?? 3\" pInputTextarea> </textarea>\n\n <p-calendar\n *ngSwitchCase=\"'datepicker'\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [dateFormat]=\"$any(descriptor.datePickerFormat)\"\n [minDate]=\"$any(descriptor.datePickerMin)\"\n [maxDate]=\"$any(descriptor.datePickerMax)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [showIcon]=\"true\">\n </p-calendar>\n\n <p-inputMask\n *ngSwitchCase=\"'mask'\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [mask]=\"$any(descriptor.mask)\"\n [placeholder]=\"$any(descriptor.placeholder)\"\n [slotChar]=\"$any(descriptor.slotChar)\">\n </p-inputMask>\n\n <input *ngSwitchDefault pInputText [id]=\"$any(key)\" [type]=\"to.type || 'text'\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" />\n</ng-container>\n", components: [{ type: i1$3.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "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", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }, { type: i2$5.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabelledBy"], outputs: ["onChange"] }, { type: i3.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i4$3.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i5.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "view", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i6$1.InputMask, selector: "p-inputMask", inputs: ["type", "slotChar", "autoClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autoFocus", "autocomplete", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown"] }], directives: [{ type: i4$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i9$1.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { type: i4$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i10$1.InputText, selector: "[pInputText]" }], pipes: { "translate": i2$2.TranslatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
4490
4522
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngFormlyFieldInputComponent, decorators: [{
4491
4523
  type: Component,
4492
- args: [{ selector: 'mng-formly-field-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container [ngSwitch]=\"to.type\">\n <p-inputNumber\n *ngSwitchCase=\"'number'\"\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [min]=\"$any(descriptor.numberMin)\"\n [max]=\"$any(descriptor.numberMax)\"\n [step]=\"$any(descriptor.numberStep)\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits || 0\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits || 0\">\n </p-inputNumber>\n\n <div *ngSwitchCase=\"'switch'\" class=\"flex flex-column\">\n <label [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <p-inputSwitch [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-inputSwitch>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n </div>\n\n <ng-container *ngSwitchCase=\"'radio'\">\n <div *ngFor=\"let option of descriptor.radioOptions\" [id]=\"$any(key)\" class=\"field-radiobutton\">\n <p-radioButton [name]=\"$any(key)\" [value]=\"option.value\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-radioButton>\n <label [for]=\"option.value\" class=\"mng-radio-button-label\">{{ option.title | translate }}</label>\n </div>\n </ng-container>\n\n <textarea *ngSwitchCase=\"'textarea'\" [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [rows]=\"descriptor.rows ?? 3\" pInputTextarea> </textarea>\n\n <p-calendar\n *ngSwitchCase=\"'datepicker'\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [dateFormat]=\"$any(descriptor.datePickerFormat)\"\n [minDate]=\"$any(descriptor.datePickerMin)\"\n [maxDate]=\"$any(descriptor.datePickerMax)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [showIcon]=\"true\">\n </p-calendar>\n\n <input *ngSwitchDefault pInputText [id]=\"$any(key)\" [type]=\"to.type || 'text'\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" />\n</ng-container>\n" }]
4524
+ args: [{ selector: 'mng-formly-field-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container [ngSwitch]=\"to.type\">\n <p-inputNumber\n *ngSwitchCase=\"'number'\"\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [min]=\"$any(descriptor.numberMin)\"\n [max]=\"$any(descriptor.numberMax)\"\n [step]=\"$any(descriptor.numberStep)\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits || 0\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits || 0\">\n </p-inputNumber>\n\n <div *ngSwitchCase=\"'switch'\" class=\"flex flex-column\">\n <label [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <p-inputSwitch [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-inputSwitch>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n </div>\n\n <ng-container *ngSwitchCase=\"'radio'\">\n <div *ngFor=\"let option of descriptor.radioOptions\" [id]=\"$any(key)\" class=\"field-radiobutton\">\n <p-radioButton [name]=\"$any(key)\" [value]=\"option.value\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\"></p-radioButton>\n <label [for]=\"option.value\" class=\"mng-radio-button-label\">{{ option.title | translate }}</label>\n </div>\n </ng-container>\n\n <textarea *ngSwitchCase=\"'textarea'\" [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [rows]=\"descriptor.rows ?? 3\" pInputTextarea> </textarea>\n\n <p-calendar\n *ngSwitchCase=\"'datepicker'\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [dateFormat]=\"$any(descriptor.datePickerFormat)\"\n [minDate]=\"$any(descriptor.datePickerMin)\"\n [maxDate]=\"$any(descriptor.datePickerMax)\"\n [showTime]=\"descriptor.datePickerShowTime\"\n [showIcon]=\"true\">\n </p-calendar>\n\n <p-inputMask\n *ngSwitchCase=\"'mask'\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [mask]=\"$any(descriptor.mask)\"\n [placeholder]=\"$any(descriptor.placeholder)\"\n [slotChar]=\"$any(descriptor.slotChar)\">\n </p-inputMask>\n\n <input *ngSwitchDefault pInputText [id]=\"$any(key)\" [type]=\"to.type || 'text'\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" />\n</ng-container>\n" }]
4493
4525
  }] });
4494
4526
 
4495
4527
  class MngFormlyFieldDropdownComponent extends FieldType {
@@ -5426,8 +5458,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
5426
5458
  }], ctorParameters: function () { return [{ type: MngCommonsService }]; } });
5427
5459
 
5428
5460
  class MngMenuItemComponent {
5429
- constructor(router, mngCommons, mainLayoutService) {
5461
+ constructor(injector, router, route, mngCommons, mainLayoutService) {
5462
+ this.injector = injector;
5430
5463
  this.router = router;
5464
+ this.route = route;
5431
5465
  this.mngCommons = mngCommons;
5432
5466
  this.mainLayoutService = mainLayoutService;
5433
5467
  this.index = 0;
@@ -5436,6 +5470,8 @@ class MngMenuItemComponent {
5436
5470
  this.key = '';
5437
5471
  this.active = false;
5438
5472
  this.hover = false;
5473
+ this.isAllowedSubject = new BehaviorSubject(true);
5474
+ this.isAllowed$ = this.isAllowedSubject.asObservable().pipe(distinctUntilChanged());
5439
5475
  }
5440
5476
  ngOnInit() {
5441
5477
  if (!this.mngCommons.menuModeIsSlim && this.item.routerLink) {
@@ -5459,14 +5495,20 @@ class MngMenuItemComponent {
5459
5495
  this.menuResetSubscription = this.mngCommons.menuReset$.subscribe(() => {
5460
5496
  this.active = false;
5461
5497
  });
5462
- this.routerEventsSubscription = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
5463
- if (this.mngCommons.menuModeIsSlim && !this.mainLayoutService.isMobile()) {
5464
- this.active = false;
5498
+ this.routerEventsSubscription = this.router.events.subscribe(next => {
5499
+ if (next instanceof GuardsCheckEnd && next.shouldActivate) {
5500
+ this.checkIfMenuItemIsAllowedFromGuard(next.state);
5465
5501
  }
5466
- else {
5467
- this.updateActiveStateFromRoute();
5502
+ else if (next instanceof NavigationEnd) {
5503
+ if (this.mngCommons.menuModeIsSlim && !this.mainLayoutService.isMobile()) {
5504
+ this.active = false;
5505
+ }
5506
+ else {
5507
+ this.updateActiveStateFromRoute();
5508
+ }
5468
5509
  }
5469
5510
  });
5511
+ this.checkIfMenuItemIsAllowedFromGuard(this.router.routerState.snapshot);
5470
5512
  }
5471
5513
  updateActiveStateFromRoute() {
5472
5514
  if (this.itemUrl) {
@@ -5488,10 +5530,6 @@ class MngMenuItemComponent {
5488
5530
  }
5489
5531
  // notify other items
5490
5532
  this.mngCommons.menuChangeActiveKey(this.key);
5491
- // execute command
5492
- if (this.item.command) {
5493
- this.item.command({ originalEvent: event, item: this.item });
5494
- }
5495
5533
  // toggle active state
5496
5534
  if (this.item.items) {
5497
5535
  this.active = !this.active;
@@ -5523,10 +5561,45 @@ class MngMenuItemComponent {
5523
5561
  this.menuSourceSubscription?.unsubscribe();
5524
5562
  this.menuResetSubscription?.unsubscribe();
5525
5563
  this.routerEventsSubscription?.unsubscribe();
5564
+ this.guardsSubscription?.unsubscribe();
5565
+ }
5566
+ checkIfMenuItemIsAllowedFromGuard(routerState) {
5567
+ this.guardsSubscription?.unsubscribe();
5568
+ if (this.item.guards?.length) {
5569
+ const obs = [];
5570
+ for (const guard of this.item.guards) {
5571
+ const tokenInjectedInstance = this.injector.get(guard);
5572
+ if (tokenInjectedInstance && 'canActivate' in tokenInjectedInstance) {
5573
+ const guardInstance = tokenInjectedInstance;
5574
+ const canActivateRes = guardInstance.canActivate(this.route.snapshot, routerState);
5575
+ let canActivateObs;
5576
+ if (canActivateRes instanceof Observable) {
5577
+ canActivateObs = canActivateRes;
5578
+ }
5579
+ else if (canActivateRes instanceof Promise) {
5580
+ canActivateObs = from(canActivateRes);
5581
+ }
5582
+ else {
5583
+ canActivateObs = of(canActivateRes);
5584
+ }
5585
+ obs.push(canActivateObs.pipe(first(), map(res => res === true) // if url tree is present, that means redirect and implies not allowed
5586
+ ));
5587
+ }
5588
+ }
5589
+ this.guardsSubscription = combineLatest(obs)
5590
+ .pipe(first())
5591
+ .subscribe(next => {
5592
+ const result = next.every(n => n === true);
5593
+ this.isAllowedSubject.next(result);
5594
+ });
5595
+ }
5596
+ else {
5597
+ this.isAllowedSubject.next(true);
5598
+ }
5526
5599
  }
5527
5600
  }
5528
- MngMenuItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngMenuItemComponent, deps: [{ token: i1.Router }, { token: MngCommonsService }, { token: MngMainLayoutComponentService }], target: i0.ɵɵFactoryTarget.Component });
5529
- MngMenuItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngMenuItemComponent, selector: "[mng-menuitem]", inputs: { item: "item", index: "index", root: "root", parentKey: "parentKey" }, host: { properties: { "class.layout-root-menuitem": "root", "class.active-menuitem": "active" } }, ngImport: i0, template: "<ng-container>\n <div *ngIf=\"root && item.visible !== false\" class=\"layout-menuitem-root-text\">{{ item.label | translate }}</div>\n <a\n *ngIf=\"(!item.routerLink || item.items) && item.visible !== false\"\n [attr.href]=\"item.url\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"onMouseEnter()\"\n (keydown.enter)=\"itemClick($event)\"\n [routerLink]=\"item.routerLink\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.class\"\n pRipple>\n <i [ngClass]=\"item.icon\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <a\n *ngIf=\"item.routerLink && !item.items && item.visible !== false\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"hover = true\"\n (mouseleave)=\"hover = false\"\n [routerLink]=\"item.routerLink\"\n routerLinkActive=\"active-menuitem-routerlink\"\n [routerLinkActiveOptions]=\"{exact: true}\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.class\"\n pRipple>\n <i [ngClass]=\"item.icon\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <ul\n *ngIf=\"((item.items && active) || (item.items && (mngCommons.menuModeIsStatic$ | async) && (root || active))) && item.visible !== false\"\n [@children]=\"\n (mngCommons.menuModeIsSlim$ | async) && (mainLayoutService.isMobile$ | async) === false && root\n ? active\n ? 'visible'\n : 'hidden'\n : (mngCommons.menuModeIsStatic$ | async) && root && (mainLayoutService.isMobile$ | async) === false\n ? 'visible'\n : active\n ? 'visibleAnimated'\n : 'hiddenAnimated'\n \">\n <ng-template ngFor let-child let-i=\"index\" [ngForOf]=\"item.items\">\n <li mng-menuitem [item]=\"child\" [index]=\"i\" [parentKey]=\"key\" [class]=\"child.badgeClass\"></li>\n </ng-template>\n </ul>\n</ng-container>\n", components: [{ type: MngMenuItemComponent, selector: "[mng-menuitem]", inputs: ["item", "index", "root", "parentKey"] }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i9.Ripple, selector: "[pRipple]" }, { type: i4$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i2$2.TranslatePipe, "async": i4$1.AsyncPipe }, animations: [
5601
+ MngMenuItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngMenuItemComponent, deps: [{ token: i0.Injector }, { token: i1.Router }, { token: i1.ActivatedRoute }, { token: MngCommonsService }, { token: MngMainLayoutComponentService }], target: i0.ɵɵFactoryTarget.Component });
5602
+ MngMenuItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngMenuItemComponent, selector: "[mng-menuitem]", inputs: { item: "item", index: "index", root: "root", parentKey: "parentKey" }, host: { properties: { "class.layout-root-menuitem": "root", "class.active-menuitem": "active" } }, ngImport: i0, template: "<ng-container>\n <div *ngIf=\"root && item.visible !== false && (isAllowed$ | async) === true\" class=\"layout-menuitem-root-text\">{{ item.label! | translate }}</div>\n <a\n *ngIf=\"(!item.routerLink || item.items) && item.visible !== false && (isAllowed$ | async) === true\"\n [attr.href]=\"item.href\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"onMouseEnter()\"\n (keydown.enter)=\"itemClick($event)\"\n [routerLink]=\"item.routerLink\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.className ?? ''\"\n pRipple>\n <i [ngClass]=\"item.icon ?? ''\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label! | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <a\n *ngIf=\"item.routerLink && !item.items && item.visible !== false && (isAllowed$ | async) === true\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"hover = true\"\n (mouseleave)=\"hover = false\"\n [routerLink]=\"item.routerLink\"\n routerLinkActive=\"active-menuitem-routerlink\"\n [routerLinkActiveOptions]=\"{exact: true}\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.className ?? ''\"\n pRipple>\n <i [ngClass]=\"item.icon ?? ''\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label! | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <ul\n *ngIf=\"((item.items && active) || (item.items && (mngCommons.menuModeIsStatic$ | async) && (root || active))) && item.visible !== false && (isAllowed$ | async) === true\"\n [@children]=\"\n (mngCommons.menuModeIsSlim$ | async) && (mainLayoutService.isMobile$ | async) === false && root\n ? active\n ? 'visible'\n : 'hidden'\n : (mngCommons.menuModeIsStatic$ | async) && root && (mainLayoutService.isMobile$ | async) === false\n ? 'visible'\n : active\n ? 'visibleAnimated'\n : 'hiddenAnimated'\n \">\n <ng-template ngFor let-child let-i=\"index\" [ngForOf]=\"item.items\">\n <li mng-menuitem [item]=\"child\" [index]=\"i\" [parentKey]=\"key\" [class]=\"child.badgeClassName\"></li>\n </ng-template>\n </ul>\n</ng-container>\n", components: [{ type: MngMenuItemComponent, selector: "[mng-menuitem]", inputs: ["item", "index", "root", "parentKey"] }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i9.Ripple, selector: "[pRipple]" }, { type: i4$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4$1.AsyncPipe, "translate": i2$2.TranslatePipe }, animations: [
5530
5603
  trigger('children', [
5531
5604
  state('void', style({
5532
5605
  height: '0px'
@@ -5578,8 +5651,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
5578
5651
  transition('hiddenAnimated => visibleAnimated', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')),
5579
5652
  transition('void => visibleAnimated, visibleAnimated => void', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)'))
5580
5653
  ])
5581
- ], template: "<ng-container>\n <div *ngIf=\"root && item.visible !== false\" class=\"layout-menuitem-root-text\">{{ item.label | translate }}</div>\n <a\n *ngIf=\"(!item.routerLink || item.items) && item.visible !== false\"\n [attr.href]=\"item.url\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"onMouseEnter()\"\n (keydown.enter)=\"itemClick($event)\"\n [routerLink]=\"item.routerLink\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.class\"\n pRipple>\n <i [ngClass]=\"item.icon\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <a\n *ngIf=\"item.routerLink && !item.items && item.visible !== false\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"hover = true\"\n (mouseleave)=\"hover = false\"\n [routerLink]=\"item.routerLink\"\n routerLinkActive=\"active-menuitem-routerlink\"\n [routerLinkActiveOptions]=\"{exact: true}\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.class\"\n pRipple>\n <i [ngClass]=\"item.icon\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <ul\n *ngIf=\"((item.items && active) || (item.items && (mngCommons.menuModeIsStatic$ | async) && (root || active))) && item.visible !== false\"\n [@children]=\"\n (mngCommons.menuModeIsSlim$ | async) && (mainLayoutService.isMobile$ | async) === false && root\n ? active\n ? 'visible'\n : 'hidden'\n : (mngCommons.menuModeIsStatic$ | async) && root && (mainLayoutService.isMobile$ | async) === false\n ? 'visible'\n : active\n ? 'visibleAnimated'\n : 'hiddenAnimated'\n \">\n <ng-template ngFor let-child let-i=\"index\" [ngForOf]=\"item.items\">\n <li mng-menuitem [item]=\"child\" [index]=\"i\" [parentKey]=\"key\" [class]=\"child.badgeClass\"></li>\n </ng-template>\n </ul>\n</ng-container>\n" }]
5582
- }], ctorParameters: function () { return [{ type: i1.Router }, { type: MngCommonsService }, { type: MngMainLayoutComponentService }]; }, propDecorators: { item: [{
5654
+ ], template: "<ng-container>\n <div *ngIf=\"root && item.visible !== false && (isAllowed$ | async) === true\" class=\"layout-menuitem-root-text\">{{ item.label! | translate }}</div>\n <a\n *ngIf=\"(!item.routerLink || item.items) && item.visible !== false && (isAllowed$ | async) === true\"\n [attr.href]=\"item.href\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"onMouseEnter()\"\n (keydown.enter)=\"itemClick($event)\"\n [routerLink]=\"item.routerLink\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.className ?? ''\"\n pRipple>\n <i [ngClass]=\"item.icon ?? ''\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label! | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <a\n *ngIf=\"item.routerLink && !item.items && item.visible !== false && (isAllowed$ | async) === true\"\n (click)=\"itemClick($event)\"\n (mouseenter)=\"hover = true\"\n (mouseleave)=\"hover = false\"\n [routerLink]=\"item.routerLink\"\n routerLinkActive=\"active-menuitem-routerlink\"\n [routerLinkActiveOptions]=\"{exact: true}\"\n [attr.target]=\"item.target\"\n [attr.tabindex]=\"0\"\n [ngClass]=\"item.className ?? ''\"\n pRipple>\n <i [ngClass]=\"item.icon ?? ''\" class=\"layout-menuitem-icon\"></i>\n <span class=\"layout-menuitem-text\">{{ item.label! | translate }}</span>\n <i class=\"pi pi-fw pi-angle-down layout-submenu-toggler\" *ngIf=\"item.items\"></i>\n <span class=\"menuitem-badge\" *ngIf=\"item.badge\">{{ item.badge }}</span>\n </a>\n <ul\n *ngIf=\"((item.items && active) || (item.items && (mngCommons.menuModeIsStatic$ | async) && (root || active))) && item.visible !== false && (isAllowed$ | async) === true\"\n [@children]=\"\n (mngCommons.menuModeIsSlim$ | async) && (mainLayoutService.isMobile$ | async) === false && root\n ? active\n ? 'visible'\n : 'hidden'\n : (mngCommons.menuModeIsStatic$ | async) && root && (mainLayoutService.isMobile$ | async) === false\n ? 'visible'\n : active\n ? 'visibleAnimated'\n : 'hiddenAnimated'\n \">\n <ng-template ngFor let-child let-i=\"index\" [ngForOf]=\"item.items\">\n <li mng-menuitem [item]=\"child\" [index]=\"i\" [parentKey]=\"key\" [class]=\"child.badgeClassName\"></li>\n </ng-template>\n </ul>\n</ng-container>\n" }]
5655
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: MngCommonsService }, { type: MngMainLayoutComponentService }]; }, propDecorators: { item: [{
5583
5656
  type: Input
5584
5657
  }], index: [{
5585
5658
  type: Input
@@ -5748,7 +5821,7 @@ class MngTableviewComponent {
5748
5821
  }
5749
5822
  }
5750
5823
  MngTableviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableviewComponent, deps: [{ token: i1.ActivatedRoute }, { token: i2$1.MessageService }, { token: i2$2.TranslateService }, { token: i2.DialogService }, { token: i2$1.ConfirmationService }, { token: MngActionService }, { token: TableviewComponentService }], target: i0.ɵɵFactoryTarget.Component });
5751
- MngTableviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngTableviewComponent, selector: "mng-tableview", inputs: { descriptor: "descriptor", dataProvider: "dataProvider", actions: "actions" }, providers: [MessageService, ConfirmationService, TableviewComponentService], viewQueries: [{ propertyName: "tableComponent", first: true, predicate: MngTableComponent, descendants: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\"> </mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"> </mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table [descriptor]=\"descriptor.table\" [dataProvider]=\"dataProvider\" [useQueryParams]=\"true\" (cellClick)=\"onTableCellClick($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-m-0\">{{ descriptor.tableTitle | translate }}</h5>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [itemId]=\"descriptor.model.idPropertyName ? item[descriptor.model.idPropertyName] : null\">\n </mng-action>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n", components: [{ type: i7$1.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i8$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData"] }, { type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionEnabled"], outputs: ["tableLoad", "cellClick", "selectionChange"] }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { type: i1.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], pipes: { "translate": i2$2.TranslatePipe } });
5824
+ MngTableviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngTableviewComponent, selector: "mng-tableview", inputs: { descriptor: "descriptor", dataProvider: "dataProvider", actions: "actions" }, providers: [MessageService, ConfirmationService, TableviewComponentService], viewQueries: [{ propertyName: "tableComponent", first: true, predicate: MngTableComponent, descendants: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\"> </mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"> </mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table [descriptor]=\"descriptor.table\" [dataProvider]=\"dataProvider\" [useQueryParams]=\"true\" (cellClick)=\"onTableCellClick($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-m-0\">{{ descriptor.tableTitle | translate }}</h5>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [itemId]=\"descriptor.model.idPropertyName ? item[descriptor.model.idPropertyName] : null\">\n </mng-action>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n", components: [{ type: i7$1.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i8$1.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData"] }, { type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionEnabled"], outputs: ["tableLoad", "cellClick", "selectionChange"] }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { type: i1.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], pipes: { "translate": i2$2.TranslatePipe } });
5752
5825
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableviewComponent, decorators: [{
5753
5826
  type: Component,
5754
5827
  args: [{ selector: 'mng-tableview', providers: [MessageService, ConfirmationService, TableviewComponentService], template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\"> </mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"> </mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table [descriptor]=\"descriptor.table\" [dataProvider]=\"dataProvider\" [useQueryParams]=\"true\" (cellClick)=\"onTableCellClick($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-m-0\">{{ descriptor.tableTitle | translate }}</h5>\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnAction\" let-item=\"rowItem\">\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [itemId]=\"descriptor.model.idPropertyName ? item[descriptor.model.idPropertyName] : null\">\n </mng-action>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n" }]
@@ -5899,6 +5972,15 @@ const formlyTypesConfig = [
5899
5972
  }
5900
5973
  }
5901
5974
  },
5975
+ {
5976
+ name: 'mask',
5977
+ extends: 'input',
5978
+ defaultOptions: {
5979
+ templateOptions: {
5980
+ type: 'mask'
5981
+ }
5982
+ }
5983
+ },
5902
5984
  {
5903
5985
  name: 'dropdown',
5904
5986
  component: MngFormlyFieldDropdownComponent,
@@ -6471,8 +6553,12 @@ class RoutesBuilder {
6471
6553
  addRouteRedirect(path, redirectTo, pathMatch = 'prefix') {
6472
6554
  return this.addRouteBuilder(RouteBuilder.createRedirect(path, redirectTo, pathMatch));
6473
6555
  }
6474
- addLazyRoute(path, loadChildren) {
6475
- return this.addRouteBuilder(RouteBuilder.createFromRoute({ path: path, loadChildren: loadChildren }));
6556
+ addLazyRoute(path, loadChildren, canLoad) {
6557
+ const route = { path: path, loadChildren: loadChildren };
6558
+ if (canLoad?.length) {
6559
+ route.canLoad = canLoad;
6560
+ }
6561
+ return this.addRouteBuilder(RouteBuilder.createFromRoute(route));
6476
6562
  }
6477
6563
  addRoute(path, component) {
6478
6564
  return this.addRouteBuilder(RouteBuilder.create(path, component));
@@ -6612,11 +6698,32 @@ class RouteBuilder {
6612
6698
  this.withBreadcrumb(title);
6613
6699
  return this;
6614
6700
  }
6701
+ withCanActivate(diToken) {
6702
+ if (!this.route.canActivate) {
6703
+ this.route.canActivate = [];
6704
+ }
6705
+ this.route.canActivate.push(diToken);
6706
+ return this;
6707
+ }
6708
+ withCanDeactivate(diToken) {
6709
+ if (!this.route.canDeactivate) {
6710
+ this.route.canDeactivate = [];
6711
+ }
6712
+ this.route.canDeactivate.push(diToken);
6713
+ return this;
6714
+ }
6715
+ withResolver(diToken, name) {
6716
+ if (!this.route.resolve) {
6717
+ this.route.resolve = {};
6718
+ }
6719
+ this.route.resolve[name] = diToken;
6720
+ return this;
6721
+ }
6615
6722
  withData(data) {
6616
6723
  this.route.data = data;
6617
6724
  return this;
6618
6725
  }
6619
- withPrimeMenuItem(menuItem) {
6726
+ withMngMenuItem(menuItem) {
6620
6727
  this.menuItem = menuItem;
6621
6728
  return this;
6622
6729
  }
@@ -6688,34 +6795,61 @@ class RouteBuilder {
6688
6795
  }
6689
6796
  }
6690
6797
  }
6798
+ if (this.route.canActivate) {
6799
+ angularRoute.canActivate = [...this.route.canActivate];
6800
+ }
6801
+ if (this.route.canActivateChild) {
6802
+ angularRoute.canActivateChild = [...this.route.canActivateChild];
6803
+ }
6804
+ if (this.route.canLoad) {
6805
+ angularRoute.canLoad = [...this.route.canLoad];
6806
+ }
6807
+ if (this.route.canDeactivate) {
6808
+ angularRoute.canDeactivate = [...this.route.canDeactivate];
6809
+ }
6810
+ if (this.route.resolve) {
6811
+ angularRoute.resolve = { ...this.route.resolve };
6812
+ }
6691
6813
  return angularRoute;
6692
6814
  }
6693
6815
  buildMenu() {
6694
- const menuItem = this.menuItem ? { ...this.menuItem } : null;
6816
+ const menuItemBuild = this.menuItem ? { ...this.menuItem } : null;
6695
6817
  const routeChildrenMenuItems = this.children.flatMap(child => child.buildMenu());
6696
6818
  const menuItemChildren = [];
6697
- const finalMenuItemChildren = [];
6698
- if (menuItem?.items) {
6699
- finalMenuItemChildren.push(...menuItem.items);
6819
+ const menuItemChildrenBuild = [];
6820
+ if (menuItemBuild?.items) {
6821
+ menuItemChildrenBuild.push(...menuItemBuild.items);
6700
6822
  }
6701
6823
  for (const menuItemChild of this.menuItemChildren) {
6702
6824
  const finalMenuItemChild = { ...menuItemChild };
6703
6825
  if (!finalMenuItemChild.routerLink) {
6704
6826
  finalMenuItemChild.routerLink = this.routePath;
6705
6827
  }
6828
+ if (typeof finalMenuItemChild.routerLink === 'string') {
6829
+ finalMenuItemChild.routerLink = [finalMenuItemChild.routerLink];
6830
+ }
6706
6831
  finalMenuItemChild.routerLink = RouteUtil.removeEmptyPathSegments(finalMenuItemChild.routerLink);
6707
6832
  menuItemChildren.push(finalMenuItemChild);
6708
6833
  }
6709
- finalMenuItemChildren.push(...menuItemChildren, ...routeChildrenMenuItems);
6710
- if (!menuItem) {
6711
- return finalMenuItemChildren;
6834
+ menuItemChildrenBuild.push(...menuItemChildren, ...routeChildrenMenuItems);
6835
+ if (!menuItemBuild) {
6836
+ return menuItemChildrenBuild;
6837
+ }
6838
+ menuItemBuild.label = menuItemBuild.label ?? this.pageTitle;
6839
+ if (typeof menuItemBuild.routerLink === 'string') {
6840
+ menuItemBuild.routerLink = [menuItemBuild.routerLink];
6712
6841
  }
6713
- menuItem.label = menuItem.label ?? this.pageTitle;
6714
- menuItem.routerLink = RouteUtil.removeEmptyPathSegments(menuItem.routerLink ?? this.routePath);
6715
- if (finalMenuItemChildren.length > 0) {
6716
- menuItem.items = finalMenuItemChildren;
6842
+ menuItemBuild.routerLink = RouteUtil.removeEmptyPathSegments(menuItemBuild.routerLink ?? this.routePath);
6843
+ if (menuItemChildrenBuild.length > 0) {
6844
+ menuItemBuild.items = menuItemChildrenBuild;
6717
6845
  }
6718
- return [menuItem];
6846
+ if (!menuItemBuild.guards) {
6847
+ const guards = this.findMenuItemGuards();
6848
+ if (guards.length > 0) {
6849
+ menuItemBuild.guards = guards;
6850
+ }
6851
+ }
6852
+ return [menuItemBuild];
6719
6853
  }
6720
6854
  createMenuItem(icon, label, routerLink) {
6721
6855
  const menuItem = {};
@@ -6733,13 +6867,30 @@ class RouteBuilder {
6733
6867
  adjustMenuRouterLinksFromBuilder(menuItems) {
6734
6868
  for (const menuItem of menuItems) {
6735
6869
  if (menuItem.routerLink) {
6736
- menuItem.routerLink = RouteUtil.appendPathToBasePath(this.routePath, menuItem.routerLink);
6870
+ menuItem.routerLink = RouteUtil.appendPathToBasePath(this.routePath, typeof menuItem.routerLink === 'string' ? [menuItem.routerLink] : menuItem.routerLink);
6737
6871
  }
6738
6872
  if (Array.isArray(menuItem.items)) {
6739
6873
  this.adjustMenuRouterLinksFromBuilder(menuItem.items);
6740
6874
  }
6741
6875
  }
6742
6876
  }
6877
+ findMenuItemGuards() {
6878
+ const guards = [];
6879
+ if (this.route.canActivate?.length) {
6880
+ guards.push(...this.route.canActivate);
6881
+ }
6882
+ if (this.parent) {
6883
+ // Check for parent guards that should be included in decision to hide menu item!
6884
+ // Some parent routes might have guards, but no menu items, so this guards must be taken into account here,
6885
+ // because there is no parent menu item to hide.
6886
+ this.parent.findMenuItemGuards().forEach(g => {
6887
+ if (guards.indexOf(g) < 0) {
6888
+ guards.push(g);
6889
+ }
6890
+ });
6891
+ }
6892
+ return guards;
6893
+ }
6743
6894
  }
6744
6895
 
6745
6896
  /*