@mapomodule/uikit 1.0.0-alpha.21 → 1.0.0-alpha.24

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/components/ConfirmDialog.vue +10 -14
  3. package/components/Detail/Detail.vue +246 -365
  4. package/components/DropArea.vue +17 -33
  5. package/components/Form/Form.vue +228 -0
  6. package/components/{Detail/DetailField.vue → Form/FormField.vue} +35 -15
  7. package/components/Form/FormGroup.vue +108 -0
  8. package/components/Form/FormTabs.vue +151 -0
  9. package/components/{Detail → Form}/defaults.js +0 -0
  10. package/components/{fields → Form/fields}/DateField.vue +3 -3
  11. package/components/{fields → Form/fields}/FileField.vue +0 -0
  12. package/components/{fields → Form/fields}/FksField.vue +2 -2
  13. package/components/{fields → Form/fields}/MediaField.vue +4 -5
  14. package/components/{fields → Form/fields}/MediaM2mField.vue +3 -3
  15. package/components/Form/fields/Repeater.vue +575 -0
  16. package/components/{fields → Form/fields}/SeoPreview.vue +10 -10
  17. package/components/{fields → Form/fields}/wygEditor/defaults.js +0 -0
  18. package/components/{fields → Form/fields}/wygEditor/utils/events.js +0 -0
  19. package/components/{fields → Form/fields}/wygEditor/utils/mapomedia.plugin.js +0 -0
  20. package/components/{fields → Form/fields}/wygEditor/utils/script.injector.js +0 -0
  21. package/components/{fields → Form/fields}/wygEditor/wygEditor.vue +0 -0
  22. package/components/LangSwitcher.vue +44 -0
  23. package/components/List/List.vue +14 -15
  24. package/components/List/ListActions.vue +5 -5
  25. package/components/List/ListFilters.vue +9 -2
  26. package/components/List/ListHead.vue +1 -1
  27. package/components/List/ListQuickEdit.vue +21 -104
  28. package/components/List/ListTable.vue +15 -18
  29. package/components/Login.vue +5 -4
  30. package/components/LogoutButton.vue +43 -28
  31. package/components/MediaManager/MediaEditor.vue +20 -18
  32. package/components/MediaManager/MediaFolders.vue +14 -19
  33. package/components/MediaManager/MediaGallery.vue +1 -1
  34. package/components/MediaManager/MediaManager.vue +22 -15
  35. package/components/MediaManager/MediaManagerDialog.vue +2 -1
  36. package/components/MediaManager/MediaUploader.vue +6 -7
  37. package/components/SnackBar.vue +2 -3
  38. package/components/layout/Sidebar/SidebarFooter.vue +6 -25
  39. package/components/layout/Sidebar/SidebarListItem.vue +2 -2
  40. package/components/layout/Sidebar/SidebarProfile.vue +2 -2
  41. package/defaults.js +70 -24
  42. package/module.js +12 -4
  43. package/package.json +4 -3
  44. package/pages/index.vue +1 -1
  45. package/translations/en-US.js +129 -0
  46. package/translations/it-IT.js +131 -0
  47. package/components/fields/Repeater.vue +0 -338
