@stackline/angular-multiselect-dropdown 22.0.1 → 22.0.2

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.
@@ -1549,6 +1549,8 @@ class AngularMultiSelect {
1549
1549
  this.dropdownAppendedToBody = false;
1550
1550
  this.overlayListenersBound = false;
1551
1551
  this.overlayPositionTimer = null;
1552
+ this.optionClickFromPointerDown = null;
1553
+ this.optionClickGuardTimer = null;
1552
1554
  this.boundOverlayPositionUpdate = () => this.scheduleDropdownPositionUpdate();
1553
1555
  this.overlayThemeVariables = [
1554
1556
  '--ms-primary',
@@ -1976,9 +1978,71 @@ class AngularMultiSelect {
1976
1978
  }
1977
1979
  onDropdownPanelPointerDown(event) {
1978
1980
  if (this.isBodyOverlayEnabled()) {
1981
+ var option = this.getPointerDownOption(event);
1982
+ if (option) {
1983
+ this.selectOptionFromPointerDown(option, event);
1984
+ return;
1985
+ }
1979
1986
  event.stopPropagation();
1980
1987
  }
1981
1988
  }
1989
+ getPointerDownOption(event) {
1990
+ var target = event && event.target;
1991
+ if (!target || !target.closest) {
1992
+ return null;
1993
+ }
1994
+ var option = target.closest('.dropdown-option');
1995
+ if (!option || option.classList.contains('is-disabled')) {
1996
+ return null;
1997
+ }
1998
+ return option;
1999
+ }
2000
+ selectOptionFromPointerDown(option, event) {
2001
+ var pointerEvent = event;
2002
+ if (event.type === 'pointerdown' && pointerEvent.button !== undefined && pointerEvent.button !== 0) {
2003
+ event.stopPropagation();
2004
+ return;
2005
+ }
2006
+ if (event.cancelable) {
2007
+ event.preventDefault();
2008
+ }
2009
+ event.stopPropagation();
2010
+ option.dispatchEvent(new MouseEvent('click', {
2011
+ bubbles: true,
2012
+ cancelable: true,
2013
+ view: window
2014
+ }));
2015
+ this.ignoreNextNativeOptionClick(option);
2016
+ }
2017
+ ignoreNextNativeOptionClick(option) {
2018
+ this.optionClickFromPointerDown = option;
2019
+ if (this.optionClickGuardTimer) {
2020
+ clearTimeout(this.optionClickGuardTimer);
2021
+ }
2022
+ this.optionClickGuardTimer = setTimeout(() => {
2023
+ if (this.optionClickFromPointerDown === option) {
2024
+ this.optionClickFromPointerDown = null;
2025
+ }
2026
+ }, 500);
2027
+ }
2028
+ shouldIgnoreNativeOptionClick(evt) {
2029
+ if (!this.optionClickFromPointerDown || !evt || evt.type !== 'click') {
2030
+ return false;
2031
+ }
2032
+ if (evt.currentTarget !== this.optionClickFromPointerDown) {
2033
+ return false;
2034
+ }
2035
+ this.optionClickFromPointerDown = null;
2036
+ if (this.optionClickGuardTimer) {
2037
+ clearTimeout(this.optionClickGuardTimer);
2038
+ this.optionClickGuardTimer = null;
2039
+ }
2040
+ if (evt.cancelable) {
2041
+ evt.preventDefault();
2042
+ }
2043
+ evt.stopPropagation();
2044
+ return true;
2045
+ }
1982
2046
  getAriaLabel() {
1983
2047
  if (this.settings && this.settings.ariaLabel) {
1984
2048
  return this.settings.ariaLabel;
@@ -2621,6 +2685,9 @@ class AngularMultiSelect {
2621
2685
  //this.calculateDropdownDirection();
2622
2686
  }
2623
2687
  onItemClick(item, index, evt) {
2688
+ if (this.shouldIgnoreNativeOptionClick(evt)) {
2689
+ return;
2690
+ }
2624
2691
  if (item.disabled) {
2625
2692
  return;
2626
2693
  }
@@ -2642,6 +2709,12 @@ class AngularMultiSelect {
2642
2709
  }
2643
2710
  }
2644
2711
  else {
2712
+ if (this.settings.singleSelection) {
2713
+ this.onTouchedCallback(this.selectedItems);
2714
+ this.closeDropdown();
2715
+ this.syncSelectAllState();
2716
+ return;
2717
+ }
2645
2718
  this.removeSelected(item);
2646
2719
  this.onDeSelect.emit(item);
2647
2720
  }
@@ -3194,6 +3267,11 @@ class AngularMultiSelect {
3194
3267
  }
3195
3268
  ngOnDestroy() {
3196
3269
  this.restoreDropdownPanel(true);
3270
+ if (this.optionClickGuardTimer) {
3271
+ clearTimeout(this.optionClickGuardTimer);
3272
+ this.optionClickGuardTimer = null;
3273
+ }
3274
+ this.optionClickFromPointerDown = null;
3197
3275
  if (this.subscription) {
3198
3276
  this.subscription.unsubscribe();
3199
3277
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "../../../node_modules/ng-packagr/package.schema.json",
3
3
  "name": "@stackline/angular-multiselect-dropdown",
4
- "version": "22.0.1",
4
+ "version": "22.0.2",
5
5
  "license": "MIT",
6
6
  "author": "Pradeep Terli (Original), Alexandro Paixao Marques (Maintainer)",
7
7
  "description": "Angular multiselect dropdown for Angular 22 with maintained release lines, accessibility-focused and keyboard/ARIA tested interactions, dialog-safe body overlays, Stackline skins, search, grouping, templates, headless helpers, and forms support.",
@@ -60,10 +60,6 @@
60
60
  "css-theme",
61
61
  "legacy-angular",
62
62
  "angular-compatibility",
63
- "angular21",
64
- "angular20",
65
- "angular19",
66
- "angular14",
67
63
  "angular2-multiselect",
68
64
  "angular2-multiselect-dropdown",
69
65
  "migration-friendly",
@@ -72,9 +68,10 @@
72
68
  "ngx-multiselect",
73
69
  "virtual-scroll",
74
70
  "angular22",
75
- "angular 22"
71
+ "angular 22",
72
+ "angular-22"
76
73
  ],
77
- "homepage": "https://alexandro.net/docs/angular/multiselect/",
74
+ "homepage": "https://alexandro.net/docs/angular/multiselect/angular-22/",
78
75
  "peerDependencies": {
79
76
  "@angular/core": ">=22.0.0 <24.0.0",
80
77
  "@angular/forms": ">=22.0.0 <24.0.0",
@@ -88,7 +85,7 @@
88
85
  "url": "https://github.com/alexandroit/angular-multiselect-dropdown/issues"
89
86
  },
90
87
  "engines": {
91
- "node": ">=22.22.3"
88
+ "node": "^22.22.3 || ^24.15.0 || >=26.0.0"
92
89
  },
93
90
  "module": "fesm2022/stackline-angular-multiselect-dropdown.mjs",
94
91
  "typings": "types/stackline-angular-multiselect-dropdown.d.ts",
@@ -408,6 +408,8 @@ declare class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChan
408
408
  private dropdownAppendedToBody;
409
409
  private overlayListenersBound;
410
410
  private overlayPositionTimer;
411
+ private optionClickFromPointerDown;
412
+ private optionClickGuardTimer;
411
413
  private boundOverlayPositionUpdate;
412
414
  private overlayThemeVariables;
413
415
  id: any;
@@ -455,6 +457,10 @@ declare class AngularMultiSelect implements OnInit, ControlValueAccessor, OnChan
455
457
  private clearOverlayPositionTimer;
456
458
  private scheduleDropdownPositionUpdate;
457
459
  onDropdownPanelPointerDown(event: Event): void;
460
+ private getPointerDownOption;
461
+ private selectOptionFromPointerDown;
462
+ private ignoreNextNativeOptionClick;
463
+ private shouldIgnoreNativeOptionClick;
458
464
  getAriaLabel(): string;
459
465
  getListboxAriaLabel(): string;
460
466
  getSearchAriaLabel(): string;