@cloudron/pankow 4.3.0 → 4.3.1

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudron/pankow",
3
3
  "private": false,
4
- "version": "4.3.0",
4
+ "version": "4.3.1",
5
5
  "description": "Vue 3 UI component library for Cloudron apps",
6
6
  "main": "index.js",
7
7
  "types": "types/index.d.ts",
@@ -13,7 +13,13 @@
13
13
  "./*": "./*",
14
14
  "./vite-plugin": "./vite-plugin.js"
15
15
  },
16
- "keywords": ["vue", "vue3", "cloudron", "ui", "components"],
16
+ "keywords": [
17
+ "vue",
18
+ "vue3",
19
+ "cloudron",
20
+ "ui",
21
+ "components"
22
+ ],
17
23
  "files": [
18
24
  "*.css",
19
25
  "*.js",
@@ -38,9 +38,7 @@ const props = defineProps({
38
38
  },
39
39
  navigationHandler: {
40
40
  type: Function,
41
- default: (toEntry) => {
42
- router.replace(toEntry.resourcePath);
43
- }
41
+ default: null
44
42
  }
45
43
  });
46
44
 
@@ -54,6 +52,7 @@ const entries = ref([]);
54
52
  const dismissDistance = ref(0);
55
53
 
56
54
  const hasDownloadHandler = computed(() => typeof props.downloadHandler === 'function');
55
+ const navigate = (entry) => (props.navigationHandler || ((e) => router.replace(e.resourcePath)))(entry);
57
56
 
58
57
  const rootEl = useTemplateRef('rootEl');
59
58
  const imageContainer = useTemplateRef('imageContainer');
@@ -105,7 +104,7 @@ function onScroll() {
105
104
 
106
105
  if (curIndex.value !== i) {
107
106
  curIndex.value = i;
108
- if (props.navigationHandler) props.navigationHandler(entry.value);
107
+ navigate(entry.value);
109
108
  }
110
109
 
111
110
  break;
@@ -166,13 +165,13 @@ function onClose() {
166
165
 
167
166
  function onPrev() {
168
167
  if (curIndex.value < 1) return;
169
- if (props.navigationHandler) props.navigationHandler(entries.value[curIndex.value-1]);
168
+ navigate(entries.value[curIndex.value-1]);
170
169
  open(entries.value[curIndex.value-1], entries.value, false);
171
170
  }
172
171
 
173
172
  function onNext() {
174
173
  if (curIndex.value >= entries.value.length) return;
175
- if (props.navigationHandler) props.navigationHandler(entries.value[curIndex.value+1]);
174
+ navigate(entries.value[curIndex.value+1]);
176
175
  open(entries.value[curIndex.value+1], entries.value, false);
177
176
  }
178
177