@spartan-ng/brain 0.0.1-alpha.582 → 0.0.1-alpha.584

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.
@@ -122,10 +122,11 @@ class BrnDialogService {
122
122
  if (options?.id && this._cdkDialog.getDialogById(options.id)) {
123
123
  throw new Error(`Dialog with ID: ${options.id} already exists`);
124
124
  }
125
+ const attachTo = options?.attachTo ?? this._defaultOptions.attachTo;
125
126
  const positionStrategy = options?.positionStrategy ??
126
127
  this._defaultOptions.positionStrategy ??
127
- (options?.attachTo && options?.attachPositions && options?.attachPositions?.length > 0
128
- ? this._positionBuilder?.flexibleConnectedTo(options.attachTo).withPositions(options.attachPositions ?? [])
128
+ (attachTo && options?.attachPositions && options?.attachPositions?.length > 0
129
+ ? this._positionBuilder?.flexibleConnectedTo(attachTo).withPositions(options.attachPositions ?? [])
129
130
  : this._positionBuilder.global().centerHorizontally().centerVertically());
130
131
  let brnDialogRef;
131
132
  let effectRef;
@@ -155,7 +156,7 @@ class BrnDialogService {
155
156
  positionStrategy,
156
157
  scrollStrategy: options?.scrollStrategy ?? this._defaultOptions.scrollStrategy ?? this._sso?.block(),
157
158
  restoreFocus: options?.restoreFocus ?? this._defaultOptions.restoreFocus,
158
- disableClose: options?.disableClose ?? this._defaultOptions.disableClose,
159
+ disableClose: true,
159
160
  autoFocus: options?.autoFocus ?? this._defaultOptions.autoFocus,
160
161
  ariaDescribedBy: options?.ariaDescribedBy ?? `brn-dialog-description-${dialogId}`,
161
162
  ariaLabelledBy: options?.ariaLabelledBy ?? `brn-dialog-title-${dialogId}`,
@@ -192,7 +193,8 @@ class BrnDialogService {
192
193
  });
193
194
  const overlay = cdkDialogRef.overlayRef.overlayElement;
194
195
  const backdrop = cdkDialogRef.overlayRef.backdropElement;
195
- if (options?.closeOnOutsidePointerEvents) {
196
+ const closeOnOutsidePointerEvents = options?.closeOnOutsidePointerEvents ?? this._defaultOptions.closeOnOutsidePointerEvents;
197
+ if (closeOnOutsidePointerEvents) {
196
198
  cdkDialogRef.outsidePointerEvents.pipe(takeUntil(destroyed$)).subscribe(() => {
197
199
  const overlays = this._overlayCloseDispatcher._attachedOverlays;
198
200
  const index = overlays.indexOf(cdkDialogRef.overlayRef);
@@ -204,12 +206,14 @@ class BrnDialogService {
204
206
  }
205
207
  });
206
208
  }
207
- if (options?.closeOnBackdropClick) {
209
+ const closeOnBackdropClick = options?.closeOnBackdropClick ?? this._defaultOptions.closeOnBackdropClick;
210
+ if (closeOnBackdropClick) {
208
211
  cdkDialogRef.backdropClick.pipe(takeUntil(destroyed$)).subscribe(() => {
209
212
  brnDialogRef.close(undefined, options?.closeDelay);
210
213
  });
211
214
  }
212
- if (!options?.disableClose) {
215
+ const disableClose = options?.disableClose ?? this._defaultOptions.disableClose;
216
+ if (!disableClose) {
213
217
  cdkDialogRef.keydownEvents
214
218
  .pipe(filter((e) => e.key === 'Escape'), takeUntil(destroyed$))
215
219
  .subscribe(() => {