@mapomodule/uikit 1.0.0-alpha.35 → 1.0.0-alpha.37

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 CHANGED
@@ -3,6 +3,37 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.37](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-11-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * better icon sizing for media m2m ([2c241f8](https://github.com/lotrekagency/mapo/commit/2c241f85ab5c0ccee772dd28beb4d917fbed9c97))
12
+ * fix gallery ui interface ([6570535](https://github.com/lotrekagency/mapo/commit/6570535dcd8a515c798eff5026ec781c52e06b7a))
13
+ * fix index layout ([7b15fcc](https://github.com/lotrekagency/mapo/commit/7b15fcc846b829555d7a0aa7b1f309f57107fd66))
14
+ * fixed fields init values ([23f1658](https://github.com/lotrekagency/mapo/commit/23f1658928dd5742125b01e997af6444d713144d))
15
+ * fixed media m2m readonly ([5fa3f80](https://github.com/lotrekagency/mapo/commit/5fa3f805a99f6b77910b35b46c688ff3b1292545))
16
+
17
+
18
+ ### Features
19
+
20
+ * better handle videow preview in mobile mode ([e3120f3](https://github.com/lotrekagency/mapo/commit/e3120f3652e5a53adf6b6b99059ce828fb8f9f03))
21
+
22
+
23
+
24
+
25
+
26
+ # [1.0.0-alpha.36](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-11-12)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * fix media preview type checks ([580515f](https://github.com/lotrekagency/mapo/commit/580515f9bba9786056159d9fc11af1ce90aecbdb))
32
+
33
+
34
+
35
+
36
+
6
37
  # [1.0.0-alpha.35](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-11-11)
7
38
 
8
39
 
@@ -36,7 +36,7 @@ export default {
36
36
  name: "DateField",
37
37
  data() {
38
38
  return {
39
- model: null,
39
+ model: this.value,
40
40
  menu: null,
41
41
  };
42
42
  },
@@ -66,9 +66,6 @@ export default {
66
66
  //@arg Emits the date or the date range edited.
67
67
  this.$emit("input", val);
68
68
  },
69
- },
70
- mounted() {
71
- this.model = this.value;
72
- },
69
+ }
73
70
  };
74
71
  </script>
@@ -15,7 +15,7 @@ export default {
15
15
  name: "FksField",
16
16
  data() {
17
17
  return {
18
- model: null,
18
+ model: this.value,
19
19
  options: this.items || [],
20
20
  loading: false,
21
21
  };
@@ -3,13 +3,13 @@
3
3
  <v-text-field
4
4
  readonly
5
5
  v-bind="$attrs"
6
- @click="dialog = hasSelection ? dialog : true"
6
+ @click="hasSelection || editSelection()"
7
7
  class="media-m2m--card rounded-0"
8
8
  :class="{ 'media-m2m--selected': !!hasSelection }"
9
9
  :value="hasSelection ? ' ' : ''"
10
10
  >
11
11
  <template v-slot:append>
12
- <v-btn v-if="hasSelection" @click="dialog = true" tile small>{{
12
+ <v-btn v-if="hasSelection" @click="editSelection" tile small>{{
13
13
  $t("mapo.mediaM2MField.editSelection")
14
14
  }}</v-btn>
15
15
  <v-virtual-scroll
@@ -26,6 +26,7 @@
26
26
  :media="item"
27
27
  :video-preview="!item.is_image"
28
28
  class="media-m2m--preview"
29
+ icon-size="30"
29
30
  />
30
31
  </v-list-item-avatar>
31
32
 
@@ -95,7 +96,7 @@
95
96
  import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
96
97
 
97
98
  /**
98
- * This component is made to simplify ManyToMany and ForeignKeys associations. With this component you can modify an array selecting items from a list of checkboxes or a signle item selecting from a checkbox.
99
+ * This component is made to manage media fields for multiple selection.
99
100
  */
100
101
 
101
102
  export default {
@@ -126,6 +127,10 @@ export default {
126
127
  removeItem(media) {
127
128
  this.model = this.model.filter(({ id }) => id != media.id);
128
129
  },
130
+ editSelection(){
131
+ if (!this.readonly)
132
+ this.dialog = true;
133
+ }
129
134
  },
130
135
  watch: {
131
136
  value(val) {
@@ -55,7 +55,7 @@ export default {
55
55
  data() {
56
56
  return {
57
57
  editorInstance: null,
58
- editorContent: "",
58
+ editorContent: this.value,
59
59
  };
60
60
  },
61
61
 
@@ -10,18 +10,7 @@
10
10
  class="elevation-4 media-gallery--selection-item"
11
11
  />
12
12
  </div>
13
- <div class="media-gallery--loading" v-if="loading">
14
- <v-progress-circular
15
- size="60"
16
- color="primary"
17
- indeterminate
18
- ></v-progress-circular>
19
- </div>
20
- <div class="media-gallery--empty" v-else-if="!medias.length">
21
- <v-icon size="60"> mdi-image-off-outline </v-icon>
22
- <p>{{ $t("mapo.mediaGallery.noMediaFound") }}</p>
23
- </div>
24
- <div class="media-gallery--masonry" v-else>
13
+ <div ref="masonry" class="media-gallery--masonry" v-if="medias.length">
25
14
  <div
26
15
  v-for="media in medias"
27
16
  :key="media.file"
@@ -48,6 +37,14 @@
48
37
  />
49
38
  </div>
50
39
  </div>
40
+ <div class="media-gallery--loading" v-else-if="loading">
41
+ <v-icon size="30">mdi-timer-sand</v-icon>
42
+ {{ $t('mapo.fetchingData') }}
43
+ </div>
44
+ <div class="media-gallery--empty" v-else>
45
+ <v-icon size="60"> mdi-image-off-outline </v-icon>
46
+ <p>{{ $t("mapo.mediaGallery.noMediaFound") }}</p>
47
+ </div>
51
48
  <v-pagination
52
49
  class="mt-2"
53
50
  v-if="pages > 1"
@@ -178,7 +175,9 @@ export default {
178
175
  return this.page;
179
176
  },
180
177
  set(val) {
181
- this.getRoot({ page: val })
178
+ this.getRoot({ page: val }).then(() => {
179
+ this.$refs.masonry?.scrollTo({ top: 0, behavior: "smooth" })
180
+ })
182
181
  },
183
182
  },
184
183
  },
@@ -29,13 +29,14 @@
29
29
  dense
30
30
  clearable
31
31
  :loading="loadingSearch"
32
- class="mx-2 mt-2"
32
+ class="mx-2 mt-2 rounded-0"
33
33
  ></v-text-field>
34
34
  <v-btn v-show="!$vuetify.breakpoint.xs" class="ma-2 ml-0" @click="getRoot" icon>
35
35
  <v-icon>mdi-update</v-icon>
36
36
  </v-btn>
37
37
  </div>
38
38
  </v-card-title>
39
+ <v-progress-linear v-if="loading" indeterminate></v-progress-linear>
39
40
  <MediaBreadcrumbs/>
40
41
  <v-card-text class="media-manager--card-text pa-0">
41
42
  <v-tabs-items touchless v-model="tab" class="transparent fill-height">
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <v-img
3
- :src="(media.is_image && media.file) || null"
4
- :lazy-src="(media.is_image && media.thumbnail) || null"
3
+ :src="(isImage && media.file) || null"
4
+ :lazy-src="(isImage && media.thumbnail) || null"
5
5
  aspect-ratio="1"
6
6
  class="grey lighten-2"
7
7
  :class="{
@@ -15,7 +15,7 @@
15
15
  <template v-slot:placeholder>
16
16
  <v-row class="fill-height ma-0" align="center" justify="center">
17
17
  <v-progress-circular
18
- v-if="media.is_image"
18
+ v-if="isImage"
19
19
  indeterminate
20
20
  color="grey lighten-5"
21
21
  ></v-progress-circular>
@@ -93,6 +93,13 @@
93
93
  </style>
94
94
 
95
95
  <script>
96
+
97
+ const extensions = {
98
+ image: ["png", "jpg", "jpeg", "avif", "webp"],
99
+ audio: ["mp3", "ogg", "flac"],
100
+ video: ["mp4", "webm", "avi", "mov", "wmv"]
101
+ }
102
+
96
103
  export default {
97
104
  data() {
98
105
  return {
@@ -135,22 +142,42 @@ export default {
135
142
  "70px"
136
143
  );
137
144
  },
138
- isVideo() {
139
- return this.media.mime_type && this.media.mime_type.startsWith("video/");
145
+ isImage() {
146
+ if (this.media?.mime_type)
147
+ return this.media.mime_type.startsWith("image/");
148
+ return extensions.image.includes(this.media?.file?.split(".").pop()?.toLowerCase())
140
149
  },
150
+ isVideo() {
151
+ if (this.media?.mime_type)
152
+ return this.media.mime_type.startsWith("video/");
153
+ return extensions.video.includes(this.media?.file?.split(".").pop()?.toLowerCase())
154
+ },
141
155
  isAudio() {
142
- return this.media.mime_type && this.media.mime_type.startsWith("audio/");
156
+ if (this.media?.mime_type)
157
+ return this.media.mime_type.startsWith("audio/");
158
+ return extensions.audio.includes(this.media?.file?.split(".").pop()?.toLowerCase())
143
159
  },
144
160
  videoListeners() {
145
161
  if (this.isVideo && this.videoPreview) {
146
162
  return {
147
163
  mouseenter: this.startVideoPreview,
148
164
  mouseleave: this.stopVideoPreview,
165
+ touchstart: this.handleTouch
149
166
  };
150
167
  }
151
168
  },
152
169
  },
153
170
  methods: {
171
+ handleTouch(event){
172
+ const video = this.$refs.video;
173
+ if (video && !this.playing) {
174
+ this.startVideoPreview()
175
+ event.preventDefault()
176
+ event.stopPropagation()
177
+ } else {
178
+ this.stopVideoPreview()
179
+ }
180
+ },
154
181
  startVideoPreview() {
155
182
  const video = this.$refs.video;
156
183
  if (video && !this.playing) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.35",
3
+ "version": "1.0.0-alpha.37",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -15,5 +15,5 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "gitHead": "dd40443bd7e5fdaf91799444f59faae5a6dd03bf"
18
+ "gitHead": "0b662c6cdd42bc868259cd2b37f208d5fc72e239"
19
19
  }
package/pages/index.vue CHANGED
@@ -1,21 +1,23 @@
1
1
  <template>
2
- <v-row justify="center" align="center">
3
- <v-col cols="12" sm="8" md="12">
4
- <div class="mapo-info">
5
- <h1 id="mapo">
6
- <code>mapomodule {{ version }}</code>
7
- </h1>
8
- <br>
9
- <br>
10
- <code>{{ $t('mapo.index.welcomeMessage') }}</code>
11
- <br>
12
- <br>
13
- <code>
14
- ## TODO INSERT HERE A LITTLE TUTORIAL.
15
- </code>
16
- </div>
17
- </v-col>
18
- </v-row>
2
+ <v-container>
3
+ <v-row justify="center" align="center">
4
+ <v-col cols="12" sm="8" md="12">
5
+ <div class="mapo-info">
6
+ <h1 id="mapo">
7
+ <code>mapomodule {{ version }}</code>
8
+ </h1>
9
+ <br>
10
+ <br>
11
+ <code>{{ $t('mapo.index.welcomeMessage') }}</code>
12
+ <br>
13
+ <br>
14
+ <code>
15
+ ## TODO INSERT HERE A LITTLE TUTORIAL.
16
+ </code>
17
+ </div>
18
+ </v-col>
19
+ </v-row>
20
+ </v-container>
19
21
  </template>
20
22
 
21
23
  <style scoped>