@mapomodule/uikit 1.0.0-alpha.29 → 1.0.0-alpha.30

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,19 @@
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.30](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-09-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **repeater:** added v-container to form repeater to prevent field size expansion ([82af78e](https://github.com/lotrekagency/mapo/commit/82af78e7f74a7bc197ebae9ad7e72b1bb126729f))
12
+ * **repeater:** handle null values ([6cea5c4](https://github.com/lotrekagency/mapo/commit/6cea5c43de6af8647714b06bcd34325acb61f466))
13
+ * **wygEditor:** handle null values ([18477da](https://github.com/lotrekagency/mapo/commit/18477da45803697eabe5d8167f446e2c21ef64f8))
14
+
15
+
16
+
17
+
18
+
6
19
  # [1.0.0-alpha.29](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2022-09-03)
7
20
 
8
21
 
@@ -45,7 +45,7 @@
45
45
  justify="center"
46
46
  >
47
47
  <v-col v-for="col in cols" :key="col">
48
- <MediaElement
48
+ <MediaField
49
49
  v-if="pageMedias[getIndexFromGrid(row, col)]"
50
50
  v-model="pageMedias[getIndexFromGrid(row, col)]"
51
51
  :aspect-ratio="1"
@@ -2,9 +2,9 @@
2
2
  <div class="container pa-0">
3
3
  <div class="d-flex justify-space-between">
4
4
  <span class="repeater-label">{{ label }}:</span>
5
- <v-btn v-if="collapsable" outlined tile text small @click="collapseAll"
6
- >{{ $t("mapo.collapse") }}</v-btn
7
- >
5
+ <v-btn v-if="collapsable" outlined tile text small @click="collapseAll">{{
6
+ $t("mapo.collapse")
7
+ }}</v-btn>
8
8
  </div>
9
9
  <draggable
10
10
  v-model="items"
@@ -30,34 +30,35 @@
30
30
  v-html="getCollapsedLabel(model, index)"
31
31
  ></span>
32
32
  </div>
33
- <div v-if="isExpanded(index)" class="repeater-fields container">
34
- <Form
35
- v-model="items[index]"
36
- :currentLang="translatable ? currentLang : null"
37
- :languages="langs"
38
- :fields="getFields(model)"
39
- :errors="getErrors(index)"
40
- :readonly="readonly"
41
- >
42
- <template
43
- v-for="(slot, name) in templateSlots(model, $slots)"
44
- :slot="slot"
45
- >
46
- <slot :name="name"></slot>
47
- </template>
48
- <template
49
- v-for="(slot, name) in templateSlots(model, $scopedSlots)"
50
- v-slot:[slot]="props"
51
- >
52
- <slot :name="name" v-bind="props" />
53
- </template>
54
- </Form>
33
+ <div v-if="isExpanded(index)" class="repeater-fields">
34
+ <v-container>
35
+ <Form
36
+ v-model="items[index]"
37
+ :currentLang="translatable ? currentLang : null"
38
+ :languages="langs"
39
+ :fields="getFields(model)"
40
+ :errors="getErrors(index)"
41
+ :readonly="readonly"
42
+ >
43
+ <template
44
+ v-for="(slot, name) in templateSlots(model, $slots)"
45
+ :slot="slot"
46
+ >
47
+ <slot :name="name"></slot>
48
+ </template>
49
+ <template
50
+ v-for="(slot, name) in templateSlots(model, $scopedSlots)"
51
+ v-slot:[slot]="props"
52
+ >
53
+ <slot :name="name" v-bind="props" />
54
+ </template>
55
+ </Form>
56
+ </v-container>
55
57
  </div>
56
58
  <div class="repeater-side-bar grey lighten-2">
57
- <span
58
- class="repeater-counter grey--text text--darken-2 text-truncate"
59
- >{{ index + 1 }}</span
60
- >
59
+ <span class="repeater-counter grey--text text--darken-2 text-truncate">{{
60
+ index + 1
61
+ }}</span>
61
62
  <v-tooltip right>
62
63
  <template v-slot:activator="{ on, attrs }">
63
64
  <v-icon
@@ -98,7 +99,7 @@
98
99
  </div>
99
100
  </div>
100
101
  </draggable>
101
- <v-divider/>
102
+ <v-divider />
102
103
  <div class="d-flex justify-end">
103
104
  <v-btn
104
105
  class="repeater-add-line"
@@ -113,14 +114,12 @@
113
114
  </div>
114
115
  <v-dialog v-if="hasTemplates" v-model="tModalOpen" width="600" scrollable>
115
116
  <v-card>
116
- <v-card-title class="text-h5">{{ $t("mapo.repeater.selectTemplate") }}</v-card-title>
117
+ <v-card-title class="text-h5">{{
118
+ $t("mapo.repeater.selectTemplate")
119
+ }}</v-card-title>
117
120
  <v-card-text>
118
121
  <div class="row mt-4">
119
- <div
120
- v-for="(template, i) in templates"
121
- :key="i"
122
- class="col-12 col-md-6 pa-0"
123
- >
122
+ <div v-for="(template, i) in templates" :key="i" class="col-12 col-md-6 pa-0">
124
123
  <div @click="tModalCallback(template)" class="template-button">
125
124
  <span class="text-h5">{{ template.name }}</span
126
125
  ><br />
@@ -175,7 +174,9 @@
175
174
  overflow: hidden;
176
175
  text-overflow: ellipsis;
177
176
  }
178
- .theme--light .repeater-line-wrapper { border-color: rgba(0, 0, 0, 0.12); }
177
+ .theme--light .repeater-line-wrapper {
178
+ border-color: rgba(0, 0, 0, 0.12);
179
+ }
179
180
  .repeater-line-wrapper {
180
181
  border: 1px solid;
181
182
  border-bottom: none;
@@ -189,7 +190,7 @@
189
190
  }
190
191
  }
191
192
  &.expanded {
192
- > div > div >.expand-icon {
193
+ > div > div > .expand-icon {
193
194
  transform: rotate(180deg);
194
195
  }
195
196
  > div > div > .collapsed-label {
@@ -265,7 +266,7 @@ export default {
265
266
  items: null,
266
267
  tModalOpen: false,
267
268
  tModalCallback: () => {},
268
- collapsedStack: (this.value || []).map(() => !!this.collapsable)
269
+ collapsedStack: (this.value || []).map(() => !!this.collapsable),
269
270
  };
270
271
  },
271
272
  props: {
@@ -303,7 +304,7 @@ export default {
303
304
  // With this you can define the output of the collapsed label. You can enter the pointed path of a value in the row or a callback function to extract the label from the row.
304
305
  collapsedLabel: {
305
306
  type: String | Function,
306
- default: null
307
+ default: null,
307
308
  },
308
309
  // This is mainly an internal property. It is used by DetailField to pass the list of languages inherited from the Detail component.
309
310
  langs: {
@@ -313,13 +314,13 @@ export default {
313
314
  },
314
315
  // This is mainly an internal property. It is used by DetailField to pass the active language inherited from the Detail component.
315
316
  currentLang: String,
316
- maxHeight: String | Number
317
+ maxHeight: String | Number,
317
318
  },
318
319
  watch: {
319
320
  value(val) {
320
- this.items = val;
321
+ this.items = val || [];
321
322
  if (val.length != this.collapsedStack.length)
322
- this.collapsedStack = (val || []).map(() => !!this.collapsable)
323
+ this.collapsedStack = (val || []).map(() => !!this.collapsable);
323
324
  },
324
325
  items(val) {
325
326
  this.$emit("input", val);
@@ -329,7 +330,7 @@ export default {
329
330
  },
330
331
  },
331
332
  methods: {
332
- isExpanded(index){
333
+ isExpanded(index) {
333
334
  return !this.collapsedStack[index];
334
335
  },
335
336
  async addItem(index) {
@@ -341,7 +342,7 @@ export default {
341
342
  }
342
343
  const newIndex = typeof index == "number" ? index : this.items.length;
343
344
  this.items.splice(newIndex, 0, element);
344
- this.collapsedStack.splice(newIndex, 0, false)
345
+ this.collapsedStack.splice(newIndex, 0, false);
345
346
  this.sortable &&
346
347
  this.sortCallback({
347
348
  moved: { element, newIndex },
@@ -375,27 +376,32 @@ export default {
375
376
  },
376
377
  getFields(model) {
377
378
  if (this.hasTemplates) {
378
- const template = this.templates.find(t => model[t.tCodeField] == t.tCode)
379
+ const template = this.templates.find((t) => model[t.tCodeField] == t.tCode);
379
380
  return template ? template.fields : [];
380
381
  }
381
382
  return this.fields;
382
383
  },
383
- templateSlots(model, slots){
384
+ templateSlots(model, slots) {
384
385
  if (this.hasTemplates) {
385
- const template = this.templates.find(t => model[t.tCodeField] == t.tCode)
386
- return nameSpacedSlots(slots, `template.${template.tCode}.`).reduce((acc, v) => ({ [`template.${template.tCode}.${v}`]: v, ...acc }), {})
386
+ const template = this.templates.find((t) => model[t.tCodeField] == t.tCode);
387
+ return nameSpacedSlots(slots, `template.${template.tCode}.`).reduce(
388
+ (acc, v) => ({ [`template.${template.tCode}.${v}`]: v, ...acc }),
389
+ {}
390
+ );
387
391
  }
388
392
  return Object.keys(slots).reduce((acc, v) => ({ [v]: v, ...acc }), {});
389
393
  },
390
394
  getCollapsedLabel(model, index) {
391
- const fallback = this.$t("mapo.repeater.item", {numberItem: index + 1});
395
+ const fallback = this.$t("mapo.repeater.item", { numberItem: index + 1 });
392
396
  switch (typeof this.collapsedLabel) {
393
397
  case "string":
394
398
  return getPointed(model, this.collapsedLabel, fallback);
395
399
  case "function":
396
400
  return this.collapsedLabel(model);
397
401
  default:
398
- const field = this.getFields(model).find(f => !f.type || f.type.lower() == "text");
402
+ const field = this.getFields(model).find(
403
+ (f) => !f.type || f.type.lower() == "text"
404
+ );
399
405
  return getPointed(model, field.value, fallback);
400
406
  }
401
407
  },
@@ -404,14 +410,15 @@ export default {
404
410
  const stackItem = this.collapsedStack[oldIndex];
405
411
  this.collapsedStack.splice(oldIndex, 1);
406
412
  this.collapsedStack.splice(newIndex, 0, stackItem);
407
- this.sortCallback({ ...event, items: this.items, eventType: 'move' })
413
+ this.sortCallback({ ...event, items: this.items, eventType: "move" });
408
414
  },
409
415
  toggleExpand(index, forceValue) {
410
- this.collapsedStack[index] = forceValue == undefined ? !this.collapsedStack[index] : !forceValue;
416
+ this.collapsedStack[index] =
417
+ forceValue == undefined ? !this.collapsedStack[index] : !forceValue;
411
418
  this.collapsedStack = [...this.collapsedStack];
412
419
  },
413
420
  collapseAll() {
414
- this.collapsedStack = this.collapsedStack.map(() => true)
421
+ this.collapsedStack = this.collapsedStack.map(() => true);
415
422
  },
416
423
  },
417
424
  computed: {
@@ -429,26 +436,26 @@ export default {
429
436
  name: tValue.name || titleCase(tKey.replace(/_/, " ")),
430
437
  tCode: tValue.tCode || tKey,
431
438
  tCodeField: tValue.tCodeField || "tCode",
432
- preview, description,
439
+ preview,
440
+ description,
433
441
  };
434
442
  });
435
443
  }
436
444
  return Object.values(templates);
437
445
  },
438
- maxHeightStyle(){
439
- if (this.maxHeight !== undefined){
440
- const maxHeight = isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`
441
- return { maxHeight, paddingTop: '15px', overflowX: 'hidden', overflowY: 'auto' }
446
+ maxHeightStyle() {
447
+ if (this.maxHeight !== undefined) {
448
+ const maxHeight = isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`;
449
+ return { maxHeight, paddingTop: "15px", overflowX: "hidden", overflowY: "auto" };
442
450
  }
443
- }
451
+ },
444
452
  },
445
453
  mounted() {
446
- this.items = this.value;
454
+ this.items = this.value || [];
447
455
  },
448
456
  };
449
457
  </script>
450
458
 
451
-
452
459
  <docs>
453
460
 
454
461
 
@@ -20,7 +20,7 @@ import defaults from "./defaults.js";
20
20
  import validEvents from "./utils/events.js";
21
21
 
22
22
  /**
23
- * This component wraps a [wygEditor](https://www.tiny.cloud/) instance. With the use of the v-model you can use this component to edit any content you like.
23
+ * This component wraps a [wygEditor](https://www.tiny.cloud/) instance. With the use of the v-model you can use this component to edit any content you like.
24
24
  */
25
25
 
26
26
  export default {
@@ -144,7 +144,7 @@ export default {
144
144
  value(val) {
145
145
  if (this.editor && this.editor.initialized && val !== this.editorContent) {
146
146
  this.editorContent = val
147
- this.editor.setContent(val);
147
+ this.editor.setContent(val || "");
148
148
  }
149
149
  },
150
150
  readonly(val) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.29",
3
+ "version": "1.0.0-alpha.30",
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.23",
10
+ "@mapomodule/utils": "^1.0.0-alpha.30",
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": "2a60a65a7baa45b0961ca2efb750828ad4a3d218"
18
+ "gitHead": "f648aac2fc02b28e687f4631cfbaf4cde6999a8b"
19
19
  }