@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
@@ -19,7 +19,7 @@
19
19
  <v-icon :class="[dragover ? 'mt-2, mb-6' : 'mt-5']" size="60">
20
20
  mdi-cloud-upload
21
21
  </v-icon>
22
- <p>Drop your file(s) here, or click to select them.</p>
22
+ <p>{{ $t("mapo.dropArea.dropOrClick") }}</p>
23
23
  <input
24
24
  type="file"
25
25
  style="display: none"
@@ -30,9 +30,7 @@
30
30
  </v-row>
31
31
  <v-virtual-scroll
32
32
  :items="uploadedFiles"
33
- :height="
34
- uploadedFiles.length * 64 > 256 ? 256 : uploadedFiles.length * 64
35
- "
33
+ :height="uploadedFiles.length * 64 > 256 ? 256 : uploadedFiles.length * 64"
36
34
  item-height="64"
37
35
  >
38
36
  <template v-slot:default="{ item }">
@@ -41,10 +39,7 @@
41
39
  <v-img :src="item.info.objectURL"></v-img>
42
40
  </v-list-item-avatar>
43
41
 
44
- <v-list-item-content
45
- class="cursor-pointer"
46
- @click.stop="editItem(item)"
47
- >
42
+ <v-list-item-content class="cursor-pointer" @click.stop="editItem(item)">
48
43
  <v-list-item-title>
49
44
  {{ item.info.name }}
50
45
  </v-list-item-title>
@@ -74,11 +69,7 @@
74
69
  </v-btn>
75
70
  </slot>
76
71
  </v-card-actions>
77
- <v-dialog
78
- v-model="editDialog"
79
- v-bind="{ light, dark, elevation }"
80
- max-width="500px"
81
- >
72
+ <v-dialog v-model="editDialog" v-bind="{ light, dark, elevation }" max-width="500px">
82
73
  <v-card v-if="editedItem">
83
74
  <v-card-title>
84
75
  <!-- Slot to provide custom edit card title. Exposes `editedItem`. -->
@@ -102,7 +93,7 @@
102
93
  <v-col cols="12">
103
94
  <v-text-field
104
95
  v-model="editedItem.name"
105
- label="File name"
96
+ :label="$t('mapo.fileName')"
106
97
  ></v-text-field>
107
98
  </v-col>
108
99
  </v-row>
@@ -112,8 +103,8 @@
112
103
 
113
104
  <v-card-actions>
114
105
  <v-spacer></v-spacer>
115
- <v-btn color="primary" text @click="closeEdit"> Cancel </v-btn>
116
- <v-btn color="primary" text @click="saveEdit"> Save </v-btn>
106
+ <v-btn color="primary" text @click="closeEdit">{{ $t("mapo.cancel") }}</v-btn>
107
+ <v-btn color="primary" text @click="saveEdit">{{ $t("mapo.save") }}</v-btn>
117
108
  </v-card-actions>
118
109
  </v-card>
119
110
  </v-dialog>
@@ -133,8 +124,8 @@ import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
133
124
  * You can drag and drop over the button or click it to load the files.
134
125
  * When files are loaded into the component it will emit an event containing all the files.
135
126
  * This component will not take care of the actual file upload.
