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

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.
@@ -1,18 +1,16 @@
1
1
  <template>
2
2
  <div>
3
- <slot v-bind="{ on, attrs }" name="activator"></slot>
3
+ <slot v-bind="{ on, $attrs }" name="activator"></slot>
4
4
  <v-dialog v-model="dialog" max-width="100%" width="800" scrollable>
5
5
  <media-manager
6
- @selectionChange="selectionChange($event)"
7
- :selection="$attrs.selection"
8
- @update:selection="$emit('update:selection', $event)"
9
- v-bind="{ select, noFolders, mime }"
6
+ v-if="dialog"
7
+ v-bind="{ noFolders, mime }"
10
8
  elevation="0"
11
- ref="mediaManager"
9
+ fill-backgroud
12
10
  >
13
11
  <template v-slot:actions>
14
12
  <v-spacer></v-spacer>
15
- <v-btn v-if="select == 'multi'" color="primary" text @click="done">{{ $t("mapo.apply") }}</v-btn>
13
+ <v-btn v-if="select == 'multi'" color="primary" text tile @click="done">{{ $t("mapo.confirm") }}</v-btn>
16
14
  </template>
17
15
  </media-manager>
18
16
  </v-dialog>
@@ -20,14 +18,13 @@
20
18
  </template>
21
19
 
22
20
  <script>
21
+ import { mapGetters, mapActions } from "vuex"
22
+
23
23
  export default {
24
24
  name: "MediaManagerDialog",
25
25
  data() {
26
26
  return {
27
- selection: [],
28
27
  dialog: false,
29
- attrs: { ...this.$attrs },
30
- reset: false,
31
28
  on: {
32
29
  click: (event) => {
33
30
  event.preventDefault();
@@ -52,6 +49,9 @@ export default {
52
49
  return ["none", "single", "multi"].indexOf(val) !== -1;
53
50
  },
54
51
  },
52
+ selected: {
53
+ type: Object | Array | null,
54
+ },
55
55
  mime: {
56
56
  type: String,
57
57
  required: false
@@ -61,17 +61,30 @@ export default {
61
61
  value(val) {
62
62
  this.dialog = val;
63
63
  },
64
+ selected(val){
65
+ this.dialog && this.setSelection(val);
66
+ },
67
+ selection(val){
68
+ if (this.dialog && !(val?.id == this.selected?.id)){
69
+ this.done()
70
+ }
71
+ },
64
72
  dialog(val) {
73
+ if(val){
74
+ this.setSelectionMode(this.select).then(() => this.setSelection(this.selected));
75
+ }
65
76
  this.$emit("input", val);
66
77
  this.$emit(val ? "open" : "close");
67
78
  if (!val && this.reject) {
68
79
  this.reject();
69
80
  }
70
- if (val && this.reset) this.$refs.mediaManager.reset();
71
- this.reset = !val;
72
81
  },
73
82
  },
83
+ computed:{
84
+ ...mapGetters("mapo/media", ["selection", "selectMode"])
85
+ },
74
86
  methods: {
87
+ ...mapActions("mapo/media", ["setSelection", "setSelectionMode"]),
75
88
  open() {
76
89
  this.dialog = true;
77
90
  return new Promise((resolve, reject) => {
@@ -79,18 +92,12 @@ export default {
79
92
  this.reject = reject;
80
93
  });
81
94
  },
82
- selectionChange(event) {
83
- this.selection = event;
84
- if (this.select == "single") {
85
- this.done();
86
- }
87
- },
88
95
  done() {
89
96
  if (this.resolve) {
90
97
  this.resolve(this.selection);
91
98
  }
92
99
  this.dialog = false;
93
- this.$emit("selectionChange", this.selection);
100
+ this.$emit("update:selected", this.selection);
94
101
  },
95
102
  },
96
103
  };
@@ -5,7 +5,6 @@
5
5
  aspect-ratio="1"
6
6
  class="grey lighten-2"
7
7
  :class="{
8
- selected,
9
8
  'media-controls': mediaControls,
10
9
  'video-preview': videoPreview,
11
10
  }"
@@ -106,10 +105,6 @@ export default {
106
105
  type: Object,
107
106
  default: () => ({}),
108
107
  },
109
- selected: {
110
- type: Boolean,
111
- default: false,
112
- },
113
108
  filename: {
114
109
  type: Boolean,
115
110
  default: false,
@@ -57,6 +57,8 @@
57
57
  </template>
58
58
 
59
59
  <script>
60
+ import { mapGetters, mapActions } from "vuex"
61
+
60
62
  export default {
61
63
  name: "MediaUploader",
62
64
  data() {
@@ -67,16 +69,8 @@ export default {
67
69
  _mediaFileCrud: null
68
70
  };
69
71
  },
70
- props: {
71
- parentFolder: {
72
- type: Object
73
- },
74
- folders: {
75
- type: Array,
76
- default: () => []
77
- }
78
- },
79
72
  computed: {
73
+ ...mapGetters("mapo/media", ["parentFolder", "folders"]),
80
74
  mediaFileCrud() {
81
75
  this._mediaFileCrud =
82
76
  this._mediaFileCrud ||
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.33",
3
+ "version": "1.0.0-alpha.35",
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>",
7
7
  "repository": "https://github.com/lotrekagency/mapo",
8
8
  "main": "./module.js",
9
9
  "dependencies": {
10
- "@mapomodule/utils": "^1.0.0-alpha.30",
10
+ "@mapomodule/utils": "^1.0.0-alpha.34",
11
11
  "@nuxtjs/i18n": "^7.2.2",
12
12
  "@nuxtjs/vuetify": "^1.12.3",
13
13
  "vuedraggable": "^2.24.3"
@@ -15,5 +15,5 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "gitHead": "a2dbae1a4fedc354c793b65a8466b83252bf1d26"
18
+ "gitHead": "dd40443bd7e5fdaf91799444f59faae5a6dd03bf"
19
19
  }
@@ -62,7 +62,7 @@ export default {
62
62
  // Form/fields/MediaM2mField.vue
63
63
  mediaM2MField: {
64
64
  mediaCarousel: "Media Carousel",
65
- newSelection: "New Selection",
65
+ editSelection: "Edit selection",
66
66
  },
67
67
  // Form/fields/Repeater.vue
68
68
  repeater: {
@@ -110,6 +110,7 @@ export default {
110
110
  },
111
111
  // MediaManager/MediaFolders.vue
112
112
  mediaFolders: {
113
+ goBack: "Go back",
113
114
  noFolders: "No folders here... Create a new one!",
114
115
  newFolder: "Add new folder",
115
116
  editFolder: "Edit folder",
@@ -62,7 +62,7 @@ export default {
62
62
  // Form/fields/MediaM2mField.vue
63
63
  mediaM2MField: {
64
64
  mediaCarousel: "Galleria Media",
65
- newSelection: "Nuova selezione",
65
+ editSelection: "Modifica selezione",
66
66
  },
67
67
  // Form/fields/Repeater.vue
68
68
  repeater: {
@@ -112,6 +112,7 @@ export default {
112
112
  },
113
113
  // MediaManager/MediaFolders.vue
114
114
  mediaFolders: {
115
+ goBack: "Torna indietro",
115
116
  noFolders: "Non sono presenti cartelle... Creane una!",
116
117
  newFolder: "Crea nuova cartella",
117
118
  editFolder: "Modifica cartella",