@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.
@@ -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 = '0px';
329
- this.left = '0px';
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
- const contextMenuElement = this.elementRef.nativeElement;
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 anchor = this.anchor?.nativeElement;
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 + gapBetweenButtonAndPopover}px`;
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();