adb-shared 7.0.10 → 7.0.11
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/fesm2022/adb-shared.mjs +13 -15
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/types/adb-shared.d.ts +1 -0
package/fesm2022/adb-shared.mjs
CHANGED
|
@@ -506,9 +506,7 @@ class AdbDropdownDirective {
|
|
|
506
506
|
this.adbDropdownService.currentMenu = this.elementRef.nativeElement;
|
|
507
507
|
menu.setAttribute('id', this.dropId);
|
|
508
508
|
if (menu.classList.contains('show')) {
|
|
509
|
-
|
|
510
|
-
this.expanded = false;
|
|
511
|
-
this.dropdownCloseSignal.emit();
|
|
509
|
+
this.handleClose();
|
|
512
510
|
return;
|
|
513
511
|
}
|
|
514
512
|
this.adbDropdownSignal.emit();
|
|
@@ -516,6 +514,15 @@ class AdbDropdownDirective {
|
|
|
516
514
|
this.expanded = true;
|
|
517
515
|
this.setMenuPosition(toggleButton, menu);
|
|
518
516
|
}
|
|
517
|
+
handleClose() {
|
|
518
|
+
const fireEvent = this.expanded;
|
|
519
|
+
const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
|
|
520
|
+
parent?.classList.remove('show');
|
|
521
|
+
this.expanded = false;
|
|
522
|
+
if (fireEvent) {
|
|
523
|
+
this.dropdownCloseSignal.emit();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
519
526
|
setMenuPosition(toggleButton, menu) {
|
|
520
527
|
const buttonRect = toggleButton.getBoundingClientRect();
|
|
521
528
|
const menuRect = menu.getBoundingClientRect();
|
|
@@ -541,16 +548,11 @@ class AdbDropdownDirective {
|
|
|
541
548
|
const parent = this.insideClickSignal() ? this.elementRef.nativeElement.parentNode : this.elementRef.nativeElement;
|
|
542
549
|
const clickedInside = parent.contains(target);
|
|
543
550
|
if (!clickedInside) {
|
|
544
|
-
|
|
545
|
-
parent?.classList.remove('show');
|
|
546
|
-
this.expanded = false;
|
|
547
|
-
this.dropdownCloseSignal.emit();
|
|
551
|
+
this.handleClose();
|
|
548
552
|
}
|
|
549
553
|
}
|
|
550
554
|
else {
|
|
551
|
-
|
|
552
|
-
parent?.classList.remove('show');
|
|
553
|
-
this.expanded = false;
|
|
555
|
+
this.handleClose();
|
|
554
556
|
}
|
|
555
557
|
}
|
|
556
558
|
onResize() {
|
|
@@ -565,11 +567,7 @@ class AdbDropdownDirective {
|
|
|
565
567
|
}
|
|
566
568
|
}
|
|
567
569
|
close() {
|
|
568
|
-
|
|
569
|
-
const menu = node.querySelector('.dropdown-menu');
|
|
570
|
-
menu.classList.remove('show');
|
|
571
|
-
this.expanded = false;
|
|
572
|
-
this.dropdownCloseSignal.emit();
|
|
570
|
+
this.handleClose();
|
|
573
571
|
}
|
|
574
572
|
getId() {
|
|
575
573
|
return '' + Math.floor(Math.random() * Date.now());
|