@7365admin1/layer-common 4.0.3-staging.226 → 4.0.3-staging.228
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.
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-for="item in list" :key="item._id">
|
|
3
|
+
<v-file-upload-item :file="item.file" lines="one" width="100%" nav @click="handleClickItem(item._id)">
|
|
4
|
+
<template #prepend>
|
|
5
|
+
<v-avatar size="32" rounded></v-avatar>
|
|
6
|
+
</template>
|
|
7
|
+
<template #append>
|
|
8
|
+
<span class="d-flex align-center ga-1">
|
|
9
|
+
<v-tooltip v-if="prop.showCheckbox" interactive location="top">
|
|
10
|
+
<template v-slot:activator="{ props: activatorProps }">
|
|
11
|
+
<v-checkbox v-if="!(prop.readOnly && item.preview === false)" @click.stop hide-details :readonly="prop.readOnly" v-model="item.preview"
|
|
12
|
+
v-bind="activatorProps" @update:model-value="handleCheckbox(item)"></v-checkbox>
|
|
13
|
+
</template>
|
|
14
|
+
<span v-if="!prop.readOnly">Set as preview</span>
|
|
15
|
+
<span v-else>Preview Selected</span>
|
|
16
|
+
</v-tooltip>
|
|
17
|
+
<v-btn v-if="!prop.readOnly" icon="mdi-close" class="text-text2" density="compact" size="small" flat
|
|
18
|
+
@click.stop="handleRemoveItem(item)" />
|
|
19
|
+
</span>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
</v-file-upload-item>
|
|
23
|
+
</template>
|
|
24
|
+
<ImageCarousel v-model="showCarousel" :active-file-id="activeFileId" :files="filesArray" />
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
|
|
29
|
+
type TRawFileArray = { file: File, _id: string, preview?: boolean }
|
|
30
|
+
|
|
31
|
+
const prop = defineProps({
|
|
32
|
+
list: {
|
|
33
|
+
type: Array as PropType<TRawFileArray[]>,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
showCheckbox: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
readOnly: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits(['remove', 'select-featured', 'set-preview'])
|
|
47
|
+
|
|
48
|
+
const showCarousel = ref(false)
|
|
49
|
+
const filesArray = ref<string[]>([]) //carousel files, id strings array
|
|
50
|
+
|
|
51
|
+
const activeFileId = ref('')
|
|
52
|
+
|
|
53
|
+
function handleClickItem(id: string) {
|
|
54
|
+
showCarousel.value = true;
|
|
55
|
+
activeFileId.value = id
|
|
56
|
+
filesArray.value = prop.list?.map( x => x?._id)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleCheckbox(item: TRawFileArray) {
|
|
60
|
+
if (item.preview === true) {
|
|
61
|
+
emit('set-preview', item?._id)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function handleRemoveItem(item: TRawFileArray) {
|
|
66
|
+
emit('remove', item?._id)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<style scoped></style>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
>
|
|
15
15
|
<v-row no-gutters>
|
|
16
16
|
<template v-for="(label, key) in formattedFields" :key="key">
|
|
17
|
-
<v-col cols="12" class="mb-5">
|
|
17
|
+
<v-col v-if="shouldShowField(key)" cols="12" class="mb-5">
|
|
18
18
|
<v-row no-gutters class="">
|
|
19
19
|
<v-col class="font-weight-bold">{{ label }}:</v-col>
|
|
20
20
|
|
|
@@ -311,6 +311,10 @@ function getFieldValue(key: keyof TAnnouncement) {
|
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
function shouldShowField(key: string) {
|
|
315
|
+
return key !== "endDate" || !prop.activeAnnouncement?.noExpiration;
|
|
316
|
+
}
|
|
317
|
+
|
|
314
318
|
const rawFileArray = ref<{ file: File; _id: string; preview: boolean }[]>([]);
|
|
315
319
|
|
|
316
320
|
const photosArray = getByType("image/");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.0.3-staging.
|
|
5
|
+
"version": "4.0.3-staging.228",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|