@coreui/angular 5.7.23 → 5.7.24
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.
|
@@ -1395,6 +1395,8 @@ class BackdropService {
|
|
|
1395
1395
|
backdropClick$ = this.#backdropClick.asObservable();
|
|
1396
1396
|
#document = inject(DOCUMENT);
|
|
1397
1397
|
activeBackdrop;
|
|
1398
|
+
#clearBackdropId;
|
|
1399
|
+
#pendingBackdrop;
|
|
1398
1400
|
get #scrollbarWidth() {
|
|
1399
1401
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
1400
1402
|
const documentWidth = this.#document.documentElement.clientWidth;
|
|
@@ -1403,6 +1405,7 @@ class BackdropService {
|
|
|
1403
1405
|
}
|
|
1404
1406
|
scrollbarWidth = this.#scrollbarWidth;
|
|
1405
1407
|
setBackdrop(type = 'modal') {
|
|
1408
|
+
this.#flushClearBackdrop();
|
|
1406
1409
|
const backdropElement = this.#document.createElement('div');
|
|
1407
1410
|
backdropElement.classList.add(`${type}-backdrop`);
|
|
1408
1411
|
backdropElement.classList.add('fade');
|
|
@@ -1428,17 +1431,37 @@ class BackdropService {
|
|
|
1428
1431
|
delete backdropElement.__backdropClickHandler;
|
|
1429
1432
|
}
|
|
1430
1433
|
backdropElement.classList.remove('show');
|
|
1431
|
-
|
|
1434
|
+
this.#flushClearBackdrop();
|
|
1435
|
+
this.#pendingBackdrop = backdropElement;
|
|
1436
|
+
this.#clearBackdropId = setTimeout(() => {
|
|
1437
|
+
this.#clearBackdropId = undefined;
|
|
1438
|
+
this.#pendingBackdrop = undefined;
|
|
1432
1439
|
if (this.activeBackdrop === backdropElement) {
|
|
1433
1440
|
this.resetScrollbar();
|
|
1441
|
+
this.activeBackdrop = undefined;
|
|
1434
1442
|
}
|
|
1435
|
-
|
|
1436
|
-
this.#document.body.removeChild(backdropElement);
|
|
1437
|
-
}
|
|
1443
|
+
this.#removeBackdrop(backdropElement);
|
|
1438
1444
|
}, 300);
|
|
1439
1445
|
}
|
|
1440
1446
|
return undefined;
|
|
1441
1447
|
}
|
|
1448
|
+
#flushClearBackdrop() {
|
|
1449
|
+
if (this.#clearBackdropId === undefined) {
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
clearTimeout(this.#clearBackdropId);
|
|
1453
|
+
this.#clearBackdropId = undefined;
|
|
1454
|
+
const pending = this.#pendingBackdrop;
|
|
1455
|
+
this.#pendingBackdrop = undefined;
|
|
1456
|
+
if (pending) {
|
|
1457
|
+
this.#removeBackdrop(pending);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
#removeBackdrop(backdropElement) {
|
|
1461
|
+
if (backdropElement.parentElement === this.#document.body) {
|
|
1462
|
+
this.#document.body.removeChild(backdropElement);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1442
1465
|
get #isRTL() {
|
|
1443
1466
|
return [this.#document.documentElement.dir, this.#document.body.dir].includes('rtl');
|
|
1444
1467
|
}
|