@breadstone/mosaik-elements-angular 0.0.255 → 0.0.257
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 0.0.257 (2026-05-06)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **DialogService, DrawerService, MessageBoxService, SheetService, ToastService:** refactor click outside close handling ([34feb21a64](https://github.com/RueDeRennes/mosaik/commit/34feb21a64))
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **docs:** update line numbers in overlay service documentation ([5c461a79b7](https://github.com/RueDeRennes/mosaik/commit/5c461a79b7))
|
|
10
|
+
|
|
11
|
+
## 0.0.256 (2026-05-04)
|
|
12
|
+
|
|
13
|
+
This was a version bump only for mosaik-elements-angular to align it with other projects, there were no code changes.
|
|
14
|
+
|
|
1
15
|
## 0.0.255 (2026-05-04)
|
|
2
16
|
|
|
3
17
|
This was a version bump only for mosaik-elements-angular to align it with other projects, there were no code changes.
|
|
@@ -5,7 +5,7 @@ import { AbsoluteItemElement, AbsoluteElement, ActionbarGroupElement, ActionbarI
|
|
|
5
5
|
import { AbstractControl, FormGroupDirective, NgControl, TouchedChangeEvent, NG_VALUE_ACCESSOR, FormControl, FormArray, FormGroup } from '@angular/forms';
|
|
6
6
|
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
7
7
|
import { CssLength, ThemeObserver, ThemeGeneratorServiceLocator, ThemeGenerator, ThemeObserverServiceLocator } from '@breadstone/mosaik-themes';
|
|
8
|
-
import { Subscription, filter, of, isObservable, Subject, BehaviorSubject,
|
|
8
|
+
import { Subscription, filter, of, isObservable, Subject, BehaviorSubject, take, takeUntil, fromEvent, timer, share, Observable } from 'rxjs';
|
|
9
9
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
10
|
import { FORM_FIELD, validate } from '@angular/forms/signals';
|
|
11
11
|
import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
@@ -11876,6 +11876,66 @@ class PortalProvider {
|
|
|
11876
11876
|
}
|
|
11877
11877
|
}
|
|
11878
11878
|
|
|
11879
|
+
// #region Imports
|
|
11880
|
+
// #region Methods
|
|
11881
|
+
/**
|
|
11882
|
+
* Subscribes to CDK outside interactions while preserving Mosaik portal ownership.
|
|
11883
|
+
*
|
|
11884
|
+
* @internal
|
|
11885
|
+
*/
|
|
11886
|
+
function connectOverlayOutsideClose(overlayRef, closed, close) {
|
|
11887
|
+
overlayRef.backdropClick().pipe(take(1), takeUntil(closed))
|
|
11888
|
+
.subscribe(() => close());
|
|
11889
|
+
overlayRef.outsidePointerEvents().pipe(filter((event) => !isOwnedMosaikPortalProjectionEvent(overlayRef, event)), take(1), takeUntil(closed))
|
|
11890
|
+
.subscribe(() => close());
|
|
11891
|
+
}
|
|
11892
|
+
function isOwnedMosaikPortalProjectionEvent(overlayRef, event) {
|
|
11893
|
+
return event.composedPath()
|
|
11894
|
+
.some((target) => isMosaikPortalProjectionElement(target) && isProjectionOwnedByOverlay(overlayRef, target));
|
|
11895
|
+
}
|
|
11896
|
+
function isMosaikPortalProjectionElement(target) {
|
|
11897
|
+
return typeof HTMLElement !== 'undefined' && target instanceof HTMLElement && target.localName === 'mosaik-portal-projection';
|
|
11898
|
+
}
|
|
11899
|
+
function isProjectionOwnedByOverlay(overlayRef, projection) {
|
|
11900
|
+
const portal = tryGetProjectionPortal(projection);
|
|
11901
|
+
return portal !== null && isComposedDescendantOf(overlayRef.overlayElement, portal);
|
|
11902
|
+
}
|
|
11903
|
+
function tryGetProjectionPortal(projection) {
|
|
11904
|
+
try {
|
|
11905
|
+
return typeof HTMLElement !== 'undefined' && projection.portal instanceof HTMLElement
|
|
11906
|
+
? projection.portal
|
|
11907
|
+
: null;
|
|
11908
|
+
}
|
|
11909
|
+
catch {
|
|
11910
|
+
return null;
|
|
11911
|
+
}
|
|
11912
|
+
}
|
|
11913
|
+
function isComposedDescendantOf(parent, child) {
|
|
11914
|
+
let current = child;
|
|
11915
|
+
while (current) {
|
|
11916
|
+
if (current === parent) {
|
|
11917
|
+
return true;
|
|
11918
|
+
}
|
|
11919
|
+
if (isShadowRoot(current)) {
|
|
11920
|
+
current = current.host;
|
|
11921
|
+
}
|
|
11922
|
+
else if (current.parentNode) {
|
|
11923
|
+
current = current.parentNode;
|
|
11924
|
+
}
|
|
11925
|
+
else {
|
|
11926
|
+
const root = current.getRootNode();
|
|
11927
|
+
current = isShadowRoot(root)
|
|
11928
|
+
? root.host
|
|
11929
|
+
: null;
|
|
11930
|
+
}
|
|
11931
|
+
}
|
|
11932
|
+
return false;
|
|
11933
|
+
}
|
|
11934
|
+
function isShadowRoot(node) {
|
|
11935
|
+
return typeof ShadowRoot !== 'undefined' && node instanceof ShadowRoot;
|
|
11936
|
+
}
|
|
11937
|
+
// #endregion
|
|
11938
|
+
|
|
11879
11939
|
// #endregion
|
|
11880
11940
|
/**
|
|
11881
11941
|
* @public
|
|
@@ -12038,14 +12098,7 @@ class DialogService extends PortalProvider {
|
|
|
12038
12098
|
}
|
|
12039
12099
|
});
|
|
12040
12100
|
if (config.clickOutsideToClose) {
|
|
12041
|
-
|
|
12042
|
-
backdropClickSubscription.unsubscribe();
|
|
12043
|
-
dialogRef.close(Cancel.negative());
|
|
12044
|
-
});
|
|
12045
|
-
const outsidePointerEventsSubscription = overlayRef.outsidePointerEvents().subscribe(() => {
|
|
12046
|
-
outsidePointerEventsSubscription.unsubscribe();
|
|
12047
|
-
dialogRef.close(Cancel.negative());
|
|
12048
|
-
});
|
|
12101
|
+
connectOverlayOutsideClose(overlayRef, dialogRef.closed, () => dialogRef.close(Cancel.negative()));
|
|
12049
12102
|
}
|
|
12050
12103
|
if (config.pressEscapeToClose) {
|
|
12051
12104
|
const documentKeyupSubscription = fromEvent(this._document, 'keyup').pipe(filter((event) => event.keyCode === Key.Escape), takeUntil(dialogRef.closed))
|
|
@@ -14898,14 +14951,7 @@ class DrawerService extends PortalProvider {
|
|
|
14898
14951
|
}
|
|
14899
14952
|
});
|
|
14900
14953
|
if (config.clickOutsideToClose) {
|
|
14901
|
-
|
|
14902
|
-
backdropClickSubscription.unsubscribe();
|
|
14903
|
-
drawerRef.close(Cancel.negative());
|
|
14904
|
-
});
|
|
14905
|
-
const outsidePointerEventsSubscription = overlayRef.outsidePointerEvents().subscribe(() => {
|
|
14906
|
-
outsidePointerEventsSubscription.unsubscribe();
|
|
14907
|
-
drawerRef.close(Cancel.negative());
|
|
14908
|
-
});
|
|
14954
|
+
connectOverlayOutsideClose(overlayRef, drawerRef.closed, () => drawerRef.close(Cancel.negative()));
|
|
14909
14955
|
}
|
|
14910
14956
|
if (config.pressEscapeToClose) {
|
|
14911
14957
|
const documentKeyupSubscription = fromEvent(this._document, 'keyup').pipe(filter((event) => event.keyCode === Key.Escape), takeUntil(drawerRef.closed))
|
|
@@ -15845,14 +15891,7 @@ class MessageBoxService extends PortalProvider {
|
|
|
15845
15891
|
Object.assign(messageBoxRef.element.intl, config.intl);
|
|
15846
15892
|
}
|
|
15847
15893
|
if (config.clickOutsideToClose) {
|
|
15848
|
-
|
|
15849
|
-
backdropClickSubscription.unsubscribe();
|
|
15850
|
-
messageBoxRef.close(Cancel.negative());
|
|
15851
|
-
});
|
|
15852
|
-
const outsidePointerEventsSubscription = overlayRef.outsidePointerEvents().subscribe(() => {
|
|
15853
|
-
outsidePointerEventsSubscription.unsubscribe();
|
|
15854
|
-
messageBoxRef.close(Cancel.negative());
|
|
15855
|
-
});
|
|
15894
|
+
connectOverlayOutsideClose(overlayRef, messageBoxRef.closed, () => messageBoxRef.close(Cancel.negative()));
|
|
15856
15895
|
}
|
|
15857
15896
|
if (config.pressEscapeToClose) {
|
|
15858
15897
|
const documentKeyupSubscription = fromEvent(this._document, 'keyup').pipe(filter((event) => event.keyCode === Key.Escape), takeUntil(messageBoxRef.closed))
|
|
@@ -17505,14 +17544,7 @@ class SheetService extends PortalProvider {
|
|
|
17505
17544
|
}
|
|
17506
17545
|
});
|
|
17507
17546
|
if (config.clickOutsideToClose) {
|
|
17508
|
-
|
|
17509
|
-
backdropClickSubscription.unsubscribe();
|
|
17510
|
-
sheetRef.close(Cancel.negative());
|
|
17511
|
-
});
|
|
17512
|
-
const outsidePointerEventsSubscription = overlayRef.outsidePointerEvents().subscribe(() => {
|
|
17513
|
-
outsidePointerEventsSubscription.unsubscribe();
|
|
17514
|
-
sheetRef.close(Cancel.negative());
|
|
17515
|
-
});
|
|
17547
|
+
connectOverlayOutsideClose(overlayRef, sheetRef.closed, () => sheetRef.close(Cancel.negative()));
|
|
17516
17548
|
}
|
|
17517
17549
|
if (config.pressEscapeToClose) {
|
|
17518
17550
|
const documentKeyupSubscription = fromEvent(this._document, 'keyup').pipe(filter((event) => event.keyCode === Key.Escape), takeUntil(sheetRef.closed))
|
|
@@ -18272,14 +18304,7 @@ class ToastService extends PortalProvider {
|
|
|
18272
18304
|
}
|
|
18273
18305
|
});
|
|
18274
18306
|
if (config.clickOutsideToClose) {
|
|
18275
|
-
|
|
18276
|
-
backdropClickSubscription.unsubscribe();
|
|
18277
|
-
toastRef.close(Cancel.negative());
|
|
18278
|
-
});
|
|
18279
|
-
const outsidePointerEventsSubscription = overlayRef.outsidePointerEvents().subscribe(() => {
|
|
18280
|
-
outsidePointerEventsSubscription.unsubscribe();
|
|
18281
|
-
toastRef.close(Cancel.negative());
|
|
18282
|
-
});
|
|
18307
|
+
connectOverlayOutsideClose(overlayRef, toastRef.closed, () => toastRef.close(Cancel.negative()));
|
|
18283
18308
|
}
|
|
18284
18309
|
if (config.pressEscapeToClose) {
|
|
18285
18310
|
const documentKeyupSubscription = fromEvent(this._document, 'keyup').pipe(filter((event) => event.keyCode === Key.Escape), takeUntil(toastRef.closed))
|