@sebgroup/green-angular 1.8.3 → 1.8.5
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/esm2020/lib/context-menu/context-menu.component.mjs +11 -13
- package/esm2020/lib/context-menu/context-menu.constants.mjs +3 -0
- package/esm2020/lib/modal/modal.component.mjs +7 -2
- package/fesm2015/sebgroup-green-angular.mjs +18 -13
- package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
- package/fesm2020/sebgroup-green-angular.mjs +18 -13
- package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
- package/lib/context-menu/context-menu.component.d.ts +3 -4
- package/lib/context-menu/context-menu.constants.d.ts +2 -0
- package/package.json +3 -3
|
@@ -313,6 +313,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
313
313
|
}]
|
|
314
314
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
315
315
|
|
|
316
|
+
const CONTEXT_MENU_TOP = '0px';
|
|
317
|
+
const CONTEXT_MENU_LEFT = '0px';
|
|
318
|
+
|
|
316
319
|
class NggContextMenuComponent {
|
|
317
320
|
constructor(changeDetectorRef, elementRef, closeContextMenu) {
|
|
318
321
|
this.changeDetectorRef = changeDetectorRef;
|
|
@@ -325,15 +328,14 @@ class NggContextMenuComponent {
|
|
|
325
328
|
this.closeOnScroll = false;
|
|
326
329
|
this.contextMenuItemClicked = new EventEmitter();
|
|
327
330
|
this.isActive = false;
|
|
328
|
-
this.top =
|
|
329
|
-
this.left =
|
|
331
|
+
this.top = CONTEXT_MENU_TOP;
|
|
332
|
+
this.left = CONTEXT_MENU_LEFT;
|
|
330
333
|
}
|
|
331
334
|
onDocumentClick(target) {
|
|
332
335
|
if (!this.isActive) {
|
|
333
336
|
return;
|
|
334
337
|
}
|
|
335
|
-
|
|
336
|
-
if (!contextMenuElement.contains(target)) {
|
|
338
|
+
if (!this.elementRef.nativeElement.contains(target)) {
|
|
337
339
|
this.close();
|
|
338
340
|
}
|
|
339
341
|
}
|
|
@@ -357,17 +359,18 @@ class NggContextMenuComponent {
|
|
|
357
359
|
this.close();
|
|
358
360
|
return;
|
|
359
361
|
}
|
|
360
|
-
const
|
|
361
|
-
const buttonRect = anchor.getBoundingClientRect();
|
|
362
|
-
const left = this.calculateLeft(this.direction, buttonRect);
|
|
363
|
-
const top = this.calculateTop(buttonRect.bottom);
|
|
362
|
+
const buttonRect = this.anchor?.nativeElement.getBoundingClientRect();
|
|
364
363
|
const gapBetweenButtonAndPopover = 3;
|
|
364
|
+
const left = this.calculateLeft(this.direction, buttonRect);
|
|
365
|
+
const top = buttonRect.bottom + gapBetweenButtonAndPopover;
|
|
365
366
|
this.left = `${left}px`;
|
|
366
|
-
this.top = `${top
|
|
367
|
+
this.top = `${top}px`;
|
|
367
368
|
this.isActive = true;
|
|
368
369
|
}
|
|
369
370
|
close() {
|
|
370
371
|
this.isActive = false;
|
|
372
|
+
this.top = CONTEXT_MENU_TOP;
|
|
373
|
+
this.left = CONTEXT_MENU_LEFT;
|
|
371
374
|
this.changeDetectorRef.markForCheck();
|
|
372
375
|
}
|
|
373
376
|
onItemClick(item) {
|
|
@@ -385,9 +388,6 @@ class NggContextMenuComponent {
|
|
|
385
388
|
break;
|
|
386
389
|
}
|
|
387
390
|
}
|
|
388
|
-
calculateTop(buttonRectBottom) {
|
|
389
|
-
return buttonRectBottom + window.pageYOffset;
|
|
390
|
-
}
|
|
391
391
|
calculateLeft(direction, buttonRect) {
|
|
392
392
|
const popover = this.popover?.nativeElement;
|
|
393
393
|
const popoverWidth = popover?.offsetWidth || 0;
|
|
@@ -980,7 +980,12 @@ class NggModalComponent {
|
|
|
980
980
|
if (this.trapFocus) {
|
|
981
981
|
this.enableFocusTrap();
|
|
982
982
|
}
|
|
983
|
-
disableBodyScroll(this.ref.nativeElement
|
|
983
|
+
disableBodyScroll(this.ref.nativeElement, {
|
|
984
|
+
allowTouchMove: (el) => {
|
|
985
|
+
// Allow touchmove for elements inside modal, its required for scroll to work on iOS devices
|
|
986
|
+
return this.ref.nativeElement.contains(el);
|
|
987
|
+
}
|
|
988
|
+
});
|
|
984
989
|
}
|
|
985
990
|
else {
|
|
986
991
|
this.disableFocusTrap();
|