136
- *
137
- */
127
+ *
128
+ */
138
129
  export default {
139
130
  name: "DropArea",
140
131
  props: {
@@ -174,9 +165,7 @@ export default {
174
165
  this.uploadedFiles = [];
175
166
  },
176
167
  removeFile(fileName) {
177
- const index = this.uploadedFiles.findIndex(
178
- (file) => file.info.name === fileName
179
- );
168
+ const index = this.uploadedFiles.findIndex((file) => file.info.name === fileName);
180
169
  if (index > -1) this.uploadedFiles.splice(index, 1);
181
170
  },
182
171
  pickFile() {
@@ -193,7 +182,7 @@ export default {
193
182
  if (this.uploadedFiles.length > 0) this.uploadedFiles = [];
194
183
  if (!this.multiple && files.length > 1) {
195
184
  this.$mapo.$snack.open({
196
- message: "Only one file can be uploaded at a time..",
185
+ message: this.$t("mapo.dropArea.onlyOneFile"),
197
186
  color: "error",
198
187
  });
199
188
  } else {
@@ -207,9 +196,7 @@ export default {
207
196
  processFile(blob) {
208
197
  return {
209
198
  info: {
210
- objectURL: blob.type.startsWith("image/")
211
- ? URL.createObjectURL(blob)
212
- : null,
199
+ objectURL: blob.type.startsWith("image/") ? URL.createObjectURL(blob) : null,
213
200
  name: blob.name,
214
201
  size: humanFileSize(blob.size, true, 2),
215
202
  type: blob.type,
@@ -223,10 +210,7 @@ export default {
223
210
  this.editDialog = true;
224
211
  },
225
212
  saveEdit() {
226
- this.uploadedFiles[this.editedIndex].info = Object.assign(
227
- {},
228
- this.editedItem
229
- );
213
+ this.uploadedFiles[this.editedIndex].info = Object.assign({}, this.editedItem);
230
214
  this.closeEdit();
231
215
  },
232
216
  closeEdit() {
@@ -240,11 +224,11 @@ export default {
240
224
  watch: {
241
225
  uploadedFiles(val) {
242
226
  /** Fires when the list of files loaded changes
243
- * @arg This emits a list of files in the format {info, blob} where the blob is a
244
- * [File](https://developer.mozilla.org/en-US/docs/Web/API/File) and info are some custom info about the file.
245
- */
227
+ * @arg This emits a list of files in the format {info, blob} where the blob is a
228
+ * [File](https://developer.mozilla.org/en-US/docs/Web/API/File) and info are some custom info about the file.
229
+ */
246
230
  this.$emit("change", val);
247
231
  },
248
232
  },
249
233
  };
250
- </script>
234
+ </script>
@@ -0,0 +1,228 @@
1
+ <template>
2
+ <div class="row">
3
+ <div
4
+ class="col-12"
5
+ :class="field.class"
6
+ v-for="(field, index) in computedFields"
7
+ :key="index"
8
+ v-show="show(field)"
9
+ :style="show(field, 'visibility') ? '' : 'opacity: 0; visibility: hidden;'"
10
+ >
11
+ <FormTabs
12
+ v-if="field.tabs"
13
+ v-model="model"
14
+ v-bind="{ currentLang, errors, languages, readonly }"
15
+ :conf="field"
16
+ :moreSlotBindings="slotBindings"
17
+ >
18
+ <template
19
+ v-for="slot in nameSpacedSlots($slots, `group.${field.group.slug}.`)"
20
+ :slot="slot"
21
+ >
22
+ <slot :name="`group.${field.group.slug}.${slot}`"></slot>
23
+ </template>
24
+ <template
25
+ v-for="slot in nameSpacedSlots($scopedSlots, `group.${field.group.slug}.`)"
26
+ v-slot:[slot]="props"
27
+ >
28
+ <slot :name="`group.${field.group.slug}.${slot}`" v-bind="props" />
29
+ </template>
30
+ </FormTabs>
31
+ <FormGroup
32
+ v-else-if="field.group"
33
+ v-model="model"
34
+ v-bind="{ currentLang, errors, languages, readonly }"
35
+ :conf="field"
36
+ :moreSlotBindings="slotBindings"
37
+ >
38
+ <template
39
+ v-for="slot in nameSpacedSlots($slots, `group.${field.group.slug}.`)"
40
+ :slot="slot"
41
+ >
42
+ <slot :name="`group.${field.group.slug}.${slot}`"></slot>
43
+ </template>
44
+ <template
45
+ v-for="slot in nameSpacedSlots($scopedSlots, `group.${field.group.slug}.`)"
46
+ v-slot:[slot]="props"
47
+ >
48
+ <slot :name="`group.${field.group.slug}.${slot}`" v-bind="props" />
49
+ </template>
50
+ </FormGroup>
51
+
52
+ <div v-else>
53
+ <slot :name="field.slotName + '.before'" v-bind="{ conf: field, ...slotBindings, }" />
54
+ <slot
55
+ :name="field.slotName"
56
+ v-bind="{ conf: field, ...slotBindings, }"
57
+ >
58
+ <FormField
59
+ v-model="model"
60
+ v-bind="{ currentLang, errors, readonly }"
61
+ :langs="languages"
62
+ :conf="field"
63
+ >
64
+ <template
65
+ v-for="slot in nameSpacedSlots($slots, `fields.${field.value}.`)"
66
+ :slot="slot"
67
+ >
68
+ <slot :name="`fields.${field.value}.${slot}`"></slot>
69
+ </template>
70
+ <template
71
+ v-for="slot in nameSpacedSlots($scopedSlots, `fields.${field.value}.`)"
72
+ v-slot:[slot]="props"
73
+ >
74
+ <slot :name="`fields.${field.value}.${slot}`" v-bind="props" />
75
+ </template>
76
+ </FormField>
77
+ </slot>
78
+ <slot :name="field.slotName + '.after'" v-bind="{ conf: field, ...slotBindings, }" />
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </template>
83
+ <script>
84
+ import { nameSpacedSlots } from "@mapomodule/utils/helpers/slots";
85
+ import { slugify, titleCase } from "@mapomodule/utils/helpers/formatters";
86
+ import { deepClone } from "@mapomodule/utils/helpers/objHelpers";
87
+
88
+ export default {
89
+ name: "Form",
90
+ data() {
91
+ return {
92
+ model: {},
93
+ internalFields: []
94
+ };
95
+ },
96
+ props: {
97
+ // V-model of the object we are editing.
98
+ value: {
99
+ type: Object,
100
+ required: true,
101
+ },
102
+ // Set the current lang to value.
103
+ currentLang: {
104
+ type: String,
105
+ required: false,
106
+ },
107
+ // Makes all the fields readonly.
108
+ readonly: Boolean,
109
+ // 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.
110
+ errors: Object,
111
+ // Additional bindings to indrease slots capabilities
112
+ moreSlotBindings: Object,
113
+ // The main configuration that determines the arrangement of the fields in the detail layout.
114
+ fields: {
115
+ // [`DetailConfiguration`](#detailconfiguration)
116
+ type: Object | Array,
117
+ required: true,
118
+ },
119
+ // A list of languages into which the payload needs to be translated.
120
+ languages: {
121
+ type: Array,
122
+ default: () => [],
123
+ },
124
+ },
125
+ watch: {
126
+ value(val) {
127
+ this.model = val;
128
+ this.initLang();
129
+ },
130
+ model(val) {
131
+ this.$emit("input", val);
132
+ },
133
+ fields(val){
134
+ this.internalFields = this.cloneFields(val)
135
+ }
136
+ },
137
+ methods: {
138
+ nameSpacedSlots,
139
+ initLang(lang = this.currentLang) {
140
+ if (lang && !this.model.translations) {
141
+ this.model.translations = {};
142
+ }
143
+ if (lang && !this.model.translations[lang]) {
144
+ this.model.translations[lang] = {};
145
+ }
146
+ },
147
+ parseConf(field, i) {
148
+ const conf = typeof field === "string" ? { value: field } : field;
149
+ conf.value = conf.value || "";
150
+ conf.value = conf.value.replace(new RegExp(`^translations\.(${this.languages.join("|")})\.?`), "");
151
+ conf.slotName = `fields.${conf.value || i}`;
152
+ if (this.currentLang && !field.synci18n) {
153
+ const base = `translations.${this.currentLang}`;
154
+ conf.value = (conf.value && `${base}.${conf.value}`) || base;
155
+ }
156
+ if (this.isReadonly) {
157
+ conf.attrs = { ...conf.attrs, readonly: true };
158
+ }
159
+ return conf;
160
+ },
161
+ parseGroup(group, icon="mdi-cube-outline") {
162
+ return typeof group === "string"
163
+ ? { name: group, slug: slugify && slugify(group), icon }
164
+ : { slug: slugify && slugify(group.name), icon, ...group };
165
+ },
166
+ parseTabs(tabs) {
167
+ return Object.keys(tabs).map(key => {
168
+ const tab = tabs[key]
169
+ return {
170
+ label: titleCase(key.replace(/_/, " ")),
171
+ slug: key,
172
+ ...tab.tab,
173
+ fields: this.mapConf(Array.isArray(tab) && tab || tab.fields || [])
174
+ }
175
+ })
176
+ },
177
+ parseTagsGroup(field){
178
+ const gType = typeof field.group
179
+ const slug = gType == "string" && slugify(field.group) || gType == "object" && slugify(field.group?.name) || Object.keys(field.tabs).join("-")
180
+ return this.parseGroup(gType == "string" ? { ...this.parseGroup(field.group, null), slug} : { slug,...field.group }, null)
181
+ },
182
+ mapConf(fields) {
183
+ return fields.map((f, i) =>
184
+ f.tabs
185
+ ? { group: this.parseTagsGroup(f), tabs: this.parseTabs(f.tabs) }
186
+ : f.group
187
+ ? { group: this.parseGroup(f.group), fields: this.mapConf(f.fields) }
188
+ : this.parseConf(f, i)
189
+ );
190
+ },
191
+ show(conf, type = "display"){
192
+ const prop = type == "visibility" ? "vVisible" : "vShow"
193
+ if (typeof conf[prop] == "function") {
194
+ return conf[prop]({
195
+ model: this.model,
196
+ errors: this.errors,
197
+ languages: this.languages,
198
+ currentLang: this.currentLang
199
+ })
200
+ }
201
+ return true
202
+ },
203
+ cloneFields(fields){
204
+ return process.browser ? deepClone(fields) : fields
205
+ }
206
+
207
+ },
208
+ computed: {
209
+ slotBindings() {
210
+ return {
211
+ model: this.model,
212
+ errors: this.errors,
213
+ currentLang: this.currentLang,
214
+ langs: this.languages,
215
+ ...this.moreSlotBindings,
216
+ };
217
+ },
218
+ computedFields() {
219
+ return this.mapConf(this.internalFields);
220
+ },
221
+ },
222
+ created(){
223
+ this.internalFields = this.cloneFields(this.fields)
224
+ this.model = this.value
225
+ this.initLang();
226
+ }
227
+ };
228
+ </script>
@@ -1,7 +1,16 @@
1
1
  <template>
2
2
  <div>
3
3
  <span class="mapo-label" :class="`mapo-label-${conf.value}`">{{label}}</span>
4
- <component :is="is" v-model="model" v-bind="fieldAttrs"></component>
4
+ <component :is="is" v-model="model" v-bind="fieldAttrs">
5
+ <template v-for="(_, slot) in $slots" :slot="slot">
6
+ <!-- @vuese-ignore -->
7
+ <slot :name="slot"></slot>
8
+ </template>
9
+ <template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
10
+ <!-- @vuese-ignore -->
11
+ <slot :name="slot" v-bind="props" />
12
+ </template>
13
+ </component>
5
14
  </div>
6
15
  </template>
7
16
 
@@ -12,23 +21,25 @@
12
21
  </style>
13
22
 
14
23
  <script>
15
- import wygEditor from "@mapomodule/uikit/components/fields/wygEditor/wygEditor.vue";
16
- import DateField from "@mapomodule/uikit/components/fields/DateField.vue";
17
- import FksField from "@mapomodule/uikit/components/fields/FksField.vue";
18
- import MediaM2mField from "@mapomodule/uikit/components/fields/MediaM2mField.vue";
19
- import MediaField from "@mapomodule/uikit/components/fields/MediaField.vue";
20
- import SeoPreview from "@mapomodule/uikit/components/fields/SeoPreview.vue";
21
- import FileField from "@mapomodule/uikit/components/fields/FileField.vue";
22
- import Repeater from "@mapomodule/uikit/components/fields/Repeater.vue"
24
+ import wygEditor from "@mapomodule/uikit/components/Form/fields/wygEditor/wygEditor.vue";
25
+ import DateField from "@mapomodule/uikit/components/Form/fields/DateField.vue";
26
+ import FksField from "@mapomodule/uikit/components/Form/fields/FksField.vue";
27
+ import MediaM2mField from "@mapomodule/uikit/components/Form/fields/MediaM2mField.vue";
28
+ import MediaField from "@mapomodule/uikit/components/Form/fields/MediaField.vue";
29
+ import SeoPreview from "@mapomodule/uikit/components/Form/fields/SeoPreview.vue";
30
+ import FileField from "@mapomodule/uikit/components/Form/fields/FileField.vue";
31
+ import Repeater from "@mapomodule/uikit/components/Form/fields/Repeater.vue"
23
32
 
24
33
  import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
34
+ import { titleCase } from "@mapomodule/utils/helpers/formatters";
35
+
25
36
  import defaults from "./defaults";
26
37
 
27
38
  /**
28
39
  * This is mainly an internal component. It is used by the [`DetailComponent`](/components/detail/Detail/) in order to render dinamic fields inside the main form.
29
40
  */
30
41
  export default {
31
- name: "DetailField",
42
+ name: "FormField",
32
43
  components: {
33
44
  wygEditor,
34
45
  DateField,
@@ -54,6 +65,8 @@ export default {
54
65
  type: Object,
55
66
  required: true,
56
67
  },
68
+ // Makes the field readonly.
69
+ readonly: Boolean,
57
70
  // 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.
58
71
  errors: Object,
59
72
  // The main configuration that determines the rendering of the field. See [FieldConfiguration](/components/detail/Detail/#fieldconfiguration).
@@ -81,12 +94,21 @@ export default {
81
94
  }
82
95
  },
83
96
  model(val) {
84
- const dump = { ...this.value };
97
+ const dump = { ...this.value }; // since we cannot directly edit a prop
85
98
  setPointed(
86
99
  dump,
87
100
  this.conf.value,
88
- this.accessor.set({ model: { ...this.value }, val })
101
+ this.accessor.set({ model: dump, val })
89
102
  );
103
+ if (typeof this.conf.onChange == "function")
104
+ this.conf.onChange({
105
+ val,
106
+ model: dump,
107
+ currentLang: this.currentLang,
108
+ languages: this.langs,
109
+ conf: this.conf
110
+ })
111
+
90
112
  // Fired when the v-model changes.
91
113
  // @arg Emits the entire payload modified.
92
114
  this.$emit("input", dump);
@@ -133,6 +155,7 @@ export default {
133
155
  ...(this.defaultAttrs[
134
156
  this.is.replace(/-./g, (x) => x[1].toUpperCase())
135
157
  ] || {}),
158
+ readonly: this.readonly,
136
159
  ...this.conf.attrs,
137
160
  currentLang: this.currentLang,
138
161
  langs: this.langs,
@@ -142,9 +165,6 @@ export default {
142
165
  if (this.conf.label !== undefined) {
143
166
  return this.conf.label;
144
167
  }
145
- const titleCase = (string) =>
146
- (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) ||
147
- "";
148
168
  return titleCase(
149
169
  (this.conf.value || "")
150
170
  .replace(/^translations\.\w\w\./, "")
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <v-card v-if="conf" v-show="show(conf.group)" class="my-2 rounded-0 elevation-0 group-card">
3
+ <v-card-title :class="conf.group.titleClass">
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
+ <Form
13
+ v-model="model"
14
+ v-bind="{ currentLang, errors, languages, readonly }"
15
+ :fields="conf.fields"
16
+ :moreSlotBindings="slotBindings"
17
+ >
18
+ <template v-for="(_, slot) in $slots" :slot="slot">
19
+ <!-- @vuese-ignore -->
20
+ <slot :name="slot" />
21
+ </template>
22
+ <template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
23
+ <!-- @vuese-ignore -->
24
+ <slot :name="slot" v-bind="props" />
25
+ </template>
26
+ </Form>
27
+ </div>
28
+ </v-card>
29
+ </template>
30
+ <style lang="scss" scoped>
31
+ .theme--light .group-card {
32
+ border: 1px solid rgba(0, 0, 0, 0.12);
33
+ }
34
+ </style>
35
+ <script>
36
+ export default {
37
+ name: "FormGroup",
38
+ data() {
39
+ return {
40
+ model: {},
41
+ };
42
+ },
43
+ props: {
44
+ // V-model of the object we are editing.
45
+ value: {
46
+ type: Object,
47
+ required: true,
48
+ },
49
+ // Set the current lang to value.
50
+ currentLang: {
51
+ type: String,
52
+ required: false,
53
+ },
54
+ // 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.
55
+ errors: Object,
56
+ // Additional bindings to indrease slots capabilities
57
+ moreSlotBindings: Object,
58
+ // The main configuration that determines the arrangement of the fields in the detail layout.
59
+ conf: {
60
+ type: Object,
61
+ required: true,
62
+ },
63
+ // A list of languages into which the payload needs to be translated.
64
+ languages: {
65
+ type: Array,
66
+ default: () => [],
67
+ },
68
+ // Makes all the fields readonly.
69
+ readonly: Boolean,
70
+ },
71
+ watch: {
72
+ value(val) {
73
+ this.model = val;
74
+ },
75
+ model(val) {
76
+ this.$emit("input", val);
77
+ },
78
+ },
79
+ computed: {
80
+ slotBindings() {
81
+ return {
82
+ model: this.model,
83
+ errors: this.errors,
84
+ currentLang: this.currentLang,
85
+ langs: this.languages,
86
+ ...this.moreSlotBindings,
87
+ };
88
+ },
89
+ },
90
+ methods: {
91
+ show(conf, type = "display"){
92
+ const prop = type == "visibility" ? "vVisible" : "vShow"
93
+ if (typeof conf[prop] == "function") {
94
+ return conf[prop]({
95
+ model: this.model,
96
+ errors: this.errors,
97
+ languages: this.languages,
98
+ currentLang: this.currentLang
99
+ })
100
+ }
101
+ return true
102
+ },
103
+ },
104
+ created() {
105
+ this.model = this.value;
106
+ },
107
+ };
108
+ </script>