@mediusinc/mng-commons 5.2.0-rc.0 → 5.2.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/core/components/notification/notification-wrapper.component.d.ts +3 -1
  2. package/core/error/error-helpers.d.ts +5 -0
  3. package/core/error/error.model.d.ts +6 -0
  4. package/core/helpers/route.d.ts +1 -1
  5. package/core/models/menu.model.d.ts +2 -1
  6. package/core/router/route-builder.d.ts +0 -1
  7. package/core/security/permission.service.d.ts +13 -5
  8. package/core/security/permissions.model.d.ts +27 -2
  9. package/esm2022/core/components/notification/notification-wrapper.component.mjs +6 -5
  10. package/esm2022/core/error/error-helpers.mjs +8 -1
  11. package/esm2022/core/error/error.model.mjs +2 -1
  12. package/esm2022/core/models/menu.model.mjs +1 -1
  13. package/esm2022/core/router/route-builder.mjs +1 -24
  14. package/esm2022/core/rxjs/map-data-list-result-operator.mjs +4 -1
  15. package/esm2022/core/security/permission.guard.mjs +2 -2
  16. package/esm2022/core/security/permission.service.mjs +65 -15
  17. package/esm2022/core/security/permissions.model.mjs +1 -1
  18. package/esm2022/form/components/date-range/date-range.component.mjs +9 -3
  19. package/esm2022/form/components/number-range/number-range.component.mjs +106 -0
  20. package/esm2022/form/index.mjs +2 -1
  21. package/esm2022/model/descriptors/enum.descriptor.mjs +1 -1
  22. package/esm2022/model/helpers/i18n.mjs +2 -2
  23. package/esm2022/table/api/descriptors/column.descriptor.mjs +8 -19
  24. package/esm2022/table/api/descriptors/table.descriptor.mjs +13 -9
  25. package/esm2022/table/api/helpers/table-descriptor-helpers.mjs +3 -2
  26. package/esm2022/table/components/column-filter-full/column-filter-full.component.mjs +72 -10
  27. package/esm2022/table/helpers/notification.mjs +2 -2
  28. package/esm2022/tableview/action/components/action/action.component.mjs +6 -7
  29. package/esm2022/tableview/action/helpers/i18n.mjs +4 -4
  30. package/esm2022/tableview/action/services/action-executor.service.mjs +6 -3
  31. package/esm2022/tableview/api/action/descriptors/action-descriptor.factory.mjs +2 -2
  32. package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +5 -4
  33. package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +2 -3
  34. package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +2 -3
  35. package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +14 -7
  36. package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +1 -1
  37. package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +12 -4
  38. package/fesm2022/mediusinc-mng-commons-core.mjs +82 -42
  39. package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
  40. package/fesm2022/mediusinc-mng-commons-form.mjs +109 -3
  41. package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
  42. package/fesm2022/mediusinc-mng-commons-model.mjs +1 -1
  43. package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
  44. package/fesm2022/mediusinc-mng-commons-table-api.mjs +21 -27
  45. package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
  46. package/fesm2022/mediusinc-mng-commons-table.mjs +72 -10
  47. package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
  48. package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +20 -13
  49. package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
  50. package/fesm2022/mediusinc-mng-commons-tableview.mjs +23 -14
  51. package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
  52. package/form/components/date-range/date-range.component.d.ts +4 -2
  53. package/form/components/number-range/number-range.component.d.ts +30 -0
  54. package/form/index.d.ts +1 -0
  55. package/i18n/en.json +1 -1
  56. package/i18n/sl.json +1 -1
  57. package/model/descriptors/enum.descriptor.d.ts +1 -1
  58. package/package.json +7 -7
  59. package/table/api/descriptors/column.descriptor.d.ts +4 -10
  60. package/table/api/descriptors/table.descriptor.d.ts +2 -1
  61. package/table/components/column-filter-full/column-filter-full.component.d.ts +3 -2
  62. package/tableview/action/components/action/action.component.d.ts +0 -1
  63. package/tableview/action/services/action-executor.service.d.ts +1 -0
  64. package/tableview/api/editor/descriptors/field.descriptor.d.ts +12 -7
  65. package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +5 -5
  66. package/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +1 -0
  67. package/version-info.json +6 -6
