@webitel/ui-datalist 1.1.76 → 1.1.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-datalist",
3
- "version": "1.1.76",
3
+ "version": "1.1.78",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "build:types": "vue-tsc -b tsconfig.build.json",
@@ -39,7 +39,7 @@
39
39
  "@vuelidate/core": "^2.0.3",
40
40
  "@vuelidate/validators": "^2.0.4",
41
41
  "@vueuse/core": "^14.0",
42
- "@webitel/api-services": "^0.1.0",
42
+ "@webitel/api-services": "^1.0.0",
43
43
  "@webitel/styleguide": "~26.2",
44
44
  "@webitel/ui-sdk": ">=26.2",
45
45
  "axios": "^1.15.2",
@@ -30,7 +30,7 @@
30
30
  </template>
31
31
 
32
32
  <script lang="ts" setup>
33
- import { onClickOutside } from '@vueuse/core';
33
+ import { onClickOutside, useEventListener } from '@vueuse/core';
34
34
  import { WtIconAction } from '@webitel/ui-sdk/components';
35
35
  import { ref } from 'vue';
36
36
  import { useI18n } from 'vue-i18n';
@@ -72,6 +72,43 @@ const dynamicFilterAddAction = ref<{
72
72
  hidePopover: () => void;
73
73
  } | null>(null);
74
74
 
75
+ /**
76
+ * @author @HlukhovYe
77
+ *
78
+ * https://webitel.atlassian.net/browse/WTEL-10240
79
+ *
80
+ * A click fully outside the popover can also be the same click that closes a
81
+ * child select/multiselect/datepicker overlay (its own panel is teleported to
82
+ * `body`, so it's not a descendant of `popoverContentRef`, and the `ignore`
83
+ * list below only matches clicks landing directly on it, not this outside
84
+ * click). The browser blurs the overlay's focused element (e.g. a multiselect
85
+ * filter input) as part of the same mousedown that starts this click, so by
86
+ * the time onClickOutside's own `click`-phase handler runs, `activeElement`
87
+ * has already reset to `body` — too late to check. A capture-phase
88
+ * `pointerdown` listener runs earlier, while focus is still intact, so it's
89
+ * used here to snapshot whether an open field overlay currently has focus.
90
+ * If so, let that overlay's own outside-click handler close it and leave this
91
+ * popover open — otherwise both close on the same click.
92
+ */
93
+ let hadOwnOpenFieldOverlayOnPointerdown = false;
94
+ useEventListener(
95
+ document,
96
+ 'pointerdown',
97
+ () => {
98
+ const openFieldOverlay = document.querySelector(
99
+ '.p-select-overlay, .p-multiselect-overlay, .p-datepicker-panel',
100
+ );
101
+ hadOwnOpenFieldOverlayOnPointerdown = !!(
102
+ openFieldOverlay &&
103
+ (popoverContentRef.value?.contains(document.activeElement) ||
104
+ openFieldOverlay.contains(document.activeElement))
105
+ );
106
+ },
107
+ {
108
+ capture: true,
109
+ },
110
+ );
111
+
75
112
  /**
76
113
  * @author @Oleksandr Palonnyi
77
114
  *
@@ -84,7 +121,11 @@ const dynamicFilterAddAction = ref<{
84
121
  * */
85
122
  onClickOutside(
86
123
  popoverContentRef,
87
- () => dynamicFilterAddAction?.value?.hidePopover(),
124
+ () => {
125
+ if (hadOwnOpenFieldOverlayOnPointerdown) return;
126
+
127
+ dynamicFilterAddAction?.value?.hidePopover();
128
+ },
88
129
  {
89
130
  capture: true, // Fix for PrimeVue stopPropagation bug
90
131
  ignore: [