@cloudron/pankow 3.2.10 → 3.2.11

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.
Files changed (2) hide show
  1. package/components/Menu.vue +15 -20
  2. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
 
3
- import { nextTick, useTemplateRef, computed, ref } from 'vue';
3
+ import { nextTick, useTemplateRef, computed, ref, onUnmounted } from 'vue';
4
4
 
5
5
  import MenuItem from './MenuItem.vue';
6
6
  import MenuItemLink from './MenuItemLink.vue';
@@ -134,6 +134,10 @@ function onItemActivated(item) {
134
134
  if (props.closeOnActivation) close();
135
135
  }
136
136
 
137
+ function blurEventHandler() {
138
+ close();
139
+ }
140
+
137
141
  async function open(event, element = null) {
138
142
  isOpen.value = true;
139
143
  pageX = element ? element.getBoundingClientRect().left : event.pageX;
@@ -158,6 +162,10 @@ async function open(event, element = null) {
158
162
  if (event.type === 'keydown' && event.key === 'ArrowUp') selectUp();
159
163
  else if (event.type === 'keydown') selectDown();
160
164
  else container.value.focus();
165
+
166
+ setTimeout(() => {
167
+ window.document.addEventListener('click', blurEventHandler);
168
+ }, 0);
161
169
  }
162
170
 
163
171
  function selectUp() {
@@ -200,16 +208,10 @@ function selectDown() {
200
208
  }
201
209
  }
202
210
 
203
- function onBackdrop(event) {
204
- close();
205
- event.preventDefault();
206
- }
207
-
208
211
  function close() {
212
+ window.document.removeEventListener('click', blurEventHandler);
209
213
  isOpen.value = false;
210
214
  container.value.style.maxHeight = 'unset';
211
- container.value.style.bottom = 'unset';
212
- container.value.style.top = 'unset';
213
215
  emit('close');
214
216
  }
215
217
 
@@ -265,7 +267,12 @@ function position() {
265
267
  }
266
268
  }
267
269
 
270
+ onUnmounted(() => {
271
+ window.document.removeEventListener('click', blurEventHandler);
272
+ });
273
+
268
274
  defineExpose({
275
+ isOpen,
269
276
  open,
270
277
  close,
271
278
  });
@@ -274,7 +281,6 @@ defineExpose({
274
281
 
275
282
  <template>
276
283
  <teleport to="#app">
277
- <div class="pankow-menu-backdrop" @click="onBackdrop($event)" @contextmenu="onBackdrop($event)" v-show="isOpen"></div>
278
284
  <Transition :name="rollUp ? 'pankow-roll-up' : 'pankow-roll-down'">
279
285
  <div class="pankow-menu" v-show="isOpen" ref="container" tabindex="0" @keydown.up.stop="selectUp()" @keydown.down.stop="selectDown()" @keydown.esc.stop="close()" @keydown="onKeyDown">
280
286
  <TextInput placeholder="Filter ..." style="border: 0; padding: 8px 12px;" v-model="searchString" v-if="searchThreshold < model.length"/>
@@ -287,16 +293,6 @@ defineExpose({
287
293
 
288
294
  <style>
289
295
 
290
- .pankow-menu-backdrop {
291
- position: fixed;
292
- height: 100%;
293
- width: 100%;
294
- left: 0px;
295
- top: 0px;
296
- z-index: 3001;
297
- background-color: transparent;
298
- }
299
-
300
296
  .pankow-menu {
301
297
  position: fixed;
302
298
  box-shadow: var(--pankow-menu-shadow);
@@ -306,7 +302,6 @@ defineExpose({
306
302
  z-index: 3001;
307
303
  color: var(--pankow-color-dark);
308
304
  overflow: auto;
309
- /*max-height: 100%;*/
310
305
  outline: none;
311
306
  }
312
307
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudron/pankow",
3
3
  "private": false,
4
- "version": "3.2.10",
4
+ "version": "3.2.11",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "types": "types/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "devDependencies": {
25
25
  "@vitejs/plugin-vue": "^6.0.1",
26
26
  "typescript": "^5.9.2",
27
- "vite": "^7.1.2",
28
- "vue": "^3.5.18"
27
+ "vite": "^7.1.3",
28
+ "vue": "^3.5.19"
29
29
  }
30
30
  }