@one-paragon/angular-utilities 0.0.12 → 0.0.13

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.
@@ -50,7 +50,7 @@ import { MatNativeDateModule } from '@angular/material/core';
50
50
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
51
51
  import { MatBadgeModule } from '@angular/material/badge';
52
52
  import * as i1$3 from '@angular/material/dialog';
53
- import { MatDialogModule, MatDialogConfig } from '@angular/material/dialog';
53
+ import { MatDialogModule } from '@angular/material/dialog';
54
54
  import { MatExpansionModule } from '@angular/material/expansion';
55
55
  import { MatGridListModule } from '@angular/material/grid-list';
56
56
  import { MatListModule } from '@angular/material/list';
@@ -2817,13 +2817,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
2817
2817
  template: ``
2818
2818
  }]
2819
2819
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
2820
+ const defaultDialogConfig = {
2821
+ maxHeight: '95vh'
2822
+ };
2820
2823
  class DialogDirective {
2821
2824
  constructor(templateRef, dialog, service) {
2822
2825
  this.templateRef = templateRef;
2823
2826
  this.dialog = dialog;
2824
2827
  this.service = service;
2825
2828
  this.opDialogClosed = new EventEmitter();
2826
- this.opDialogConfig = new MatDialogConfig();
2829
+ this._dialogConfig = defaultDialogConfig;
2827
2830
  this._data = new Subject();
2828
2831
  this.subscription = this._data.pipe(switchAll()).subscribe(d => {
2829
2832
  if (d) {
@@ -2835,6 +2838,12 @@ class DialogDirective {
2835
2838
  }
2836
2839
  });
2837
2840
  }
2841
+ set opDialogConfig(config) {
2842
+ this._dialogConfig = { ...defaultDialogConfig, ...config };
2843
+ }
2844
+ get opDialogConfig() {
2845
+ return this._dialogConfig;
2846
+ }
2838
2847
  set state(open_close) {
2839
2848
  this._data.next(open_close);
2840
2849
  }
@@ -2845,14 +2854,14 @@ class DialogDirective {
2845
2854
  if (this.nativeElement) {
2846
2855
  const rect = this.nativeElement.getBoundingClientRect();
2847
2856
  const position = { left: `${rect.left}px`, top: `${rect.bottom - 50}px` };
2848
- this.opDialogConfig = { ...(this.opDialogConfig ?? {}), position };
2857
+ this.opDialogConfig = { ...this.opDialogConfig, position };
2849
2858
  }
2850
2859
  this.dialogRef = this.dialog.open(DialogWrapper, this.opDialogConfig);
2851
2860
  this.componentWrapper = this.dialogRef.componentInstance;
2852
2861
  this.componentWrapper.close = () => this.dialogRef?.close();
2853
2862
  this.componentWrapper.data = this.opDialogConfig.data;
2854
2863
  this.componentWrapper.template = this.templateRef;
2855
- if (!this.opDialogConfig || !this.opDialogConfig.disableClose) {
2864
+ if (!this.opDialogConfig.disableClose) {
2856
2865
  this.service.addDialogRef(this.dialogRef);
2857
2866
  }
2858
2867
  const sub = this.dialogRef.afterClosed().subscribe(() => {