@@ -1,7 +1,7 @@
1
1
  import * as i2 from '@angular/common';
2
2
  import { AsyncPipe, NgTemplateOutlet, JsonPipe, NgStyle, DatePipe } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, Injectable, signal, inject, Injector, DestroyRef, input, booleanAttribute, output, viewChild, computed, effect, Component, ChangeDetectionStrategy, Optional, untracked, HostListener, contentChildren, viewChildren, QueryList, Directive, LOCALE_ID, HostBinding, ViewChild } from '@angular/core';
4
+ import { InjectionToken, Injectable, signal, inject, Injector, input, booleanAttribute, output, viewChild, computed, effect, Component, ChangeDetectionStrategy, Optional, DestroyRef, untracked, HostListener, contentChildren, viewChildren, QueryList, Directive, LOCALE_ID, HostBinding, ViewChild } from '@angular/core';
5
5
  import { takeUntilDestroyed, toSignal, toObservable as toObservable$1 } from '@angular/core/rxjs-interop';
6
6
  import * as i1 from '@angular/router';
7
7
  import { NavigationEnd, Router, ActivatedRoute, NavigationStart, NavigationCancel, NavigationError, NavigationSkipped, RouterOutlet } from '@angular/router';
@@ -19,7 +19,7 @@ import * as i8 from 'primeng/tooltip';
19
19
  import { TooltipModule } from 'primeng/tooltip';
20
20
  import { ReplaySubject, BehaviorSubject, distinctUntilChanged, Subject, take, of, switchMap, mergeMap as mergeMap$1, from, timeout, combineLatest, debounceTime, combineLatestWith, isObservable, throwError, filter as filter$1 } from 'rxjs';
21
21
  import * as i3 from '@mediusinc/mng-commons/core';
