@dotglitch/ngx-common 1.0.5 → 1.0.7

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.
@@ -517,10 +517,10 @@ class MenuComponent {
517
517
  }
518
518
  });
519
519
  // Show the icon column if there are any items with an icon
520
- this.showIconColumn = !!this.items.find(i => typeof i == "object" &&
520
+ this.showIconColumn = !!this.items?.find(i => typeof i == "object" &&
521
521
  typeof i['icon'] == "string" &&
522
522
  i['icon'].length > 2);
523
- this.showShortcutColumn = !!this.items.find(i => typeof i == "object" &&
523
+ this.showShortcutColumn = !!this.items?.find(i => typeof i == "object" &&
524
524
  typeof i['shortcut'] == "string" &&
525
525
  i['shortcut'].length > 2);
526
526
  // setTimeout(() => {
@@ -707,7 +707,6 @@ class MenuDirective {
707
707
  });
708
708
  }
709
709
  if (!this.config?.trigger) {
710
- el.onclick = this.openMenu.bind(this);
711
710
  el.addEventListener('click', this.openMenu.bind(this));
712
711
  }
713
712
  else {
@@ -728,7 +727,7 @@ class MenuDirective {
728
727
  async openMenu(evt) {
729
728
  const el = this.viewContainer.element.nativeElement;
730
729
  el.classList.add("ngx-menu-open");
731
- return openMenu(this.dialog, this.menuItems, this.data, evt, this.config)
730
+ return openMenu(this.dialog, this.menuItems, this.data, evt, this.config, el)
732
731
  .then((...res) => {
733
732
  el.classList.remove("ngx-menu-open");
734
733
  return res;
@@ -778,10 +777,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
778
777
  args: ["ngx-menu-config"]
779
778
  }] } });
780
779
  // Helper to open the menu without using the directive.
781
- const openMenu = async (dialog, menuItems, data, evt, config = {}) => {
780
+ const openMenu = async (dialog, menuItems, data, evt, config = {}, el) => {
782
781
  evt.preventDefault();
783
782
  evt.stopPropagation();
784
- const cords = getPosition(evt, config, await calcMenuItemBounds(menuItems, data));
783
+ const cords = getPosition(el || evt, config, await calcMenuItemBounds(menuItems, data));
785
784
  const specificId = crypto.randomUUID();
786
785
  if (!config.alignment)
787
786
  config.alignment = "start";