@explorer-1/vue 0.3.7 → 0.3.9
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/components/BaseLink/BaseLink.vue +44 -36
- package/src/components/BlockCsrTable/CsrAttachment.vue +16 -4
- package/src/components/HomepageCarousel/HomepageCarousel.stories.js +1 -1
- package/src/components/TopicDetailMissionCarousel/TopicDetailMissionCarousel.stories.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @explorer-1/vue
|
|
2
2
|
|
|
3
|
+
## 0.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 604b717: Fixing url handling in BlockCsrTable, adding option to disable trailing slash in BaseLink.
|
|
8
|
+
|
|
9
|
+
## 0.3.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 9c083c4: Fixing both pinia store and vue-component-meta docgen in Storybook. Making tags more consistent in Storybook.
|
|
14
|
+
|
|
3
15
|
## 0.3.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -50,6 +50,11 @@ export default defineComponent({
|
|
|
50
50
|
type: String,
|
|
51
51
|
default: undefined
|
|
52
52
|
},
|
|
53
|
+
/** Links are normalized to add a trailing slash (handles links to files, query params etc.). Set to false to disable. */
|
|
54
|
+
addSlash: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
53
58
|
title: {
|
|
54
59
|
type: String,
|
|
55
60
|
default: undefined
|
|
@@ -196,46 +201,49 @@ export default defineComponent({
|
|
|
196
201
|
eventBus.emit('linkClicked')
|
|
197
202
|
},
|
|
198
203
|
addTrailingSlash(path: string) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const isQueryPath = path.includes('?')
|
|
209
|
-
const isAnchorPath = path.includes('#')
|
|
210
|
-
if (
|
|
211
|
-
!isQueryPath &&
|
|
212
|
-
!isAnchorPath &&
|
|
213
|
-
!isFilePath() &&
|
|
214
|
-
path !== '/' &&
|
|
215
|
-
!path.endsWith('/') &&
|
|
216
|
-
!path.startsWith('/preview')
|
|
217
|
-
) {
|
|
218
|
-
// add a trailing slash if there isn't one
|
|
219
|
-
filteredPath += '/'
|
|
220
|
-
} else if (isQueryPath) {
|
|
221
|
-
if (!path.includes('/?')) {
|
|
222
|
-
// also add a trailing slash to paths with query params
|
|
223
|
-
const urlParts = filteredPath.split('?')
|
|
224
|
-
const pathWithSlash = `${urlParts[0]}/`
|
|
225
|
-
const queryParams = urlParts[1]
|
|
226
|
-
filteredPath = pathWithSlash + '?' + queryParams
|
|
204
|
+
if (this.addSlash) {
|
|
205
|
+
let filteredPath = path
|
|
206
|
+
if (path && typeof path === 'string') {
|
|
207
|
+
const isFilePath = () => {
|
|
208
|
+
const afterLastSlash = path.split('/').pop()
|
|
209
|
+
if (afterLastSlash && afterLastSlash.includes('.')) {
|
|
210
|
+
return true
|
|
211
|
+
}
|
|
212
|
+
return false
|
|
227
213
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
214
|
+
const isQueryPath = path.includes('?')
|
|
215
|
+
const isAnchorPath = path.includes('#')
|
|
216
|
+
if (
|
|
217
|
+
!isQueryPath &&
|
|
218
|
+
!isAnchorPath &&
|
|
219
|
+
!isFilePath() &&
|
|
220
|
+
path !== '/' &&
|
|
221
|
+
!path.endsWith('/') &&
|
|
222
|
+
!path.startsWith('/preview')
|
|
223
|
+
) {
|
|
224
|
+
// add a trailing slash if there isn't one
|
|
225
|
+
filteredPath += '/'
|
|
226
|
+
} else if (isQueryPath) {
|
|
227
|
+
if (!path.includes('/?')) {
|
|
228
|
+
// also add a trailing slash to paths with query params
|
|
229
|
+
const urlParts = filteredPath.split('?')
|
|
230
|
+
const pathWithSlash = `${urlParts[0]}/`
|
|
231
|
+
const queryParams = urlParts[1]
|
|
232
|
+
filteredPath = pathWithSlash + '?' + queryParams
|
|
233
|
+
}
|
|
234
|
+
} else if (isAnchorPath) {
|
|
235
|
+
if (!path.includes('/#')) {
|
|
236
|
+
// also add a trailing slash to paths with anchors
|
|
237
|
+
const urlParts = filteredPath.split('#')
|
|
238
|
+
const pathWithSlash = `${urlParts[0]}/`
|
|
239
|
+
const anchor = urlParts[1]
|
|
240
|
+
filteredPath = pathWithSlash + '#' + anchor
|
|
241
|
+
}
|
|
235
242
|
}
|
|
236
243
|
}
|
|
244
|
+
return filteredPath
|
|
237
245
|
}
|
|
238
|
-
return
|
|
246
|
+
return path
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
249
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { computed, onMounted } from 'vue'
|
|
3
3
|
import BaseLink from './../BaseLink/BaseLink.vue'
|
|
4
4
|
|
|
5
5
|
interface CsrAttachmentProps {
|
|
@@ -15,14 +15,26 @@ interface CsrAttachmentProps {
|
|
|
15
15
|
const props = withDefaults(defineProps<CsrAttachmentProps>(), {
|
|
16
16
|
params: undefined
|
|
17
17
|
})
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
const encodedAttachmentUrl = computed(() => {
|
|
20
|
+
let url = ''
|
|
21
|
+
if (props.params.data?.Attachment && props.params.attachmentPrefix) {
|
|
22
|
+
url = props.params.attachmentPrefix + props.params.data.Attachment
|
|
23
|
+
}
|
|
24
|
+
return encodeURI(url)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
console.log(encodedAttachmentUrl.value)
|
|
29
|
+
})
|
|
19
30
|
</script>
|
|
20
31
|
<template>
|
|
21
32
|
<BaseLink
|
|
22
|
-
v-if="params?.data?.Attachment"
|
|
23
|
-
:href="
|
|
33
|
+
v-if="props.params?.data?.Attachment"
|
|
34
|
+
:href="encodedAttachmentUrl"
|
|
24
35
|
variant="default"
|
|
25
36
|
target="_blank"
|
|
37
|
+
:add-slash="false"
|
|
26
38
|
>Download</BaseLink
|
|
27
39
|
>
|
|
28
40
|
</template>
|
|
@@ -4,7 +4,7 @@ import HomepageCarousel from './HomepageCarousel.vue'
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Components/WWW/Homepage/HomepageCarousel',
|
|
6
6
|
component: HomepageCarousel,
|
|
7
|
-
tags: ['
|
|
7
|
+
tags: ['carousels'],
|
|
8
8
|
excludeStories: /.*Data$/,
|
|
9
9
|
parameters: {
|
|
10
10
|
viewMode: 'canvas'
|
|
@@ -2,7 +2,7 @@ import TopicDetailMissionCarousel from './TopicDetailMissionCarousel.vue'
|
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Components/WWW/TopicDetail/MissionCarousel/TopicDetailMissionCarousel',
|
|
4
4
|
component: TopicDetailMissionCarousel,
|
|
5
|
-
tags: ['
|
|
5
|
+
tags: ['carousels', 'listings'],
|
|
6
6
|
excludeStories: /.*Data$/
|
|
7
7
|
}
|
|
8
8
|
|