@mediusinc/mng-commons 2.0.0-rc.7 → 2.0.0-rc.8

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.
@@ -11832,6 +11832,7 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
11832
11832
  this.descriptor = this.props.descriptor;
11833
11833
  this.props.fieldComponent = this;
11834
11834
  this.viewContainer = this.props.formEditorComponent.viewContainerInit;
11835
+ this.dialogIsLoadingSubject.next(false);
11835
11836
  if (this.descriptor.lookupTableDataProvider?.serviceType) {
11836
11837
  this.dialogUseDataProvider = true;
11837
11838
  this.dialogDataProviderService = this.injector.get(this.descriptor.lookupTableDataProvider.serviceType);
@@ -11871,29 +11872,32 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
11871
11872
  });
11872
11873
  }
11873
11874
  openAddDialog() {
11875
+ this.dialogSelectedAddItems = [];
11876
+ this.isDialogVisible = true;
11874
11877
  if (!this.dialogAreItemsLoaded && this.dialogUseDataProvider) {
11875
- this.dialogIsLoadingSubject.next(true);
11876
- const queryParamBuilder = MediusQueryParamBuilder.create(50);
11877
- if (this.descriptor.lookupTableDescriptor.hasDefaultSort) {
11878
- this.descriptor.lookupTableDescriptor.defaultSortProperty.forEach((p, idx) => queryParamBuilder.withSort(p, this.descriptor.lookupTableDescriptor.defaultSortAsc[idx]));
11879
- }
11880
- if (this.descriptor.hasLookupExcludeValues) {
11881
- const filterValues = this.formControl.value.map((i) => i[this.descriptor.excludeValueProperty]);
11882
- queryParamBuilder.withFilter(this.descriptor.excludeFilterProperty, filterValues, undefined, MediusFilterMatchType.NotIn);
11883
- }
11884
- this.lookupDataProviderSubscription = this.descriptor.lookupTableDataProvider?.getAll(queryParamBuilder.build(), this.dialogDataProviderService).subscribe({
11885
- next: res => {
11886
- this.addItemsSubject.next(res);
11887
- this.dialogAreItemsLoaded = true;
11888
- this.dialogIsLoadingSubject.next(false);
11889
- },
11890
- error: () => {
11891
- this.dialogIsLoadingSubject.next(false);
11878
+ // wrapped in request animation frame due to primeng bug: https://github.com/primefaces/primeng/issues/12980
11879
+ requestAnimationFrame(() => {
11880
+ this.dialogIsLoadingSubject.next(true);
11881
+ const queryParamBuilder = MediusQueryParamBuilder.create(50);
11882
+ if (this.descriptor.lookupTableDescriptor.hasDefaultSort) {
11883
+ this.descriptor.lookupTableDescriptor.defaultSortProperty.forEach((p, idx) => queryParamBuilder.withSort(p, this.descriptor.lookupTableDescriptor.defaultSortAsc[idx]));
11884
+ }
11885
+ if (this.descriptor.hasLookupExcludeValues) {
11886
+ const filterValues = this.formControl.value.map((i) => i[this.descriptor.excludeValueProperty]);
11887
+ queryParamBuilder.withFilter(this.descriptor.excludeFilterProperty, filterValues, undefined, MediusFilterMatchType.NotIn);
11892
11888
  }
11889
+ this.lookupDataProviderSubscription = this.descriptor.lookupTableDataProvider?.getAll(queryParamBuilder.build(), this.dialogDataProviderService).subscribe({
11890
+ next: res => {
11891
+ this.addItemsSubject.next(res);
11892
+ this.dialogAreItemsLoaded = true;
11893
+ this.dialogIsLoadingSubject.next(false);
11894
+ },
11895
+ error: () => {
11896
+ this.dialogIsLoadingSubject.next(false);
11897
+ }
11898
+ });
11893
11899
  });
11894
11900
  }
11895
- this.dialogSelectedAddItems = [];
11896
- this.isDialogVisible = true;
11897
11901
  this.formControl.markAsTouched();
11898
11902
  this.descriptor.nextEvent(MngFormFieldEventTypeEnum.DialogLifecycle, MngFormlyFieldTableDialogMultiselectComponent, this, {
11899
11903
  eventSubtype: MngFormFieldEventDialogSubtype.VISIBILITY,
@@ -12752,9 +12756,10 @@ class MngTopbarUserComponent {
12752
12756
  ngOnDestroy() {
12753
12757
  this.subscriptions.forEach(value => value.unsubscribe());
12754
12758
  }
12755
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
12756
12759
  logout(user, event) {
12757
12760
  if (typeof user?.logout === 'function') {
12761
+ event.preventDefault();
12762
+ event.stopPropagation();
12758
12763
  user.logout();
12759
12764
  }
12760
12765
  }
@@ -12763,10 +12768,10 @@ class MngTopbarUserComponent {
12763
12768
  }
12764
12769
  }
12765
12770
  MngTopbarUserComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: MngTopbarUserComponent, deps: [{ token: MngCommonsService }, { token: MngMainLayoutComponentService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
12766
- MngTopbarUserComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.6", type: MngTopbarUserComponent, isStandalone: true, selector: "mng-topbar-user-component", ngImport: i0, template: "<a href=\"#\" class=\"user-block\" (click)=\"click($event)\">\n <i class=\"pi pi-fw pi-user\"></i>\n <span class=\"profile-item-username hidden sm:inline-block\">&nbsp; {{ user?.displayName ?? user?.username }}</span>\n</a>\n<ul class=\"fadeInDown dropdown-window\">\n <li role=\"menuitem\">\n <a>\n <div class=\"flex\">\n <div class=\"flex-grow-0\">\n <i class=\"pi pi-fw pi-user\"></i>\n </div>\n <div class=\"flex-grow-1\">\n <strong>{{ user?.displayName ?? user?.username }}</strong>\n <small *ngIf=\"((userRoles$ | async)?.length ?? 0) > 0\">\n <br />\n {{ userRoles$ | mgnEnumerateAsync : undefined : undefined : undefined : 'roles' | async }}\n </small>\n </div>\n </div>\n </a>\n </li>\n <li role=\"menuitem\" *ngIf=\"user?.logout || user?.logoutUrl\">\n <a [href]=\"user?.logoutUrl\" (click)=\"logout(user, $event)\">\n <i class=\"pi pi-fw pi-sign-out\"></i>\n <span>{{ 'mngTopbar.logout' | translate }}</span>\n </a>\n </li>\n</ul>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: MngEnumerateAsyncPipe, name: "mgnEnumerateAsync" }] });
12771
+ MngTopbarUserComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.6", type: MngTopbarUserComponent, isStandalone: true, selector: "mng-topbar-user-component", ngImport: i0, template: "<a href=\"#\" class=\"user-block\" (click)=\"click($event)\">\n <i class=\"pi pi-fw pi-user\"></i>\n <span class=\"profile-item-username hidden sm:inline-block\">&nbsp; {{ user?.displayName ?? user?.username }}</span>\n</a>\n<ul class=\"fadeInDown dropdown-window\">\n <li role=\"menuitem\">\n <a>\n <div class=\"flex\">\n <div class=\"flex-grow-0\">\n <i class=\"pi pi-fw pi-user\"></i>\n </div>\n <div class=\"flex-grow-1\">\n <strong>{{ user?.displayName ?? user?.username }}</strong>\n <small *ngIf=\"((userRoles$ | async)?.length ?? 0) > 0\">\n <br />\n {{ userRoles$ | mgnEnumerateAsync : undefined : undefined : undefined : 'roles' | async }}\n </small>\n </div>\n </div>\n </a>\n </li>\n <li role=\"menuitem\" *ngIf=\"user?.logout || user?.logoutUrl\">\n <a [href]=\"user?.logoutUrl ?? 'javascript:void(0)'\" (click)=\"logout(user, $event)\">\n <i class=\"pi pi-fw pi-sign-out\"></i>\n <span>{{ 'mngTopbar.logout' | translate }}</span>\n </a>\n </li>\n</ul>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: MngEnumerateAsyncPipe, name: "mgnEnumerateAsync" }] });
12767
12772
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: MngTopbarUserComponent, decorators: [{
12768
12773
  type: Component,
12769
- args: [{ standalone: true, selector: 'mng-topbar-user-component', imports: [NgClass, NgIf, AsyncPipe, TranslateModule, MngEnumerateAsyncPipe], template: "<a href=\"#\" class=\"user-block\" (click)=\"click($event)\">\n <i class=\"pi pi-fw pi-user\"></i>\n <span class=\"profile-item-username hidden sm:inline-block\">&nbsp; {{ user?.displayName ?? user?.username }}</span>\n</a>\n<ul class=\"fadeInDown dropdown-window\">\n <li role=\"menuitem\">\n <a>\n <div class=\"flex\">\n <div class=\"flex-grow-0\">\n <i class=\"pi pi-fw pi-user\"></i>\n </div>\n <div class=\"flex-grow-1\">\n <strong>{{ user?.displayName ?? user?.username }}</strong>\n <small *ngIf=\"((userRoles$ | async)?.length ?? 0) > 0\">\n <br />\n {{ userRoles$ | mgnEnumerateAsync : undefined : undefined : undefined : 'roles' | async }}\n </small>\n </div>\n </div>\n </a>\n </li>\n <li role=\"menuitem\" *ngIf=\"user?.logout || user?.logoutUrl\">\n <a [href]=\"user?.logoutUrl\" (click)=\"logout(user, $event)\">\n <i class=\"pi pi-fw pi-sign-out\"></i>\n <span>{{ 'mngTopbar.logout' | translate }}</span>\n </a>\n </li>\n</ul>\n" }]
12774
+ args: [{ standalone: true, selector: 'mng-topbar-user-component', imports: [NgClass, NgIf, AsyncPipe, TranslateModule, MngEnumerateAsyncPipe], template: "<a href=\"#\" class=\"user-block\" (click)=\"click($event)\">\n <i class=\"pi pi-fw pi-user\"></i>\n <span class=\"profile-item-username hidden sm:inline-block\">&nbsp; {{ user?.displayName ?? user?.username }}</span>\n</a>\n<ul class=\"fadeInDown dropdown-window\">\n <li role=\"menuitem\">\n <a>\n <div class=\"flex\">\n <div class=\"flex-grow-0\">\n <i class=\"pi pi-fw pi-user\"></i>\n </div>\n <div class=\"flex-grow-1\">\n <strong>{{ user?.displayName ?? user?.username }}</strong>\n <small *ngIf=\"((userRoles$ | async)?.length ?? 0) > 0\">\n <br />\n {{ userRoles$ | mgnEnumerateAsync : undefined : undefined : undefined : 'roles' | async }}\n </small>\n </div>\n </div>\n </a>\n </li>\n <li role=\"menuitem\" *ngIf=\"user?.logout || user?.logoutUrl\">\n <a [href]=\"user?.logoutUrl ?? 'javascript:void(0)'\" (click)=\"logout(user, $event)\">\n <i class=\"pi pi-fw pi-sign-out\"></i>\n <span>{{ 'mngTopbar.logout' | translate }}</span>\n </a>\n </li>\n</ul>\n" }]
12770
12775
  }], ctorParameters: function () { return [{ type: MngCommonsService }, { type: MngMainLayoutComponentService }, { type: i0.ElementRef }]; } });
12771
12776
 
12772
12777
  class MngTopbarComponent {
@@ -14288,9 +14293,16 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
14288
14293
  if (this.tableviewPermissions?.[TableviewActionDefaultCategories.READ]) {
14289
14294
  this.routeData.permissions = this.tableviewPermissions[TableviewActionDefaultCategories.READ];
14290
14295
  }
14296
+ // copy route data for children, reset breadcrumbs menu items and permission
14297
+ const childrenRouteData = {
14298
+ ...this.routeData,
14299
+ breadcrumb: null,
14300
+ menuItems: undefined,
14301
+ permissions: undefined
14302
+ };
14291
14303
  // list route
14292
14304
  const rootChildRouteBuilder = RouteBuilder.create('', MngActionRouteComponent);
14293
- rootChildRouteBuilder.withData({ ...this.routeData });
14305
+ rootChildRouteBuilder.withData({ ...childrenRouteData });
14294
14306
  if (this.tableviewPermissions?.[TableviewActionDefaultCategories.READ]) {
14295
14307
  rootChildRouteBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.READ]);
14296
14308
  }
@@ -14298,7 +14310,7 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
14298
14310
  // add route
14299
14311
  if (this.hasAdd) {
14300
14312
  const routeBuilder = RouteBuilder.create(this.addPath, MngActionRouteComponent);
14301
- routeBuilder.withData({ ...this.routeData });
14313
+ routeBuilder.withData({ ...childrenRouteData });
14302
14314
  if (this.tableviewPermissions?.[TableviewActionDefaultCategories.ADD]) {
14303
14315
  routeBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.ADD]);
14304
14316
  }
@@ -14306,7 +14318,7 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
14306
14318
  }
14307
14319
  if (this.hasDetails) {
14308
14320
  const routeBuilder = RouteBuilder.create(this.detailsPath, MngActionRouteComponent);
14309
- routeBuilder.withData({ ...this.routeData });
14321
+ routeBuilder.withData({ ...childrenRouteData });
14310
14322
  if (this.tableviewPermissions?.[TableviewActionDefaultCategories.DETAILS]) {
14311
14323
  routeBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.DETAILS]);
14312
14324
  }
@@ -14314,7 +14326,7 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
14314
14326
  }
14315
14327
  if (this.hasEdit) {
14316
14328
  const routeBuilder = RouteBuilder.create(this.editPath, MngActionRouteComponent);
14317
- routeBuilder.withData({ ...this.routeData });
14329
+ routeBuilder.withData({ ...childrenRouteData });
14318
14330
  if (this.tableviewPermissions?.[TableviewActionDefaultCategories.EDIT]) {
14319
14331
  routeBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.EDIT]);
14320
14332
  }