@messaia/cdk 13.3.5-rc14 → 13.3.5-rc15

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.
@@ -2807,6 +2807,8 @@ class BaseComponent {
2807
2807
  this.currentRoute = btoa(x.url);
2808
2808
  }
2809
2809
  });
2810
+ /* Get the return url if any */
2811
+ this.route.queryParams.subscribe(x => this.setReturnUrl(x.returnUrl));
2810
2812
  }
2811
2813
  /**
2812
2814
  * Lifecycle hook that is called after a component's view has been fully initialized.
@@ -2831,6 +2833,25 @@ class BaseComponent {
2831
2833
  let currentUrl = this.router.url;
2832
2834
  this.router.navigateByUrl('/', { replaceUrl: true }).then(() => this.router.navigateByUrl(currentUrl, { replaceUrl: true }));
2833
2835
  }
2836
+ /**
2837
+ * Navigates back to return url
2838
+ */
2839
+ navigateToReturnUrl() {
2840
+ if (this.returnUrl) {
2841
+ var urlParts = Utils.getUrlParts(this.returnUrl);
2842
+ this.router.navigate([urlParts.url], { queryParams: urlParts.params, fragment: urlParts.hash });
2843
+ }
2844
+ }
2845
+ /**
2846
+ * Sets return url
2847
+ * @param returnUrl
2848
+ */
2849
+ setReturnUrl(returnUrl) {
2850
+ try {
2851
+ this.returnUrl = returnUrl ? decodeURIComponent(atob(returnUrl)) : null;
2852
+ }
2853
+ catch (error) { }
2854
+ }
2834
2855
  /**
2835
2856
  * Listen for expansion panel changes
2836
2857
  */
