@mapomodule/uikit 1.0.0-alpha.5 → 1.0.0-alpha.50

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 (90) hide show
  1. package/CHANGELOG.md +873 -0
  2. package/components/ConfirmDialog.vue +58 -37
  3. package/components/Detail/Detail.vue +450 -243
  4. package/components/Detail/DetailLangSwitch.vue +9 -2
  5. package/components/DropArea.vue +63 -56
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +214 -0
  8. package/components/Form/FormGroup.vue +146 -0
  9. package/components/Form/FormTabs.vue +188 -0
  10. package/components/Form/defaults.js +97 -0
  11. package/components/Form/fields/ColorField.vue +79 -0
  12. package/components/{fields → Form/fields}/DateField.vue +20 -11
  13. package/components/Form/fields/DateTimeField.vue +271 -0
  14. package/components/Form/fields/EnhancedMediaField.vue +224 -0
  15. package/components/Form/fields/FileField.vue +125 -0
  16. package/components/Form/fields/FksField.vue +88 -0
  17. package/components/Form/fields/MediaField.vue +159 -0
  18. package/components/Form/fields/MediaM2mField.vue +149 -0
  19. package/components/Form/fields/Repeater.vue +596 -0
  20. package/components/Form/fields/SeoPreview.vue +89 -0
  21. package/components/Form/fields/TimeField.vue +154 -0
  22. package/components/Form/fields/mapField/leaflet.injector.js +39 -0
  23. package/components/Form/fields/mapField/mapField.vue +348 -0
  24. package/components/Form/fields/wygEditor/defaults.js +25 -0
  25. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  26. package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
  27. package/components/LangSwitcher.vue +44 -0
  28. package/components/List/List.vue +103 -51
  29. package/components/List/ListActions.vue +23 -5
  30. package/components/List/ListFilters.vue +166 -114
  31. package/components/List/ListHead.vue +30 -12
  32. package/components/List/ListQuickEdit.vue +130 -61
  33. package/components/List/ListTable.vue +210 -66
  34. package/components/Login.vue +17 -7
  35. package/components/LogoutButton.vue +43 -28
  36. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  37. package/components/MediaManager/MediaEditor.vue +297 -120
  38. package/components/MediaManager/MediaFileChanger.vue +78 -0
  39. package/components/MediaManager/MediaFolders.vue +224 -116
  40. package/components/MediaManager/MediaGallery.vue +224 -145
  41. package/components/MediaManager/MediaManager.vue +125 -159
  42. package/components/MediaManager/MediaManagerDialog.vue +36 -31
  43. package/components/MediaManager/MediaPreview.vue +258 -0
  44. package/components/MediaManager/MediaUploader.vue +91 -90
  45. package/components/MenuManager/MenuManager.vue +332 -0
  46. package/components/MenuManager/MenuNodeEditor.vue +255 -0
  47. package/components/MenuManager/MenuTreeview.vue +237 -0
  48. package/components/MenuManager/MenuTreeviewNode.vue +208 -0
  49. package/components/PagePreview.vue +58 -0
  50. package/components/SnackBar.vue +5 -7
  51. package/components/ThemeToggle.vue +13 -0
  52. package/components/layout/Sidebar/Sidebar.vue +61 -30
  53. package/components/layout/Sidebar/SidebarList.vue +19 -15
  54. package/components/layout/Sidebar/SidebarListItem.vue +122 -38
  55. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  56. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  57. package/components/layout/Topbar/Topbar.vue +11 -42
  58. package/components/layout/routebuilder.js +3 -3
  59. package/defaults/i18n.js +37 -0
  60. package/defaults/vuetify.js +34 -0
  61. package/layouts/default.vue +33 -18
  62. package/layouts/empty.vue +10 -0
  63. package/module.js +7 -5
  64. package/package.json +6 -4
  65. package/pages/index.vue +19 -18
  66. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  67. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  68. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  69. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  70. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  71. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  72. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  73. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  74. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  75. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  76. package/translations/en-US.js +177 -0
  77. package/translations/it-IT.js +180 -0
  78. package/components/Detail/DetailField.vue +0 -129
  79. package/components/Detail/defaults.js +0 -50
  80. package/components/fields/M2mField.vue +0 -95
  81. package/components/fields/MediaField.vue +0 -195
  82. package/components/fields/MediaM2mField.vue +0 -238
  83. package/components/fields/TinyMce/TinyMce.vue +0 -177
  84. package/components/fields/TinyMce/defaults.js +0 -55
  85. package/components/layout/Sidebar/SidebarFooter.vue +0 -75
  86. package/defaults.js +0 -29
  87. package/layouts/error.vue +0 -45
  88. /package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  89. /package/components/{fields/TinyMce/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
  90. /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
@@ -0,0 +1,180 @@
1
+ export default {
2
+ mapo: {
3
+ // Generics
4
+ cancel: "Annulla",
5
+ save: "Salva",
6
+ apply: "Applica",
7
+ confirm: "Conferma",
8
+ ok: "OK",
9
+ close: "Chiudi",
10
+ edit: "Modifica",
11
+ delete: "Elimina",
12
+ add: "Aggiungi",
13
+ remove: "Rimuovi",
14
+ clear: "Rimuovi",
15
+ expand: "Espandi",
16
+ collapse: "Comprimi",
17
+ search: "Cerca...",
18
+ create: "Crea",
19
+ createContinue: "Crea e continua",
20
+ saveContinue: "Salva e continua",
21
+ back: "Indietro",
22
+ genericError: "Qualcosa è andato storto, riprova più tardi...",
23
+ saveSuccess: "Elemento salvato con successo!",
24
+ createSuccess: "Elemento creato con successo!",
25
+ confirmDelete: "Vuoi veramente eliminare questo elemento?",
26
+ unsavedData: "Uscire dalla pagina?",
27
+ confirmLeaveChanges: "I dati non sono ancora stati salvati.",
28
+ fetchingData: "Caricamento in corso...",
29
+ login: "Login",
30
+ loginError:
31
+ "Impossibile effettuare il login in questo momento. Riprova più tardi.",
32
+ logout: "Esci",
33
+ // Elements
34
+ name: "Nome",
35
+ description: "Descrizione",
36
+ mime: "Tipo MIME",
37
+ fileName: "Nome File",
38
+ folder: "Cartella",
39
+ created: "Creato il",
40
+ size: "Dimensioni",
41
+ altTag: "Alt Tag",
42
+ titleTag: "Title Tag",
43
+ linkedModels: "Modelli collegati",
44
+ searchLocation: "Cerca un luogo",
45
+ showPreview: "Mostra anteprima",
46
+ latitude: "Latitudine",
47
+ longitude: "Longitudine",
48
+ pointName: "Nome punto",
49
+
50
+ // pages/index.vue
51
+ index: {
52
+ welcomeMessage:
53
+ "Congratulazioni!! 🥳 Mapo è stato installato correttamente!",
54
+ },
55
+
56
+ //errors
57
+ error: {
58
+ searchError: "Errore durante la ricerca",
59
+ },
60
+
61
+ // ConfirmDialog.vue
62
+ confirmDialog: {
63
+ areYouSure: "Sei sicuro di ciò che vuoi fare?",
64
+ },
65
+ // DropArea.vue
66
+ dropArea: {
67
+ dropOrClick:
68
+ "Trascina qui i tuoi file, o clicca per selezionarne uno",
69
+ onlyOneFile: "È possibile caricare un solo file alla volta...",
70
+ },
71
+
72
+ // Form/fields/MediaField.vue
73
+ mediaField: { confirmRemove: "Vuoi veramente rimuovere questo media?" },
74
+ // Form/fields/MediaM2mField.vue
75
+ mediaM2MField: {
76
+ mediaCarousel: "Galleria Media",
77
+ editSelection: "Modifica selezione",
78
+ },
79
+ // Form/fields/Repeater.vue
80
+ repeater: {
81
+ addHere: "Aggiungi qui",
82
+ selectTemplate: "Seleziona template",
83
+ item: "Elemento n.{numberItem}",
84
+ },
85
+ // Form/fields/SeoPreview.vue
86
+ seoPreview: {
87
+ title: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
88
+ description:
89
+ "Questa è una descrizione di esempio che verrà sostituita non appena inizierai a compilare i campi. Assicurati che le descrizioni siano mobile-friendly e keyword-rich!",
90
+ },
91
+
92
+ // List/List.vue
93
+ list: {
94
+ allSelected: "Tutti gli elementi selezionati",
95
+ NSelected: "{numberItems} elementi selezionati",
96
+ selectAll: "Seleziona tutti",
97
+ },
98
+ // List/ListActions.vue
99
+ listActions: {
100
+ groupActions: "Azioni di gruppo",
101
+ permanentDelete: "Eliminazione permanente",
102
+ selectionRequired: "Devi selezionare almeno un elemento",
103
+ },
104
+ // List/ListFilters.vue
105
+ listFilters: { filter: "Filtra" },
106
+ // List/ListHead.vue
107
+ listHead: { addNew: "Aggiungi nuovo" },
108
+ // List/ListQuickEdit.vue
109
+ listQuickEdit: {
110
+ badInput: "Alcuni campi sono compilati in modo errato.",
111
+ },
112
+ // List/ListTable.vue
113
+ listTable: {
114
+ quickAdd: "Aggiunta veloce",
115
+ toggleOrder: "Attiva/Disattiva riordinamento elementi",
116
+ errorOrder: "Riordinamento fallito",
117
+ },
118
+ // MenuManager/MenuNodeEditor.vue
119
+ menuNodeEditor: {
120
+ editNode: "Nodo",
121
+ title: "Titolo",
122
+ linkTypeLabel: "Tipo di link",
123
+ styleLabel: "Stile",
124
+ openInNewTabLabel: "Apri in una nuova finestra",
125
+ relContentTypeLabel: "Tipo di pagina",
126
+ relPageIdLabel: "Pagina",
127
+ staticLabel: "Url Statica",
128
+ relational: "Relazionale",
129
+ static: "Statico",
130
+ },
131
+ // MenuManager/MenuManager.vue
132
+ menuManager: {
133
+ noSelectedNode: "Seleziona un nodo o creane uno nuovo."
134
+ },
135
+ // MenuManager/MenuTreeview.vue
136
+ menuTreeview:{
137
+ newNode: "Crea nodo",
138
+ noRootNodes: "Non c'è nessun nodo qui, creane uno nuovo!",
139
+ areYouSureDelete: "Sei sicuro di voler eliminare questo nodo e tutti i suoi discendenti?"
140
+ },
141
+ // MediaManager/MediaEditor.vue
142
+ mediaEditor: {
143
+ changeFile: "Cambia File",
144
+ maintainOldUrl: "Mantieni URL precedente",
145
+ confirmDelete: "Vuoi veramente eliminare questo media?",
146
+ details: "Dettagli",
147
+ },
148
+ // MediaManager/MediaFolders.vue
149
+ mediaFolders: {
150
+ goBack: "Torna indietro",
151
+ noFolders: "Non sono presenti cartelle... Creane una!",
152
+ newFolder: "Crea nuova cartella",
153
+ imageFolder: "Tutte le immagini",
154
+ videoFolder: "Tutti i video",
155
+ audioFolder: "Tutti gli audio",
156
+ docFolder: "Tutti i documenti",
157
+ editFolder: "Modifica cartella",
158
+ folderName: "Nome cartella",
159
+ confirmDelete:
160
+ "Vuoi veramente eliminare questa cartella e tutti i suoi contenuti?",
161
+ },
162
+ // MediaManager/MediaGallery.vue
163
+ mediaGallery: {
164
+ noMediaFound: "Nessun media individuato...",
165
+ selectAll: "Seleziona pagina",
166
+ deselectAll: "Deseleziona pagina",
167
+ selectedAssets: "elementi selezionati",
168
+ deleteSelected: "Stai per eliminare {number} elementi. Vuoi proseguire?",
169
+ deleteSuccess: "{number} elementi eliminati!"
170
+ },
171
+ // MediaManager/MediaManager.vue
172
+ mediaManager: {
173
+ gallery: "Galleria",
174
+ uploader: "Caricamento Media",
175
+ fileInfo: "File info succesfully updated",
176
+ },
177
+ // MediaManager/MediaUploader.vue
178
+ mediaUploader: { optimizingFiles: "Ottimizzazione dei file..", uploadingFiles: "Upload dei file..", success: "{numberFiles} file caricati", tooLarge: "Attenzione! Ottimizza prima di caricare!" },
179
+ },
180
+ };
@@ -1,129 +0,0 @@
1
- <template>
2
- <component :is="is" v-model="model" v-bind="fieldProp"></component>
3
- </template>
4
-
5
- <script>
6
- import TinyMce from "@mapomodule/uikit/components/fields/TinyMce/TinyMce.vue";
7
- import DateField from "@mapomodule/uikit/components/fields/DateField.vue";
8
- import M2mField from "@mapomodule/uikit/components/fields/M2mField.vue";
9
- import MediaM2mField from "@mapomodule/uikit/components/fields/MediaM2mField.vue";
10
- import MediaField from "@mapomodule/uikit/components/fields/MediaField.vue";
11
-
12
- import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
13
- import defaults from "./defaults";
14
-
15
- /**
16
- * 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.
17
- */
18
- export default {
19
- name: "DetailField",
20
- components: {
21
- TinyMce,
22
- DateField,
23
- M2mField,
24
- MediaM2mField,
25
- MediaField
26
- },
27
-
28
- data() {
29
- return {
30
- model: null,
31
- fieldsMap: defaults.mapping,
32
- fieldsProps: defaults.props,
33
- fieldsAccess: defaults.accessor
34
- };
35
- },
36
- props: {
37
- // V-model of the payload needed to edit the field value in realtime.
38
- value: {
39
- type: Object,
40
- required: true
41
- },
42
- // 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.
43
- errors: Object,
44
- // The main configuration that determines the rendering of the field. See [FieldConfiguration](/components/detail/Detail/#fieldconfiguration).
45
- conf: {
46
- // [`FieldConfiguration`](/components/detail/Detail/#fieldconfiguration)
47
- type: Object,
48
- required: true
49
- }
50
- },
51
- watch: {
52
- value: {
53
- deep: true,
54
- handler(val) {
55
- this.setModel(val);
56
- }
57
- },
58
- conf(newConf, oldConf) {
59
- if (newConf.value !== oldConf.value) {
60
- this.setModel();
61
- }
62
- },
63
- model(val) {
64
- const dump = { ...this.value };
65
- setPointed(
66
- dump,
67
- this.conf.value,
68
- this.accessor.set({ model: { ...this.value }, val })
69
- );
70
- // Fired when the v-model changes.
71
- // @arg Emits the entire payload modified.
72
- this.$emit("input", dump);
73
- }
74
- },
75
- methods: {
76
- setModel(val = this.value) {
77
- var model = this.accessor.get({
78
- model: { ...val },
79
- val: getPointed({ ...val }, this.conf.value)
80
- });
81
- if (val && JSON.stringify(this.model) !== JSON.stringify(model))
82
- this.model = model;
83
- }
84
- },
85
- computed: {
86
- accessor() {
87
- let func = function({ val }) {
88
- return val;
89
- };
90
- return {
91
- get: func,
92
- set: func,
93
- ...(this.fieldsAccess[this.is] || {}),
94
- ...this.conf.accessor
95
- };
96
- },
97
- fieldProp() {
98
- return {
99
- label: this.label,
100
- errorMessages: getPointed(this.errors || {}, this.conf.value, []),
101
- ...(this.fieldsProps[this.is] || {}),
102
- ...this.conf.attrs
103
- };
104
- },
105
- label() {
106
- if (this.conf.label !== undefined) {
107
- return this.conf.label;
108
- }
109
- const titleCase = string =>
110
- (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) ||
111
- "";
112
- return titleCase(
113
- (this.conf.value || "")
114
- .replace(/^translations\.\w\w\./, "")
115
- .split(".")
116
- .join(" ")
117
- .replace(/_/, " ")
118
- );
119
- },
120
- is() {
121
- return (
122
- this.conf.is ||
123
- (this.conf.type && this.fieldsMap[this.conf.type]) ||
124
- "v-text-field"
125
- );
126
- }
127
- }
128
- };
129
- </script>
@@ -1,50 +0,0 @@
1
- const mapping = {
2
- text: "v-text-field",
3
- select: "v-select",
4
- date: "date-field",
5
- textarea: "v-textarea",
6
- switch: "v-switch",
7
- slider: "v-slider",
8
- file: "v-file-input",
9
- editor: "tiny-mce",
10
- media: "media-field",
11
- m2m: "m2m-field",
12
- mediaList: "media-m2m-field"
13
- }
14
-
15
- const props = {
16
- "v-text-field": {
17
- outlined: true
18
- },
19
- "v-textarea": {
20
- outlined: true
21
- },
22
- "date-field": {
23
- outlined: true
24
- },
25
- "v-select": {
26
- outlined: true,
27
- itemText: "text",
28
- itemValue: "value"
29
- },
30
- "v-switch": {
31
- inset: true,
32
- ripple: false
33
- }
34
- }
35
-
36
- const dateFunc = function ({ val }) {
37
- return val && new Date(val).toISOString().split("T")[0];
38
- };
39
-
40
- const accessor = {
41
- "v-date-picker": {
42
- get: dateFunc, set: dateFunc
43
- },
44
- "date-field": {
45
- get: dateFunc, set: dateFunc
46
- }
47
- }
48
- export default {
49
- mapping, props, accessor
50
- }
@@ -1,95 +0,0 @@
1
- <template>
2
- <div>
3
- <v-checkbox
4
- v-for="(option, index) in options"
5
- :key="index"
6
- :label="option[itemText]"
7
- :input-value="isSelected(option)"
8
- @change="changed($event, option)"
9
- >
10
- </v-checkbox>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- /**
16
- * This component is made to simplify Many To Many associations. With this component you can modify an array selecting items from a list of checkboxes.
17
- */
18
-
19
- export default {
20
- name: "M2mField",
21
- data() {
22
- return {
23
- proxyItems: []
24
- };
25
- },
26
- props: {
27
- // V-model property. It is the array to be modified.
28
- value: {
29
- type: Array,
30
- required: true
31
- },
32
- // This is the array of options from which you can choose.
33
- items: {
34
- type: Array,
35
- default: () => []
36
- },
37
- itemText: {
38
- type: String,
39
- default: "text"
40
- },
41
- itemValue: {
42
- type: String,
43
- default: "*"
44
- },
45
- lookup: {
46
- type: String,
47
- default: "id"
48
- },
49
- endPoint: String,
50
- mapping: {
51
- type: Function,
52
- default: items => items
53
- }
54
- },
55
- computed: {
56
- hasKey() {
57
- return this.itemValue !== "*";
58
- },
59
- options() {
60
- return this.mapping(this.proxyItems);
61
- }
62
- },
63
- methods: {
64
- isSelected(option) {
65
- return !!(this.value || []).find(
66
- e => e[this.lookup] == option[this.lookup]
67
- );
68
- },
69
- changed(value, option) {
70
- let val = this.hasKey ? option[this.itemValue] : option;
71
- let newArr = [...(this.value || [])];
72
- if (value) {
73
- newArr.push(val);
74
- } else {
75
- let i = newArr.findIndex(e => e[this.lookup] == option[this.lookup]);
76
- i !== -1 && newArr.splice(i, 1);
77
- }
78
- this.$emit("input", newArr);
79
- }
80
- },
81
- watch: {
82
- items(val) {
83
- this.proxyItems = val;
84
- }
85
- },
86
- mounted() {
87
- if (this.endPoint && (!this.items || !this.items.length)) {
88
- this.$mapo.$api
89
- .crud(this.endPoint)
90
- .list()
91
- .then(res => (this.proxyItems = res));
92
- }
93
- }
94
- };
95
- </script>
@@ -1,195 +0,0 @@
1
- <template>
2
- <div>
3
- <v-text-field
4
- v-if="title"
5
- v-model="title"
6
- class="mb-n8 pb-0"
7
- solo
8
- readonly
9
- v-bind="$attrs"
10
- ></v-text-field>
11
- <v-hover v-model="isHovered">
12
- <div style="position: relative">
13
- <v-img
14
- v-if="mediaExists"
15
- :src="internalValue.file"
16
- :lazy-src="internalValue.thumbnail"
17
- v-bind="{
18
- aspectRatio,
19
- contain,
20
- height,
21
- width,
22
- maxWidth,
23
- maxHeight,
24
- minWidth,
25
- minHeight,
26
- }"
27
- >
28
- <template v-slot:placeholder>
29
- <v-row
30
- v-if="internalValue"
31
- class="fill-height ma-0"
32
- align="center"
33
- justify="center"
34
- >
35
- <v-progress-circular
36
- indeterminate
37
- color="grey"
38
- ></v-progress-circular>
39
- </v-row>
40
- </template>
41
- </v-img>
42
-
43
- <!-- If the media is not avaible, it shows a btn to add new media -->
44
- <v-card
45
- v-else-if="!rmAddBtn"
46
- v-bind="{
47
- height,
48
- width,
49
- maxWidth,
50
- maxHeight,
51
- minWidth,
52
- minHeight,
53
- ...$attrs,
54
- }"
55
- >
56
- <v-card-title>{{ label }}</v-card-title>
57
-
58
- <v-card-actions>
59
- <v-btn @click="editing = true" block :min-height="minHeight">
60
- <v-icon size="80"> mdi-plus-circle-outline </v-icon>
61
- </v-btn>
62
- </v-card-actions>
63
- </v-card>
64
-
65
- <!-- Shows darkening overlay on image with buttons on top while hovered -->
66
- <v-overlay opacity="0.3" absolute :value="overlay">
67
- <v-row>
68
- <v-col cols="12">
69
- <h3>{{ label }}</h3>
70
- </v-col>
71
- </v-row>
72
- <v-row>
73
- <v-col cols="6">
74
- <v-btn @click="editing = true" fab v-bind="$attrs">
75
- <v-icon>mdi-pencil</v-icon>
76
- </v-btn>
77
- </v-col>
78
-
79
- <v-col cols="6">
80
- <v-btn @click="confirmDelete" fab v-bind="$attrs">
81
- <v-icon>mdi-delete</v-icon>
82
- </v-btn>
83
- </v-col>
84
- </v-row>
85
- </v-overlay>
86
-
87
- <!-- Select media dialog -->
88
- <media-manager-dialog
89
- v-model="editing"
90
- select="single"
91
- v-on:selectionChange="update"
92
- v-bind="$attrs"
93
- >
94
- </media-manager-dialog>
95
-
96
- </div>
97
- </v-hover>
98
- </div>
99
- </template>
100
-
101
- <style scoped>
102
- </style>
103
-
104
- <script>
105
- export default {
106
- name: "MediaField",
107
- data() {
108
- return {
109
- internalValue: null,
110
- editing: false,
111
- isHovered: false,
112
- };
113
- },
114
-
115
- props: {
116
- value: Object,
117
- label: String,
118
- title: {
119
- type: String,
120
- default: () => "",
121
- },
122
- rmAddBtn: {
123
- type: Boolean,
124
- default: false,
125
- },
126
- //image reflections
127
- aspectRatio: {
128
- type: String | Number,
129
- default: undefined,
130
- },
131
- contain: {
132
- type: Boolean,
133
- default: false,
134
- },
135
- height: {
136
- type: String | Number,
137
- default: "100%",
138
- },
139
- width: {
140
- type: String | Number,
141
- default: "100%",
142
- },
143
- maxWidth: {
144
- type: String | Number,
145
- default: undefined,
146
- },
147
- maxHeight: {
148
- type: String | Number,
149
- default: undefined,
150
- },
151
- minWidth: {
152
- type: String | Number,
153
- default: undefined,
154
- },
155
- minHeight: {
156
- type: String | Number,
157
- default: 300,
158
- },
159
- },
160
-
161
- computed: {
162
- mediaExists() {
163
- return !!this.internalValue?.file;
164
- },
165
- overlay() {
166
- return this.isHovered && this.mediaExists;
167
- },
168
- },
169
-
170
- methods: {
171
- update(val) {
172
- this.internalValue = val;
173
- },
174
- confirmDelete() {
175
- this.$mapo.$confirm
176
- .open({
177
- title: "Remove",
178
- question: "Are you sure to want to remove this media?"
179
- })
180
- .then((res) => (res ? (this.internalValue = null) : null));
181
- },
182
- },
183
-
184
- watch: {
185
- value(val) {
186
- if (val !== this.internalValue) {
187
- this.internalValue = val;
188
- }
189
- },
190
- internalValue(val) {
191
- this.$emit("input", val);
192
- },
193
- },
194
- };
195
- </script>