@mapomodule/uikit 1.0.0-alpha.42 → 1.0.0-alpha.43

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,17 @@
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.43](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2023-02-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * allow overflow on media dialog container ([705a3be](https://github.com/lotrekagency/mapo/commit/705a3be3100e22b7ec043415c0cca8dff8973144))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.0.0-alpha.42](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.41...v1.0.0-alpha.42) (2023-02-01)
7
18
 
8
19
 
@@ -70,7 +70,15 @@
70
70
  </style>
71
71
 
72
72
  <script>
73
- import dateFormat from "dateformat";
73
+ import {
74
+ formatLocalTime,
75
+ formatLocalDate,
76
+ formatLocalDateTime,
77
+ mergeDate,
78
+ mergeTime,
79
+ cleanDateStr,
80
+ } from "@mapomodule/utils/helpers/datetime";
81
+
74
82
  /**
75
83
  * This component is used to edit a datetime in iso format. It is a combination of "v-text-field", "v-date-picker" and "v-time-picker".
76
84
  * All dates are emitted using UTC timezone.
@@ -117,11 +125,6 @@ export default {
117
125
  value(val) {
118
126
  this.setupValue();
119
127
  },
120
- model(val) {
121
- // Fired when the v-model changes
122
- //@arg Emits the date or the date range edited.
123
- this.$emit("input", val);
124
- },
125
128
  menu(val) {
126
129
  if (val)
127
130
  setTimeout(() => {
@@ -173,8 +176,8 @@ export default {
173
176
  (typeof this.value == "string" && this.value
174
177
  ? this.value.split(",").filter((v) => v)
175
178
  : this.value) || [];
176
- this.startDateTime = dates.length > 0 ? dates[0] : null;
177
- this.endDateTime = dates.length > 1 ? dates[1] : null;
179
+ this.startDateTime = dates.length > 0 ? cleanDateStr(dates[0]) : null;
180
+ this.endDateTime = dates.length > 1 ? cleanDateStr(dates[1]) : null;
178
181
  },
179
182
  },
180
183
  computed: {
@@ -182,21 +185,12 @@ export default {
182
185
  get() {
183
186
  const time = this.isStartFocused ? this.startDateTime : this.endDateTime;
184
187
  if (!time) return null;
185
- return dateFormat(time, "HH:MM:ss");
188
+ return formatLocalTime(time);
186
189
  },
187
190
  set(value) {
188
- const mergeTime = (dateTime, time) => {
189
- let newDateTime = new Date(dateTime);
190
- const [hours, minutes, seconds] = time.split(":").map((n) => parseInt(n));
191
- if (hours) newDateTime.setHours(hours);
192
- if (minutes) newDateTime.setMinutes(minutes);
193
- if (seconds) newDateTime.setSeconds(seconds);
194
- return newDateTime.toISOString();
195
- };
196
-
197
191
  if (this.isStartFocused)
198
- this.startDateTime = mergeTime(this.startDateTime, value);
199
- else this.endDateTime = mergeTime(this.endDateTime, value);
192
+ this.startDateTime = mergeTime(this.startDateTime, value).toISOString();
193
+ else this.endDateTime = mergeTime(this.endDateTime, value).toISOString();
200
194
  this.emit();
201
195
  },
202
196
  },
@@ -204,31 +198,25 @@ export default {
204
198
  get() {
205
199
  const d = [this.startDateTime, this.endDateTime]
206
200
  .filter((d) => d)
207
- .map((d) => dateFormat(d, "yyyy-mm-dd"));
201
+ .map((d) => formatLocalDate(d));
208
202
  if (this.range) return d;
209
203
  else if (d.length > 0) return d[0];
210
204
  return null;
211
205
  },
212
206
  set(value) {
213
- const mergeDate = (dateTime, date) => {
214
- let newDateTime = new Date(dateTime);
215
- const dateObj = new Date(date);
216
- newDateTime.setFullYear(dateObj.getFullYear());
217
- newDateTime.setMonth(dateObj.getMonth());
218
- newDateTime.setDate(dateObj.getDate());
219
- return newDateTime.toISOString();
220
- };
221
-
222
207
  if (this.range && value.length == 2) {
223
- this.endDateTime = mergeDate(this.endDateTime || null, value[1]);
224
- this.startDateTime = mergeDate(this.startDateTime || null, value[0]);
208
+ this.endDateTime = mergeDate(this.endDateTime || null, value[1]).toISOString();
209
+ this.startDateTime = mergeDate(
210
+ this.startDateTime || null,
211
+ value[0]
212
+ ).toISOString();
225
213
  setTimeout(() => this.$refs.endRawInput?.focus());
226
214
  } else {
227
215
  this.endDateTime = null;
228
216
  this.startDateTime = mergeDate(
229
217
  this.startDateTime || null,
230
218
  Array.isArray(value) ? value[0] : value
231
- );
219
+ ).toISOString();
232
220
  }
233
221
  this.emit();
234
222
  },
@@ -236,7 +224,7 @@ export default {
236
224
  startRawDateTime: {
237
225
  get() {
238
226
  if (!this.startDateTime) return null;
239
- return dateFormat(this.startDateTime, "yyyy-mm-dd'T'HH:MM:ss");
227
+ return formatLocalDateTime(this.startDateTime);
240
228
  },
241
229
  set(value) {
242
230
  const oldDateTime = this.startDateTime;
@@ -248,7 +236,7 @@ export default {
248
236
  endRawDateTime: {
249
237
  get() {
250
238
  if (!this.endDateTime) return null;
251
- return dateFormat(this.endDateTime, "yyyy-mm-dd'T'HH:MM:ss");
239
+ return formatLocalDateTime(this.endDateTime);
252
240
  },
253
241
  set(value) {
254
242
  const oldDateTime = this.endDateTime;
@@ -51,7 +51,12 @@
51
51
  </style>
52
52
 
53
53
  <script>
54
- import dateFormat from "dateformat";
54
+ import {
55
+ formatLocalTime,
56
+ cleanDateStr,
57
+ formatUTCTime,
58
+ mergeTime,
59
+ } from "@mapomodule/utils/helpers/datetime";
55
60
 
56
61
  /**
57
62
  * This component is used to edit a time in iso format. It is a combination of "v-text-field" and "v-time-picker".
@@ -61,9 +66,8 @@ export default {
61
66
  name: "TimeField",
62
67
  data() {
63
68
  return {
64
- model: null,
69
+ model: { model: null, returnDate: false },
65
70
  menu: null,
66
- returnDate: false,
67
71
  };
68
72
  },
69
73
  props: {
@@ -80,15 +84,19 @@ export default {
80
84
  },
81
85
  watch: {
82
86
  value(val) {
83
- if (this.model !== val) {
84
- this.setupValue();
87
+ const model = this.setupModel(val);
88
+ if (JSON.stringify(model) != JSON.stringify(this.model)) {
89
+ this.model = model;
85
90
  }
86
91
  },
87
- model(val) {
88
- // Fired when the v-model changes
89
- //@arg Emits the time edited.
90
- if (this.returnDate) this.$emit("input", `${this.value.split("T")[0]}T${val}Z`);
91
- else this.$emit("input", val);
92
+ model: {
93
+ handler: function (val) {
94
+ // Fired when the v-model changes
95
+ //@arg Emits the time edited.
96
+ if (val.returnDate) this.$emit("input", val.model.toISOString());
97
+ else this.$emit("input", formatUTCTime(val.model));
98
+ },
99
+ deep: true,
92
100
  },
93
101
  menu(val) {
94
102
  if (val)
@@ -100,10 +108,10 @@ export default {
100
108
  computed: {
101
109
  localModel: {
102
110
  get() {
103
- return this.model && dateFormat(`2000-01-01T${this.model}Z`, "HH:MM:ss");
111
+ return this.model?.model && formatLocalTime(this.model?.model);
104
112
  },
105
113
  set(value) {
106
- this.model = dateFormat(`2000-01-01T${value}`, "UTC:HH:MM:ss");
114
+ this.model.model = mergeTime(this?.model?.model || new Date(), value);
107
115
  },
108
116
  },
109
117
  },
@@ -124,14 +132,15 @@ export default {
124
132
  }
125
133
  this.localModel = model;
126
134
  },
127
- setupValue() {
128
- const d = new Date(this.value);
129
- this.returnDate = !isNaN(d);
130
- this.model = !isNaN(d) ? dateFormat(d, "UTC:HH:MM:ss") : this.value;
135
+ setupModel(val) {
136
+ const d = new Date(cleanDateStr(val));
137
+ const returnDate = !isNaN(d);
138
+ const model = !isNaN(d) ? d : mergeTime(new Date(), cleanDateStr(val));
139
+ return { returnDate, model };
131
140
  },
132
141
  },
133
142
  mounted() {
134
- this.setupValue();
143
+ this.model = this.setupModel(this.value);
135
144
  },
136
145
  };
137
146
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-container>
2
+ <v-container class="container">
3
3
  <drop-area @change="updateMediaList($event)" multiple>
4
4
  <template v-slot:actions="{ clearList }">
5
5
  <div v-if="mediaList && mediaList.length">
@@ -59,6 +59,13 @@
59
59
  </v-container>
60
60
  </template>
61
61
 
62
+ <style scoped>
63
+ .container {
64
+ height: 100%;
65
+ overflow: auto;
66
+ }
67
+ </style>
68
+
62
69
  <script>
63
70
  import { mapGetters } from "vuex"
64
71
  const MAX_IMAGE_SIZE = 1000000 // 1mb
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.42",
3
+ "version": "1.0.0-alpha.43",
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.40",
10
+ "@mapomodule/utils": "^1.0.0-alpha.43",
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": "9f5a3f301377c547f69103e91201144b726b784c"
18
+ "gitHead": "ffa0eeb2768f663bd8906832c614c51c76987027"
19
19
  }