@@ -0,0 +1,151 @@
1
+ <template>
2
+ <v-card v-if="conf" class="tabs-card my-2 rounded-0 elevation-0">
3
+ <v-card-title :class="conf.group.titleClass" v-if="hasTitle">
4
+ <slot name="title.before" v-bind="slotBindings" />
5
+ <slot name="title" v-bind="slotBindings">
6
+ <v-icon left> {{ conf.group.icon }} </v-icon>
7
+ <span>{{ conf.group.name }}</span>
8
+ </slot>
9
+ <slot name="title.after" v-bind="slotBindings" />
10
+ </v-card-title>
11
+ <div class="container">
12
+ <v-tabs v-model="tabIndex" class="tab-wrapper">
13
+ <v-tab v-for="(tab, index) in conf.tabs" :key="index" v-show="show(tab)">
14
+ <v-badge :value="hasErrors(tab)" color="error" dot>
15
+ {{ tab.label }} <v-icon v-if="tab.icon">{{ tab.icon }}</v-icon>
16
+ </v-badge>
17
+ </v-tab>
18
+ </v-tabs>
19
+ <v-tabs-items v-model="tabIndex">
20
+ <v-tab-item v-for="(tab, index) in conf.tabs" :key="index" class="pt-8">
21
+ <slot :name="`tab.${tab.slug}`" v-bind="slotBindings">
22
+ <Form
23
+ v-model="model"
24
+ v-bind="{ currentLang, errors, languages, readonly }"
25
+ :fields="tab.fields"
26
+ :moreSlotBindings="slotBindings"
27
+ >
28
+ <template
29
+ v-for="slot in nameSpacedSlots($slots, `tab.${tab.slug}.`)"
30
+ :slot="slot"
31
+ >
32
+ <slot :name="`tab.${tab.slug}.${slot}`"></slot>
33
+ </template>
34
+ <template
35
+ v-for="slot in nameSpacedSlots(
36
+ $scopedSlots,
37
+ `tab.${tab.slug}.`
38
+ )"
39
+ v-slot:[slot]="props"
40
+ >
41
+ <slot :name="`tab.${tab.slug}.${slot}`" v-bind="props" />
42
+ </template>
43
+ </Form>
44
+ </slot>
45
+ </v-tab-item>
46
+ </v-tabs-items>
47
+ </div>
48
+ </v-card>
49
+ </template>
50
+
51
+ <style lang="scss" scoped>
52
+ .tab-wrapper {
53
+ margin: -12px 0 0 -12px;
54
+ }
55
+ .theme--light .tabs-card {
56
+ border: 1px solid rgba(0, 0, 0, 0.12);
57
+ }
58
+ </style>
59
+ <script>
60
+ import { findPropPaths } from "@mapomodule/utils/helpers/objHelpers";
61
+ import { nameSpacedSlots } from "@mapomodule/utils/helpers/slots";
62
+
63
+ export default {
64
+ name: "FormTabs",
65
+ data() {
66
+ return {
67
+ model: {},
68
+ tabIndex: 0,
69
+ };
70
+ },
71
+ props: {
72
+ // V-model of the object we are editing.
73
+ value: {
74
+ type: Object,
75
+ required: true,
76
+ },
77
+ // Set the current lang to value.
78
+ currentLang: {
79
+ type: String,
80
+ required: false,
81
+ },
82
+ // Makes all the fields readonly.
83
+ readonly: Boolean,
84
+ // An object representing all the errors of all fields. This means that this component will find the error of its field following the dottedPath of the value in the error dict.
85
+ errors: Object,
86
+ // Additional bindings to indrease slots capabilities
87
+ moreSlotBindings: Object,
88
+ // The main configuration that determines the arrangement of the fields in the detail layout.
89
+ conf: {
90
+ type: Object,
91
+ required: true,
92
+ },
93
+ // A list of languages into which the payload needs to be translated.
94
+ languages: {
95
+ type: Array,
96
+ default: () => [],
97
+ },
98
+ },
99
+ watch: {
100
+ value(val) {
101
+ this.model = val;
102
+ },
103
+ model(val) {
104
+ this.$emit("input", val);
105
+ },
106
+ },
107
+ computed: {
108
+ slotBindings() {
109
+ return {
110
+ model: this.model,
111
+ errors: this.errors,
112
+ currentLang: this.currentLang,
113
+ langs: this.languages,
114
+ ...this.moreSlotBindings,
115
+ };
116
+ },
117
+ hasTitle() {
118
+ return !!(
119
+ Object.keys({ ...this.$scopedSlots, ...this.$slots }).some((s) =>
120
+ s.startsWith("title")
121
+ ) ||
122
+ this.conf.group.name ||
123
+ this.conf.group.icon
124
+ );
125
+ },
126
+ },
127
+ methods: {
128
+ nameSpacedSlots,
129
+ hasErrors(tab) {
130
+ return findPropPaths(this.errors || {}, ({ val }) =>
131
+ Array.isArray(val)
132
+ ).some((k) => tab.fields.some((f) => k.startsWith(f.value)));
133
+ },
134
+ show(conf, type = "display"){
135
+ const prop = type == "visibility" ? "vVisible" : "vShow"
136
+ if (typeof conf[prop] == "function") {
137
+ return conf[prop]({
138
+ model: this.model,
139
+ errors: this.errors,
140
+ languages: this.languages,
141
+ currentLang: this.currentLang
142
+ })
143
+ }
144
+ return true
145
+ },
146
+ },
147
+ created() {
148
+ this.model = this.value;
149
+ },
150
+ };
151
+ </script>
File without changes
@@ -21,8 +21,8 @@
21
21
  ></v-text-field>