22
- import { getI18n, getI18nAsync, toastMessage, getI18nForError, LoggerService, CommonsService, ParametrizePipe, escapeHtmlAny, toObservable, CommonsInternalError, StyleSizeEnum, CommonsHttpError, Permissions, ComponentDirective, objectDeepCopy, Styles, TemplateDirective, findTemplateByName, fromSubscribeError, getErrorLogLevel, StyleLevelEnum, getObjectPropertyByPath, FilterMatchMode, COMMONS_MODULE_CONFIG_IT, dateToIsoString, RouteBuilder, createLazyRoute, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons/core';
22
+ import { getI18n, getI18nAsync, toastMessage, getI18nForError, LoggerService, CommonsService, ParametrizePipe, escapeHtmlAny, toObservable, CommonsInternalError, StyleSizeEnum, CommonsHttpError, Permissions, ComponentDirective, objectDeepCopy, Styles, TemplateDirective, findTemplateByName, fromSubscribeError, getErrorLogLevel, StyleLevelEnum, getObjectPropertyByPath, FilterMatchMode, getI18nTypePropertyKey, COMMONS_MODULE_CONFIG_IT, dateToIsoString, RouteBuilder, createLazyRoute, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons/core';
23
23
  import { ActionActivationTriggerEnum, ActionTypeEnum, DataProviderExecutor, ActionDeleteDescriptorInst, ActionEditorEditDescriptorInst, ActionEditorDetailsDescriptorInst, ActionEditorAddDescriptorInst, ActionEditorDescriptorInst, CommonsActionError, ActionLinkDescriptorInst, TableviewEditorTypeEnum, TableviewDescriptorInst, FieldInputDescriptor, FieldInputTypeEnum, FieldActionDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldLookupDescriptor, FieldManyToManyEditorDescriptor, FieldManyEditorDescriptor, FieldValidationDescriptor, FormEventTypeEnum, FormFieldEventComponentSubtype, ActionEditorSubmitTypeEnum, ActionEditorSubmitDescriptorInst, ActionPositionEnum, runFnFromDataProviderOrFallback, runGetAllFromDataProvider, runFetchFromDataProvider, runCreateFromDataProvider, runUpdateFromDataProvider, runDeleteFromDataProvider, FormFieldEventTypeEnum, FieldGroupTypeEnum, FormFieldEventDialogSubtype, FieldManyEditorActionEnum, ActionEditorDescriptor, actionEditorCancel, ActionDescriptorInst, FieldManyToManyEditorActionEnum, TableviewActionDefaultCategories, DATA_LANGUAGE_DROPDOWN_COMPONENT_IT } from '@mediusinc/mng-commons/tableview/api';
24
24
  import { mergeMap, map, filter, startWith, catchError, first, take as take$1 } from 'rxjs/operators';
25
25
  import { getI18nModelParams, getI18nModelParamsAsync, type } from '@mediusinc/mng-commons/model';
@@ -139,9 +139,9 @@ function getKeysByPriority(action, actionPathKeys, customKey, fallbackKey) {
139
139
  actionPathKeys = [actionPathKeys];
140
140
  }
141
141
  actionPathKeys.forEach(k => {
142
- const modelActionKey = `${action.i18nModelActionBaseKey}.${k}`;
143
- const actionKey = `${action.actionName}.${k}`;
144
- keys.push(modelActionKey, actionKey);
142
+ if (action.i18nModelActionBaseKey)
143
+ keys.push(`${action.i18nModelActionBaseKey}.${k}`);
144
+ keys.push(`${action.actionName}.${k}`);
145
145
  });
146
146
  if (fallbackKey) {
147
147
  keys.push(fallbackKey);
@@ -547,8 +547,9 @@ class ActionExecutorService {
547
547
  this.viewContainer = inject(ViewContainer, { optional: true });
548
548
  this.parametrize = new ParametrizePipe();
549
549
  this.instancesBufferMax = 100;
550
- this.logger = inject(LoggerService).create('ActionExecutorService');
550
+ this.logger = inject(LoggerService).create(ActionExecutorService.className);
551
551
  }
552
+ static { this.className = 'ActionExecutorService'; }
552
553
  /**
553
554
  * Prepares action context for usage in validation.
554
555
  * @param action Action descriptor.
@@ -817,7 +818,9 @@ class ActionExecutorService {
817
818
  // mark execution error on context
818
819
  ctx.executionError(actionError);
819
820
  if (ctx.instance.action.hasRunNotificationError) {
820
- actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', this.messageService, ctx.parameters.item);
821
+ const message = actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', this.messageService, ctx.parameters.item);
822
+ actionError.notification = message;
823
+ actionError.notificationEmitSource = ActionExecutorService.className;
821
824
  }
822
825
  let errorObs = of(void 0);
823
826
  if (isMainRunFn) {
@@ -1378,7 +1381,6 @@ class ActionComponent {
1378
1381
  this.authorization = authorization;
1379
1382
  this.actionExecutor = actionExecutor;
1380
1383
  this.viewContainer = viewContainer;
1381
- this.destroyRef = inject(DestroyRef);
1382
1384
  // metadata and editor mode input
1383
1385
  this.action = input.required();
1384
1386
  this.item = input();
@@ -1536,7 +1538,7 @@ class ActionComponent {
1536
1538
  if (typeof action.permissions !== 'undefined' || typeof routePermissions !== 'undefined') {
1537
1539
  this.isPermittedSubscription?.unsubscribe();
1538
1540
  const permissions = action.permissions && routePermissions ? Permissions.All.of(routePermissions, action.permissions) : routePermissions ?? action.permissions;
1539
- this.isVisibleSubscription = this.authorization.isPermitted(permissions, this.route().snapshot, context).subscribe({
1541
+ this.isVisibleSubscription = this.authorization.isActionVisible(permissions, context, this.route().snapshot).subscribe({
1540
1542
  next: res => this.isPermitted.set(res)
1541
1543
  });
1542
1544
  }
@@ -1554,7 +1556,7 @@ class ActionComponent {
1554
1556
  }
1555
1557
  this.tooltipSubscription?.unsubscribe();
1556
1558
  if (action.button.tooltip) {
1557
- this.tooltipSubscription = getI18nForActionAsync(this.translate, action, 'tooltip', action.button.tooltip, this.item(), undefined, undefined).subscribe({
1559
+ this.tooltipSubscription = getI18nForActionAsync(this.translate, action, 'tooltip', action.button.tooltip, this.item()).subscribe({
1558
1560
  next: i18n => this.tooltip.set(i18n ?? '')
1559
1561
  });
1560
1562
  }
@@ -1593,12 +1595,12 @@ class ActionComponent {
1593
1595
  visibilityObservables.push(toObservable(subaction.isVisibleFunction(context)));
1594
1596
  }
1595
1597
  if (typeof subaction.permissions !== 'undefined') {
1596
- visibilityObservables.push(this.authorization.isPermitted(subaction.permissions, this.route().snapshot, context));
1598
+ visibilityObservables.push(this.authorization.isActionVisible(subaction.permissions, context, this.route().snapshot));
1597
1599
  }
1598
1600
  const routeData = this.route().snapshot.data;
1599
1601
  if (subaction.tableviewCategory && routeData.tableviewPermissions && routeData.tableviewPermissions[subaction.tableviewCategory]) {
1600
1602
  const routePermissions = routeData.tableviewPermissions[subaction.tableviewCategory];
1601
- visibilityObservables.push(this.authorization.isPermitted(routePermissions, this.route().snapshot, context));
1603
+ visibilityObservables.push(this.authorization.isActionVisible(routePermissions, context, this.route().snapshot));
1602
1604
  }
1603
1605
  this.subactionSubscriptions.push(combineLatest(visibilityObservables).subscribe(visibilities => {
1604
1606
  menuItem.visible = visibilities.every(value => value);
@@ -4157,8 +4159,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImpor
4157
4159
  }] });
4158
4160
 
4159
4161
  class FormlyFieldWrapperComponent extends FieldWrapper {
4162
+ constructor() {
4163
+ super(...arguments);
4164
+ this.label = signal(undefined);
4165
+ }
4160
4166
  ngOnInit() {
4161
4167
  const descriptor = this.props?.['descriptor'];
4168
+ if (descriptor.label !== null) {
4169
+ this.label.set(descriptor.label ?? getI18nTypePropertyKey(descriptor.editor.model.i18nBaseKey ?? descriptor.editor.model.typeName, descriptor.property));
4170
+ }
4162
4171
  if (this.formState.disabled && descriptor.isLocalized) {
4163
4172
  this.addMissingTranslationHelperText();
4164
4173
  }
@@ -4173,11 +4182,11 @@ class FormlyFieldWrapperComponent extends FieldWrapper {
4173
4182
  }
4174
4183
  }
4175
4184
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FormlyFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4176
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: FormlyFieldWrapperComponent, isStandalone: true, selector: "mng-formly-field-wrapper", usesInheritance: true, ngImport: i0, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field'\">\n <div class=\"grid mt-0\">\n @if (props.label) {\n <label [for]=\"key\" class=\"col\" [class]=\"props['descriptor']?.['labelClassName'] ?? ''\"\n >{{ props!.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n }\n </div>\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError) {\n <small class=\"p-error block\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4185
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: FormlyFieldWrapperComponent, isStandalone: true, selector: "mng-formly-field-wrapper", usesInheritance: true, ngImport: i0, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field'\">\n <div class=\"grid mt-0\">\n @if (label(); as label) {\n <label [for]=\"key\" class=\"col\" [class]=\"props['descriptor']?.['labelClassName'] ?? ''\"\n >{{ label | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n }\n </div>\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError) {\n <small class=\"p-error block\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4177
4186
  }
4178
4187
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FormlyFieldWrapperComponent, decorators: [{
4179
4188
  type: Component,
4180
- args: [{ standalone: true, selector: 'mng-formly-field-wrapper', imports: [TranslateModule, FormlyModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field'\">\n <div class=\"grid mt-0\">\n @if (props.label) {\n <label [for]=\"key\" class=\"col\" [class]=\"props['descriptor']?.['labelClassName'] ?? ''\"\n >{{ props!.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n }\n </div>\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError) {\n <small class=\"p-error block\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n</div>\n" }]
4189
+ args: [{ standalone: true, selector: 'mng-formly-field-wrapper', imports: [TranslateModule, FormlyModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field'\">\n <div class=\"grid mt-0\">\n @if (label(); as label) {\n <label [for]=\"key\" class=\"col\" [class]=\"props['descriptor']?.['labelClassName'] ?? ''\"\n >{{ label | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n }\n </div>\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError) {\n <small class=\"p-error block\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n</div>\n" }]
4181
4190
  }] });
4182
4191
 
4183
4192
  class FormlyFieldDatepickerComponent extends ACommonsFormlyFieldType {