@@ -2999,8 +3020,23 @@ class BaseComponent {
2999
3020
  if (this.menu) {
3000
3021
  this.titleService.setTitle(this.menu.title);
3001
3022
  this.title = this.titleService.getTitle();
3002
- if (this.menu.items) {
3003
- var submenu = this.menu.items.filter(x => x.path == this.router.url)[0];
3023
+ if (!this.menu.items) {
3024
+ return;
3025
+ }
3026
+ /* Get subtitle from url params */
3027
+ var subtitle = this.route?.snapshot?.paramMap?.get('subtitle');
3028
+ if (subtitle) {
3029
+ try {
3030
+ this.subtitle = atob(subtitle);
3031
+ }
3032
+ catch (e) {
3033
+ this.subtitle = subtitle;
3034
+ }
3035
+ }
3036
+ else {
3037
+ /* Get current route */
3038
+ let currentRoute = this.router.url.split('?')[0]?.split(';')[0];
3039
+ var submenu = this.menu.items.filter(x => x.path == currentRoute)[0];
3004
3040
  if (submenu) {
3005
3041
  this.subtitle = submenu.title;
3006
3042
  }
@@ -3318,11 +3354,6 @@ class GenericFormBaseComponent extends BaseComponent {
3318
3354
  else if (!this.id && this.route.snapshot?.data?.id) {
3319
3355
  this.id = this.route.snapshot?.data?.id;
3320
3356
  }
3321
- /* Get the return url if any */
3322
- this.route.queryParams.subscribe(x => {
3323
- this.returnUrl = x.returnUrl ? decodeURIComponent(atob(x.returnUrl)) : null;
3324
- this.listRoute = this.returnUrl || this.listRoute;
3325
- });
3326
3357
  /* Set panel ID from query */
3327
3358
  this.panelId = this.route.snapshot.queryParams?.panelId;
3328
3359
  this.subtitle || (this.subtitle = this.route.snapshot?.data?.subtitle);
@@ -3604,8 +3635,7 @@ class GenericFormBaseComponent extends BaseComponent {
3604
3635
  */
3605
3636
  back(action = SaveAction.SaveAndClose) {
3606
3637
  if (action == SaveAction.SaveAndClose && this.returnUrl) {
3607
- var urlParts = Utils.getUrlParts(this.returnUrl);
3608
- this.router.navigate([urlParts.url], { queryParams: urlParts.params, fragment: urlParts.hash });
3638
+ this.navigateToReturnUrl();
3609
3639
  }
3610
3640
  else {
3611
3641
  if (this.isEditMode) {
@@ -3629,6 +3659,14 @@ class GenericFormBaseComponent extends BaseComponent {
3629
3659
  }
3630
3660
  }
3631
3661
  }
3662
+ /**
3663
+ * Sets return url
3664
+ * @param returnUrl
3665
+ */
3666
+ setReturnUrl(returnUrl) {
3667
+ super.setReturnUrl(returnUrl);
3668
+ this.listRoute = this.returnUrl || this.listRoute;
3669
+ }
3632
3670
  /**
3633
3671
  * Creates a new instance of the TEntity
3634
3672
  */
@@ -5430,7 +5468,8 @@ class GenericListComponent extends BaseComponent {
5430
5468
  .subscribe(() => this.loadList(false));
5431
5469
  }
5432
5470
  else {
5433
- this.router.navigate([`${this.router.url}/add`]);
5471
+ let currentRoute = this.router.url.split('?')[0]?.split(';')[0];
5472
+ this.router.navigate([`${currentRoute}/add`]);
5434
5473
  }
5435
5474
  }
5436
5475
  /**
@@ -5439,7 +5478,8 @@ class GenericListComponent extends BaseComponent {
5439
5478
  */
5440
5479
  edit(item) {
5441
5480
  if (!this.isTextSelected()) {
5442
- this.router.navigate([`${this.router.url}/edit/${item.id}`]);
5481
+ let currentRoute = this.router.url.split('?')[0]?.split(';')[0];
5482
+ this.router.navigate([`${currentRoute}/edit/${item.id}`]);
5443
5483
  }
5444
5484
  }
5445
5485
  /**
@@ -15870,16 +15910,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
15870
15910
  }] } });
15871
15911
 
15872
15912
  class VdListToolbarComponent {
15913
+ constructor() {
15914
+ /**
15915
+ * back: EventEmitter<any>
15916
+ */
15917
+ this.back = new EventEmitter();
15918
+ }
15873
15919
  }
15874
15920
  /** @nocollapse */ /** @nocollapse */ VdListToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdListToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15875
- /** @nocollapse */ /** @nocollapse */ VdListToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: VdListToolbarComponent, selector: "vd-list-toolbar", inputs: { dataSource: "dataSource", subtitle: "subtitle", menuItems: "menuItems" }, ngImport: i0, template: "<mat-toolbar dense>\r\n <div layout=\"row\" layout-align=\"start center\" flex>\r\n <button mat-icon-button vdLayoutManageListOpen [hideWhenOpened]=\"true\">\r\n <mat-icon>menu</mat-icon>\r\n </button>\r\n <span>{{subtitle}}</span>\r\n <span flex></span>\r\n <button mat-icon-button (click)=\"dataSource.reload()\" *ngIf=\"dataSource\">\r\n <mat-icon>sync</mat-icon>\r\n </button>\r\n <vd-list-toolbar-menu [menuItems]=\"menuItems\"></vd-list-toolbar-menu>\r\n </div>\r\n</mat-toolbar>", components: [{ type: i3$5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: VdListToolbarMenuComponent, selector: "vd-list-toolbar-menu", inputs: ["menuItems", "item"] }], directives: [{ type: VdLayoutManageListOpenDirective, selector: "[vdLayoutManageListOpen]", inputs: ["vdLayoutManageListOpen"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
15921
+ /** @nocollapse */ /** @nocollapse */ VdListToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: VdListToolbarComponent, selector: "vd-list-toolbar", inputs: { dataSource: "dataSource", subtitle: "subtitle", backButton: "backButton", menuItems: "menuItems" }, outputs: { back: "back" }, ngImport: i0, template: "<mat-toolbar dense [ngClass]=\"{'pad-left-none': backButton}\">\r\n <div layout=\"row\" layout-align=\"start center\" flex>\r\n <button mat-icon-button vdLayoutManageListOpen [hideWhenOpened]=\"true\">\r\n <mat-icon>menu</mat-icon>\r\n </button>\r\n <button mat-icon-button (click)=\"back.emit()\" *ngIf=\"backButton\">\r\n <mat-icon>arrow_back</mat-icon>\r\n </button>\r\n <span>{{subtitle}}</span>\r\n <span flex></span>\r\n <button mat-icon-button (click)=\"dataSource.reload()\" *ngIf=\"dataSource\">\r\n <mat-icon>sync</mat-icon>\r\n </button>\r\n <vd-list-toolbar-menu [menuItems]=\"menuItems\"></vd-list-toolbar-menu>\r\n </div>\r\n</mat-toolbar>", components: [{ type: i3$5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: VdListToolbarMenuComponent, selector: "vd-list-toolbar-menu", inputs: ["menuItems", "item"] }], directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: VdLayoutManageListOpenDirective, selector: "[vdLayoutManageListOpen]", inputs: ["vdLayoutManageListOpen"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
15876
15922
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdListToolbarComponent, decorators: [{
15877
15923
  type: Component,
15878
- args: [{ selector: 'vd-list-toolbar', template: "<mat-toolbar dense>\r\n <div layout=\"row\" layout-align=\"start center\" flex>\r\n <button mat-icon-button vdLayoutManageListOpen [hideWhenOpened]=\"true\">\r\n <mat-icon>menu</mat-icon>\r\n </button>\r\n <span>{{subtitle}}</span>\r\n <span flex></span>\r\n <button mat-icon-button (click)=\"dataSource.reload()\" *ngIf=\"dataSource\">\r\n <mat-icon>sync</mat-icon>\r\n </button>\r\n <vd-list-toolbar-menu [menuItems]=\"menuItems\"></vd-list-toolbar-menu>\r\n </div>\r\n</mat-toolbar>" }]
15924
+ args: [{ selector: 'vd-list-toolbar', template: "<mat-toolbar dense [ngClass]=\"{'pad-left-none': backButton}\">\r\n <div layout=\"row\" layout-align=\"start center\" flex>\r\n <button mat-icon-button vdLayoutManageListOpen [hideWhenOpened]=\"true\">\r\n <mat-icon>menu</mat-icon>\r\n </button>\r\n <button mat-icon-button (click)=\"back.emit()\" *ngIf=\"backButton\">\r\n <mat-icon>arrow_back</mat-icon>\r\n </button>\r\n <span>{{subtitle}}</span>\r\n <span flex></span>\r\n <button mat-icon-button (click)=\"dataSource.reload()\" *ngIf=\"dataSource\">\r\n <mat-icon>sync</mat-icon>\r\n </button>\r\n <vd-list-toolbar-menu [menuItems]=\"menuItems\"></vd-list-toolbar-menu>\r\n </div>\r\n</mat-toolbar>" }]
15879
15925
  }], propDecorators: { dataSource: [{
15880
15926
  type: Input
15881
15927
  }], subtitle: [{
15882
15928
  type: Input
15929
+ }], backButton: [{
15930
+ type: Input
15931
+ }], back: [{
15932
+ type: Output
15883
15933
  }], menuItems: [{
15884
15934
  type: Input
15885
15935
  }] } });