22
22
  </template>
23
23
  <v-date-picker v-model="model" :range="range" no-title>
24
- <v-btn text color="primary" @click="menu = false"> Cancel </v-btn>
25
- <v-btn text color="primary" @click="$refs.menu.save(model)"> OK </v-btn>
24
+ <v-btn text color="primary" @click="menu = false">{{ $t("mapo.cancel") }}</v-btn>
25
+ <v-btn text color="primary" @click="$refs.menu.save(model)">{{ $t("mapo.ok") }}</v-btn>
26
26
  </v-date-picker>
27
27
  </v-menu>
28
28
  </div>
@@ -71,4 +71,4 @@ export default {
71
71
  this.model = this.value;
72
72
  },
73
73
  };
74
- </script>
74
+ </script>
File without changes
@@ -40,7 +40,7 @@ export default {
40
40
  chips: this.$attrs.multiple === false ? false : true,
41
41
  multiple: true,
42
42
  loading: this.loading,
43
- noDataText: this.loading ? "Fetching data.." : undefined,
43
+ noDataText: this.loading ? this.$t("mapo.fetchingData") : undefined,
44
44
  ...this.$attrs,
45
45
  };
46
46
  },
@@ -85,4 +85,4 @@ export default {
85
85
  }
86
86
  },
87
87
  };
88
- </script>
88
+ </script>
@@ -14,7 +14,6 @@
14
14
  v-if="mediaExists"
15
15
  :src="internalValue.is_image && internalValue.file || null"
16
16
  :lazy-src="internalValue.is_image && internalValue.thumbnail || null"
17
-
18
17
  :class="{'grey lighten-2': !internalValue.is_image}"
19
18
  v-bind="{
20
19
  aspectRatio,
@@ -200,9 +199,9 @@ export default {
200
199
  confirmDelete() {
201
200
  this.$mapo.$confirm
202
201
  .open({
203
- title: "Remove",
204
- question: "Are you sure to want to remove this media?",
205
- approveButton: { text: "Remove", attrs: { color: "red", text: true } }
202
+ title: this.$t("mapo.remove"),
203
+ question: this.$t("mapo.mediaField.confirmRemove"),
204
+ approveButton: { text: this.$t("mapo.remove"), attrs: { color: "red", text: true } }
206
205
  })
207
206
  .then((res) => (res ? (this.internalValue = null) : null));
208
207
  },
@@ -222,4 +221,4 @@ export default {
222
221
  this.internalValue = this.val
223
222
  }
224
223
  };
225
- </script>
224
+ </script>
@@ -13,7 +13,7 @@
13
13
  light: !dark,
14
14
  }"
15
15
  >
16
- <v-card-title v-if="!pages">Media Carousel</v-card-title>
16
+ <v-card-title v-if="!pages">{{ $t("mapo.mediaM2MField.mediaCarousel") }}</v-card-title>
17
17
  <v-card-actions>
18
18
  <v-row justify="center" class="ma-1" no-gutters>
19
19
  <v-col>
@@ -23,7 +23,7 @@
23
23
  outlined
24
24
  :min-height="pages ? undefined : minHeight"
25
25
  >
26
- <div v-if="pages">New Selection</div>
26
+ <div v-if="pages">{{ $t("mapo.mediaM2MField.newSelection") }}</div>
27
27
  <v-icon v-else size="80"> mdi-plus-circle-outline </v-icon>
28
28
  </v-btn>
29
29
  </v-col>
@@ -240,4 +240,4 @@ export default {
240
240
  },
241
241
  },
242
242
  };
243
- </script>
243
+ </script>