@christianriedl/media 1.0.293 → 1.0.294

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.293",
3
+ "version": "1.0.294",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -8,8 +8,8 @@
8
8
  const emits = defineEmits<{ (e: 'select', value: IPhotoRegion): void }>();
9
9
 
10
10
  const apiKey = props.googleApiKey;
11
- const getMediaService = inject(getMediaBinSymbol)!;
12
- const mediaService = getMediaService() ;
11
+ const getMediaService = inject(getMediaBinSymbol);
12
+ const mediaService = getMediaService ?? getMediaService() : null;
13
13
 
14
14
  const mapRef = ref(GoogleMap);
15
15
  const mapSizeStyle = computed(() => {
@@ -227,8 +227,8 @@
227
227
  photoLeft.value = { 'left': left + 'px' };
228
228
  photoHeight.value = Math.floor(h * fac);
229
229
  photoWidth.value = Math.floor(w * fac);
230
- const albumUrl = mediaService.getFolder(photo.dlnaParentId).url;
231
- photoUrl = mediaService.getPhotoUrl(albumUrl, photo.url, `${0}x${photoHeight.value}x${photo.orientation}x70`);
230
+ const albumUrl = mediaService!.getFolder(photo.dlnaParentId).url;
231
+ photoUrl = mediaService!.getPhotoUrl(albumUrl, photo.url, `${0}x${photoHeight.value}x${photo.orientation}x70`);
232
232
  console.log (`left:${left} w:${photoWidth.value} h:${photoHeight.value} : ${photoUrl}`);
233
233
  photoTitle = photo.title ? photo.title : photo.name;
234
234
  showPhoto.value = true;
@@ -3,7 +3,7 @@
3
3
  import { Dictionary, Helper } from '@christianriedl/utils';
4
4
  import { IPictureFile, EOrientation, EPictureFlags, getMediaBinSymbol } from '@christianriedl/media';
5
5
 
6
- const props = defineProps<{ file: IPictureFile, all: boolean, splitxmp: boolean }>();
6
+ const props = defineProps<{ file: IPictureFile, all: boolean, splitxmp: boolean, metadata?: Dictionary<any> }>();
7
7
 
8
8
  interface ITree {
9
9
  id: number;
@@ -15,24 +15,34 @@
15
15
  const properties = ref<Dictionary<any>>({});
16
16
  const propertiesVisible = ref(false);
17
17
  const getMediaService = inject(getMediaBinSymbol)!;
18
- const mediaService = getMediaService();
18
+ const mediaService = getMediaService ? getMediaService() : null;
19
19
  const treeColumns = computed(() => props.splitxmp ? 3 : 2);
20
20
  let metadata: Dictionary<any>;
21
21
  let allMetaData: Dictionary<any>;
22
-
23
- watch(() => props.all, async () => await fetchMetaData(), { immediate: true });
24
- watch(() => props.splitxmp, () => buildTree());
25
-
22
+ if (props.metadata) {
23
+ if (props.all) {
24
+ allMetaData = props.metadata;
25
+ buildTree();
26
+ }
27
+ else {
28
+ setMetaData(props.metadata, props.file);
29
+ properties.value = metadata;
30
+ }
31
+ }
32
+ else {
33
+ watch(() => props.all, async () => await fetchMetaData(), { immediate: true });
34
+ watch(() => props.splitxmp, () => buildTree());
35
+ }
26
36
  async function fetchMetaData() {
27
37
  if (props.all) {
28
38
  if (!allMetaData) {
29
- allMetaData = await mediaService.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
39
+ allMetaData = await mediaService!.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
30
40
  }
31
41
  buildTree();
32
42
  }
33
43
  else {
34
44
  if (!metadata) {
35
- const data = await mediaService.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
45
+ const data = await mediaService!.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
36
46
  setMetaData(data, props.file);
37
47
  }
38
48
  properties.value = metadata;
@@ -177,26 +187,33 @@
177
187
  </script>
178
188
  <template>
179
189
  <v-container v-if="props.all">
180
- <v-row density="compact">
181
- <v-col :cols="treeColumns">
182
- <v-treeview :items="tree" item-value="id" open-all activatable slim active-startegy="leaf"
183
- density="compact" @update:activated="onSelectTree">
184
- </v-treeview>
185
- </v-col>
186
- <v-col v-if="propertiesVisible" :cols="12 - treeColumns">
187
- <v-row density="compact" v-for="(prop,key) in properties" :key="key">
188
- <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
189
- <v-col cols="8">{{prop}}</v-col>
190
- <v-divider></v-divider>
191
- </v-row>
192
- </v-col>
193
- </v-row>
190
+ <v-row density="compact">
191
+ <v-col :cols="treeColumns">
192
+ <v-treeview :items="tree" item-value="id" open-all activatable slim active-startegy="leaf"
193
+ density="compact" @update:activated="onSelectTree">
194
+ </v-treeview>
195
+ </v-col>
196
+ <v-col v-if="propertiesVisible" :cols="12 - treeColumns">
197
+ <v-row density="compact" v-for="(prop,key) in properties" :key="key">
198
+ <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
199
+ <v-col cols="8">{{prop}}</v-col>
200
+ <v-divider></v-divider>
201
+ </v-row>
202
+ </v-col>
203
+ </v-row>
194
204
  </v-container>
195
205
  <v-container v-else>
196
- <v-row v-for="(value, key) in properties" :key="key">
197
- <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
198
- <v-col cols="8">{{value}}</v-col>
199
- <v-divider></v-divider>
200
- </v-row>
206
+ <v-row v-for="(value, key) in properties" :key="key">
207
+ <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
208
+ <v-col cols="8">{{value}}</v-col>
209
+ <v-divider></v-divider>
210
+ </v-row>
201
211
  </v-container>
202
212
  </template>
213
+
214
+ <style scoped>
215
+ .v-row--density-default {
216
+ --v-col-gap-x: 0px;
217
+ --v-col-gap-y: 0px;
218
+ }
219
+ </style>