@7365admin1/layer-common 4.0.3-staging.227 → 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>
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.227",
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.",